summaryrefslogtreecommitdiffstats
path: root/sys/sys/disk.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-01-30 20:34:23 +0000
committerphk <phk@FreeBSD.org>2003-01-30 20:34:23 +0000
commit10368fffb1d835224b6bc69ba27c8d7df0def2d2 (patch)
tree96c17d49e8ea0bcfcc969ba4c2dbd2676bf901bb /sys/sys/disk.h
parent8fe9dd24e05669b545bdaf81f691a5000f652f44 (diff)
downloadFreeBSD-src-10368fffb1d835224b6bc69ba27c8d7df0def2d2.zip
FreeBSD-src-10368fffb1d835224b6bc69ba27c8d7df0def2d2.tar.gz
Add some agility to the disk_create() API:
Make passing the methods in a cdevsw structure optional. Move "CANFREE" and "NOGIANT" flags into struct disk instead of the cdevsw which may or may not be there. Rename CANFREE to CANDELETE to match BIO_DELETE operation. Add "OPEN" flag so drivers don't have to provide open/close methods just to maintain such a flag. Add temporary stopgap include of <sys/conf.h> to <sys/disk.h> until the files which have them in the other order are fixed. Add KASSERTS to make sure we don't get fed too many NULL pointers. Clear our geom's softc pointer before we wither.
Diffstat (limited to 'sys/sys/disk.h')
-rw-r--r--sys/sys/disk.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/sys/disk.h b/sys/sys/disk.h
index 7af2cd6..25aa4af 100644
--- a/sys/sys/disk.h
+++ b/sys/sys/disk.h
@@ -19,13 +19,23 @@
#include <sys/queue.h>
+#ifndef _SYS_CONF_H_
+#include <sys/conf.h> /* XXX: temporary to avoid breakage */
+#endif
+
struct g_geom;
struct disk {
u_int d_flags;
- u_int d_dsflags;
struct cdevsw *d_devsw;
+ d_open_t *d_open;
+ d_close_t *d_close;
+ d_strategy_t *d_strategy;
+ d_ioctl_t *d_ioctl;
+ dumper_t *d_dump;
dev_t d_dev;
+ u_int d_unit;
+ const char *d_name;
/* These four fields must be valid while opened */
u_int d_sectorsize;
@@ -36,6 +46,10 @@ struct disk {
struct g_geom *d_softc;
};
+#define DISKFLAG_NOGIANT 0x1
+#define DISKFLAG_OPEN 0x2
+#define DISKFLAG_CANDELETE 0x4
+
dev_t disk_create(int unit, struct disk *disk, int flags, struct cdevsw *cdevsw, void *unused);
void disk_destroy(dev_t dev);
struct disk *disk_enumerate(struct disk *disk);
OpenPOWER on IntegriCloud