diff options
author | phk <phk@FreeBSD.org> | 1997-10-17 12:36:19 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-10-17 12:36:19 +0000 |
commit | 14aa7b01ea93949392e6e18666f790095eac2ebf (patch) | |
tree | af234d30cce9d801c011d9f4154cc8c26d406c53 /sys/isofs | |
parent | 988fe95f9897d896424ea0328f166e0e740afeaa (diff) | |
download | FreeBSD-src-14aa7b01ea93949392e6e18666f790095eac2ebf.zip FreeBSD-src-14aa7b01ea93949392e6e18666f790095eac2ebf.tar.gz |
Make a set of VOP standard lock, unlock & islocked VOP operators, which
depend on the lock being located at vp->v_data. Saves 3x3 identical
vop procs, more as the other filesystems becomes lock aware.
Diffstat (limited to 'sys/isofs')
-rw-r--r-- | sys/isofs/cd9660/cd9660_node.h | 4 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vnops.c | 70 |
2 files changed, 12 insertions, 62 deletions
diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h index 5c0b721..971cdba 100644 --- a/sys/isofs/cd9660/cd9660_node.h +++ b/sys/isofs/cd9660/cd9660_node.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_node.h 8.6 (Berkeley) 5/14/95 - * $Id: cd9660_node.h,v 1.13 1997/10/12 20:23:36 phk Exp $ + * $Id: cd9660_node.h,v 1.14 1997/10/16 10:47:39 phk Exp $ */ /* @@ -61,6 +61,7 @@ typedef struct { struct iso_node { + struct lock i_lock; /* node lock > Keep this first< */ struct iso_node *i_next, **i_prev; /* hash chain */ struct vnode *i_vnode; /* vnode associated with this inode */ struct vnode *i_devvp; /* vnode for block I/O */ @@ -74,7 +75,6 @@ struct iso_node { doff_t i_diroff; /* offset in dir, where we found last entry */ doff_t i_offset; /* offset of free space in directory */ ino_t i_ino; /* inode number of found directory */ - struct lock i_lock; /* node lock */ long iso_extent; /* extent of file */ long i_size; diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 0318324..6a719a8 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95 - * $Id: cd9660_vnops.c,v 1.44 1997/10/16 10:47:47 phk Exp $ + * $Id: cd9660_vnops.c,v 1.45 1997/10/16 20:32:21 phk Exp $ */ #include <sys/param.h> @@ -69,11 +69,8 @@ static int iso_shipdir __P((struct isoreaddir *idp)); static int cd9660_readdir __P((struct vop_readdir_args *)); static int cd9660_readlink __P((struct vop_readlink_args *ap)); static int cd9660_abortop __P((struct vop_abortop_args *)); -static int cd9660_lock __P((struct vop_lock_args *)); -static int cd9660_unlock __P((struct vop_unlock_args *)); static int cd9660_strategy __P((struct vop_strategy_args *)); static int cd9660_print __P((struct vop_print_args *)); -static int cd9660_islocked __P((struct vop_islocked_args *)); /* * Setattr call. Only allowed for block and character special devices. @@ -718,40 +715,6 @@ cd9660_abortop(ap) } /* - * Lock an inode. - */ -static int -cd9660_lock(ap) - struct vop_lock_args /* { - struct vnode *a_vp; - int a_flags; - struct proc *a_p; - } */ *ap; -{ - struct vnode *vp = ap->a_vp; - - return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags, &vp->v_interlock, - ap->a_p)); -} - -/* - * Unlock an inode. - */ -static int -cd9660_unlock(ap) - struct vop_unlock_args /* { - struct vnode *a_vp; - int a_flags; - struct proc *a_p; - } */ *ap; -{ - struct vnode *vp = ap->a_vp; - - return (lockmgr(&VTOI(vp)->i_lock, ap->a_flags | LK_RELEASE, - &vp->v_interlock, ap->a_p)); -} - -/* * Calculate the logical to physical mapping if not done already, * then call the device strategy routine. */ @@ -805,19 +768,6 @@ cd9660_print(ap) } /* - * Check for a locked inode. - */ -int -cd9660_islocked(ap) - struct vop_islocked_args /* { - struct vnode *a_vp; - } */ *ap; -{ - - return (lockstatus(&VTOI(ap->a_vp)->i_lock)); -} - -/* * Return POSIX pathconf information applicable to cd9660 filesystems. */ int @@ -869,8 +819,8 @@ struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { { &vop_cachedlookup_desc, (vop_t *) cd9660_lookup }, { &vop_getattr_desc, (vop_t *) cd9660_getattr }, { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_islocked_desc, (vop_t *) cd9660_islocked }, - { &vop_lock_desc, (vop_t *) cd9660_lock }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, { &vop_pathconf_desc, (vop_t *) cd9660_pathconf }, { &vop_print_desc, (vop_t *) cd9660_print }, @@ -880,7 +830,7 @@ struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, { &vop_setattr_desc, (vop_t *) cd9660_setattr }, { &vop_strategy_desc, (vop_t *) cd9660_strategy }, - { &vop_unlock_desc, (vop_t *) cd9660_unlock }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, { NULL, NULL } }; static struct vnodeopv_desc cd9660_vnodeop_opv_desc = @@ -896,12 +846,12 @@ struct vnodeopv_entry_desc cd9660_specop_entries[] = { { &vop_access_desc, (vop_t *) cd9660_access }, { &vop_getattr_desc, (vop_t *) cd9660_getattr }, { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_islocked_desc, (vop_t *) cd9660_islocked }, - { &vop_lock_desc, (vop_t *) cd9660_lock }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, { &vop_print_desc, (vop_t *) cd9660_print }, { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { &vop_unlock_desc, (vop_t *) cd9660_unlock }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, { NULL, NULL } }; static struct vnodeopv_desc cd9660_specop_opv_desc = @@ -914,12 +864,12 @@ struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { { &vop_access_desc, (vop_t *) cd9660_access }, { &vop_getattr_desc, (vop_t *) cd9660_getattr }, { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_islocked_desc, (vop_t *) cd9660_islocked }, - { &vop_lock_desc, (vop_t *) cd9660_lock }, + { &vop_islocked_desc, (vop_t *) vop_stdislocked }, + { &vop_lock_desc, (vop_t *) vop_stdlock }, { &vop_print_desc, (vop_t *) cd9660_print }, { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { &vop_unlock_desc, (vop_t *) cd9660_unlock }, + { &vop_unlock_desc, (vop_t *) vop_stdunlock }, { NULL, NULL } }; static struct vnodeopv_desc cd9660_fifoop_opv_desc = |