mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Add new interface function
int devclass_find_free_unit(devclass_t dc, int unit); which return first free unit in given class starting from 'unit'.
This commit is contained in:
parent
ceb6fd100e
commit
82849b4dfe
1 changed files with 10 additions and 0 deletions
|
|
@ -341,6 +341,16 @@ devclass_get_maxunit(devclass_t dc)
|
|||
return (dc->maxunit);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static int
|
||||
devclass_alloc_unit(devclass_t dc, int *unitp)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue