From 111cac0e8092026a0583d070204dffd53dd980d1 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 1 Nov 2001 05:07:28 +0000 Subject: [PATCH] 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'. --- sys/kern/subr_bus.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index d97f0f5e766b..6937b561d26b 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) {