From 39f70682ae11dba11363602e6bf34184a3ca28ec Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 18 Aug 2000 10:01:02 +0000 Subject: [PATCH] Introduce vop_stdinactive() and make it the default if no vop_inactive is declared. Sort and prune a few vop_op[]. --- sys/fs/fifofs/fifo_vnops.c | 16 +--------------- sys/fs/portalfs/portal_vnops.c | 14 -------------- sys/fs/procfs/procfs_vnops.c | 24 ------------------------ sys/fs/specfs/spec_vnops.c | 16 +--------------- sys/kern/vfs_default.c | 19 +++++++++++++------ sys/miscfs/devfs/devfs_vnops.c | 17 ----------------- sys/miscfs/fifofs/fifo_vnops.c | 16 +--------------- sys/miscfs/portal/portal_vnops.c | 14 -------------- sys/miscfs/procfs/procfs_vnops.c | 24 ------------------------ sys/miscfs/specfs/spec_vnops.c | 16 +--------------- sys/sys/vnode.h | 1 + 11 files changed, 18 insertions(+), 159 deletions(-) diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 03e3e374ba2e..453f2077bec7 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -71,7 +71,6 @@ static int fifo_read __P((struct vop_read_args *)); static int fifo_write __P((struct vop_write_args *)); static int fifo_ioctl __P((struct vop_ioctl_args *)); static int fifo_poll __P((struct vop_poll_args *)); -static int fifo_inactive __P((struct vop_inactive_args *)); static int fifo_bmap __P((struct vop_bmap_args *)); static int fifo_pathconf __P((struct vop_pathconf_args *)); static int fifo_advlock __P((struct vop_advlock_args *)); @@ -97,7 +96,7 @@ static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_close_desc, (vop_t *) fifo_close }, { &vop_create_desc, (vop_t *) fifo_badop }, { &vop_getattr_desc, (vop_t *) vop_ebadf }, - { &vop_inactive_desc, (vop_t *) fifo_inactive }, + { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_ioctl_desc, (vop_t *) fifo_ioctl }, { &vop_lease_desc, (vop_t *) vop_null }, { &vop_link_desc, (vop_t *) fifo_badop }, @@ -107,7 +106,6 @@ static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_open_desc, (vop_t *) fifo_open }, { &vop_pathconf_desc, (vop_t *) fifo_pathconf }, { &vop_poll_desc, (vop_t *) fifo_poll }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_print_desc, (vop_t *) fifo_print }, { &vop_read_desc, (vop_t *) fifo_read }, { &vop_readdir_desc, (vop_t *) fifo_badop }, @@ -458,18 +456,6 @@ fifo_poll(ap) return (revents); } -static int -fifo_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - struct proc *a_p; - } */ *ap; -{ - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} - /* * This is a noop, simply returning what one has been given. */ diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index d4146da6a833..621059a1d478 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -69,7 +69,6 @@ static int portal_badop __P((void)); static void portal_closefd __P((struct proc *p, int fd)); static int portal_connect __P((struct socket *so, struct socket *so2)); static int portal_getattr __P((struct vop_getattr_args *ap)); -static int portal_inactive __P((struct vop_inactive_args *ap)); static int portal_lookup __P((struct vop_lookup_args *ap)); static int portal_open __P((struct vop_open_args *ap)); static int portal_print __P((struct vop_print_args *ap)); @@ -526,18 +525,6 @@ portal_readdir(ap) return (0); } -static int -portal_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - struct proc *a_p; - } */ *ap; -{ - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} - static int portal_reclaim(ap) struct vop_reclaim_args /* { @@ -590,7 +577,6 @@ static struct vnodeopv_entry_desc portal_vnodeop_entries[] = { { &vop_access_desc, (vop_t *) vop_null }, { &vop_bmap_desc, (vop_t *) portal_badop }, { &vop_getattr_desc, (vop_t *) portal_getattr }, - { &vop_inactive_desc, (vop_t *) portal_inactive }, { &vop_lookup_desc, (vop_t *) portal_lookup }, { &vop_open_desc, (vop_t *) portal_open }, { &vop_pathconf_desc, (vop_t *) vop_stdpathconf }, diff --git a/sys/fs/procfs/procfs_vnops.c b/sys/fs/procfs/procfs_vnops.c index 0d72522f1532..35b3afbded0e 100644 --- a/sys/fs/procfs/procfs_vnops.c +++ b/sys/fs/procfs/procfs_vnops.c @@ -67,7 +67,6 @@ static int procfs_badop __P((void)); static int procfs_bmap __P((struct vop_bmap_args *)); static int procfs_close __P((struct vop_close_args *)); static int procfs_getattr __P((struct vop_getattr_args *)); -static int procfs_inactive __P((struct vop_inactive_args *)); static int procfs_ioctl __P((struct vop_ioctl_args *)); static int procfs_lookup __P((struct vop_lookup_args *)); static int procfs_open __P((struct vop_open_args *)); @@ -335,28 +334,6 @@ procfs_bmap(ap) return (0); } -/* - * procfs_inactive is called when the pfsnode - * is vrele'd and the reference count goes - * to zero. (vp) will be on the vnode free - * list, so to get it back vget() must be - * used. - * - * (vp) is locked on entry, but must be unlocked on exit. - */ -static int -procfs_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - } */ *ap; -{ - struct vnode *vp = ap->a_vp; - - VOP_UNLOCK(vp, 0, ap->a_p); - - return (0); -} - /* * _reclaim is called when getnewvnode() * wants to make use of an entry on the vnode @@ -1014,7 +991,6 @@ static struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { { &vop_close_desc, (vop_t *) procfs_close }, { &vop_create_desc, (vop_t *) procfs_badop }, { &vop_getattr_desc, (vop_t *) procfs_getattr }, - { &vop_inactive_desc, (vop_t *) procfs_inactive }, { &vop_link_desc, (vop_t *) procfs_badop }, { &vop_lookup_desc, (vop_t *) procfs_lookup }, { &vop_mkdir_desc, (vop_t *) procfs_badop }, diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 2b1df9efe20a..f6bd8537fe78 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -59,7 +59,6 @@ static int spec_close __P((struct vop_close_args *)); static int spec_freeblks __P((struct vop_freeblks_args *)); static int spec_fsync __P((struct vop_fsync_args *)); static int spec_getpages __P((struct vop_getpages_args *)); -static int spec_inactive __P((struct vop_inactive_args *)); static int spec_ioctl __P((struct vop_ioctl_args *)); static int spec_open __P((struct vop_open_args *)); static int spec_poll __P((struct vop_poll_args *)); @@ -79,7 +78,7 @@ static struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_freeblks_desc, (vop_t *) spec_freeblks }, { &vop_fsync_desc, (vop_t *) spec_fsync }, { &vop_getpages_desc, (vop_t *) spec_getpages }, - { &vop_inactive_desc, (vop_t *) spec_inactive }, + { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_ioctl_desc, (vop_t *) spec_ioctl }, { &vop_lease_desc, (vop_t *) vop_null }, { &vop_link_desc, (vop_t *) vop_panic }, @@ -88,7 +87,6 @@ static struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_open_desc, (vop_t *) spec_open }, { &vop_pathconf_desc, (vop_t *) vop_stdpathconf }, { &vop_poll_desc, (vop_t *) spec_poll }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_print_desc, (vop_t *) spec_print }, { &vop_read_desc, (vop_t *) spec_read }, { &vop_readdir_desc, (vop_t *) vop_panic }, @@ -391,18 +389,6 @@ spec_fsync(ap) return (0); } -static int -spec_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - struct proc *a_p; - } */ *ap; -{ - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} - /* * Just call the device strategy routine */ diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 00f9beb7c4ea..e95e7e20b719 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -68,6 +68,7 @@ static struct vnodeopv_entry_desc default_vnodeop_entries[] = { { &vop_bwrite_desc, (vop_t *) vop_stdbwrite }, { &vop_close_desc, (vop_t *) vop_null }, { &vop_fsync_desc, (vop_t *) vop_null }, + { &vop_inactive_desc, (vop_t *) vop_stdinactive }, { &vop_ioctl_desc, (vop_t *) vop_enotty }, { &vop_islocked_desc, (vop_t *) vop_noislocked }, { &vop_lease_desc, (vop_t *) vop_null }, @@ -77,15 +78,9 @@ static struct vnodeopv_entry_desc default_vnodeop_entries[] = { { &vop_pathconf_desc, (vop_t *) vop_einval }, { &vop_poll_desc, (vop_t *) vop_nopoll }, { &vop_readlink_desc, (vop_t *) vop_einval }, - { &vop_reallocblks_desc, (vop_t *) vop_eopnotsupp }, { &vop_revoke_desc, (vop_t *) vop_revoke }, { &vop_strategy_desc, (vop_t *) vop_nostrategy }, { &vop_unlock_desc, (vop_t *) vop_nounlock }, - { &vop_getacl_desc, (vop_t *) vop_eopnotsupp }, - { &vop_setacl_desc, (vop_t *) vop_eopnotsupp }, - { &vop_aclcheck_desc, (vop_t *) vop_eopnotsupp }, - { &vop_getextattr_desc, (vop_t *) vop_eopnotsupp }, - { &vop_setextattr_desc, (vop_t *) vop_eopnotsupp }, { NULL, NULL } }; @@ -271,6 +266,18 @@ vop_stdislocked(ap) return (lockstatus(l, ap->a_p)); } +int +vop_stdinactive(ap) + struct vop_inactive_args /* { + struct vnode *a_vp; + struct proc *a_p; + } */ *ap; +{ + + VOP_UNLOCK(ap->a_vp, 0, ap->a_p); + return (0); +} + /* * Return true for select/poll. */ diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index c7085014b18c..9a9c1204c71c 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -1532,21 +1532,6 @@ devfs_fsync(struct vop_fsync_args *ap) splx(s); return (0); } -/* - * - * struct vop_inactive_args { - * struct vnode *a_vp; - * struct proc *a_p; - * } - */ - -static int -devfs_inactive(struct vop_inactive_args *ap) -{ - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} /* * Just call the device strategy routine @@ -1964,7 +1949,6 @@ static struct vnodeopv_entry_desc devfs_vnodeop_entries[] = { { &vop_access_desc, (vop_t *) devfs_access }, { &vop_bmap_desc, (vop_t *) devfs_badop }, { &vop_getattr_desc, (vop_t *) devfs_getattr }, - { &vop_inactive_desc, (vop_t *) devfs_inactive }, { &vop_link_desc, (vop_t *) devfs_link }, { &vop_lookup_desc, (vop_t *) devfs_lookup }, { &vop_pathconf_desc, (vop_t *) vop_stdpathconf }, @@ -1999,7 +1983,6 @@ static struct vnodeopv_entry_desc devfs_spec_vnodeop_entries[] = { { &vop_fsync_desc, (vop_t *) devfs_fsync }, { &vop_getattr_desc, (vop_t *) devfs_getattr }, { &vop_getpages_desc, (vop_t *) devfs_getpages }, - { &vop_inactive_desc, (vop_t *) devfs_inactive }, { &vop_ioctl_desc, (vop_t *) devfs_ioctl }, { &vop_lease_desc, (vop_t *) vop_null }, { &vop_link_desc, (vop_t *) devfs_badop }, diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index 03e3e374ba2e..453f2077bec7 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -71,7 +71,6 @@ static int fifo_read __P((struct vop_read_args *)); static int fifo_write __P((struct vop_write_args *)); static int fifo_ioctl __P((struct vop_ioctl_args *)); static int fifo_poll __P((struct vop_poll_args *)); -static int fifo_inactive __P((struct vop_inactive_args *)); static int fifo_bmap __P((struct vop_bmap_args *)); static int fifo_pathconf __P((struct vop_pathconf_args *)); static int fifo_advlock __P((struct vop_advlock_args *)); @@ -97,7 +96,7 @@ static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_close_desc, (vop_t *) fifo_close }, { &vop_create_desc, (vop_t *) fifo_badop }, { &vop_getattr_desc, (vop_t *) vop_ebadf }, - { &vop_inactive_desc, (vop_t *) fifo_inactive }, + { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_ioctl_desc, (vop_t *) fifo_ioctl }, { &vop_lease_desc, (vop_t *) vop_null }, { &vop_link_desc, (vop_t *) fifo_badop }, @@ -107,7 +106,6 @@ static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_open_desc, (vop_t *) fifo_open }, { &vop_pathconf_desc, (vop_t *) fifo_pathconf }, { &vop_poll_desc, (vop_t *) fifo_poll }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_print_desc, (vop_t *) fifo_print }, { &vop_read_desc, (vop_t *) fifo_read }, { &vop_readdir_desc, (vop_t *) fifo_badop }, @@ -458,18 +456,6 @@ fifo_poll(ap) return (revents); } -static int -fifo_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - struct proc *a_p; - } */ *ap; -{ - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} - /* * This is a noop, simply returning what one has been given. */ diff --git a/sys/miscfs/portal/portal_vnops.c b/sys/miscfs/portal/portal_vnops.c index d4146da6a833..621059a1d478 100644 --- a/sys/miscfs/portal/portal_vnops.c +++ b/sys/miscfs/portal/portal_vnops.c @@ -69,7 +69,6 @@ static int portal_badop __P((void)); static void portal_closefd __P((struct proc *p, int fd)); static int portal_connect __P((struct socket *so, struct socket *so2)); static int portal_getattr __P((struct vop_getattr_args *ap)); -static int portal_inactive __P((struct vop_inactive_args *ap)); static int portal_lookup __P((struct vop_lookup_args *ap)); static int portal_open __P((struct vop_open_args *ap)); static int portal_print __P((struct vop_print_args *ap)); @@ -526,18 +525,6 @@ portal_readdir(ap) return (0); } -static int -portal_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - struct proc *a_p; - } */ *ap; -{ - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} - static int portal_reclaim(ap) struct vop_reclaim_args /* { @@ -590,7 +577,6 @@ static struct vnodeopv_entry_desc portal_vnodeop_entries[] = { { &vop_access_desc, (vop_t *) vop_null }, { &vop_bmap_desc, (vop_t *) portal_badop }, { &vop_getattr_desc, (vop_t *) portal_getattr }, - { &vop_inactive_desc, (vop_t *) portal_inactive }, { &vop_lookup_desc, (vop_t *) portal_lookup }, { &vop_open_desc, (vop_t *) portal_open }, { &vop_pathconf_desc, (vop_t *) vop_stdpathconf }, diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index 0d72522f1532..35b3afbded0e 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -67,7 +67,6 @@ static int procfs_badop __P((void)); static int procfs_bmap __P((struct vop_bmap_args *)); static int procfs_close __P((struct vop_close_args *)); static int procfs_getattr __P((struct vop_getattr_args *)); -static int procfs_inactive __P((struct vop_inactive_args *)); static int procfs_ioctl __P((struct vop_ioctl_args *)); static int procfs_lookup __P((struct vop_lookup_args *)); static int procfs_open __P((struct vop_open_args *)); @@ -335,28 +334,6 @@ procfs_bmap(ap) return (0); } -/* - * procfs_inactive is called when the pfsnode - * is vrele'd and the reference count goes - * to zero. (vp) will be on the vnode free - * list, so to get it back vget() must be - * used. - * - * (vp) is locked on entry, but must be unlocked on exit. - */ -static int -procfs_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - } */ *ap; -{ - struct vnode *vp = ap->a_vp; - - VOP_UNLOCK(vp, 0, ap->a_p); - - return (0); -} - /* * _reclaim is called when getnewvnode() * wants to make use of an entry on the vnode @@ -1014,7 +991,6 @@ static struct vnodeopv_entry_desc procfs_vnodeop_entries[] = { { &vop_close_desc, (vop_t *) procfs_close }, { &vop_create_desc, (vop_t *) procfs_badop }, { &vop_getattr_desc, (vop_t *) procfs_getattr }, - { &vop_inactive_desc, (vop_t *) procfs_inactive }, { &vop_link_desc, (vop_t *) procfs_badop }, { &vop_lookup_desc, (vop_t *) procfs_lookup }, { &vop_mkdir_desc, (vop_t *) procfs_badop }, diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 2b1df9efe20a..f6bd8537fe78 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -59,7 +59,6 @@ static int spec_close __P((struct vop_close_args *)); static int spec_freeblks __P((struct vop_freeblks_args *)); static int spec_fsync __P((struct vop_fsync_args *)); static int spec_getpages __P((struct vop_getpages_args *)); -static int spec_inactive __P((struct vop_inactive_args *)); static int spec_ioctl __P((struct vop_ioctl_args *)); static int spec_open __P((struct vop_open_args *)); static int spec_poll __P((struct vop_poll_args *)); @@ -79,7 +78,7 @@ static struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_freeblks_desc, (vop_t *) spec_freeblks }, { &vop_fsync_desc, (vop_t *) spec_fsync }, { &vop_getpages_desc, (vop_t *) spec_getpages }, - { &vop_inactive_desc, (vop_t *) spec_inactive }, + { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_ioctl_desc, (vop_t *) spec_ioctl }, { &vop_lease_desc, (vop_t *) vop_null }, { &vop_link_desc, (vop_t *) vop_panic }, @@ -88,7 +87,6 @@ static struct vnodeopv_entry_desc spec_vnodeop_entries[] = { { &vop_open_desc, (vop_t *) spec_open }, { &vop_pathconf_desc, (vop_t *) vop_stdpathconf }, { &vop_poll_desc, (vop_t *) spec_poll }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, { &vop_print_desc, (vop_t *) spec_print }, { &vop_read_desc, (vop_t *) spec_read }, { &vop_readdir_desc, (vop_t *) vop_panic }, @@ -391,18 +389,6 @@ spec_fsync(ap) return (0); } -static int -spec_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - struct proc *a_p; - } */ *ap; -{ - - VOP_UNLOCK(ap->a_vp, 0, ap->a_p); - return (0); -} - /* * Just call the device strategy routine */ diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index ccd845e78d8c..82c4d1e84ca3 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -608,6 +608,7 @@ void vfs_write_resume __P((struct mount *mp)); void vfs_write_suspend __P((struct mount *mp)); int vop_stdbwrite __P((struct vop_bwrite_args *ap)); int vop_stdgetwritemount __P((struct vop_getwritemount_args *)); +int vop_stdinactive __P((struct vop_inactive_args *)); int vop_stdislocked __P((struct vop_islocked_args *)); int vop_stdlock __P((struct vop_lock_args *)); int vop_stdunlock __P((struct vop_unlock_args *));