summaryrefslogtreecommitdiff
path: root/sys/kern/subr_disk.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2000-06-15 20:30:53 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2000-06-15 20:30:53 +0000
commit4bd02a5609ea21b6876f95d7f63ae08dd4b85be1 (patch)
treed004d079a69450b92b2c39e2736a3a928c1efa22 /sys/kern/subr_disk.c
parent0b1574bd338137410761a20a75cf3393e5169f7b (diff)
Notes
Diffstat (limited to 'sys/kern/subr_disk.c')
-rw-r--r--sys/kern/subr_disk.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index c600d384e19c..5e18163df5fb 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -27,6 +27,8 @@ static d_open_t diskopen;
static d_close_t diskclose;
static d_ioctl_t diskioctl;
static d_psize_t diskpsize;
+
+static LIST_HEAD(, disk) disklist = LIST_HEAD_INITIALIZER(&disklist);
dev_t
disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, struct cdevsw *proto)
@@ -49,12 +51,13 @@ disk_create(int unit, struct disk *dp, int flags, struct cdevsw *cdevsw, struct
if (bootverbose)
printf("Creating DISK %s%d\n", cdevsw->d_name, unit);
dev = make_dev(proto, dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART),
- 0, 0, 0, "r%s%d", cdevsw->d_name, unit);
+ 0, 0, 0, "%s%d", cdevsw->d_name, unit);
dev->si_disk = dp;
dp->d_dev = dev;
dp->d_dsflags = flags;
dp->d_devsw = cdevsw;
+ LIST_INSERT_HEAD(&disklist, dp, d_list);
return (dev);
}
@@ -95,11 +98,22 @@ disk_invalidate (struct disk *disk)
void
disk_destroy(dev_t dev)
{
+ LIST_REMOVE(dev->si_disk, d_list);
+ bzero(dev->si_disk, sizeof(*dev->si_disk));
dev->si_disk = NULL;
destroy_dev(dev);
return;
}
+struct disk *
+disk_enumerate(struct disk *disk)
+{
+ if (!disk)
+ return (LIST_FIRST(&disklist));
+ else
+ return (LIST_NEXT(disk, d_list));
+}
+
/*
* The cdevsw functions
*/