FreeBSD/sys/xen/xenbus/xenbusb_front.c
/**
 * \brief Enumerate all devices of the given type on this bus.
 *
 * \param dev   NewBus device_t for this XenBus front bus instance.
 * \param type  String indicating the device sub-tree (e.g. "vfb", "vif")
 *              to enumerate. 
 *
 * \return  On success, 0. Otherwise an errno value indicating the
 *          type of failure.
 *
 * Devices that are found are entered into the NewBus hierarchy via
 * xenbusb_add_device().  xenbusb_add_device() ignores duplicate detects
 * and ignores duplicate devices, so it can be called unconditionally
 * for any device found in the XenStore.
 */
\brief Enumerate all devices of the given type on this bus.
\param dev   NewBus device_t for this XenBus front bus instance.
\param type  String indicating the device sub-tree
to enumerate.

\return  On success, 0. Otherwise an errno value indicating the
type of failure.

Devices that are found are entered into the NewBus hierarchy via
xenbusb_add_device().  xenbusb_add_device() ignores duplicate detects
and ignores duplicate devices, so it can be called unconditionally
for any device found in the XenStore.
\ brief Enumerate all devices of the given type on this bus . \ param dev NewBus device_t for this XenBus front bus instance . \ param type String indicating the device sub - tree to enumerate . \ return On success 0 . Otherwise an errno value indicating the type of failure . Devices that are found are entered into the NewBus hierarchy via xenbusb_add_device () . xenbusb_add_device () ignores duplicate detects and ignores duplicate devices so it can be called unconditionally for any device found in the XenStore .
static int
xenbusb_front_enumerate_type(device_t dev, const char *type)
{
	struct xenbusb_softc *xbs;
	const char **dir;
	unsigned int i, count;
	int error;
	xbs = device_get_softc(dev);
	error = xs_directory(XST_NIL, xbs->xbs_node, type, &count, &dir);
	if (error)
		return (error);
	for (i = 0; i < count; i++)
		xenbusb_add_device(dev, type, dir[i]);
	free(dir, M_XENSTORE);
	return (0);
}
static int xenbusb_front_enumerate_type ( device_t dev , const char * type ) { struct xenbusb_softc * xbs ; const char * * dir ; unsigned int i , count ; int error ; xbs = device_get_softc ( dev ) ; error = xs_directory ( XST_NIL , xbs -> xbs_node , type , & count , & dir ) ; if ( error ) return ( error ) ; for ( i = 0 ; i < count ; i ++ ) xenbusb_add_device ( dev , type , dir [ i ] ) ; free ( dir , M_XENSTORE ) ; return ( 0 ) ; }
\brief Enumerate all devices of the given type on this bus.
\ brief Enumerate all devices of the given type on this bus .