FreeBSD/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
/**
 * Get the info for the given device and then recursively process all
 * child devices.
 */
Get the info for the given device and then recursively process all
child devices.
Get the info for the given device and then recursively process all child devices .
static int
device_collector(struct devinfo_dev *dev, void *arg)
{
	struct device_entry *entry;
	HRDBG("%llu/%llu name='%s' desc='%s' drivername='%s' location='%s'",
	    (unsigned long long)dev->dd_handle,
	    (unsigned long long)dev->dd_parent, dev->dd_name, dev->dd_desc,
	    dev->dd_drivername, dev->dd_location);
	if (dev->dd_name[0] != '\0' || dev->dd_location[0] != '\0') {
		HRDBG("ANALYZING dev %s at %s",
		    dev->dd_name, dev->dd_location);
		if ((entry = device_find_by_dev(dev)) != NULL) {
			entry->flags |= HR_DEVICE_FOUND;
			entry->status = (u_int)device_get_status(dev);
		} else if ((entry = device_entry_create_devinfo(dev)) != NULL) {
			device_get_type(dev, &entry->type);
			entry->flags |= HR_DEVICE_FOUND;
			entry->status = (u_int)device_get_status(dev);
		}
	} else {
		HRDBG("SKIPPED unknown device at location '%s'",
		    dev->dd_location );
	}
	return (devinfo_foreach_device_child(dev, device_collector, arg));
}
static int device_collector ( struct devinfo_dev * dev , void * arg ) { struct device_entry * entry ; HRDBG ( " " , ( unsigned long long ) dev -> dd_handle , ( unsigned long long ) dev -> dd_parent , dev -> dd_name , dev -> dd_desc , dev -> dd_drivername , dev -> dd_location ) ; if ( dev -> dd_name [ 0 ] != ' \0 ' || dev -> dd_location [ 0 ] != ' \0 ' ) { HRDBG ( " " , dev -> dd_name , dev -> dd_location ) ; if ( ( entry = device_find_by_dev ( dev ) ) != NULL ) { entry -> flags |= HR_DEVICE_FOUND ; entry -> status = ( u_int ) device_get_status ( dev ) ; } else if ( ( entry = device_entry_create_devinfo ( dev ) ) != NULL ) { device_get_type ( dev , & entry -> type ) ; entry -> flags |= HR_DEVICE_FOUND ; entry -> status = ( u_int ) device_get_status ( dev ) ; } } else { HRDBG ( " " , dev -> dd_location ) ; } return ( devinfo_foreach_device_child ( dev , device_collector , arg ) ) ; }
Get the info for the given device and then recursively process all
 child devices.
Get the info for the given device and then recursively process all child devices .