FreeBSD/sys/kern/subr_bus.c
/**
 * @brief Find a free unit number in a devclass
 *
 * This function searches for the first unused unit number greater
 * that or equal to @p unit.
 *
 * @param dc		the devclass to examine
 * @param unit		the first unit number to check
 */
@brief Find a free unit number in a devclass
This function searches for the first unused unit number greater
that or equal to @p unit.

@param dc            the devclass to examine
@param unit          the first unit number to check
@brief Find a free unit number in a devclass This function searches for the first unused unit number greater that or equal to @p unit . @param dc the devclass to examine @param unit the first unit number to check
int
devclass_find_free_unit(devclass_t dc, int unit)
{
	if (dc == NULL)
		return (unit);
	while (unit < dc->maxunit && dc->devices[unit] != NULL)
		unit++;
	return (unit);
}
int devclass_find_free_unit ( devclass_t dc , int unit ) { if ( dc == NULL ) return ( unit ) ; while ( unit < dc -> maxunit && dc -> devices [ unit ] != NULL ) unit ++ ; return ( unit ) ; }
@brief Find a free unit number in a devclass
 This function searches for the first unused unit number greater
 that or equal to @p unit.
@brief Find a free unit number in a devclass This function searches for the first unused unit number greater that or equal to @p unit .