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/ia64 | |
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/ia64')
-rw-r--r-- | sys/ia64/ia64/sscdisk.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/ia64/ia64/sscdisk.c b/sys/ia64/ia64/sscdisk.c index c92cc55..d831ab9 100644 --- a/sys/ia64/ia64/sscdisk.c +++ b/sys/ia64/ia64/sscdisk.c @@ -84,7 +84,7 @@ struct ssc_s { int unit; LIST_ENTRY(ssc_s) list; struct bio_queue_head bio_queue; - struct disk disk; + struct disk *disk; dev_t dev; int busy; int fd; @@ -174,15 +174,18 @@ ssccreate(int unit) sc->unit = unit; bioq_init(&sc->bio_queue); - sc->disk.d_drv1 = sc; - sc->disk.d_fwheads = 0; - sc->disk.d_fwsectors = 0; - sc->disk.d_maxsize = DFLTPHYS; - sc->disk.d_mediasize = (off_t)SSC_NSECT * DEV_BSIZE; - sc->disk.d_name = "sscdisk"; - sc->disk.d_sectorsize = DEV_BSIZE; - sc->disk.d_strategy = sscstrategy; - disk_create(sc->unit, &sc->disk, 0, NULL, NULL); + sc->disk = disk_alloc(); + sc->disk->d_drv1 = sc; + sc->disk->d_fwheads = 0; + sc->disk->d_fwsectors = 0; + sc->disk->d_maxsize = DFLTPHYS; + sc->disk->d_mediasize = (off_t)SSC_NSECT * DEV_BSIZE; + sc->disk->d_name = "sscdisk"; + sc->disk->d_sectorsize = DEV_BSIZE; + sc->disk->d_strategy = sscstrategy; + sc->disk->d_unit = sc->unit; + sc->disk->d_flags = DISKFLAG_NEEDSGIANT; + disk_create(sc->disk, DISK_VERSION); sc->fd = fd; if (sc->unit == 0) sscrootready = 1; |