/* A new block device driver has been mapped in. This may affect both mounted
* file systems and open block-special files.
*/
- int r, new_driver_e, found;
+ int r, new_driver_e, found, bits;
struct filp *rfilp;
struct vmnt *vmp;
struct vnode *vp;
if (!S_ISBLK(vp->v_mode)) continue;
/* Reopen the device on the driver, once per filp. */
- if ((r = bdev_open(vp->v_sdev, rfilp->filp_mode & O_ACCMODE)) != OK)
+ bits = mode_map[rfilp->filp_mode & O_ACCMODE];
+ 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);
extern _PROTOTYPE (int (*pfs_call_vec[]), (void) ); /* pfs callback table */
extern char dot1[2]; /* dot1 (&dot1[0]) and dot2 (&dot2[0]) have a special */
extern char dot2[3]; /* meaning to search_dir: no access permission check. */
+extern char mode_map[]; /* mapping from O_ACCMODE mask to R_BIT/W_BIT flags */
#endif
#include "vmnt.h"
#include "path.h"
-PRIVATE char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0};
+PUBLIC char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0};
FORWARD _PROTOTYPE( int common_open, (char path[PATH_MAX], int oflags,
mode_t omode) );
case I_CHAR_SPECIAL:
/* Invoke the driver for special processing. */
dev = (dev_t) vp->v_sdev;
- r = dev_open(dev, who_e, bits | (oflags & ~O_ACCMODE));
+ /* TTY needs to know about the O_NOCTTY flag. */
+ r = dev_open(dev, who_e, bits | (oflags & O_NOCTTY));
if (r == SUSPEND) suspend(FP_BLOCKED_ON_DOPEN);
else vp = filp->filp_vno; /* Might be updated by
* dev_open/clone_opcl */
/* A new block device driver has been mapped in. This may affect both mounted
* file systems and open block-special files.
*/
- int r, new_driver_e, found;
+ int r, new_driver_e, found, bits;
struct filp *fp;
struct vmnt *vmp;
struct vnode *vp;
if(!S_ISBLK(vp->v_mode)) continue;
/* Reopen the device on the driver, once per filp. */
- if ((r = bdev_open(vp->v_sdev, fp->filp_mode & O_ACCMODE)) != OK)
+ bits = mode_map[fp->filp_mode & O_ACCMODE];
+ 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);
extern _PROTOTYPE (int (*pfs_call_vec[]), (void) ); /* pfs callback table */
extern char dot1[2]; /* dot1 (&dot1[0]) and dot2 (&dot2[0]) have a special */
extern char dot2[3]; /* meaning to search_dir: no access permission check. */
+extern char mode_map[]; /* mapping from O_ACCMODE mask to R_BIT/W_BIT flags */
#include "vnode.h"
#include "vmnt.h"
-PRIVATE char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0};
+PUBLIC char mode_map[] = {R_BIT, W_BIT, R_BIT|W_BIT, 0};
FORWARD _PROTOTYPE( struct vnode *new_node, (int oflags, mode_t bits) );
FORWARD _PROTOTYPE( int pipe_open, (struct vnode *vp,mode_t bits,int oflags));
case I_CHAR_SPECIAL:
/* Invoke the driver for special processing. */
dev = (dev_t) vp->v_sdev;
- r = dev_open(dev, who_e, bits | (oflags & ~O_ACCMODE));
+ /* TTY needs to know about the O_NOCTTY flag. */
+ r = dev_open(dev, who_e, bits | (oflags & O_NOCTTY));
if (r == SUSPEND) suspend(FP_BLOCKED_ON_DOPEN);
break;
case I_BLOCK_SPECIAL: