summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-02-18 21:36:53 +0000
committerphk <phk@FreeBSD.org>2004-02-18 21:36:53 +0000
commit49c92e5706ab055d53ea35d401f4310fc07ff74a (patch)
tree16cf67c25fa19d01be97b31241d2c56e85a88674 /sys/geom/geom_disk.h
parent7ca155be2a4009e2ad701b61538e8376c49a7403 (diff)
downloadFreeBSD-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/geom/geom_disk.h')
-rw-r--r--sys/geom/geom_disk.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h
index 712e871..a94df89 100644
--- a/sys/geom/geom_disk.h
+++ b/sys/geom/geom_disk.h
@@ -57,6 +57,7 @@ struct disk {
/* Fields which are private to geom_disk */
struct g_geom *d_geom;
struct devstat *d_devstat;
+ int d_destroyed;
/* Shared fields */
u_int d_flags;
@@ -85,13 +86,16 @@ struct disk {
void *d_drv1;
};
-#define DISKFLAG_NOGIANT 0x1
+#define DISKFLAG_NEEDSGIANT 0x1
#define DISKFLAG_OPEN 0x2
#define DISKFLAG_CANDELETE 0x4
-void disk_create(int unit, struct disk *disk, int flags, void *unused, void *unused2);
+struct disk *disk_alloc(void);
+void disk_create(struct disk *disk, int version);
void disk_destroy(struct disk *disk);
+#define DISK_VERSION_00 0x58561059
+#define DISK_VERSION DISK_VERSION_00
#endif /* _KERNEL */
#endif /* _GEOM_GEOM_DISK_H_ */
OpenPOWER on IntegriCloud