From: David van Moolenbroek Date: Sun, 4 Aug 2013 12:39:02 +0000 (+0200) Subject: VFS: fix access bits in device reopen calls X-Git-Tag: v3.3.0~876 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=c4f3c7d66f70f8bc5feaebbbd068e5d98dd77a25;p=minix.git VFS: fix access bits in device reopen calls --- diff --git a/servers/vfs/device.c b/servers/vfs/device.c index e52db1086..ab42a2238 100644 --- a/servers/vfs/device.c +++ b/servers/vfs/device.c @@ -968,7 +968,7 @@ void bdev_up(int maj) if (!S_ISBLK(vp->v_mode)) continue; /* Reopen the device on the driver, once per filp. */ - bits = mode_map[rfilp->filp_mode & O_ACCMODE]; + bits = rfilp->filp_mode & (R_BIT|W_BIT); if ((r = bdev_open(vp->v_sdev, bits)) != OK) { printf("VFS: mounted dev %d/%d re-open failed: %d.\n", maj, minor(vp->v_sdev), r); @@ -1124,7 +1124,7 @@ int maj; if (rfilp->filp_flags & O_REOPEN) { /* Try to reopen a file upon driver restart */ r = dev_reopen(vp->v_sdev, rfilp-filp, - vp->v_mode & (R_BIT|W_BIT)); + rfilp->filp_mode & (R_BIT|W_BIT)); if (r == OK) return; diff --git a/servers/vfs/glo.h b/servers/vfs/glo.h index ad17d1ea4..be48c1ba3 100644 --- a/servers/vfs/glo.h +++ b/servers/vfs/glo.h @@ -51,7 +51,6 @@ EXTERN int err_code; /* temporary storage for error number */ /* Data initialized elsewhere. */ extern int(*call_vec[]) (message *); extern int(*pfs_call_vec[]) (message *m_out); -extern char mode_map[]; /* mapping from O_ACCMODE mask to R_BIT/W_BIT flags */ EXTERN struct kinfo kinfo; /* kernel information */ diff --git a/servers/vfs/open.c b/servers/vfs/open.c index 71efa1dec..2d0dde200 100644 --- a/servers/vfs/open.c +++ b/servers/vfs/open.c @@ -31,7 +31,7 @@ #include "vmnt.h" #include "path.h" -char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0}; +static char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0}; static struct vnode *new_node(struct lookup *resolve, int oflags, mode_t bits);