device_set_unit() DO NOT USE THIS. This was approved before 4.0

release for inclusion into the release, but bde talked me out of
committing the module that needs this until after the release.  It is
after the release now. :-)
This commit is contained in:
Warner Losh 2000-04-01 06:06:37 +00:00
parent 78601fc5f8
commit ce73953a1e
2 changed files with 20 additions and 0 deletions

View File

@ -1199,6 +1199,25 @@ device_shutdown(device_t dev)
return DEVICE_SHUTDOWN(dev);
}
int
device_set_unit(device_t dev, int unit)
{
devclass_t dc;
int err;
dc = device_get_devclass(dev);
if (unit < dc->maxunit && dc->devices[unit])
return EBUSY;
err = devclass_delete_device(dc, dev);
if (err)
return err;
dev->unit = unit;
err = devclass_add_device(dc, dev);
if (err)
return err;
return 0;
}
#ifdef DEVICE_SYSCTLS
/*

View File

@ -257,6 +257,7 @@ void device_set_desc_copy(device_t dev, const char* desc);
int device_set_devclass(device_t dev, const char *classname);
int device_set_driver(device_t dev, driver_t *driver);
void device_set_flags(device_t dev, u_int32_t flags);
int device_set_unit(device_t dev, int unit); /* XXX DONT USE XXX */
int device_shutdown(device_t dev);
void device_unbusy(device_t dev);
void device_verbose(device_t dev);