summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2009-08-09 14:06:53 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2009-08-09 14:06:53 +0000
commita55af97b3a0da3ea24f7e366c806a68dc6c8d43e (patch)
treeb28d862f5e137575f21f553ee4847a16605a3bac /sys
parenteec6ea2b9d6bbf132513c8f48a6efc7a9667bc8e (diff)
Make dk_mmountroot use vnodes instead of d_open/d_close. This does ugly
things to softraid. ok jsing thib krw beck oga
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_disk.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index e1dbaa310b6..089167d1f8c 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.95 2009/06/17 01:30:30 thib Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.96 2009/08/09 14:06:52 marco Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -56,6 +56,7 @@
#include <sys/dkio.h>
#include <sys/dkstat.h> /* XXX */
#include <sys/proc.h>
+#include <sys/vnode.h>
#include <uvm/uvm_extern.h>
#include <sys/socket.h>
@@ -910,6 +911,7 @@ dk_mountroot(void)
int part = DISKPART(rootdev);
int (*mountrootfn)(void);
struct disklabel dl;
+ struct vnode *vn;
int error;
rrootdev = blktochr(rootdev);
@@ -922,18 +924,21 @@ dk_mountroot(void)
/*
* open device, ioctl for the disklabel, and close it.
*/
- error = (cdevsw[major(rrootdev)].d_open)(rawdev, FREAD,
- S_IFCHR, curproc);
+ if (cdevvp(rawdev, &vn))
+ panic("cannot obtain vnode for 0x%x/0x%x", rootdev, rrootdev);
+ error = VOP_OPEN(vn, FREAD, NOCRED, curproc);
if (error)
panic("cannot open disk, 0x%x/0x%x, error %d",
rootdev, rrootdev, error);
- error = (cdevsw[major(rrootdev)].d_ioctl)(rawdev, DIOCGDINFO,
- (caddr_t)&dl, FREAD, curproc);
+ error = VOP_IOCTL(vn, DIOCGDINFO, (caddr_t)&dl, FREAD, NOCRED, 0);
if (error)
panic("cannot read disk label, 0x%x/0x%x, error %d",
rootdev, rrootdev, error);
- (void) (cdevsw[major(rrootdev)].d_close)(rawdev, FREAD,
- S_IFCHR, curproc);
+ error = VOP_CLOSE(vn, FREAD, NOCRED, 0);
+ if (error)
+ panic("cannot close disk , 0x%x/0x%x, error %d",
+ rootdev, rrootdev, error);
+ vput(vn);
if (DL_GETPSIZE(&dl.d_partitions[part]) == 0)
panic("root filesystem has size 0");