diff options
author | phk <phk@FreeBSD.org> | 2004-09-27 20:38:46 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-09-27 20:38:46 +0000 |
commit | 228c7133a0ec5a2cd5ac33b64db645badc3df2c4 (patch) | |
tree | a24406fdd076faf788ddd15ddea078b0c51959c8 /sys/gnu/fs | |
parent | 34196975cf61be2d2e5af2931ec15659f5d0d8c2 (diff) | |
download | FreeBSD-src-228c7133a0ec5a2cd5ac33b64db645badc3df2c4.zip FreeBSD-src-228c7133a0ec5a2cd5ac33b64db645badc3df2c4.tar.gz |
Desupport device nodes on EXT2 filesystems.
Diffstat (limited to 'sys/gnu/fs')
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_extern.h | 3 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vfsops.c | 2 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vnops.c | 126 |
3 files changed, 12 insertions, 119 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_extern.h b/sys/gnu/fs/ext2fs/ext2_extern.h index 45ba6b3..8e73723 100644 --- a/sys/gnu/fs/ext2fs/ext2_extern.h +++ b/sys/gnu/fs/ext2fs/ext2_extern.h @@ -74,7 +74,7 @@ int ext2_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *); int ext2_update(struct vnode *, int); int ext2_valloc(struct vnode *, int, struct ucred *, struct vnode **); int ext2_vfree(struct vnode *, ino_t, int); -int ext2_vinit(struct mount *, vop_t **, vop_t **, struct vnode **vpp); +int ext2_vinit(struct mount *, vop_t **, struct vnode **vpp); int ext2_lookup(struct vop_cachedlookup_args *); int ext2_readdir(struct vop_readdir_args *); void ext2_print_inode(struct inode *); @@ -106,7 +106,6 @@ void mark_buffer_dirty(struct buf *bh); #define B_NOWAIT 0x08 /* do not sleep to await lock */ extern vop_t **ext2_vnodeop_p; -extern vop_t **ext2_specop_p; extern vop_t **ext2_fifoop_p; #endif /* !_SYS_GNU_EXT2FS_EXT2_EXTERN_H_ */ diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index a1e5365..bf0a2fd 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -1094,7 +1094,7 @@ printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino))); * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - if ((error = ext2_vinit(mp, ext2_specop_p, ext2_fifoop_p, &vp)) != 0) { + if ((error = ext2_vinit(mp, ext2_fifoop_p, &vp)) != 0) { vput(vp); *vpp = NULL; return (error); diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index b344173..2da6777 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -110,9 +110,6 @@ static int ext2fifo_close(struct vop_close_args *); static int ext2fifo_kqfilter(struct vop_kqfilter_args *); static int ext2fifo_read(struct vop_read_args *); static int ext2fifo_write(struct vop_write_args *); -static int ext2spec_close(struct vop_close_args *); -static int ext2spec_read(struct vop_read_args *); -static int ext2spec_write(struct vop_write_args *); static int filt_ext2read(struct knote *kn, long hint); static int filt_ext2write(struct knote *kn, long hint); static int filt_ext2vnode(struct knote *kn, long hint); @@ -158,24 +155,6 @@ static struct vnodeopv_entry_desc ext2_vnodeop_entries[] = { static struct vnodeopv_desc ext2fs_vnodeop_opv_desc = { &ext2_vnodeop_p, ext2_vnodeop_entries }; -vop_t **ext2_specop_p; -static struct vnodeopv_entry_desc ext2_specop_entries[] = { - { &vop_default_desc, (vop_t *) spec_vnoperate }, - { &vop_access_desc, (vop_t *) ext2_access }, - { &vop_close_desc, (vop_t *) ext2spec_close }, - { &vop_fsync_desc, (vop_t *) ext2_fsync }, - { &vop_getattr_desc, (vop_t *) ext2_getattr }, - { &vop_inactive_desc, (vop_t *) ext2_inactive }, - { &vop_print_desc, (vop_t *) ext2_print }, - { &vop_read_desc, (vop_t *) ext2spec_read }, - { &vop_reclaim_desc, (vop_t *) ext2_reclaim }, - { &vop_setattr_desc, (vop_t *) ext2_setattr }, - { &vop_write_desc, (vop_t *) ext2spec_write }, - { NULL, NULL } -}; -static struct vnodeopv_desc ext2fs_specop_opv_desc = - { &ext2_specop_p, ext2_specop_entries }; - vop_t **ext2_fifoop_p; static struct vnodeopv_entry_desc ext2_fifoop_entries[] = { { &vop_default_desc, (vop_t *) fifo_vnoperate }, @@ -196,7 +175,6 @@ static struct vnodeopv_desc ext2fs_fifoop_opv_desc = { &ext2_fifoop_p, ext2_fifoop_entries }; VNODEOP_SET(ext2fs_vnodeop_opv_desc); - VNODEOP_SET(ext2fs_specop_opv_desc); VNODEOP_SET(ext2fs_fifoop_opv_desc); #include <gnu/ext2fs/ext2_readwrite.c> @@ -286,6 +264,9 @@ ext2_open(ap) } */ *ap; { + if (ap->a_vp->v_type == VBLK || ap->a_vp->v_type == VCHR) + return (EOPNOTSUPP); + /* * Files marked append-only must be opened for appending. */ @@ -352,6 +333,9 @@ ext2_access(ap) mode_t mode = ap->a_mode; int error; + if (vp->v_type == VBLK || vp->v_type == VCHR) + return (EOPNOTSUPP); + /* * Disallow write attempts on read-only file systems; * unless the file is a socket, fifo, or a block or @@ -1489,83 +1473,6 @@ ext2_print(ap) } /* - * Read wrapper for special devices. - */ -static int -ext2spec_read(ap) - struct vop_read_args /* { - struct vnode *a_vp; - struct uio *a_uio; - int a_ioflag; - struct ucred *a_cred; - } */ *ap; -{ - int error, resid; - struct inode *ip; - struct uio *uio; - - uio = ap->a_uio; - resid = uio->uio_resid; - error = VOCALL(spec_vnodeop_p, VOFFSET(vop_read), ap); - /* - * The inode may have been revoked during the call, so it must not - * be accessed blindly here or in the other wrapper functions. - */ - ip = VTOI(ap->a_vp); - if (ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) - ip->i_flag |= IN_ACCESS; - return (error); -} - -/* - * Write wrapper for special devices. - */ -static int -ext2spec_write(ap) - struct vop_write_args /* { - struct vnode *a_vp; - struct uio *a_uio; - int a_ioflag; - struct ucred *a_cred; - } */ *ap; -{ - int error, resid; - struct inode *ip; - struct uio *uio; - - uio = ap->a_uio; - resid = uio->uio_resid; - error = VOCALL(spec_vnodeop_p, VOFFSET(vop_write), ap); - ip = VTOI(ap->a_vp); - if (ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) - VTOI(ap->a_vp)->i_flag |= IN_CHANGE | IN_UPDATE; - return (error); -} - -/* - * Close wrapper for special devices. - * - * Update the times on the inode then do device close. - */ -static int -ext2spec_close(ap) - struct vop_close_args /* { - struct vnode *a_vp; - int a_fflag; - struct ucred *a_cred; - struct thread *a_td; - } */ *ap; -{ - struct vnode *vp = ap->a_vp; - - VI_LOCK(vp); - if (vp->v_usecount > 1) - ext2_itimes(vp); - VI_UNLOCK(vp); - return (VOCALL(spec_vnodeop_p, VOFFSET(vop_close), ap)); -} - -/* * Read wrapper for fifos. */ static int @@ -1716,9 +1623,8 @@ ext2_advlock(ap) * vnodes. */ int -ext2_vinit(mntp, specops, fifoops, vpp) +ext2_vinit(mntp, fifoops, vpp) struct mount *mntp; - vop_t **specops; vop_t **fifoops; struct vnode **vpp; { @@ -1727,22 +1633,10 @@ ext2_vinit(mntp, specops, fifoops, vpp) vp = *vpp; ip = VTOI(vp); - switch(vp->v_type = IFTOVT(ip->i_mode)) { - case VBLK: - vp->v_op = specops; - break; - case VCHR: - vp->v_op = specops; - vp = addaliasu(vp, ip->i_rdev); - ip->i_vnode = vp; - break; - case VFIFO: + vp->v_type = IFTOVT(ip->i_mode); + if (vp->v_type == VFIFO) vp->v_op = fifoops; - break; - default: - break; - - } + if (ip->i_number == ROOTINO) vp->v_vflag |= VV_ROOT; ip->i_modrev = init_va_filerev(); |