diff options
author | ache <ache@FreeBSD.org> | 2001-11-01 05:07:28 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-11-01 05:07:28 +0000 |
commit | 111cac0e8092026a0583d070204dffd53dd980d1 (patch) | |
tree | e999b46754e18e4925d3969d9ff4b077661ccbb1 /sys/kern/subr_bus.c | |
parent | 8e6deccca7ce1fa608ca30996b8f4d8cdf1ac33b (diff) | |
download | FreeBSD-src-111cac0e8092026a0583d070204dffd53dd980d1.zip FreeBSD-src-111cac0e8092026a0583d070204dffd53dd980d1.tar.gz |
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'.
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r-- | sys/kern/subr_bus.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index d97f0f5..6937b56 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -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) { |