VFS: fix access bits in device reopen calls

This commit is contained in:
David van Moolenbroek 2013-08-04 14:39:02 +02:00
parent 1939870c2e
commit c4f3c7d66f
3 changed files with 3 additions and 4 deletions

View file

@ -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;

View file

@ -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 */

View file

@ -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);