dkwedge_discover: open a device as read-only.

This commit is contained in:
yamt 2007-02-15 16:04:12 +00:00
parent 6d6b5c51d6
commit 5c1ff058e4

View File

@ -1,4 +1,4 @@
/* $NetBSD: dk.c,v 1.20 2006/11/16 01:32:50 christos Exp $ */
/* $NetBSD: dk.c,v 1.21 2007/02/15 16:04:12 yamt Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.20 2006/11/16 01:32:50 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.21 2007/02/15 16:04:12 yamt Exp $");
#include "opt_dkwedge.h"
@ -798,15 +798,13 @@ dkwedge_discover(struct disk *pdk)
goto out;
}
error = VOP_OPEN(vp, FREAD | FWRITE, NOCRED, 0);
error = VOP_OPEN(vp, FREAD, NOCRED, 0);
if (error) {
aprint_error("%s: unable to open device, error = %d\n",
pdk->dk_name, error);
vput(vp);
goto out;
}
/* VOP_OPEN() doesn't do this for us. */
vp->v_writecount++;
VOP_UNLOCK(vp, 0);
/*
@ -822,7 +820,7 @@ dkwedge_discover(struct disk *pdk)
}
}
error = vn_close(vp, FREAD | FWRITE, NOCRED, curlwp);
error = vn_close(vp, FREAD, NOCRED, curlwp);
if (error) {
aprint_error("%s: unable to close device, error = %d\n",
pdk->dk_name, error);