diff options
Diffstat (limited to 'sys/fs/devfs/devfs_vnops.c')
| -rw-r--r-- | sys/fs/devfs/devfs_vnops.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index d594b1584757..cd6cd1959d6b 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -67,6 +67,7 @@ static struct vop_vector devfs_vnodeops; static struct vop_vector devfs_specops; static const struct fileops devfs_ops_f; +static const struct fileops devfs_ops_nonpassable_f; #include <fs/devfs/devfs.h> #include <fs/devfs/devfs_int.h> @@ -1344,8 +1345,11 @@ devfs_open(struct vop_open_args *ap) if (fp == NULL) return (error); #endif - if (fp->f_ops == &badfileops) - finit(fp, fp->f_flag, DTYPE_VNODE, dev, &devfs_ops_f); + if (fp->f_ops == &badfileops) { + finit(fp, fp->f_flag, DTYPE_VNODE, dev, + (dsw->d_flags & D_NONPASSABLE) == 0 ? &devfs_ops_f : + &devfs_ops_nonpassable_f); + } return (error); } @@ -2096,6 +2100,25 @@ static const struct fileops devfs_ops_f = { .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE }; +static const struct fileops devfs_ops_nonpassable_f = { + .fo_read = devfs_read_f, + .fo_write = devfs_write_f, + .fo_truncate = devfs_truncate_f, + .fo_ioctl = devfs_ioctl_f, + .fo_poll = devfs_poll_f, + .fo_kqfilter = devfs_kqfilter_f, + .fo_stat = devfs_stat_f, + .fo_close = devfs_close_f, + .fo_chmod = vn_chmod, + .fo_chown = vn_chown, + .fo_sendfile = vn_sendfile, + .fo_seek = vn_seek, + .fo_fill_kinfo = vn_fill_kinfo, + .fo_mmap = devfs_mmap_f, + .fo_cmp = devfs_cmp_f, + .fo_flags = DFLAG_SEEKABLE +}; + /* Vops for non-CHR vnodes in /dev. */ static struct vop_vector devfs_vnodeops = { .vop_default = &default_vnodeops, |
