diff options
author | phk <phk@FreeBSD.org> | 2004-02-18 21:36:53 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-02-18 21:36:53 +0000 |
commit | 49c92e5706ab055d53ea35d401f4310fc07ff74a (patch) | |
tree | 16cf67c25fa19d01be97b31241d2c56e85a88674 /sys/dev/pst/pst-raid.c | |
parent | 7ca155be2a4009e2ad701b61538e8376c49a7403 (diff) | |
download | FreeBSD-src-49c92e5706ab055d53ea35d401f4310fc07ff74a.zip FreeBSD-src-49c92e5706ab055d53ea35d401f4310fc07ff74a.tar.gz |
Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this
gave us problems when the device disappared and the users of that device
were not immediately disappearing.
Now the struct disk is allocate with a new call, disk_alloc() and owned
by geom_disk and just abandonned by the device driver when disk_create()
is called.
Unfortunately, this results in a ton of "s/\./->/" changes to device
drivers.
Since I'm doing the sweep anyway, a couple of other API improvements
have been carried out at the same time:
The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to
DISKFLAG_NEEDSGIANT
A version number have been added to disk_create() so that we can detect,
report and ignore binary drivers with old ABI in the future.
Manual page update to follow shortly.
Diffstat (limited to 'sys/dev/pst/pst-raid.c')
-rw-r--r-- | sys/dev/pst/pst-raid.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/dev/pst/pst-raid.c b/sys/dev/pst/pst-raid.c index e545a5f..83a5280 100644 --- a/sys/dev/pst/pst-raid.c +++ b/sys/dev/pst/pst-raid.c @@ -56,7 +56,7 @@ struct pst_softc { struct iop_softc *iop; struct i2o_lct_entry *lct; struct i2o_bsa_device *info; - struct disk disk; + struct disk *disk; struct bio_queue_head queue; }; @@ -149,16 +149,19 @@ pst_attach(device_t dev) bioq_init(&psc->queue); - psc->disk.d_name = "pst"; - psc->disk.d_strategy = pststrategy; - psc->disk.d_maxsize = 64 * 1024; /*I2O_SGL_MAX_SEGS * PAGE_SIZE;*/ - psc->disk.d_drv1 = psc; - disk_create(lun, &psc->disk, DISKFLAG_NOGIANT, NULL, NULL); + psc->disk = disk_alloc(); + psc->disk->d_name = "pst"; + psc->disk->d_strategy = pststrategy; + psc->disk->d_maxsize = 64 * 1024; /*I2O_SGL_MAX_SEGS * PAGE_SIZE;*/ + psc->disk->d_drv1 = psc; + psc->disk->d_unit = lun; - psc->disk.d_sectorsize = psc->info->block_size; - psc->disk.d_mediasize = psc->info->capacity; - psc->disk.d_fwsectors = 63; - psc->disk.d_fwheads = 255; + psc->disk->d_sectorsize = psc->info->block_size; + psc->disk->d_mediasize = psc->info->capacity; + psc->disk->d_fwsectors = 63; + psc->disk->d_fwheads = 255; + + disk_create(psc->disk, DISK_VERSION); printf("pst%d: %lluMB <%.40s> [%lld/%d/%d] on %.16s\n", lun, (unsigned long long)psc->info->capacity / (1024 * 1024), |