diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index a7e84a8558fe..5ce789194338 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -94,9 +94,6 @@ int coda_printf_delay = 0; /* in microseconds */ int coda_vnop_print_entry = 0; static int coda_lockdebug = 0; -/* Definition of the vfs operation vector */ -static int (**coda_vnodeop_p)(void *); - /* * Some NetBSD details: * @@ -108,85 +105,54 @@ static int (**coda_vnodeop_p)(void *); /* Definition of the vnode operation vector */ -struct vnodeopv_entry_desc coda_vnodeop_entries[] = { - { &vop_default_desc, coda_vop_error }, - { &vop_lookup_desc, coda_lookup }, /* lookup */ - { &vop_create_desc, coda_create }, /* create */ - { &vop_mknod_desc, coda_vop_error }, /* mknod */ - { &vop_open_desc, coda_open }, /* open */ - { &vop_close_desc, coda_close }, /* close */ - { &vop_access_desc, coda_access }, /* access */ - { &vop_getattr_desc, coda_getattr }, /* getattr */ - { &vop_setattr_desc, coda_setattr }, /* setattr */ - { &vop_read_desc, coda_read }, /* read */ - { &vop_write_desc, coda_write }, /* write */ - { &vop_ioctl_desc, coda_ioctl }, /* ioctl */ - { &vop_fsync_desc, coda_fsync }, /* fsync */ - { &vop_remove_desc, coda_remove }, /* remove */ - { &vop_link_desc, coda_link }, /* link */ - { &vop_rename_desc, coda_rename }, /* rename */ - { &vop_mkdir_desc, coda_mkdir }, /* mkdir */ - { &vop_rmdir_desc, coda_rmdir }, /* rmdir */ - { &vop_symlink_desc, coda_symlink }, /* symlink */ - { &vop_readdir_desc, coda_readdir }, /* readdir */ - { &vop_readlink_desc, coda_readlink }, /* readlink */ - { &vop_inactive_desc, coda_inactive }, /* inactive */ - { &vop_reclaim_desc, coda_reclaim }, /* reclaim */ - { &vop_lock_desc, coda_lock }, /* lock */ - { &vop_unlock_desc, coda_unlock }, /* unlock */ - { &vop_bmap_desc, coda_bmap }, /* bmap */ - { &vop_print_desc, coda_vop_error }, /* print */ - { &vop_islocked_desc, coda_islocked }, /* islocked */ - { &vop_pathconf_desc, coda_pathconf }, /* pathconf */ - { &vop_advlock_desc, coda_vop_nop }, /* advlock */ - { &vop_lease_desc, coda_vop_nop }, /* lease */ - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, (vop_t*)vop_stdgetpages }, /* pager intf.*/ - { &vop_putpages_desc, (vop_t*)vop_stdputpages }, /* pager intf.*/ - { &vop_createvobject_desc, (vop_t*)vop_stdcreatevobject }, - { &vop_destroyvobject_desc, (vop_t*)vop_stddestroyvobject }, - { &vop_getvobject_desc, (vop_t*)vop_stdgetvobject }, - -#if 0 - - we need to define these someday -#define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) -#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd) -#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc) -#define UFS_TRUNCATE(aa, bb, cc, dd, ee) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd, ee) -#define UFS_UPDATE(aa, bb) VFSTOUFS((aa)->v_mount)->um_update(aa, bb) +struct vop_vector coda_vnodeops = { + .vop_default = VOP_PANIC, + .vop_lookup = coda_lookup, /* lookup */ + .vop_create = coda_create, /* create */ + .vop_mknod = VOP_PANIC, /* mknod */ + .vop_open = coda_open, /* open */ + .vop_close = coda_close, /* close */ + .vop_access = coda_access, /* access */ + .vop_getattr = coda_getattr, /* getattr */ + .vop_setattr = coda_setattr, /* setattr */ + .vop_read = coda_read, /* read */ + .vop_write = coda_write, /* write */ + .vop_ioctl = coda_ioctl, /* ioctl */ + .vop_fsync = coda_fsync, /* fsync */ + .vop_remove = coda_remove, /* remove */ + .vop_link = coda_link, /* link */ + .vop_rename = coda_rename, /* rename */ + .vop_mkdir = coda_mkdir, /* mkdir */ + .vop_rmdir = coda_rmdir, /* rmdir */ + .vop_symlink = coda_symlink, /* symlink */ + .vop_readdir = coda_readdir, /* readdir */ + .vop_readlink = coda_readlink, /* readlink */ + .vop_inactive = coda_inactive, /* inactive */ + .vop_reclaim = coda_reclaim, /* reclaim */ + .vop_lock = coda_lock, /* lock */ + .vop_unlock = coda_unlock, /* unlock */ + .vop_bmap = coda_bmap, /* bmap */ + .vop_print = VOP_PANIC, /* print */ + .vop_islocked = coda_islocked, /* islocked */ + .vop_pathconf = coda_pathconf, /* pathconf */ + .vop_advlock = VOP_NULL, /* advlock */ + .vop_lease = VOP_NULL, /* lease */ + .vop_poll = vop_stdpoll, + .vop_getpages = vop_stdgetpages, /* pager intf.*/ + .vop_putpages = vop_stdputpages, /* pager intf.*/ + .vop_createvobject = vop_stdcreatevobject, + .vop_destroyvobject = vop_stddestroyvobject, + .vop_getvobject = vop_stdgetvobject, + .vop_getwritemount = vop_stdgetwritemount, +#if 0 missing - { &vop_reallocblks_desc, (vop_t *) ufs_missingop }, - { &vop_cachedlookup_desc, (vop_t *) ufs_lookup }, - { &vop_whiteout_desc, (vop_t *) ufs_whiteout }, + .vop_cachedlookup = ufs_lookup, + .vop_whiteout = ufs_whiteout, #endif - { &vop_createvobject_desc, (vop_t *) vop_stdcreatevobject }, - { &vop_destroyvobject_desc, (vop_t *) vop_stddestroyvobject }, - { &vop_getvobject_desc, (vop_t *) vop_stdgetvobject }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -static struct vnodeopv_desc coda_vnodeop_opv_desc = - { &coda_vnodeop_p, coda_vnodeop_entries }; - -VNODEOP_SET(coda_vnodeop_opv_desc); - -/* A generic panic: we were called with something we didn't define yet */ -int -coda_vop_error(void *anon) { - struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; - - myprintf(("coda_vop_error: Vnode operation %s called, but not defined.\n", - (*desc)->vdesc_name)); - /* - panic("coda_vop_error"); - */ - return EIO; -} - /* A generic do-nothing. For lease_check, advlock */ int coda_vop_nop(void *anon) { @@ -220,8 +186,7 @@ coda_vnodeopstats_init(void) * cache file, and then opens it. */ int -coda_open(v) - void *v; +coda_open(struct vop_open_args *ap) { /* * NetBSD can pass the O_EXCL flag in mode, even though the check @@ -229,7 +194,6 @@ coda_open(v) * is passed the EXCL, it must be a bug. We strip the flag here. */ /* true args */ - struct vop_open_args *ap = v; register struct vnode **vpp = &(ap->a_vp); struct cnode *cp = VTOC(*vpp); int flag = ap->a_mode & (~O_EXCL); @@ -317,11 +281,9 @@ coda_open(v) * Close the cache file used for I/O and notify Venus. */ int -coda_close(v) - void *v; +coda_close(struct vop_close_args *ap) { /* true args */ - struct vop_close_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); int flag = ap->a_fflag; @@ -375,10 +337,8 @@ coda_close(v) } int -coda_read(v) - void *v; +coda_read(struct vop_read_args *ap) { - struct vop_read_args *ap = v; ENTRY; return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ, @@ -386,10 +346,8 @@ coda_read(v) } int -coda_write(v) - void *v; +coda_write(struct vop_write_args *ap) { - struct vop_write_args *ap = v; ENTRY; return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, @@ -525,11 +483,9 @@ printf("coda_rdwr: Internally Opening %p\n", vp); int -coda_ioctl(v) - void *v; +coda_ioctl(struct vop_ioctl_args *ap) { /* true args */ - struct vop_ioctl_args *ap = v; struct vnode *vp = ap->a_vp; int com = ap->a_command; caddr_t data = ap->a_data; @@ -575,7 +531,7 @@ coda_ioctl(v) * Make sure this is a coda style cnode, but it may be a * different vfsp */ - if (tvp->v_op != coda_vnodeop_p) { + if (tvp->v_op != &coda_vnodeops) { vrele(tvp); NDFREE(&ndp, NDF_ONLY_PNBUF); MARK_INT_FAIL(CODA_IOCTL_STATS); @@ -611,11 +567,9 @@ coda_ioctl(v) * opened the file, and therefore should already have access. */ int -coda_getattr(v) - void *v; +coda_getattr(struct vop_getattr_args *ap) { /* true args */ - struct vop_getattr_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct vattr *vap = ap->a_vap; @@ -673,11 +627,9 @@ coda_getattr(v) } int -coda_setattr(v) - void *v; +coda_setattr(struct vop_setattr_args *ap) { /* true args */ - struct vop_setattr_args *ap = v; register struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); register struct vattr *vap = ap->a_vap; @@ -713,11 +665,9 @@ coda_setattr(v) } int -coda_access(v) - void *v; +coda_access(struct vop_access_args *ap) { /* true args */ - struct vop_access_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); int mode = ap->a_mode; @@ -757,11 +707,9 @@ coda_access(v) } int -coda_readlink(v) - void *v; +coda_readlink(struct vop_readlink_args *ap) { /* true args */ - struct vop_readlink_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct uio *uiop = ap->a_uio; @@ -810,11 +758,9 @@ coda_readlink(v) } int -coda_fsync(v) - void *v; +coda_fsync(struct vop_fsync_args *ap) { /* true args */ - struct vop_fsync_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct ucred *cred = ap->a_cred; @@ -876,13 +822,11 @@ coda_fsync(v) } int -coda_inactive(v) - void *v; +coda_inactive(struct vop_inactive_args *ap) { /* XXX - at the moment, inactive doesn't look at cred, and doesn't have a proc pointer. Oops. */ /* true args */ - struct vop_inactive_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct ucred *cred __attribute__((unused)) = NULL; @@ -951,11 +895,9 @@ coda_inactive(v) * It appears that in NetBSD, lookup is supposed to return the vnode locked */ int -coda_lookup(v) - void *v; +coda_lookup(struct vop_lookup_args *ap) { /* true args */ - struct vop_lookup_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct vnode **vpp = ap->a_vpp; @@ -1112,11 +1054,9 @@ coda_lookup(v) /*ARGSUSED*/ int -coda_create(v) - void *v; +coda_create(struct vop_create_args *ap) { /* true args */ - struct vop_create_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct vattr *va = ap->a_vap; @@ -1200,11 +1140,9 @@ coda_create(v) } int -coda_remove(v) - void *v; +coda_remove(struct vop_remove_args *ap) { /* true args */ - struct vop_remove_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *cp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; @@ -1258,11 +1196,9 @@ coda_remove(v) } int -coda_link(v) - void *v; +coda_link(struct vop_link_args *ap) { /* true args */ - struct vop_link_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct vnode *tdvp = ap->a_tdvp; @@ -1308,11 +1244,9 @@ coda_link(v) } int -coda_rename(v) - void *v; +coda_rename(struct vop_rename_args *ap) { /* true args */ - struct vop_rename_args *ap = v; struct vnode *odvp = ap->a_fdvp; struct cnode *odcp = VTOC(odvp); struct componentname *fcnp = ap->a_fcnp; @@ -1403,11 +1337,9 @@ coda_rename(v) } int -coda_mkdir(v) - void *v; +coda_mkdir(struct vop_mkdir_args *ap) { /* true args */ - struct vop_mkdir_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; @@ -1474,11 +1406,9 @@ coda_mkdir(v) } int -coda_rmdir(v) - void *v; +coda_rmdir(struct vop_rmdir_args *ap) { /* true args */ - struct vop_rmdir_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; @@ -1523,11 +1453,9 @@ coda_rmdir(v) } int -coda_symlink(v) - void *v; +coda_symlink(struct vop_symlink_args *ap) { /* true args */ - struct vop_symlink_args *ap = v; struct vnode *tdvp = ap->a_dvp; struct cnode *tdcp = VTOC(tdvp); struct componentname *cnp = ap->a_cnp; @@ -1594,11 +1522,9 @@ coda_symlink(v) * Read directory entries. */ int -coda_readdir(v) - void *v; +coda_readdir(struct vop_readdir_args *ap) { /* true args */ - struct vop_readdir_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); register struct uio *uiop = ap->a_uio; @@ -1671,12 +1597,10 @@ printf("coda_readdir: Internally Opening %p\n", vp); * Convert from filesystem blocks to device blocks */ int -coda_bmap(v) - void *v; +coda_bmap(struct vop_bmap_args *ap) { /* XXX on the global proc */ /* true args */ - struct vop_bmap_args *ap = v; struct vnode *vp __attribute__((unused)) = ap->a_vp; /* file's vnode */ daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */ struct bufobj **bop = ap->a_bop; /* RETURN bufobj of device */ @@ -1706,11 +1630,9 @@ coda_bmap(v) } int -coda_reclaim(v) - void *v; +coda_reclaim(struct vop_reclaim_args *ap) { /* true args */ - struct vop_reclaim_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); /* upcall decl */ @@ -1745,11 +1667,9 @@ coda_reclaim(v) } int -coda_lock(v) - void *v; +coda_lock(struct vop_lock_args *ap) { /* true args */ - struct vop_lock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct thread *td = ap->a_td; @@ -1772,11 +1692,9 @@ coda_lock(v) } int -coda_unlock(v) - void *v; +coda_unlock(struct vop_unlock_args *ap) { /* true args */ - struct vop_unlock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct thread *td = ap->a_td; @@ -1793,11 +1711,9 @@ coda_unlock(v) } int -coda_islocked(v) - void *v; +coda_islocked(struct vop_islocked_args *ap) { /* true args */ - struct vop_islocked_args *ap = v; struct cnode *cp = VTOC(ap->a_vp); ENTRY; @@ -1924,7 +1840,7 @@ make_coda_node(fid, vfsp, type) lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode("coda", vfsp, coda_vnodeop_p, &vp); + err = getnewvnode("coda", vfsp, &coda_vnodeops, &vp); if (err) { panic("coda: getnewvnode returned error %d\n", err); } @@ -1941,14 +1857,11 @@ make_coda_node(fid, vfsp, type) } int -coda_pathconf(v) - void *v; +coda_pathconf( struct vop_pathconf_args *ap) { - struct vop_pathconf_args *ap; int error; register_t *retval; - ap = v; retval = ap->a_retval; error = 0; diff --git a/sys/coda/coda_vnops.h b/sys/coda/coda_vnops.h index 88a398e8cd6c..8aae9b24d431 100644 --- a/sys/coda/coda_vnops.h +++ b/sys/coda/coda_vnops.h @@ -47,38 +47,38 @@ /* NetBSD interfaces to the vnodeops */ -int coda_open(void *); -int coda_close(void *); -int coda_read(void *); -int coda_write(void *); -int coda_ioctl(void *); +vop_open_t coda_open; +vop_close_t coda_close; +vop_read_t coda_read; +vop_write_t coda_write; +vop_ioctl_t coda_ioctl; /* 1.3 int cfs_select(void *);*/ -int coda_getattr(void *); -int coda_setattr(void *); -int coda_access(void *); +vop_getattr_t coda_getattr; +vop_setattr_t coda_setattr; +vop_access_t coda_access; int coda_abortop(void *); -int coda_readlink(void *); -int coda_fsync(void *); -int coda_inactive(void *); -int coda_lookup(void *); -int coda_create(void *); -int coda_remove(void *); -int coda_link(void *); -int coda_rename(void *); -int coda_mkdir(void *); -int coda_rmdir(void *); -int coda_symlink(void *); -int coda_readdir(void *); -int coda_bmap(void *); -int coda_strategy(void *); -int coda_reclaim(void *); -int coda_lock(void *); -int coda_unlock(void *); -int coda_islocked(void *); +vop_readlink_t coda_readlink; +vop_fsync_t coda_fsync; +vop_inactive_t coda_inactive; +vop_lookup_t coda_lookup; +vop_create_t coda_create; +vop_remove_t coda_remove; +vop_link_t coda_link; +vop_rename_t coda_rename; +vop_mkdir_t coda_mkdir; +vop_rmdir_t coda_rmdir; +vop_symlink_t coda_symlink; +vop_readdir_t coda_readdir; +vop_bmap_t coda_bmap; +vop_strategy_t coda_strategy; +vop_reclaim_t coda_reclaim; +vop_lock_t coda_lock; +vop_unlock_t coda_unlock; +vop_islocked_t coda_islocked; int coda_vop_error(void *); int coda_vop_nop(void *); int coda_fbsd_getpages (void *); -int coda_pathconf(void *); +vop_pathconf_t coda_pathconf; int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct thread *td); diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index a68159162544..e5127fbe10e9 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -241,6 +241,8 @@ vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -h + ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -p + ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -q # XXX strictly, everything depends on Makefile because changes to ${PROF} # only appear there, but we don't handle that. diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 9500695a572c..685158d6a934 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -729,7 +729,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) return (0); /* Allocate a new vnode/iso_node. */ - if ((error = getnewvnode("isofs", mp, cd9660_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("isofs", mp, &cd9660_vnodeops, &vp)) != 0) { *vpp = NULLVP; return (error); } @@ -870,7 +870,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) */ switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) { case VFIFO: - vp->v_op = cd9660_fifoop_p; + vp->v_op = &cd9660_fifoops; break; default: break; diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 9761c2f09cf8..4a9e47356aa6 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -780,44 +780,33 @@ cd9660_pathconf(ap) /* * Global vfs data structures for cd9660 */ -vop_t **cd9660_vnodeop_p; -static struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_bmap_desc, (vop_t *) cd9660_bmap }, - { &vop_cachedlookup_desc, (vop_t *) cd9660_lookup }, - { &vop_getattr_desc, (vop_t *) cd9660_getattr }, - { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_ioctl_desc, (vop_t *) cd9660_ioctl }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_pathconf_desc, (vop_t *) cd9660_pathconf }, - { &vop_read_desc, (vop_t *) cd9660_read }, - { &vop_readdir_desc, (vop_t *) cd9660_readdir }, - { &vop_readlink_desc, (vop_t *) cd9660_readlink }, - { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, - { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { &vop_strategy_desc, (vop_t *) cd9660_strategy }, - { NULL, NULL } +struct vop_vector cd9660_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = cd9660_access, + .vop_bmap = cd9660_bmap, + .vop_cachedlookup = cd9660_lookup, + .vop_getattr = cd9660_getattr, + .vop_inactive = cd9660_inactive, + .vop_ioctl = cd9660_ioctl, + .vop_lookup = vfs_cache_lookup, + .vop_pathconf = cd9660_pathconf, + .vop_read = cd9660_read, + .vop_readdir = cd9660_readdir, + .vop_readlink = cd9660_readlink, + .vop_reclaim = cd9660_reclaim, + .vop_setattr = cd9660_setattr, + .vop_strategy = cd9660_strategy, }; -static struct vnodeopv_desc cd9660_vnodeop_opv_desc = - { &cd9660_vnodeop_p, cd9660_vnodeop_entries }; -VNODEOP_SET(cd9660_vnodeop_opv_desc); /* * Special device vnode ops */ -vop_t **cd9660_fifoop_p; -static struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_getattr_desc, (vop_t *) cd9660_getattr }, - { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, - { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { NULL, NULL } +struct vop_vector cd9660_fifoops = { + .vop_default = &fifo_specops, + .vop_access = cd9660_access, + .vop_getattr = cd9660_getattr, + .vop_inactive = cd9660_inactive, + .vop_reclaim = cd9660_reclaim, + .vop_setattr = cd9660_setattr, }; -static struct vnodeopv_desc cd9660_fifoop_opv_desc = - { &cd9660_fifoop_p, cd9660_fifoop_entries }; - -VNODEOP_SET(cd9660_fifoop_opv_desc); diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h index d74806307203..f0b52216bc03 100644 --- a/sys/fs/cd9660/iso.h +++ b/sys/fs/cd9660/iso.h @@ -263,9 +263,8 @@ int cd9660_uninit(struct vfsconf *); #define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \ size_t, struct proc *))eopnotsupp) -extern vop_t **cd9660_vnodeop_p; -extern vop_t **cd9660_specop_p; -extern vop_t **cd9660_fifoop_p; +extern struct vop_vector cd9660_vnodeops; +extern struct vop_vector cd9660_fifoops; int isochar(u_char *, u_char *, int, u_short *, int *, int, void *); int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *); diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index a7e84a8558fe..5ce789194338 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -94,9 +94,6 @@ int coda_printf_delay = 0; /* in microseconds */ int coda_vnop_print_entry = 0; static int coda_lockdebug = 0; -/* Definition of the vfs operation vector */ -static int (**coda_vnodeop_p)(void *); - /* * Some NetBSD details: * @@ -108,85 +105,54 @@ static int (**coda_vnodeop_p)(void *); /* Definition of the vnode operation vector */ -struct vnodeopv_entry_desc coda_vnodeop_entries[] = { - { &vop_default_desc, coda_vop_error }, - { &vop_lookup_desc, coda_lookup }, /* lookup */ - { &vop_create_desc, coda_create }, /* create */ - { &vop_mknod_desc, coda_vop_error }, /* mknod */ - { &vop_open_desc, coda_open }, /* open */ - { &vop_close_desc, coda_close }, /* close */ - { &vop_access_desc, coda_access }, /* access */ - { &vop_getattr_desc, coda_getattr }, /* getattr */ - { &vop_setattr_desc, coda_setattr }, /* setattr */ - { &vop_read_desc, coda_read }, /* read */ - { &vop_write_desc, coda_write }, /* write */ - { &vop_ioctl_desc, coda_ioctl }, /* ioctl */ - { &vop_fsync_desc, coda_fsync }, /* fsync */ - { &vop_remove_desc, coda_remove }, /* remove */ - { &vop_link_desc, coda_link }, /* link */ - { &vop_rename_desc, coda_rename }, /* rename */ - { &vop_mkdir_desc, coda_mkdir }, /* mkdir */ - { &vop_rmdir_desc, coda_rmdir }, /* rmdir */ - { &vop_symlink_desc, coda_symlink }, /* symlink */ - { &vop_readdir_desc, coda_readdir }, /* readdir */ - { &vop_readlink_desc, coda_readlink }, /* readlink */ - { &vop_inactive_desc, coda_inactive }, /* inactive */ - { &vop_reclaim_desc, coda_reclaim }, /* reclaim */ - { &vop_lock_desc, coda_lock }, /* lock */ - { &vop_unlock_desc, coda_unlock }, /* unlock */ - { &vop_bmap_desc, coda_bmap }, /* bmap */ - { &vop_print_desc, coda_vop_error }, /* print */ - { &vop_islocked_desc, coda_islocked }, /* islocked */ - { &vop_pathconf_desc, coda_pathconf }, /* pathconf */ - { &vop_advlock_desc, coda_vop_nop }, /* advlock */ - { &vop_lease_desc, coda_vop_nop }, /* lease */ - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_getpages_desc, (vop_t*)vop_stdgetpages }, /* pager intf.*/ - { &vop_putpages_desc, (vop_t*)vop_stdputpages }, /* pager intf.*/ - { &vop_createvobject_desc, (vop_t*)vop_stdcreatevobject }, - { &vop_destroyvobject_desc, (vop_t*)vop_stddestroyvobject }, - { &vop_getvobject_desc, (vop_t*)vop_stdgetvobject }, - -#if 0 - - we need to define these someday -#define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd) -#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd) -#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc) -#define UFS_TRUNCATE(aa, bb, cc, dd, ee) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd, ee) -#define UFS_UPDATE(aa, bb) VFSTOUFS((aa)->v_mount)->um_update(aa, bb) +struct vop_vector coda_vnodeops = { + .vop_default = VOP_PANIC, + .vop_lookup = coda_lookup, /* lookup */ + .vop_create = coda_create, /* create */ + .vop_mknod = VOP_PANIC, /* mknod */ + .vop_open = coda_open, /* open */ + .vop_close = coda_close, /* close */ + .vop_access = coda_access, /* access */ + .vop_getattr = coda_getattr, /* getattr */ + .vop_setattr = coda_setattr, /* setattr */ + .vop_read = coda_read, /* read */ + .vop_write = coda_write, /* write */ + .vop_ioctl = coda_ioctl, /* ioctl */ + .vop_fsync = coda_fsync, /* fsync */ + .vop_remove = coda_remove, /* remove */ + .vop_link = coda_link, /* link */ + .vop_rename = coda_rename, /* rename */ + .vop_mkdir = coda_mkdir, /* mkdir */ + .vop_rmdir = coda_rmdir, /* rmdir */ + .vop_symlink = coda_symlink, /* symlink */ + .vop_readdir = coda_readdir, /* readdir */ + .vop_readlink = coda_readlink, /* readlink */ + .vop_inactive = coda_inactive, /* inactive */ + .vop_reclaim = coda_reclaim, /* reclaim */ + .vop_lock = coda_lock, /* lock */ + .vop_unlock = coda_unlock, /* unlock */ + .vop_bmap = coda_bmap, /* bmap */ + .vop_print = VOP_PANIC, /* print */ + .vop_islocked = coda_islocked, /* islocked */ + .vop_pathconf = coda_pathconf, /* pathconf */ + .vop_advlock = VOP_NULL, /* advlock */ + .vop_lease = VOP_NULL, /* lease */ + .vop_poll = vop_stdpoll, + .vop_getpages = vop_stdgetpages, /* pager intf.*/ + .vop_putpages = vop_stdputpages, /* pager intf.*/ + .vop_createvobject = vop_stdcreatevobject, + .vop_destroyvobject = vop_stddestroyvobject, + .vop_getvobject = vop_stdgetvobject, + .vop_getwritemount = vop_stdgetwritemount, +#if 0 missing - { &vop_reallocblks_desc, (vop_t *) ufs_missingop }, - { &vop_cachedlookup_desc, (vop_t *) ufs_lookup }, - { &vop_whiteout_desc, (vop_t *) ufs_whiteout }, + .vop_cachedlookup = ufs_lookup, + .vop_whiteout = ufs_whiteout, #endif - { &vop_createvobject_desc, (vop_t *) vop_stdcreatevobject }, - { &vop_destroyvobject_desc, (vop_t *) vop_stddestroyvobject }, - { &vop_getvobject_desc, (vop_t *) vop_stdgetvobject }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, - { (struct vnodeop_desc*)NULL, (int(*)(void *))NULL } }; -static struct vnodeopv_desc coda_vnodeop_opv_desc = - { &coda_vnodeop_p, coda_vnodeop_entries }; - -VNODEOP_SET(coda_vnodeop_opv_desc); - -/* A generic panic: we were called with something we didn't define yet */ -int -coda_vop_error(void *anon) { - struct vnodeop_desc **desc = (struct vnodeop_desc **)anon; - - myprintf(("coda_vop_error: Vnode operation %s called, but not defined.\n", - (*desc)->vdesc_name)); - /* - panic("coda_vop_error"); - */ - return EIO; -} - /* A generic do-nothing. For lease_check, advlock */ int coda_vop_nop(void *anon) { @@ -220,8 +186,7 @@ coda_vnodeopstats_init(void) * cache file, and then opens it. */ int -coda_open(v) - void *v; +coda_open(struct vop_open_args *ap) { /* * NetBSD can pass the O_EXCL flag in mode, even though the check @@ -229,7 +194,6 @@ coda_open(v) * is passed the EXCL, it must be a bug. We strip the flag here. */ /* true args */ - struct vop_open_args *ap = v; register struct vnode **vpp = &(ap->a_vp); struct cnode *cp = VTOC(*vpp); int flag = ap->a_mode & (~O_EXCL); @@ -317,11 +281,9 @@ coda_open(v) * Close the cache file used for I/O and notify Venus. */ int -coda_close(v) - void *v; +coda_close(struct vop_close_args *ap) { /* true args */ - struct vop_close_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); int flag = ap->a_fflag; @@ -375,10 +337,8 @@ coda_close(v) } int -coda_read(v) - void *v; +coda_read(struct vop_read_args *ap) { - struct vop_read_args *ap = v; ENTRY; return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ, @@ -386,10 +346,8 @@ coda_read(v) } int -coda_write(v) - void *v; +coda_write(struct vop_write_args *ap) { - struct vop_write_args *ap = v; ENTRY; return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE, @@ -525,11 +483,9 @@ printf("coda_rdwr: Internally Opening %p\n", vp); int -coda_ioctl(v) - void *v; +coda_ioctl(struct vop_ioctl_args *ap) { /* true args */ - struct vop_ioctl_args *ap = v; struct vnode *vp = ap->a_vp; int com = ap->a_command; caddr_t data = ap->a_data; @@ -575,7 +531,7 @@ coda_ioctl(v) * Make sure this is a coda style cnode, but it may be a * different vfsp */ - if (tvp->v_op != coda_vnodeop_p) { + if (tvp->v_op != &coda_vnodeops) { vrele(tvp); NDFREE(&ndp, NDF_ONLY_PNBUF); MARK_INT_FAIL(CODA_IOCTL_STATS); @@ -611,11 +567,9 @@ coda_ioctl(v) * opened the file, and therefore should already have access. */ int -coda_getattr(v) - void *v; +coda_getattr(struct vop_getattr_args *ap) { /* true args */ - struct vop_getattr_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct vattr *vap = ap->a_vap; @@ -673,11 +627,9 @@ coda_getattr(v) } int -coda_setattr(v) - void *v; +coda_setattr(struct vop_setattr_args *ap) { /* true args */ - struct vop_setattr_args *ap = v; register struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); register struct vattr *vap = ap->a_vap; @@ -713,11 +665,9 @@ coda_setattr(v) } int -coda_access(v) - void *v; +coda_access(struct vop_access_args *ap) { /* true args */ - struct vop_access_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); int mode = ap->a_mode; @@ -757,11 +707,9 @@ coda_access(v) } int -coda_readlink(v) - void *v; +coda_readlink(struct vop_readlink_args *ap) { /* true args */ - struct vop_readlink_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct uio *uiop = ap->a_uio; @@ -810,11 +758,9 @@ coda_readlink(v) } int -coda_fsync(v) - void *v; +coda_fsync(struct vop_fsync_args *ap) { /* true args */ - struct vop_fsync_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct ucred *cred = ap->a_cred; @@ -876,13 +822,11 @@ coda_fsync(v) } int -coda_inactive(v) - void *v; +coda_inactive(struct vop_inactive_args *ap) { /* XXX - at the moment, inactive doesn't look at cred, and doesn't have a proc pointer. Oops. */ /* true args */ - struct vop_inactive_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct ucred *cred __attribute__((unused)) = NULL; @@ -951,11 +895,9 @@ coda_inactive(v) * It appears that in NetBSD, lookup is supposed to return the vnode locked */ int -coda_lookup(v) - void *v; +coda_lookup(struct vop_lookup_args *ap) { /* true args */ - struct vop_lookup_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct vnode **vpp = ap->a_vpp; @@ -1112,11 +1054,9 @@ coda_lookup(v) /*ARGSUSED*/ int -coda_create(v) - void *v; +coda_create(struct vop_create_args *ap) { /* true args */ - struct vop_create_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct vattr *va = ap->a_vap; @@ -1200,11 +1140,9 @@ coda_create(v) } int -coda_remove(v) - void *v; +coda_remove(struct vop_remove_args *ap) { /* true args */ - struct vop_remove_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *cp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; @@ -1258,11 +1196,9 @@ coda_remove(v) } int -coda_link(v) - void *v; +coda_link(struct vop_link_args *ap) { /* true args */ - struct vop_link_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct vnode *tdvp = ap->a_tdvp; @@ -1308,11 +1244,9 @@ coda_link(v) } int -coda_rename(v) - void *v; +coda_rename(struct vop_rename_args *ap) { /* true args */ - struct vop_rename_args *ap = v; struct vnode *odvp = ap->a_fdvp; struct cnode *odcp = VTOC(odvp); struct componentname *fcnp = ap->a_fcnp; @@ -1403,11 +1337,9 @@ coda_rename(v) } int -coda_mkdir(v) - void *v; +coda_mkdir(struct vop_mkdir_args *ap) { /* true args */ - struct vop_mkdir_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; @@ -1474,11 +1406,9 @@ coda_mkdir(v) } int -coda_rmdir(v) - void *v; +coda_rmdir(struct vop_rmdir_args *ap) { /* true args */ - struct vop_rmdir_args *ap = v; struct vnode *dvp = ap->a_dvp; struct cnode *dcp = VTOC(dvp); struct componentname *cnp = ap->a_cnp; @@ -1523,11 +1453,9 @@ coda_rmdir(v) } int -coda_symlink(v) - void *v; +coda_symlink(struct vop_symlink_args *ap) { /* true args */ - struct vop_symlink_args *ap = v; struct vnode *tdvp = ap->a_dvp; struct cnode *tdcp = VTOC(tdvp); struct componentname *cnp = ap->a_cnp; @@ -1594,11 +1522,9 @@ coda_symlink(v) * Read directory entries. */ int -coda_readdir(v) - void *v; +coda_readdir(struct vop_readdir_args *ap) { /* true args */ - struct vop_readdir_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); register struct uio *uiop = ap->a_uio; @@ -1671,12 +1597,10 @@ printf("coda_readdir: Internally Opening %p\n", vp); * Convert from filesystem blocks to device blocks */ int -coda_bmap(v) - void *v; +coda_bmap(struct vop_bmap_args *ap) { /* XXX on the global proc */ /* true args */ - struct vop_bmap_args *ap = v; struct vnode *vp __attribute__((unused)) = ap->a_vp; /* file's vnode */ daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */ struct bufobj **bop = ap->a_bop; /* RETURN bufobj of device */ @@ -1706,11 +1630,9 @@ coda_bmap(v) } int -coda_reclaim(v) - void *v; +coda_reclaim(struct vop_reclaim_args *ap) { /* true args */ - struct vop_reclaim_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); /* upcall decl */ @@ -1745,11 +1667,9 @@ coda_reclaim(v) } int -coda_lock(v) - void *v; +coda_lock(struct vop_lock_args *ap) { /* true args */ - struct vop_lock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct thread *td = ap->a_td; @@ -1772,11 +1692,9 @@ coda_lock(v) } int -coda_unlock(v) - void *v; +coda_unlock(struct vop_unlock_args *ap) { /* true args */ - struct vop_unlock_args *ap = v; struct vnode *vp = ap->a_vp; struct cnode *cp = VTOC(vp); struct thread *td = ap->a_td; @@ -1793,11 +1711,9 @@ coda_unlock(v) } int -coda_islocked(v) - void *v; +coda_islocked(struct vop_islocked_args *ap) { /* true args */ - struct vop_islocked_args *ap = v; struct cnode *cp = VTOC(ap->a_vp); ENTRY; @@ -1924,7 +1840,7 @@ make_coda_node(fid, vfsp, type) lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode("coda", vfsp, coda_vnodeop_p, &vp); + err = getnewvnode("coda", vfsp, &coda_vnodeops, &vp); if (err) { panic("coda: getnewvnode returned error %d\n", err); } @@ -1941,14 +1857,11 @@ make_coda_node(fid, vfsp, type) } int -coda_pathconf(v) - void *v; +coda_pathconf( struct vop_pathconf_args *ap) { - struct vop_pathconf_args *ap; int error; register_t *retval; - ap = v; retval = ap->a_retval; error = 0; diff --git a/sys/fs/coda/coda_vnops.h b/sys/fs/coda/coda_vnops.h index 88a398e8cd6c..8aae9b24d431 100644 --- a/sys/fs/coda/coda_vnops.h +++ b/sys/fs/coda/coda_vnops.h @@ -47,38 +47,38 @@ /* NetBSD interfaces to the vnodeops */ -int coda_open(void *); -int coda_close(void *); -int coda_read(void *); -int coda_write(void *); -int coda_ioctl(void *); +vop_open_t coda_open; +vop_close_t coda_close; +vop_read_t coda_read; +vop_write_t coda_write; +vop_ioctl_t coda_ioctl; /* 1.3 int cfs_select(void *);*/ -int coda_getattr(void *); -int coda_setattr(void *); -int coda_access(void *); +vop_getattr_t coda_getattr; +vop_setattr_t coda_setattr; +vop_access_t coda_access; int coda_abortop(void *); -int coda_readlink(void *); -int coda_fsync(void *); -int coda_inactive(void *); -int coda_lookup(void *); -int coda_create(void *); -int coda_remove(void *); -int coda_link(void *); -int coda_rename(void *); -int coda_mkdir(void *); -int coda_rmdir(void *); -int coda_symlink(void *); -int coda_readdir(void *); -int coda_bmap(void *); -int coda_strategy(void *); -int coda_reclaim(void *); -int coda_lock(void *); -int coda_unlock(void *); -int coda_islocked(void *); +vop_readlink_t coda_readlink; +vop_fsync_t coda_fsync; +vop_inactive_t coda_inactive; +vop_lookup_t coda_lookup; +vop_create_t coda_create; +vop_remove_t coda_remove; +vop_link_t coda_link; +vop_rename_t coda_rename; +vop_mkdir_t coda_mkdir; +vop_rmdir_t coda_rmdir; +vop_symlink_t coda_symlink; +vop_readdir_t coda_readdir; +vop_bmap_t coda_bmap; +vop_strategy_t coda_strategy; +vop_reclaim_t coda_reclaim; +vop_lock_t coda_lock; +vop_unlock_t coda_unlock; +vop_islocked_t coda_islocked; int coda_vop_error(void *); int coda_vop_nop(void *); int coda_fbsd_getpages (void *); -int coda_pathconf(void *); +vop_pathconf_t coda_pathconf; int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw, int ioflag, struct ucred *cred, struct thread *td); diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index 0f2094b08646..fce152ac0c4e 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -51,40 +51,34 @@ static vop_poll_t dead_poll; static vop_read_t dead_read; static vop_write_t dead_write; -vop_t **dead_vnodeop_p; -static struct vnodeopv_entry_desc dead_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) vop_ebadf }, - { &vop_advlock_desc, (vop_t *) vop_ebadf }, - { &vop_bmap_desc, (vop_t *) dead_bmap }, - { &vop_create_desc, (vop_t *) vop_panic }, - { &vop_getattr_desc, (vop_t *) vop_ebadf }, - { &vop_inactive_desc, (vop_t *) vop_null }, - { &vop_ioctl_desc, (vop_t *) dead_ioctl }, - { &vop_link_desc, (vop_t *) vop_panic }, - { &vop_lock_desc, (vop_t *) dead_lock }, - { &vop_lookup_desc, (vop_t *) dead_lookup }, - { &vop_mkdir_desc, (vop_t *) vop_panic }, - { &vop_mknod_desc, (vop_t *) vop_panic }, - { &vop_open_desc, (vop_t *) dead_open }, - { &vop_pathconf_desc, (vop_t *) vop_ebadf }, /* per pathconf(2) */ - { &vop_poll_desc, (vop_t *) dead_poll }, - { &vop_read_desc, (vop_t *) dead_read }, - { &vop_readdir_desc, (vop_t *) vop_ebadf }, - { &vop_readlink_desc, (vop_t *) vop_ebadf }, - { &vop_reclaim_desc, (vop_t *) vop_null }, - { &vop_remove_desc, (vop_t *) vop_panic }, - { &vop_rename_desc, (vop_t *) vop_panic }, - { &vop_rmdir_desc, (vop_t *) vop_panic }, - { &vop_setattr_desc, (vop_t *) vop_ebadf }, - { &vop_symlink_desc, (vop_t *) vop_panic }, - { &vop_write_desc, (vop_t *) dead_write }, - { NULL, NULL } +struct vop_vector dead_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = VOP_EBADF, + .vop_advlock = VOP_EBADF, + .vop_bmap = dead_bmap, + .vop_create = VOP_PANIC, + .vop_getattr = VOP_EBADF, + .vop_inactive = VOP_NULL, + .vop_ioctl = dead_ioctl, + .vop_link = VOP_PANIC, + .vop_lock = dead_lock, + .vop_lookup = dead_lookup, + .vop_mkdir = VOP_PANIC, + .vop_mknod = VOP_PANIC, + .vop_open = dead_open, + .vop_pathconf = VOP_EBADF, /* per pathconf(2) */ + .vop_poll = dead_poll, + .vop_read = dead_read, + .vop_readdir = VOP_EBADF, + .vop_readlink = VOP_EBADF, + .vop_reclaim = VOP_NULL, + .vop_remove = VOP_PANIC, + .vop_rename = VOP_PANIC, + .vop_rmdir = VOP_PANIC, + .vop_setattr = VOP_EBADF, + .vop_symlink = VOP_PANIC, + .vop_write = dead_write, }; -static struct vnodeopv_desc dead_vnodeop_opv_desc = - { &dead_vnodeop_p, dead_vnodeop_entries }; - -VNODEOP_SET(dead_vnodeop_opv_desc); /* * Trivial lookup routine that always fails. diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index a765b5a484a5..1eecbf1b80cb 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -110,8 +110,7 @@ static vop_setlabel_t devfs_setlabel; #endif static vop_symlink_t devfs_symlink; -static vop_t **devfs_vnodeop_p; -vop_t **devfs_specop_p; +extern struct vop_vector devfs_vnodeops; static int devfs_fp_check(struct file *fp, struct cdev **devp, struct cdevsw **dswp) @@ -187,7 +186,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, stru } else { dev = NULL; } - error = getnewvnode("devfs", mp, devfs_vnodeop_p, &vp); + error = getnewvnode("devfs", mp, &devfs_vnodeops, &vp); if (error != 0) { printf("devfs_allocv: failed to allocate new vnode\n"); return (error); @@ -196,7 +195,7 @@ devfs_allocv(struct devfs_dirent *de, struct mount *mp, struct vnode **vpp, stru if (de->de_dirent->d_type == DT_CHR) { vp->v_type = VCHR; vp = addaliasu(vp, dev->si_udev); - vp->v_op = devfs_specop_p; + vp->v_op = &devfs_specops; } else if (de->de_dirent->d_type == DT_DIR) { vp->v_type = VDIR; } else if (de->de_dirent->d_type == DT_LNK) { @@ -1369,67 +1368,55 @@ devfs_write_f(struct file *fp, struct uio *uio, struct ucred *cred, int flags, s return (error); } -static struct vnodeopv_entry_desc devfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) devfs_access }, - { &vop_getattr_desc, (vop_t *) devfs_getattr }, - { &vop_ioctl_desc, (vop_t *) devfs_rioctl }, - { &vop_lookup_desc, (vop_t *) devfs_lookup }, - { &vop_mknod_desc, (vop_t *) devfs_mknod }, - { &vop_pathconf_desc, (vop_t *) devfs_pathconf }, - { &vop_read_desc, (vop_t *) devfs_rread }, - { &vop_readdir_desc, (vop_t *) devfs_readdir }, - { &vop_readlink_desc, (vop_t *) devfs_readlink }, - { &vop_reclaim_desc, (vop_t *) devfs_reclaim }, - { &vop_remove_desc, (vop_t *) devfs_remove }, - { &vop_revoke_desc, (vop_t *) devfs_revoke }, - { &vop_setattr_desc, (vop_t *) devfs_setattr }, +static struct vop_vector devfs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = devfs_access, + .vop_getattr = devfs_getattr, + .vop_ioctl = devfs_rioctl, + .vop_lookup = devfs_lookup, + .vop_mknod = devfs_mknod, + .vop_pathconf = devfs_pathconf, + .vop_read = devfs_rread, + .vop_readdir = devfs_readdir, + .vop_readlink = devfs_readlink, + .vop_reclaim = devfs_reclaim, + .vop_remove = devfs_remove, + .vop_revoke = devfs_revoke, + .vop_setattr = devfs_setattr, #ifdef MAC - { &vop_setlabel_desc, (vop_t *) devfs_setlabel }, + .vop_setlabel = devfs_setlabel, #endif - { &vop_symlink_desc, (vop_t *) devfs_symlink }, - { NULL, NULL } + .vop_symlink = devfs_symlink, }; -static struct vnodeopv_desc devfs_vnodeop_opv_desc = - { &devfs_vnodeop_p, devfs_vnodeop_entries }; - -VNODEOP_SET(devfs_vnodeop_opv_desc); - -static struct vnodeopv_entry_desc devfs_specop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) devfs_access }, - { &vop_advlock_desc, (vop_t *) devfs_advlock }, - { &vop_bmap_desc, (vop_t *) vop_panic }, - { &vop_close_desc, (vop_t *) devfs_close }, - { &vop_create_desc, (vop_t *) vop_panic }, - { &vop_fsync_desc, (vop_t *) devfs_fsync }, - { &vop_getattr_desc, (vop_t *) devfs_getattr }, - { &vop_lease_desc, (vop_t *) vop_null }, - { &vop_link_desc, (vop_t *) vop_panic }, - { &vop_mkdir_desc, (vop_t *) vop_panic }, - { &vop_mknod_desc, (vop_t *) vop_panic }, - { &vop_open_desc, (vop_t *) devfs_open }, - { &vop_pathconf_desc, (vop_t *) devfs_pathconf }, - { &vop_print_desc, (vop_t *) devfs_print }, - { &vop_readdir_desc, (vop_t *) vop_panic }, - { &vop_readlink_desc, (vop_t *) vop_panic }, - { &vop_reallocblks_desc, (vop_t *) vop_panic }, - { &vop_reclaim_desc, (vop_t *) devfs_reclaim }, - { &vop_remove_desc, (vop_t *) devfs_remove }, - { &vop_rename_desc, (vop_t *) vop_panic }, - { &vop_revoke_desc, (vop_t *) devfs_revoke }, - { &vop_rmdir_desc, (vop_t *) vop_panic }, - { &vop_setattr_desc, (vop_t *) devfs_setattr }, +struct vop_vector devfs_specops = { + .vop_default = &default_vnodeops, + .vop_access = devfs_access, + .vop_advlock = devfs_advlock, + .vop_bmap = VOP_PANIC, + .vop_close = devfs_close, + .vop_create = VOP_PANIC, + .vop_fsync = devfs_fsync, + .vop_getattr = devfs_getattr, + .vop_lease = VOP_NULL, + .vop_link = VOP_PANIC, + .vop_mkdir = VOP_PANIC, + .vop_mknod = VOP_PANIC, + .vop_open = devfs_open, + .vop_pathconf = devfs_pathconf, + .vop_print = devfs_print, + .vop_readdir = VOP_PANIC, + .vop_readlink = VOP_PANIC, + .vop_reallocblks = VOP_PANIC, + .vop_reclaim = devfs_reclaim, + .vop_remove = devfs_remove, + .vop_rename = VOP_PANIC, + .vop_revoke = devfs_revoke, + .vop_rmdir = VOP_PANIC, + .vop_setattr = devfs_setattr, #ifdef MAC - { &vop_setlabel_desc, (vop_t *) devfs_setlabel }, + .vop_setlabel = devfs_setlabel, #endif - { &vop_strategy_desc, (vop_t *) vop_panic }, - { &vop_symlink_desc, (vop_t *) vop_panic }, - { NULL, NULL } + .vop_strategy = VOP_PANIC, + .vop_symlink = VOP_PANIC, }; - -static struct vnodeopv_desc devfs_specop_opv_desc = - { &devfs_specop_p, devfs_specop_entries }; - -VNODEOP_SET(devfs_specop_opv_desc); diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 3f25cdafc577..ccaf3421f64d 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -60,8 +60,6 @@ #define FDL_LOCKED 0x02 static int fdcache_lock; -static vop_t **fdesc_vnodeop_p; - #define NFDCACHE 4 #define FD_NHASH(ix) \ (&fdhashtbl[(ix) & fdhash]) @@ -76,6 +74,8 @@ static vop_readdir_t fdesc_readdir; static vop_reclaim_t fdesc_reclaim; static vop_setattr_t fdesc_setattr; +extern struct vop_vector fdesc_vnodeops; + /* * Initialise cache headers */ @@ -129,7 +129,7 @@ fdesc_allocvp(ftype, ix, mp, vpp, td) */ MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK); - error = getnewvnode("fdesc", mp, fdesc_vnodeop_p, vpp); + error = getnewvnode("fdesc", mp, &fdesc_vnodeops, vpp); if (error) { FREE(fd, M_TEMP); goto out; @@ -519,20 +519,15 @@ fdesc_reclaim(ap) return (0); } -static struct vnodeopv_entry_desc fdesc_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) vop_null }, - { &vop_getattr_desc, (vop_t *) fdesc_getattr }, - { &vop_inactive_desc, (vop_t *) fdesc_inactive }, - { &vop_lookup_desc, (vop_t *) fdesc_lookup }, - { &vop_open_desc, (vop_t *) fdesc_open }, - { &vop_pathconf_desc, (vop_t *) vop_stdpathconf }, - { &vop_readdir_desc, (vop_t *) fdesc_readdir }, - { &vop_reclaim_desc, (vop_t *) fdesc_reclaim }, - { &vop_setattr_desc, (vop_t *) fdesc_setattr }, - { NULL, NULL } +static struct vop_vector fdesc_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = VOP_NULL, + .vop_getattr = fdesc_getattr, + .vop_inactive = fdesc_inactive, + .vop_lookup = fdesc_lookup, + .vop_open = fdesc_open, + .vop_pathconf = vop_stdpathconf, + .vop_readdir = fdesc_readdir, + .vop_reclaim = fdesc_reclaim, + .vop_setattr = fdesc_setattr, }; -static struct vnodeopv_desc fdesc_vnodeop_opv_desc = - { &fdesc_vnodeop_p, fdesc_vnodeop_entries }; - -VNODEOP_SET(fdesc_vnodeop_opv_desc); diff --git a/sys/fs/fifofs/fifo.h b/sys/fs/fifofs/fifo.h index 1148c9a40aa6..339763b20042 100644 --- a/sys/fs/fifofs/fifo.h +++ b/sys/fs/fifofs/fifo.h @@ -30,8 +30,6 @@ * $FreeBSD$ */ -extern vop_t **fifo_vnodeop_p; - /* * Prototypes for fifo operations on vnodes. */ diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index a136e0fdd4d2..53d267f34be6 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -100,52 +100,36 @@ static struct filterops fiforead_filtops = static struct filterops fifowrite_filtops = { 1, NULL, filt_fifowdetach, filt_fifowrite }; -vop_t **fifo_vnodeop_p; -static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) vop_ebadf }, - { &vop_advlock_desc, (vop_t *) fifo_advlock }, - { &vop_close_desc, (vop_t *) fifo_close }, - { &vop_create_desc, (vop_t *) vop_panic }, - { &vop_getattr_desc, (vop_t *) vop_ebadf }, - { &vop_ioctl_desc, (vop_t *) fifo_ioctl }, - { &vop_kqfilter_desc, (vop_t *) fifo_kqfilter }, - { &vop_lease_desc, (vop_t *) vop_null }, - { &vop_link_desc, (vop_t *) vop_panic }, - { &vop_mkdir_desc, (vop_t *) vop_panic }, - { &vop_mknod_desc, (vop_t *) vop_panic }, - { &vop_open_desc, (vop_t *) fifo_open }, - { &vop_pathconf_desc, (vop_t *) fifo_pathconf }, - { &vop_print_desc, (vop_t *) fifo_print }, - { &vop_readdir_desc, (vop_t *) vop_panic }, - { &vop_readlink_desc, (vop_t *) vop_panic }, - { &vop_reallocblks_desc, (vop_t *) vop_panic }, - { &vop_reclaim_desc, (vop_t *) vop_null }, - { &vop_remove_desc, (vop_t *) vop_panic }, - { &vop_rename_desc, (vop_t *) vop_panic }, - { &vop_rmdir_desc, (vop_t *) vop_panic }, - { &vop_setattr_desc, (vop_t *) vop_ebadf }, - { &vop_symlink_desc, (vop_t *) vop_panic }, - { NULL, NULL } +struct vop_vector fifo_specops = { + .vop_default = &default_vnodeops, + .vop_access = VOP_EBADF, + .vop_advlock = fifo_advlock, + .vop_close = fifo_close, + .vop_create = VOP_PANIC, + .vop_getattr = VOP_EBADF, + .vop_ioctl = fifo_ioctl, + .vop_kqfilter = fifo_kqfilter, + .vop_lease = VOP_NULL, + .vop_link = VOP_PANIC, + .vop_mkdir = VOP_PANIC, + .vop_mknod = VOP_PANIC, + .vop_open = fifo_open, + .vop_pathconf = fifo_pathconf, + .vop_print = fifo_print, + .vop_readdir = VOP_PANIC, + .vop_readlink = VOP_PANIC, + .vop_reallocblks = VOP_PANIC, + .vop_reclaim = VOP_NULL, + .vop_remove = VOP_PANIC, + .vop_rename = VOP_PANIC, + .vop_rmdir = VOP_PANIC, + .vop_setattr = VOP_EBADF, + .vop_symlink = VOP_PANIC, }; -static struct vnodeopv_desc fifo_vnodeop_opv_desc = - { &fifo_vnodeop_p, fifo_vnodeop_entries }; - -VNODEOP_SET(fifo_vnodeop_opv_desc); struct mtx fifo_mtx; MTX_SYSINIT(fifo, &fifo_mtx, "fifo mutex", MTX_DEF); -int -fifo_vnoperate(ap) - struct vop_generic_args /* { - struct vnodeop_desc *a_desc; - - } */ *ap; -{ - return (VOCALL(fifo_vnodeop_p, ap->a_desc->vdesc_offset, ap)); -} - /* * Dispose of fifo resources. */ diff --git a/sys/fs/hpfs/hpfs.h b/sys/fs/hpfs/hpfs.h index 55ef3a37a3a7..c818d1b23e87 100644 --- a/sys/fs/hpfs/hpfs.h +++ b/sys/fs/hpfs/hpfs.h @@ -387,7 +387,7 @@ MALLOC_DECLARE(M_HPFSNO); #define HPTOV(h) ((struct vnode *)((h)->h_vp)) #define FID(f) (*((lsn_t *)(f)->fid_data)) -extern vop_t ** hpfs_vnodeop_p; +extern struct vop_vector hpfs_vnodeops; /* Hash routines, too small to be separate header */ void hpfs_hphashinit(void); diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 4acf562dd1ab..f1bd584ebed5 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -489,7 +489,7 @@ hpfs_vget( MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode), M_HPFSNO, M_WAITOK); - error = getnewvnode("hpfs", hpmp->hpm_mp, hpfs_vnodeop_p, &vp); + error = getnewvnode("hpfs", hpmp->hpm_mp, &hpfs_vnodeops, &vp); if (error) { printf("hpfs_vget: can't get new vnode\n"); FREE(hp, M_HPFSNO); diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index 2d9e40f1d0af..0381befc079d 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -1224,35 +1224,27 @@ hpfs_pathconf(ap) /* * Global vfs data structures */ -vop_t **hpfs_vnodeop_p; -struct vnodeopv_entry_desc hpfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *)vop_defaultop }, +struct vop_vector hpfs_vnodeops = { + .vop_default = &default_vnodeops, - { &vop_getattr_desc, (vop_t *)hpfs_getattr }, - { &vop_setattr_desc, (vop_t *)hpfs_setattr }, - { &vop_inactive_desc, (vop_t *)hpfs_inactive }, - { &vop_reclaim_desc, (vop_t *)hpfs_reclaim }, - { &vop_print_desc, (vop_t *)hpfs_print }, - { &vop_create_desc, (vop_t *)hpfs_create }, - { &vop_remove_desc, (vop_t *)hpfs_remove }, - { &vop_cachedlookup_desc, (vop_t *)hpfs_lookup }, - { &vop_lookup_desc, (vop_t *)vfs_cache_lookup }, - { &vop_access_desc, (vop_t *)hpfs_access }, - { &vop_close_desc, (vop_t *)hpfs_close }, - { &vop_open_desc, (vop_t *)hpfs_open }, - { &vop_readdir_desc, (vop_t *)hpfs_readdir }, - { &vop_fsync_desc, (vop_t *)hpfs_fsync }, - { &vop_bmap_desc, (vop_t *)hpfs_bmap }, - { &vop_strategy_desc, (vop_t *)hpfs_strategy }, - { &vop_read_desc, (vop_t *)hpfs_read }, - { &vop_write_desc, (vop_t *)hpfs_write }, - { &vop_ioctl_desc, (vop_t *)hpfs_ioctl }, - { &vop_pathconf_desc, (vop_t *)hpfs_pathconf }, - { NULL, NULL } + .vop_getattr = hpfs_getattr, + .vop_setattr = hpfs_setattr, + .vop_inactive = hpfs_inactive, + .vop_reclaim = hpfs_reclaim, + .vop_print = hpfs_print, + .vop_create = hpfs_create, + .vop_remove = hpfs_remove, + .vop_cachedlookup = hpfs_lookup, + .vop_lookup = vfs_cache_lookup, + .vop_access = hpfs_access, + .vop_close = hpfs_close, + .vop_open = hpfs_open, + .vop_readdir = hpfs_readdir, + .vop_fsync = hpfs_fsync, + .vop_bmap = hpfs_bmap, + .vop_strategy = hpfs_strategy, + .vop_read = hpfs_read, + .vop_write = hpfs_write, + .vop_ioctl = hpfs_ioctl, + .vop_pathconf = hpfs_pathconf, }; - -static -struct vnodeopv_desc hpfs_vnodeop_opv_desc = - { &hpfs_vnodeop_p, hpfs_vnodeop_entries }; - -VNODEOP_SET(hpfs_vnodeop_opv_desc); diff --git a/sys/fs/msdosfs/denode.h b/sys/fs/msdosfs/denode.h index 0da43784baa6..dfe7960a95c9 100644 --- a/sys/fs/msdosfs/denode.h +++ b/sys/fs/msdosfs/denode.h @@ -259,7 +259,7 @@ struct defid { #endif }; -extern vop_t **msdosfs_vnodeop_p; +extern struct vop_vector msdosfs_vnodeops; int msdosfs_lookup(struct vop_cachedlookup_args *); int msdosfs_inactive(struct vop_inactive_args *); diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 845e633057fa..6fa4a44f307f 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -248,7 +248,7 @@ deget(pmp, dirclust, diroffset, depp) * copy it from the passed disk buffer. */ /* getnewvnode() does a VREF() on the vnode */ - error = getnewvnode("msdosfs", mntp, msdosfs_vnodeop_p, &nvp); + error = getnewvnode("msdosfs", mntp, &msdosfs_vnodeops, &nvp); if (error) { *depp = NULL; FREE(ldep, M_MSDOSFSNODE); diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index bcf72e7c0f89..c735647b4d51 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1871,37 +1871,31 @@ msdosfs_advlock(ap) } /* Global vfs data structures for msdosfs */ -vop_t **msdosfs_vnodeop_p; -static struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) msdosfs_access }, - { &vop_advlock_desc, (vop_t *) msdosfs_advlock }, - { &vop_bmap_desc, (vop_t *) msdosfs_bmap }, - { &vop_cachedlookup_desc, (vop_t *) msdosfs_lookup }, - { &vop_close_desc, (vop_t *) msdosfs_close }, - { &vop_create_desc, (vop_t *) msdosfs_create }, - { &vop_fsync_desc, (vop_t *) msdosfs_fsync }, - { &vop_getattr_desc, (vop_t *) msdosfs_getattr }, - { &vop_inactive_desc, (vop_t *) msdosfs_inactive }, - { &vop_link_desc, (vop_t *) msdosfs_link }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_mkdir_desc, (vop_t *) msdosfs_mkdir }, - { &vop_mknod_desc, (vop_t *) msdosfs_mknod }, - { &vop_pathconf_desc, (vop_t *) msdosfs_pathconf }, - { &vop_print_desc, (vop_t *) msdosfs_print }, - { &vop_read_desc, (vop_t *) msdosfs_read }, - { &vop_readdir_desc, (vop_t *) msdosfs_readdir }, - { &vop_reclaim_desc, (vop_t *) msdosfs_reclaim }, - { &vop_remove_desc, (vop_t *) msdosfs_remove }, - { &vop_rename_desc, (vop_t *) msdosfs_rename }, - { &vop_rmdir_desc, (vop_t *) msdosfs_rmdir }, - { &vop_setattr_desc, (vop_t *) msdosfs_setattr }, - { &vop_strategy_desc, (vop_t *) msdosfs_strategy }, - { &vop_symlink_desc, (vop_t *) msdosfs_symlink }, - { &vop_write_desc, (vop_t *) msdosfs_write }, - { NULL, NULL } +struct vop_vector msdosfs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = msdosfs_access, + .vop_advlock = msdosfs_advlock, + .vop_bmap = msdosfs_bmap, + .vop_cachedlookup = msdosfs_lookup, + .vop_close = msdosfs_close, + .vop_create = msdosfs_create, + .vop_fsync = msdosfs_fsync, + .vop_getattr = msdosfs_getattr, + .vop_inactive = msdosfs_inactive, + .vop_link = msdosfs_link, + .vop_lookup = vfs_cache_lookup, + .vop_mkdir = msdosfs_mkdir, + .vop_mknod = msdosfs_mknod, + .vop_pathconf = msdosfs_pathconf, + .vop_print = msdosfs_print, + .vop_read = msdosfs_read, + .vop_readdir = msdosfs_readdir, + .vop_reclaim = msdosfs_reclaim, + .vop_remove = msdosfs_remove, + .vop_rename = msdosfs_rename, + .vop_rmdir = msdosfs_rmdir, + .vop_setattr = msdosfs_setattr, + .vop_strategy = msdosfs_strategy, + .vop_symlink = msdosfs_symlink, + .vop_write = msdosfs_write, }; -static struct vnodeopv_desc msdosfs_vnodeop_opv_desc = - { &msdosfs_vnodeop_p, msdosfs_vnodeop_entries }; - -VNODEOP_SET(msdosfs_vnodeop_opv_desc); diff --git a/sys/fs/ntfs/ntfs.h b/sys/fs/ntfs/ntfs.h index 05560b12433b..506d6c93213e 100644 --- a/sys/fs/ntfs/ntfs.h +++ b/sys/fs/ntfs/ntfs.h @@ -304,4 +304,4 @@ MALLOC_DECLARE(M_NTFSNTHASH); #define ddprintf(a) #endif -extern vop_t **ntfs_vnodeop_p; +extern struct vop_vector ntfs_vnodeops; diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 1705cc22a35d..23c920e7db2e 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -726,7 +726,7 @@ ntfs_vgetex( return (0); } - error = getnewvnode("ntfs", ntmp->ntm_mountp, ntfs_vnodeop_p, &vp); + error = getnewvnode("ntfs", ntmp->ntm_mountp, &ntfs_vnodeops, &vp); if(error) { ntfs_frele(fp); ntfs_ntput(ip); diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index e578a717b78d..700fd1a0aff4 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -77,9 +77,9 @@ static vop_access_t ntfs_access; static vop_open_t ntfs_open; static vop_close_t ntfs_close; static vop_readdir_t ntfs_readdir; -static vop_lookup_t ntfs_lookup; +static vop_cachedlookup_t ntfs_lookup; static vop_fsync_t ntfs_fsync; -static int ntfs_pathconf(void *); +static vop_pathconf_t ntfs_pathconf; int ntfs_prtactive = 1; /* 1 => print out reclaim of active vnodes */ @@ -607,7 +607,7 @@ ntfs_readdir(ap) int ntfs_lookup(ap) - struct vop_lookup_args /* { + struct vop_cachedlookup_args /* { struct vnode *a_dvp; struct vnode **a_vpp; struct componentname *a_cnp; @@ -717,14 +717,9 @@ ntfs_fsync(ap) * Return POSIX pathconf information applicable to NTFS filesystem */ int -ntfs_pathconf(v) - void *v; +ntfs_pathconf(ap) + struct vop_pathconf_args *ap; { - struct vop_pathconf_args /* { - struct vnode *a_vp; - int a_name; - register_t *a_retval; - } */ *ap = v; switch (ap->a_name) { case _PC_LINK_MAX: @@ -751,35 +746,26 @@ ntfs_pathconf(v) /* * Global vfs data structures */ -vop_t **ntfs_vnodeop_p; -static -struct vnodeopv_entry_desc ntfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *)vop_defaultop }, +struct vop_vector ntfs_vnodeops = { + .vop_default = &default_vnodeops, - { &vop_getattr_desc, (vop_t *)ntfs_getattr }, - { &vop_inactive_desc, (vop_t *)ntfs_inactive }, - { &vop_reclaim_desc, (vop_t *)ntfs_reclaim }, - { &vop_pathconf_desc, ntfs_pathconf }, + .vop_getattr = ntfs_getattr, + .vop_inactive = ntfs_inactive, + .vop_reclaim = ntfs_reclaim, + .vop_pathconf = ntfs_pathconf, - { &vop_cachedlookup_desc, (vop_t *)ntfs_lookup }, - { &vop_lookup_desc, (vop_t *)vfs_cache_lookup }, + .vop_cachedlookup = ntfs_lookup, + .vop_lookup = vfs_cache_lookup, - { &vop_access_desc, (vop_t *)ntfs_access }, - { &vop_close_desc, (vop_t *)ntfs_close }, - { &vop_open_desc, (vop_t *)ntfs_open }, - { &vop_readdir_desc, (vop_t *)ntfs_readdir }, - { &vop_fsync_desc, (vop_t *)ntfs_fsync }, + .vop_access = ntfs_access, + .vop_close = ntfs_close, + .vop_open = ntfs_open, + .vop_readdir = ntfs_readdir, + .vop_fsync = ntfs_fsync, - { &vop_bmap_desc, (vop_t *)ntfs_bmap }, - { &vop_strategy_desc, (vop_t *)ntfs_strategy }, - { &vop_read_desc, (vop_t *)ntfs_read }, - { &vop_write_desc, (vop_t *)ntfs_write }, + .vop_bmap = ntfs_bmap, + .vop_strategy = ntfs_strategy, + .vop_read = ntfs_read, + .vop_write = ntfs_write, - { NULL, NULL } }; - -static -struct vnodeopv_desc ntfs_vnodeop_opv_desc = - { &ntfs_vnodeop_p, ntfs_vnodeop_entries }; - -VNODEOP_SET(ntfs_vnodeop_opv_desc); diff --git a/sys/fs/nullfs/null.h b/sys/fs/nullfs/null.h index b57e7430687d..2569b38492f7 100644 --- a/sys/fs/nullfs/null.h +++ b/sys/fs/nullfs/null.h @@ -68,7 +68,7 @@ struct vnode *null_checkvp(struct vnode *vp, char *fil, int lno); #define NULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp) #endif -extern vop_t **null_vnodeop_p; +extern struct vop_vector null_vnodeops; #ifdef MALLOC_DECLARE MALLOC_DECLARE(M_NULLFSNODE); diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index 7a2d7524471e..1df0ea2d4e27 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -235,7 +235,7 @@ null_nodeget(mp, lowervp, vpp) MALLOC(xp, struct null_node *, sizeof(struct null_node), M_NULLFSNODE, M_WAITOK); - error = getnewvnode("null", mp, null_vnodeop_p, &vp); + error = getnewvnode("null", mp, &null_vnodeops, &vp); if (error) { FREE(xp, M_NULLFSNODE); return (error); diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 1f49a7a16229..6a39dc009345 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -105,7 +105,7 @@ nullfs_mount(struct mount *mp, struct thread *td) * Unlock lower node to avoid deadlock. * (XXX) VOP_ISLOCKED is needed? */ - if ((mp->mnt_vnodecovered->v_op == null_vnodeop_p) && + if ((mp->mnt_vnodecovered->v_op == &null_vnodeops) && VOP_ISLOCKED(mp->mnt_vnodecovered, NULL)) { VOP_UNLOCK(mp->mnt_vnodecovered, 0, td); isvnunlocked = 1; diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index bdb98b5b7568..41bf7ef4fbcb 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -275,7 +275,7 @@ null_bypass(ap) * that aren't. (We must always map first vp or vclean fails.) */ if (i && (*this_vp_p == NULLVP || - (*this_vp_p)->v_op != null_vnodeop_p)) { + (*this_vp_p)->v_op != &null_vnodeops)) { old_vps[i] = NULLVP; } else { old_vps[i] = *this_vp_p; @@ -857,30 +857,24 @@ null_getvobject(ap) /* * Global vfs data structures */ -vop_t **null_vnodeop_p; -static struct vnodeopv_entry_desc null_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) null_bypass }, +struct vop_vector null_vnodeops = { + .vop_bypass = null_bypass, - { &vop_access_desc, (vop_t *) null_access }, - { &vop_bmap_desc, (vop_t *) vop_eopnotsupp }, - { &vop_createvobject_desc, (vop_t *) null_createvobject }, - { &vop_destroyvobject_desc, (vop_t *) null_destroyvobject }, - { &vop_getattr_desc, (vop_t *) null_getattr }, - { &vop_getvobject_desc, (vop_t *) null_getvobject }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount}, - { &vop_inactive_desc, (vop_t *) null_inactive }, - { &vop_islocked_desc, (vop_t *) null_islocked }, - { &vop_lock_desc, (vop_t *) null_lock }, - { &vop_lookup_desc, (vop_t *) null_lookup }, - { &vop_print_desc, (vop_t *) null_print }, - { &vop_reclaim_desc, (vop_t *) null_reclaim }, - { &vop_rename_desc, (vop_t *) null_rename }, - { &vop_setattr_desc, (vop_t *) null_setattr }, - { &vop_strategy_desc, (vop_t *) vop_eopnotsupp }, - { &vop_unlock_desc, (vop_t *) null_unlock }, - { NULL, NULL } + .vop_access = null_access, + .vop_bmap = VOP_EOPNOTSUPP, + .vop_createvobject = null_createvobject, + .vop_destroyvobject = null_destroyvobject, + .vop_getattr = null_getattr, + .vop_getvobject = null_getvobject, + .vop_getwritemount = vop_stdgetwritemount, + .vop_inactive = null_inactive, + .vop_islocked = null_islocked, + .vop_lock = null_lock, + .vop_lookup = null_lookup, + .vop_print = null_print, + .vop_reclaim = null_reclaim, + .vop_rename = null_rename, + .vop_setattr = null_setattr, + .vop_strategy = VOP_EOPNOTSUPP, + .vop_unlock = null_unlock, }; -static struct vnodeopv_desc null_vnodeop_opv_desc = - { &null_vnodeop_p, null_vnodeop_entries }; - -VNODEOP_SET(null_vnodeop_opv_desc); diff --git a/sys/fs/nwfs/nwfs.h b/sys/fs/nwfs/nwfs.h index a8a9ad2d0b44..94395e4500c4 100644 --- a/sys/fs/nwfs/nwfs.h +++ b/sys/fs/nwfs/nwfs.h @@ -78,6 +78,9 @@ int nwfs_ioctl(struct vop_ioctl_args *ap); int nwfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td); int nwfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, struct thread *td, int intrflg); + +extern struct vop_vector nwfs_vnodeops; + #endif /* _KERNEL */ #endif /* _NWFS_H_ */ diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c index b86f7d1d4fd0..dc82df7f18f9 100644 --- a/sys/fs/nwfs/nwfs_node.c +++ b/sys/fs/nwfs/nwfs_node.c @@ -60,8 +60,6 @@ #define NWNOHASH(fhsum) (&nwhashtbl[(fhsum.f_id) & nwnodehash]) -extern vop_t **nwfs_vnodeop_p; - static LIST_HEAD(nwnode_hash_head,nwnode) *nwhashtbl; static u_long nwnodehash; static struct lock nwhashlock; @@ -170,7 +168,7 @@ nwfs_allocvp(struct mount *mp, ncpfid fid, struct nw_entry_info *fap, * elsewhere if MALLOC should block. */ MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO); - error = getnewvnode("nwfs", mp, nwfs_vnodeop_p, &vp); + error = getnewvnode("nwfs", mp, &nwfs_vnodeops, &vp); if (error) { *vpp = NULL; FREE(np, M_NWNODE); diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c index a3942d655fbb..37775fe0665e 100644 --- a/sys/fs/nwfs/nwfs_vnops.c +++ b/sys/fs/nwfs/nwfs_vnops.c @@ -83,41 +83,35 @@ static vop_print_t nwfs_print; static vop_pathconf_t nwfs_pathconf; /* Global vfs data structures for nwfs */ -vop_t **nwfs_vnodeop_p; -static struct vnodeopv_entry_desc nwfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) nwfs_access }, - { &vop_open_desc, (vop_t *) nwfs_open }, - { &vop_close_desc, (vop_t *) nwfs_close }, - { &vop_create_desc, (vop_t *) nwfs_create }, - { &vop_fsync_desc, (vop_t *) nwfs_fsync }, - { &vop_getattr_desc, (vop_t *) nwfs_getattr }, - { &vop_getpages_desc, (vop_t *) nwfs_getpages }, - { &vop_putpages_desc, (vop_t *) nwfs_putpages }, - { &vop_ioctl_desc, (vop_t *) nwfs_ioctl }, - { &vop_inactive_desc, (vop_t *) nwfs_inactive }, - { &vop_link_desc, (vop_t *) nwfs_link }, - { &vop_lookup_desc, (vop_t *) nwfs_lookup }, - { &vop_mkdir_desc, (vop_t *) nwfs_mkdir }, - { &vop_mknod_desc, (vop_t *) nwfs_mknod }, - { &vop_pathconf_desc, (vop_t *) nwfs_pathconf }, - { &vop_print_desc, (vop_t *) nwfs_print }, - { &vop_read_desc, (vop_t *) nwfs_read }, - { &vop_readdir_desc, (vop_t *) nwfs_readdir }, - { &vop_reclaim_desc, (vop_t *) nwfs_reclaim }, - { &vop_remove_desc, (vop_t *) nwfs_remove }, - { &vop_rename_desc, (vop_t *) nwfs_rename }, - { &vop_rmdir_desc, (vop_t *) nwfs_rmdir }, - { &vop_setattr_desc, (vop_t *) nwfs_setattr }, - { &vop_strategy_desc, (vop_t *) nwfs_strategy }, - { &vop_symlink_desc, (vop_t *) nwfs_symlink }, - { &vop_write_desc, (vop_t *) nwfs_write }, - { NULL, NULL } +static struct vop_vector nwfs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = nwfs_access, + .vop_open = nwfs_open, + .vop_close = nwfs_close, + .vop_create = nwfs_create, + .vop_fsync = nwfs_fsync, + .vop_getattr = nwfs_getattr, + .vop_getpages = nwfs_getpages, + .vop_putpages = nwfs_putpages, + .vop_ioctl = nwfs_ioctl, + .vop_inactive = nwfs_inactive, + .vop_link = nwfs_link, + .vop_lookup = nwfs_lookup, + .vop_mkdir = nwfs_mkdir, + .vop_mknod = nwfs_mknod, + .vop_pathconf = nwfs_pathconf, + .vop_print = nwfs_print, + .vop_read = nwfs_read, + .vop_readdir = nwfs_readdir, + .vop_reclaim = nwfs_reclaim, + .vop_remove = nwfs_remove, + .vop_rename = nwfs_rename, + .vop_rmdir = nwfs_rmdir, + .vop_setattr = nwfs_setattr, + .vop_strategy = nwfs_strategy, + .vop_symlink = nwfs_symlink, + .vop_write = nwfs_write, }; -static struct vnodeopv_desc nwfs_vnodeop_opv_desc = - { &nwfs_vnodeop_p, nwfs_vnodeop_entries }; - -VNODEOP_SET(nwfs_vnodeop_opv_desc); /* * nwfs_access vnode op diff --git a/sys/fs/portalfs/portal.h b/sys/fs/portalfs/portal.h index 02e42c72c5d0..5891b0f25b3b 100644 --- a/sys/fs/portalfs/portal.h +++ b/sys/fs/portalfs/portal.h @@ -63,5 +63,5 @@ struct portalnode { #define PORTAL_ROOTFILEID 2 -extern vop_t **portal_vnodeop_p; +extern struct vop_vector portal_vnodeops; #endif /* _KERNEL */ diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index 5ff1138068dc..13268364f5b8 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -110,7 +110,7 @@ portal_omount(mp, path, data, td) MALLOC(fmp, struct portalmount *, sizeof(struct portalmount), M_PORTALFSMNT, M_WAITOK); /* XXX */ - error = getnewvnode("portal", mp, portal_vnodeop_p, &rvp); /* XXX */ + error = getnewvnode("portal", mp, &portal_vnodeops, &rvp); /* XXX */ if (error) { FREE(fmp, M_PORTALFSMNT); FREE(pn, M_TEMP); diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index fcc5b557f6f6..5c40839f3099 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -131,7 +131,7 @@ portal_lookup(ap) MALLOC(pt, struct portalnode *, sizeof(struct portalnode), M_TEMP, M_WAITOK); - error = getnewvnode("portal", dvp->v_mount, portal_vnodeop_p, &fvp); + error = getnewvnode("portal", dvp->v_mount, &portal_vnodeops, &fvp); if (error) { FREE(pt, M_TEMP); goto bad; @@ -556,20 +556,14 @@ portal_reclaim(ap) return (0); } -vop_t **portal_vnodeop_p; -static struct vnodeopv_entry_desc portal_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) vop_null }, - { &vop_getattr_desc, (vop_t *) portal_getattr }, - { &vop_lookup_desc, (vop_t *) portal_lookup }, - { &vop_open_desc, (vop_t *) portal_open }, - { &vop_pathconf_desc, (vop_t *) vop_stdpathconf }, - { &vop_readdir_desc, (vop_t *) portal_readdir }, - { &vop_reclaim_desc, (vop_t *) portal_reclaim }, - { &vop_setattr_desc, (vop_t *) portal_setattr }, - { NULL, NULL } +struct vop_vector portal_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = VOP_NULL, + .vop_getattr = portal_getattr, + .vop_lookup = portal_lookup, + .vop_open = portal_open, + .vop_pathconf = vop_stdpathconf, + .vop_readdir = portal_readdir, + .vop_reclaim = portal_reclaim, + .vop_setattr = portal_setattr, }; -static struct vnodeopv_desc portal_vnodeop_opv_desc = - { &portal_vnodeop_p, portal_vnodeop_entries }; - -VNODEOP_SET(portal_vnodeop_opv_desc); diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index d237cd237aec..7bdf8236b8aa 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -72,7 +72,7 @@ SYSCTL_INT(_vfs_pfs_vncache, OID_AUTO, misses, CTLFLAG_RD, &pfs_vncache_misses, 0, "number of cache misses since initialization"); -extern vop_t **pfs_vnodeop_p; +extern struct vop_vector pfs_vnodeops; /* XXX -> .h file */ /* * Initialize vnode cache @@ -137,7 +137,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, MALLOC(pvd, struct pfs_vdata *, sizeof *pvd, M_PFSVNCACHE, M_WAITOK); if (++pfs_vncache_entries > pfs_vncache_maxentries) pfs_vncache_maxentries = pfs_vncache_entries; - error = getnewvnode("pseudofs", mp, pfs_vnodeop_p, vpp); + error = getnewvnode("pseudofs", mp, &pfs_vnodeops, vpp); if (error) { FREE(pvd, M_PFSVNCACHE); return (error); diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c index d8fa427b3e99..c90c70e93410 100644 --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -763,7 +763,7 @@ pfs_setattr(struct vop_setattr_args *va) * Read from a file */ static int -pfs_write(struct vop_read_args *va) +pfs_write(struct vop_write_args *va) { struct vnode *vn = va->a_vp; struct pfs_vdata *pvd = (struct pfs_vdata *)vn->v_data; @@ -822,35 +822,28 @@ pfs_write(struct vop_read_args *va) /* * Vnode operations */ -vop_t **pfs_vnodeop_p; -static struct vnodeopv_entry_desc pfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *)vop_defaultop }, - { &vop_access_desc, (vop_t *)pfs_access }, - { &vop_close_desc, (vop_t *)pfs_close }, - { &vop_create_desc, (vop_t *)vop_eopnotsupp }, - { &vop_getattr_desc, (vop_t *)pfs_getattr }, - { &vop_getextattr_desc, (vop_t *)pfs_getextattr }, - { &vop_ioctl_desc, (vop_t *)pfs_ioctl }, - { &vop_link_desc, (vop_t *)vop_eopnotsupp }, - { &vop_lookup_desc, (vop_t *)pfs_lookup }, - { &vop_mkdir_desc, (vop_t *)vop_eopnotsupp }, - { &vop_mknod_desc, (vop_t *)vop_eopnotsupp }, - { &vop_open_desc, (vop_t *)pfs_open }, - { &vop_read_desc, (vop_t *)pfs_read }, - { &vop_readdir_desc, (vop_t *)pfs_readdir }, - { &vop_readlink_desc, (vop_t *)pfs_readlink }, - { &vop_reclaim_desc, (vop_t *)pfs_reclaim }, - { &vop_remove_desc, (vop_t *)vop_eopnotsupp }, - { &vop_rename_desc, (vop_t *)vop_eopnotsupp }, - { &vop_rmdir_desc, (vop_t *)vop_eopnotsupp }, - { &vop_setattr_desc, (vop_t *)pfs_setattr }, - { &vop_symlink_desc, (vop_t *)vop_eopnotsupp }, - { &vop_write_desc, (vop_t *)pfs_write }, - /* XXX I've probably forgotten a few that need vop_eopnotsupp */ - { NULL, (vop_t *)NULL } +struct vop_vector pfs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = pfs_access, + .vop_close = pfs_close, + .vop_create = VOP_EOPNOTSUPP, + .vop_getattr = pfs_getattr, + .vop_getextattr = pfs_getextattr, + .vop_ioctl = pfs_ioctl, + .vop_link = VOP_EOPNOTSUPP, + .vop_lookup = pfs_lookup, + .vop_mkdir = VOP_EOPNOTSUPP, + .vop_mknod = VOP_EOPNOTSUPP, + .vop_open = pfs_open, + .vop_read = pfs_read, + .vop_readdir = pfs_readdir, + .vop_readlink = pfs_readlink, + .vop_reclaim = pfs_reclaim, + .vop_remove = VOP_EOPNOTSUPP, + .vop_rename = VOP_EOPNOTSUPP, + .vop_rmdir = VOP_EOPNOTSUPP, + .vop_setattr = pfs_setattr, + .vop_symlink = VOP_EOPNOTSUPP, + .vop_write = pfs_write, + /* XXX I've probably forgotten a few that need VOP_EOPNOTSUPP */ }; - -static struct vnodeopv_desc pfs_vnodeop_opv_desc = - { &pfs_vnodeop_p, pfs_vnodeop_entries }; - -VNODEOP_SET(pfs_vnodeop_opv_desc); diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index c76d73e8c05b..4f238e6f98a3 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -62,7 +62,7 @@ #define smbfs_hash_unlock(smp, td) lockmgr(&smp->sm_hashlock, LK_RELEASE, NULL, td) -extern vop_t **smbfs_vnodeop_p; +extern struct vop_vector smbfs_vnodeops; /* XXX -> .h file */ MALLOC_DEFINE(M_SMBNODE, "SMBFS node", "SMBFS vnode private part"); static MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name"); @@ -236,7 +236,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp, return ENOENT; MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); - error = getnewvnode("smbfs", mp, smbfs_vnodeop_p, &vp); + error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); if (error) { FREE(np, M_SMBNODE); return error; diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 787483071a1d..7067ce87a7c6 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -84,46 +84,39 @@ static vop_pathconf_t smbfs_pathconf; static vop_advlock_t smbfs_advlock; static vop_getextattr_t smbfs_getextattr; -vop_t **smbfs_vnodeop_p; -static struct vnodeopv_entry_desc smbfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) smbfs_access }, - { &vop_advlock_desc, (vop_t *) smbfs_advlock }, - { &vop_close_desc, (vop_t *) smbfs_close }, - { &vop_create_desc, (vop_t *) smbfs_create }, - { &vop_fsync_desc, (vop_t *) smbfs_fsync }, - { &vop_getattr_desc, (vop_t *) smbfs_getattr }, - { &vop_getpages_desc, (vop_t *) smbfs_getpages }, - { &vop_inactive_desc, (vop_t *) smbfs_inactive }, - { &vop_ioctl_desc, (vop_t *) smbfs_ioctl }, - { &vop_link_desc, (vop_t *) smbfs_link }, - { &vop_lookup_desc, (vop_t *) smbfs_lookup }, - { &vop_mkdir_desc, (vop_t *) smbfs_mkdir }, - { &vop_mknod_desc, (vop_t *) smbfs_mknod }, - { &vop_open_desc, (vop_t *) smbfs_open }, - { &vop_pathconf_desc, (vop_t *) smbfs_pathconf }, - { &vop_print_desc, (vop_t *) smbfs_print }, - { &vop_putpages_desc, (vop_t *) smbfs_putpages }, - { &vop_read_desc, (vop_t *) smbfs_read }, - { &vop_readdir_desc, (vop_t *) smbfs_readdir }, - { &vop_reclaim_desc, (vop_t *) smbfs_reclaim }, - { &vop_remove_desc, (vop_t *) smbfs_remove }, - { &vop_rename_desc, (vop_t *) smbfs_rename }, - { &vop_rmdir_desc, (vop_t *) smbfs_rmdir }, - { &vop_setattr_desc, (vop_t *) smbfs_setattr }, - { &vop_strategy_desc, (vop_t *) smbfs_strategy }, - { &vop_symlink_desc, (vop_t *) smbfs_symlink }, - { &vop_write_desc, (vop_t *) smbfs_write }, - { &vop_getextattr_desc, (vop_t *) smbfs_getextattr }, -/* { &vop_setextattr_desc, (vop_t *) smbfs_setextattr },*/ - { NULL, NULL } +struct vop_vector smbfs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = smbfs_access, + .vop_advlock = smbfs_advlock, + .vop_close = smbfs_close, + .vop_create = smbfs_create, + .vop_fsync = smbfs_fsync, + .vop_getattr = smbfs_getattr, + .vop_getpages = smbfs_getpages, + .vop_inactive = smbfs_inactive, + .vop_ioctl = smbfs_ioctl, + .vop_link = smbfs_link, + .vop_lookup = smbfs_lookup, + .vop_mkdir = smbfs_mkdir, + .vop_mknod = smbfs_mknod, + .vop_open = smbfs_open, + .vop_pathconf = smbfs_pathconf, + .vop_print = smbfs_print, + .vop_putpages = smbfs_putpages, + .vop_read = smbfs_read, + .vop_readdir = smbfs_readdir, + .vop_reclaim = smbfs_reclaim, + .vop_remove = smbfs_remove, + .vop_rename = smbfs_rename, + .vop_rmdir = smbfs_rmdir, + .vop_setattr = smbfs_setattr, + .vop_strategy = smbfs_strategy, + .vop_symlink = smbfs_symlink, + .vop_write = smbfs_write, + .vop_getextattr = smbfs_getextattr, +/* .vop_setextattr = smbfs_setextattr,*/ }; -static struct vnodeopv_desc smbfs_vnodeop_opv_desc = - { &smbfs_vnodeop_p, smbfs_vnodeop_entries }; - -VNODEOP_SET(smbfs_vnodeop_opv_desc); - static int smbfs_access(ap) struct vop_access_args /* { diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index c92bf5c18f31..33dde604e2af 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -68,26 +68,21 @@ static vop_reclaim_t udf_reclaim; static int udf_readatoffset(struct udf_node *, int *, int, struct buf **, uint8_t **); static int udf_bmap_internal(struct udf_node *, uint32_t, daddr_t *, uint32_t *); -vop_t **udf_vnodeop_p; -static struct vnodeopv_entry_desc udf_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) udf_access }, - { &vop_bmap_desc, (vop_t *) udf_bmap }, - { &vop_cachedlookup_desc, (vop_t *) udf_lookup }, - { &vop_getattr_desc, (vop_t *) udf_getattr }, - { &vop_ioctl_desc, (vop_t *) udf_ioctl }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_pathconf_desc, (vop_t *) udf_pathconf }, - { &vop_read_desc, (vop_t *) udf_read }, - { &vop_readdir_desc, (vop_t *) udf_readdir }, - { &vop_readlink_desc, (vop_t *) udf_readlink }, - { &vop_reclaim_desc, (vop_t *) udf_reclaim }, - { &vop_strategy_desc, (vop_t *) udf_strategy }, - { NULL, NULL } +static struct vop_vector udf_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = udf_access, + .vop_bmap = udf_bmap, + .vop_cachedlookup = udf_lookup, + .vop_getattr = udf_getattr, + .vop_ioctl = udf_ioctl, + .vop_lookup = vfs_cache_lookup, + .vop_pathconf = udf_pathconf, + .vop_read = udf_read, + .vop_readdir = udf_readdir, + .vop_readlink = udf_readlink, + .vop_reclaim = udf_reclaim, + .vop_strategy = udf_strategy, }; -static struct vnodeopv_desc udf_vnodeop_opv_desc = - { &udf_vnodeop_p, udf_vnodeop_entries }; -VNODEOP_SET(udf_vnodeop_opv_desc); MALLOC_DEFINE(M_UDFFID, "UDF FID", "UDF FileId structure"); MALLOC_DEFINE(M_UDFDS, "UDF DS", "UDF Dirstream structure"); @@ -171,7 +166,7 @@ udf_allocv(struct mount *mp, struct vnode **vpp, struct thread *td) int error; struct vnode *vp; - error = getnewvnode("udf", mp, udf_vnodeop_p, &vp); + error = getnewvnode("udf", mp, &udf_vnodeops, &vp); if (error) { printf("udf_allocv: failed to allocate new vnode\n"); return (error); diff --git a/sys/fs/umapfs/umap.h b/sys/fs/umapfs/umap.h index 10af870a2f85..4b74579e1e4a 100644 --- a/sys/fs/umapfs/umap.h +++ b/sys/fs/umapfs/umap.h @@ -83,5 +83,4 @@ extern struct vnode *umap_checkvp(struct vnode *vp, char *fil, int lno); #define UMAPVPTOLOWERVP(vp) (VTOUMAP(vp)->umap_lowervp) #endif -extern vop_t **umap_vnodeop_p; #endif /* _KERNEL */ diff --git a/sys/fs/umapfs/umap_vnops.c b/sys/fs/umapfs/umap_vnops.c index 1b56007029f0..2aa4b9ef88c1 100644 --- a/sys/fs/umapfs/umap_vnops.c +++ b/sys/fs/umapfs/umap_vnops.c @@ -506,19 +506,13 @@ umap_rename(ap) * go away with a merged buffer/block cache. * */ -vop_t **umap_vnodeop_p; -static struct vnodeopv_entry_desc umap_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) umap_bypass }, - { &vop_getattr_desc, (vop_t *) umap_getattr }, - { &vop_inactive_desc, (vop_t *) umap_inactive }, - { &vop_lock_desc, (vop_t *) umap_lock }, - { &vop_print_desc, (vop_t *) umap_print }, - { &vop_reclaim_desc, (vop_t *) umap_reclaim }, - { &vop_rename_desc, (vop_t *) umap_rename }, - { &vop_unlock_desc, (vop_t *) umap_unlock }, - { NULL, NULL } +static struct vop_vector umap_vnodeops = { + .vop_default = umap_bypass, + .vop_getattr = umap_getattr, + .vop_inactive = umap_inactive, + .vop_lock = umap_lock, + .vop_print = umap_print, + .vop_reclaim = umap_reclaim, + .vop_rename = umap_rename, + .vop_unlock = umap_unlock, }; -static struct vnodeopv_desc umap_vnodeop_opv_desc = - { &umap_vnodeop_p, umap_vnodeop_entries }; - -VNODEOP_SET(umap_vnodeop_opv_desc); diff --git a/sys/fs/unionfs/union.h b/sys/fs/unionfs/union.h index f8af98aa0bd6..8dfef3aa55f3 100644 --- a/sys/fs/unionfs/union.h +++ b/sys/fs/unionfs/union.h @@ -134,7 +134,7 @@ extern int (*union_dircheckp)(struct thread *, struct vnode **, #define UDEBUG(x) if (uniondebug) printf x #define UDEBUG_ENABLED 1 -extern vop_t **union_vnodeop_p; +extern struct vop_vector union_vnodeops; extern struct vfsops union_vfsops; extern int uniondebug; diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 364736c1c0d8..64e7b14fccea 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -444,7 +444,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache) do { scan = VTOUNION(scan)->un_pvp; - } while (scan && scan->v_op == union_vnodeop_p && + } while (scan && scan->v_op == &union_vnodeops && scan != dvp); if (scan != dvp) { /* @@ -547,7 +547,7 @@ union_allocvp(vpp, mp, dvp, upperdvp, cnp, uppervp, lowervp, docache) * Create new node rather than replace old node. */ - error = getnewvnode("union", mp, union_vnodeop_p, vpp); + error = getnewvnode("union", mp, &union_vnodeops, vpp); if (error) { /* * If an error occurs, clear out vnodes. @@ -1206,7 +1206,7 @@ union_dircache_r(vp, vppp, cntp) { struct union_node *un; - if (vp->v_op != union_vnodeop_p) { + if (vp->v_op != &union_vnodeops) { if (vppp) { VREF(vp); *(*vppp)++ = vp; @@ -1310,7 +1310,7 @@ union_dircheck(struct thread *td, struct vnode **vp, struct file *fp) { int error = 0; - if ((*vp)->v_op == union_vnodeop_p) { + if ((*vp)->v_op == &union_vnodeops) { struct vnode *lvp; lvp = union_dircache_get(*vp, td); diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 0338f2170faa..b6b09667ba74 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -1325,7 +1325,7 @@ union_rename(ap) * replace the fdvp, release the original one and ref the new one. */ - if (fdvp->v_op == union_vnodeop_p) { /* always true */ + if (fdvp->v_op == &union_vnodeops) { /* always true */ struct union_node *un = VTOUNION(fdvp); if (un->un_uppervp == NULLVP) { /* @@ -1347,7 +1347,7 @@ union_rename(ap) * replace the fvp, release the original one and ref the new one. */ - if (fvp->v_op == union_vnodeop_p) { /* always true */ + if (fvp->v_op == &union_vnodeops) { /* always true */ struct union_node *un = VTOUNION(fvp); #if 0 struct union_mount *um = MOUNTTOUNIONMOUNT(fvp->v_mount); @@ -1405,7 +1405,7 @@ union_rename(ap) * reference. */ - if (tdvp->v_op == union_vnodeop_p) { + if (tdvp->v_op == &union_vnodeops) { struct union_node *un = VTOUNION(tdvp); if (un->un_uppervp == NULLVP) { @@ -1435,7 +1435,7 @@ union_rename(ap) * file and change tvp to NULL. */ - if (tvp != NULLVP && tvp->v_op == union_vnodeop_p) { + if (tvp != NULLVP && tvp->v_op == &union_vnodeops) { struct union_node *un = VTOUNION(tvp); tvp = union_lock_upper(un, ap->a_tcnp->cn_thread); @@ -2052,56 +2052,50 @@ union_setlabel(ap) /* * Global vfs data structures */ -vop_t **union_vnodeop_p; -static struct vnodeopv_entry_desc union_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) union_access }, - { &vop_aclcheck_desc, (vop_t *) union_aclcheck }, - { &vop_advlock_desc, (vop_t *) union_advlock }, - { &vop_bmap_desc, (vop_t *) vop_eopnotsupp }, - { &vop_close_desc, (vop_t *) union_close }, - { &vop_closeextattr_desc, (vop_t *) union_closeextattr }, - { &vop_create_desc, (vop_t *) union_create }, - { &vop_createvobject_desc, (vop_t *) union_createvobject }, - { &vop_deleteextattr_desc, (vop_t *) union_deleteextattr }, - { &vop_destroyvobject_desc, (vop_t *) union_destroyvobject }, - { &vop_fsync_desc, (vop_t *) union_fsync }, - { &vop_getattr_desc, (vop_t *) union_getattr }, - { &vop_getacl_desc, (vop_t *) union_getacl }, - { &vop_getextattr_desc, (vop_t *) union_getextattr }, - { &vop_getvobject_desc, (vop_t *) union_getvobject }, - { &vop_inactive_desc, (vop_t *) union_inactive }, - { &vop_ioctl_desc, (vop_t *) union_ioctl }, - { &vop_lease_desc, (vop_t *) union_lease }, - { &vop_link_desc, (vop_t *) union_link }, - { &vop_listextattr_desc, (vop_t *) union_listextattr }, - { &vop_lookup_desc, (vop_t *) union_lookup }, - { &vop_mkdir_desc, (vop_t *) union_mkdir }, - { &vop_mknod_desc, (vop_t *) union_mknod }, - { &vop_open_desc, (vop_t *) union_open }, - { &vop_openextattr_desc, (vop_t *) union_openextattr }, - { &vop_pathconf_desc, (vop_t *) union_pathconf }, - { &vop_poll_desc, (vop_t *) union_poll }, - { &vop_print_desc, (vop_t *) union_print }, - { &vop_read_desc, (vop_t *) union_read }, - { &vop_readdir_desc, (vop_t *) union_readdir }, - { &vop_readlink_desc, (vop_t *) union_readlink }, - { &vop_getwritemount_desc, (vop_t *) union_getwritemount }, - { &vop_reclaim_desc, (vop_t *) union_reclaim }, - { &vop_remove_desc, (vop_t *) union_remove }, - { &vop_rename_desc, (vop_t *) union_rename }, - { &vop_rmdir_desc, (vop_t *) union_rmdir }, - { &vop_setacl_desc, (vop_t *) union_setacl }, - { &vop_setattr_desc, (vop_t *) union_setattr }, - { &vop_setextattr_desc, (vop_t *) union_setextattr }, - { &vop_setlabel_desc, (vop_t *) union_setlabel }, - { &vop_strategy_desc, (vop_t *) union_strategy }, - { &vop_symlink_desc, (vop_t *) union_symlink }, - { &vop_whiteout_desc, (vop_t *) union_whiteout }, - { &vop_write_desc, (vop_t *) union_write }, - { NULL, NULL } +struct vop_vector union_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = union_access, + .vop_aclcheck = union_aclcheck, + .vop_advlock = union_advlock, + .vop_bmap = VOP_EOPNOTSUPP, + .vop_close = union_close, + .vop_closeextattr = union_closeextattr, + .vop_create = union_create, + .vop_createvobject = union_createvobject, + .vop_deleteextattr = union_deleteextattr, + .vop_destroyvobject = union_destroyvobject, + .vop_fsync = union_fsync, + .vop_getattr = union_getattr, + .vop_getacl = union_getacl, + .vop_getextattr = union_getextattr, + .vop_getvobject = union_getvobject, + .vop_inactive = union_inactive, + .vop_ioctl = union_ioctl, + .vop_lease = union_lease, + .vop_link = union_link, + .vop_listextattr = union_listextattr, + .vop_lookup = union_lookup, + .vop_mkdir = union_mkdir, + .vop_mknod = union_mknod, + .vop_open = union_open, + .vop_openextattr = union_openextattr, + .vop_pathconf = union_pathconf, + .vop_poll = union_poll, + .vop_print = union_print, + .vop_read = union_read, + .vop_readdir = union_readdir, + .vop_readlink = union_readlink, + .vop_getwritemount = union_getwritemount, + .vop_reclaim = union_reclaim, + .vop_remove = union_remove, + .vop_rename = union_rename, + .vop_rmdir = union_rmdir, + .vop_setacl = union_setacl, + .vop_setattr = union_setattr, + .vop_setextattr = union_setextattr, + .vop_setlabel = union_setlabel, + .vop_strategy = union_strategy, + .vop_symlink = union_symlink, + .vop_whiteout = union_whiteout, + .vop_write = union_write, }; -static struct vnodeopv_desc union_vnodeop_opv_desc = - { &union_vnodeop_p, union_vnodeop_entries }; - -VNODEOP_SET(union_vnodeop_opv_desc); diff --git a/sys/gnu/ext2fs/ext2_extern.h b/sys/gnu/ext2fs/ext2_extern.h index 8e7372377b79..57c62b12c70a 100644 --- a/sys/gnu/ext2fs/ext2_extern.h +++ b/sys/gnu/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 **, struct vnode **vpp); +int ext2_vinit(struct mount *, struct vop_vector *, struct vnode **vpp); int ext2_lookup(struct vop_cachedlookup_args *); int ext2_readdir(struct vop_readdir_args *); void ext2_print_inode(struct inode *); @@ -105,7 +105,7 @@ void mark_buffer_dirty(struct buf *bh); #define B_METAONLY 0x04 /* Return indirect block buffer. */ #define B_NOWAIT 0x08 /* do not sleep to await lock */ -extern vop_t **ext2_vnodeop_p; -extern vop_t **ext2_fifoop_p; +extern struct vop_vector ext2_vnodeops; +extern struct vop_vector ext2_fifoops; #endif /* !_SYS_GNU_EXT2FS_EXT2_EXTERN_H_ */ diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index 905e7f7e8b91..0519c59a2758 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -1026,7 +1026,7 @@ ext2_vget(mp, ino, flags, vpp) MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("ext2fs", mp, &ext2_vnodeops, &vp)) != 0) { if (ext2fs_inode_hash_lock < 0) wakeup(&ext2fs_inode_hash_lock); ext2fs_inode_hash_lock = 0; @@ -1095,7 +1095,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_fifoop_p, &vp)) != 0) { + if ((error = ext2_vinit(mp, &ext2_fifoops, &vp)) != 0) { vput(vp); *vpp = NULL; return (error); diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c index b644ab8e7bdb..ebc39d063850 100644 --- a/sys/gnu/ext2fs/ext2_vnops.c +++ b/sys/gnu/ext2fs/ext2_vnops.c @@ -116,65 +116,54 @@ static int filt_ext2vnode(struct knote *kn, long hint); static void filt_ext2detach(struct knote *kn); /* Global vfs data structures for ext2. */ -vop_t **ext2_vnodeop_p; -static struct vnodeopv_entry_desc ext2_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) ext2_access }, - { &vop_advlock_desc, (vop_t *) ext2_advlock }, - { &vop_bmap_desc, (vop_t *) ext2_bmap }, - { &vop_cachedlookup_desc, (vop_t *) ext2_lookup }, - { &vop_close_desc, (vop_t *) ext2_close }, - { &vop_create_desc, (vop_t *) ext2_create }, - { &vop_fsync_desc, (vop_t *) ext2_fsync }, - { &vop_getattr_desc, (vop_t *) ext2_getattr }, - { &vop_inactive_desc, (vop_t *) ext2_inactive }, - { &vop_link_desc, (vop_t *) ext2_link }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_mkdir_desc, (vop_t *) ext2_mkdir }, - { &vop_mknod_desc, (vop_t *) ext2_mknod }, - { &vop_open_desc, (vop_t *) ext2_open }, - { &vop_pathconf_desc, (vop_t *) ext2_pathconf }, - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_kqfilter_desc, (vop_t *) ext2_kqfilter }, - { &vop_print_desc, (vop_t *) ext2_print }, - { &vop_read_desc, (vop_t *) ext2_read }, - { &vop_readdir_desc, (vop_t *) ext2_readdir }, - { &vop_readlink_desc, (vop_t *) ext2_readlink }, - { &vop_reallocblks_desc, (vop_t *) ext2_reallocblks }, - { &vop_reclaim_desc, (vop_t *) ext2_reclaim }, - { &vop_remove_desc, (vop_t *) ext2_remove }, - { &vop_rename_desc, (vop_t *) ext2_rename }, - { &vop_rmdir_desc, (vop_t *) ext2_rmdir }, - { &vop_setattr_desc, (vop_t *) ext2_setattr }, - { &vop_strategy_desc, (vop_t *) ext2_strategy }, - { &vop_symlink_desc, (vop_t *) ext2_symlink }, - { &vop_write_desc, (vop_t *) ext2_write }, - { NULL, NULL } +struct vop_vector ext2_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = ext2_access, + .vop_advlock = ext2_advlock, + .vop_bmap = ext2_bmap, + .vop_cachedlookup = ext2_lookup, + .vop_close = ext2_close, + .vop_create = ext2_create, + .vop_fsync = ext2_fsync, + .vop_getattr = ext2_getattr, + .vop_inactive = ext2_inactive, + .vop_link = ext2_link, + .vop_lookup = vfs_cache_lookup, + .vop_mkdir = ext2_mkdir, + .vop_mknod = ext2_mknod, + .vop_open = ext2_open, + .vop_pathconf = ext2_pathconf, + .vop_poll = vop_stdpoll, + .vop_kqfilter = ext2_kqfilter, + .vop_print = ext2_print, + .vop_read = ext2_read, + .vop_readdir = ext2_readdir, + .vop_readlink = ext2_readlink, + .vop_reallocblks = ext2_reallocblks, + .vop_reclaim = ext2_reclaim, + .vop_remove = ext2_remove, + .vop_rename = ext2_rename, + .vop_rmdir = ext2_rmdir, + .vop_setattr = ext2_setattr, + .vop_strategy = ext2_strategy, + .vop_symlink = ext2_symlink, + .vop_write = ext2_write, }; -static struct vnodeopv_desc ext2fs_vnodeop_opv_desc = - { &ext2_vnodeop_p, ext2_vnodeop_entries }; -vop_t **ext2_fifoop_p; -static struct vnodeopv_entry_desc ext2_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) ext2_access }, - { &vop_close_desc, (vop_t *) ext2fifo_close }, - { &vop_fsync_desc, (vop_t *) ext2_fsync }, - { &vop_getattr_desc, (vop_t *) ext2_getattr }, - { &vop_inactive_desc, (vop_t *) ext2_inactive }, - { &vop_kqfilter_desc, (vop_t *) ext2fifo_kqfilter }, - { &vop_print_desc, (vop_t *) ext2_print }, - { &vop_read_desc, (vop_t *) ext2fifo_read }, - { &vop_reclaim_desc, (vop_t *) ext2_reclaim }, - { &vop_setattr_desc, (vop_t *) ext2_setattr }, - { &vop_write_desc, (vop_t *) ext2fifo_write }, - { NULL, NULL } +struct vop_vector ext2_fifoops = { + .vop_default = &fifo_specops, + .vop_access = ext2_access, + .vop_close = ext2fifo_close, + .vop_fsync = ext2_fsync, + .vop_getattr = ext2_getattr, + .vop_inactive = ext2_inactive, + .vop_kqfilter = ext2fifo_kqfilter, + .vop_print = ext2_print, + .vop_read = ext2fifo_read, + .vop_reclaim = ext2_reclaim, + .vop_setattr = ext2_setattr, + .vop_write = ext2fifo_write, }; -static struct vnodeopv_desc ext2fs_fifoop_opv_desc = - { &ext2_fifoop_p, ext2_fifoop_entries }; - - VNODEOP_SET(ext2fs_vnodeop_opv_desc); - VNODEOP_SET(ext2fs_fifoop_opv_desc); #include @@ -1487,7 +1476,7 @@ ext2fifo_read(ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap); + error = fifo_specops.vop_read(ap); ip = VTOI(ap->a_vp); if ((ap->a_vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) @@ -1513,7 +1502,7 @@ ext2fifo_write(ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap); + error = fifo_specops.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; @@ -1540,7 +1529,7 @@ ext2fifo_close(ap) if (vp->v_usecount > 1) ext2_itimes(vp); VI_UNLOCK(vp); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); + return (fifo_specops.vop_close(ap)); } /* @@ -1554,7 +1543,7 @@ ext2fifo_kqfilter(ap) { int error; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_kqfilter), ap); + error = fifo_specops.vop_kqfilter(ap); if (error) error = ext2_kqfilter(ap); return (error); @@ -1622,7 +1611,7 @@ ext2_advlock(ap) int ext2_vinit(mntp, fifoops, vpp) struct mount *mntp; - vop_t **fifoops; + struct vop_vector *fifoops; struct vnode **vpp; { struct inode *ip; diff --git a/sys/gnu/fs/ext2fs/ext2_extern.h b/sys/gnu/fs/ext2fs/ext2_extern.h index 8e7372377b79..57c62b12c70a 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 **, struct vnode **vpp); +int ext2_vinit(struct mount *, struct vop_vector *, struct vnode **vpp); int ext2_lookup(struct vop_cachedlookup_args *); int ext2_readdir(struct vop_readdir_args *); void ext2_print_inode(struct inode *); @@ -105,7 +105,7 @@ void mark_buffer_dirty(struct buf *bh); #define B_METAONLY 0x04 /* Return indirect block buffer. */ #define B_NOWAIT 0x08 /* do not sleep to await lock */ -extern vop_t **ext2_vnodeop_p; -extern vop_t **ext2_fifoop_p; +extern struct vop_vector ext2_vnodeops; +extern struct vop_vector ext2_fifoops; #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 905e7f7e8b91..0519c59a2758 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -1026,7 +1026,7 @@ ext2_vget(mp, ino, flags, vpp) MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("ext2fs", mp, &ext2_vnodeops, &vp)) != 0) { if (ext2fs_inode_hash_lock < 0) wakeup(&ext2fs_inode_hash_lock); ext2fs_inode_hash_lock = 0; @@ -1095,7 +1095,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_fifoop_p, &vp)) != 0) { + if ((error = ext2_vinit(mp, &ext2_fifoops, &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 b644ab8e7bdb..ebc39d063850 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -116,65 +116,54 @@ static int filt_ext2vnode(struct knote *kn, long hint); static void filt_ext2detach(struct knote *kn); /* Global vfs data structures for ext2. */ -vop_t **ext2_vnodeop_p; -static struct vnodeopv_entry_desc ext2_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) ext2_access }, - { &vop_advlock_desc, (vop_t *) ext2_advlock }, - { &vop_bmap_desc, (vop_t *) ext2_bmap }, - { &vop_cachedlookup_desc, (vop_t *) ext2_lookup }, - { &vop_close_desc, (vop_t *) ext2_close }, - { &vop_create_desc, (vop_t *) ext2_create }, - { &vop_fsync_desc, (vop_t *) ext2_fsync }, - { &vop_getattr_desc, (vop_t *) ext2_getattr }, - { &vop_inactive_desc, (vop_t *) ext2_inactive }, - { &vop_link_desc, (vop_t *) ext2_link }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_mkdir_desc, (vop_t *) ext2_mkdir }, - { &vop_mknod_desc, (vop_t *) ext2_mknod }, - { &vop_open_desc, (vop_t *) ext2_open }, - { &vop_pathconf_desc, (vop_t *) ext2_pathconf }, - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_kqfilter_desc, (vop_t *) ext2_kqfilter }, - { &vop_print_desc, (vop_t *) ext2_print }, - { &vop_read_desc, (vop_t *) ext2_read }, - { &vop_readdir_desc, (vop_t *) ext2_readdir }, - { &vop_readlink_desc, (vop_t *) ext2_readlink }, - { &vop_reallocblks_desc, (vop_t *) ext2_reallocblks }, - { &vop_reclaim_desc, (vop_t *) ext2_reclaim }, - { &vop_remove_desc, (vop_t *) ext2_remove }, - { &vop_rename_desc, (vop_t *) ext2_rename }, - { &vop_rmdir_desc, (vop_t *) ext2_rmdir }, - { &vop_setattr_desc, (vop_t *) ext2_setattr }, - { &vop_strategy_desc, (vop_t *) ext2_strategy }, - { &vop_symlink_desc, (vop_t *) ext2_symlink }, - { &vop_write_desc, (vop_t *) ext2_write }, - { NULL, NULL } +struct vop_vector ext2_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = ext2_access, + .vop_advlock = ext2_advlock, + .vop_bmap = ext2_bmap, + .vop_cachedlookup = ext2_lookup, + .vop_close = ext2_close, + .vop_create = ext2_create, + .vop_fsync = ext2_fsync, + .vop_getattr = ext2_getattr, + .vop_inactive = ext2_inactive, + .vop_link = ext2_link, + .vop_lookup = vfs_cache_lookup, + .vop_mkdir = ext2_mkdir, + .vop_mknod = ext2_mknod, + .vop_open = ext2_open, + .vop_pathconf = ext2_pathconf, + .vop_poll = vop_stdpoll, + .vop_kqfilter = ext2_kqfilter, + .vop_print = ext2_print, + .vop_read = ext2_read, + .vop_readdir = ext2_readdir, + .vop_readlink = ext2_readlink, + .vop_reallocblks = ext2_reallocblks, + .vop_reclaim = ext2_reclaim, + .vop_remove = ext2_remove, + .vop_rename = ext2_rename, + .vop_rmdir = ext2_rmdir, + .vop_setattr = ext2_setattr, + .vop_strategy = ext2_strategy, + .vop_symlink = ext2_symlink, + .vop_write = ext2_write, }; -static struct vnodeopv_desc ext2fs_vnodeop_opv_desc = - { &ext2_vnodeop_p, ext2_vnodeop_entries }; -vop_t **ext2_fifoop_p; -static struct vnodeopv_entry_desc ext2_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) ext2_access }, - { &vop_close_desc, (vop_t *) ext2fifo_close }, - { &vop_fsync_desc, (vop_t *) ext2_fsync }, - { &vop_getattr_desc, (vop_t *) ext2_getattr }, - { &vop_inactive_desc, (vop_t *) ext2_inactive }, - { &vop_kqfilter_desc, (vop_t *) ext2fifo_kqfilter }, - { &vop_print_desc, (vop_t *) ext2_print }, - { &vop_read_desc, (vop_t *) ext2fifo_read }, - { &vop_reclaim_desc, (vop_t *) ext2_reclaim }, - { &vop_setattr_desc, (vop_t *) ext2_setattr }, - { &vop_write_desc, (vop_t *) ext2fifo_write }, - { NULL, NULL } +struct vop_vector ext2_fifoops = { + .vop_default = &fifo_specops, + .vop_access = ext2_access, + .vop_close = ext2fifo_close, + .vop_fsync = ext2_fsync, + .vop_getattr = ext2_getattr, + .vop_inactive = ext2_inactive, + .vop_kqfilter = ext2fifo_kqfilter, + .vop_print = ext2_print, + .vop_read = ext2fifo_read, + .vop_reclaim = ext2_reclaim, + .vop_setattr = ext2_setattr, + .vop_write = ext2fifo_write, }; -static struct vnodeopv_desc ext2fs_fifoop_opv_desc = - { &ext2_fifoop_p, ext2_fifoop_entries }; - - VNODEOP_SET(ext2fs_vnodeop_opv_desc); - VNODEOP_SET(ext2fs_fifoop_opv_desc); #include @@ -1487,7 +1476,7 @@ ext2fifo_read(ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap); + error = fifo_specops.vop_read(ap); ip = VTOI(ap->a_vp); if ((ap->a_vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) @@ -1513,7 +1502,7 @@ ext2fifo_write(ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap); + error = fifo_specops.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; @@ -1540,7 +1529,7 @@ ext2fifo_close(ap) if (vp->v_usecount > 1) ext2_itimes(vp); VI_UNLOCK(vp); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); + return (fifo_specops.vop_close(ap)); } /* @@ -1554,7 +1543,7 @@ ext2fifo_kqfilter(ap) { int error; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_kqfilter), ap); + error = fifo_specops.vop_kqfilter(ap); if (error) error = ext2_kqfilter(ap); return (error); @@ -1622,7 +1611,7 @@ ext2_advlock(ap) int ext2_vinit(mntp, fifoops, vpp) struct mount *mntp; - vop_t **fifoops; + struct vop_vector *fifoops; struct vnode **vpp; { struct inode *ip; diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 9500695a572c..685158d6a934 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -729,7 +729,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) return (0); /* Allocate a new vnode/iso_node. */ - if ((error = getnewvnode("isofs", mp, cd9660_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("isofs", mp, &cd9660_vnodeops, &vp)) != 0) { *vpp = NULLVP; return (error); } @@ -870,7 +870,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) */ switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) { case VFIFO: - vp->v_op = cd9660_fifoop_p; + vp->v_op = &cd9660_fifoops; break; default: break; diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 9761c2f09cf8..4a9e47356aa6 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -780,44 +780,33 @@ cd9660_pathconf(ap) /* * Global vfs data structures for cd9660 */ -vop_t **cd9660_vnodeop_p; -static struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_bmap_desc, (vop_t *) cd9660_bmap }, - { &vop_cachedlookup_desc, (vop_t *) cd9660_lookup }, - { &vop_getattr_desc, (vop_t *) cd9660_getattr }, - { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_ioctl_desc, (vop_t *) cd9660_ioctl }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_pathconf_desc, (vop_t *) cd9660_pathconf }, - { &vop_read_desc, (vop_t *) cd9660_read }, - { &vop_readdir_desc, (vop_t *) cd9660_readdir }, - { &vop_readlink_desc, (vop_t *) cd9660_readlink }, - { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, - { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { &vop_strategy_desc, (vop_t *) cd9660_strategy }, - { NULL, NULL } +struct vop_vector cd9660_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = cd9660_access, + .vop_bmap = cd9660_bmap, + .vop_cachedlookup = cd9660_lookup, + .vop_getattr = cd9660_getattr, + .vop_inactive = cd9660_inactive, + .vop_ioctl = cd9660_ioctl, + .vop_lookup = vfs_cache_lookup, + .vop_pathconf = cd9660_pathconf, + .vop_read = cd9660_read, + .vop_readdir = cd9660_readdir, + .vop_readlink = cd9660_readlink, + .vop_reclaim = cd9660_reclaim, + .vop_setattr = cd9660_setattr, + .vop_strategy = cd9660_strategy, }; -static struct vnodeopv_desc cd9660_vnodeop_opv_desc = - { &cd9660_vnodeop_p, cd9660_vnodeop_entries }; -VNODEOP_SET(cd9660_vnodeop_opv_desc); /* * Special device vnode ops */ -vop_t **cd9660_fifoop_p; -static struct vnodeopv_entry_desc cd9660_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) cd9660_access }, - { &vop_getattr_desc, (vop_t *) cd9660_getattr }, - { &vop_inactive_desc, (vop_t *) cd9660_inactive }, - { &vop_reclaim_desc, (vop_t *) cd9660_reclaim }, - { &vop_setattr_desc, (vop_t *) cd9660_setattr }, - { NULL, NULL } +struct vop_vector cd9660_fifoops = { + .vop_default = &fifo_specops, + .vop_access = cd9660_access, + .vop_getattr = cd9660_getattr, + .vop_inactive = cd9660_inactive, + .vop_reclaim = cd9660_reclaim, + .vop_setattr = cd9660_setattr, }; -static struct vnodeopv_desc cd9660_fifoop_opv_desc = - { &cd9660_fifoop_p, cd9660_fifoop_entries }; - -VNODEOP_SET(cd9660_fifoop_opv_desc); diff --git a/sys/isofs/cd9660/iso.h b/sys/isofs/cd9660/iso.h index d74806307203..f0b52216bc03 100644 --- a/sys/isofs/cd9660/iso.h +++ b/sys/isofs/cd9660/iso.h @@ -263,9 +263,8 @@ int cd9660_uninit(struct vfsconf *); #define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \ size_t, struct proc *))eopnotsupp) -extern vop_t **cd9660_vnodeop_p; -extern vop_t **cd9660_specop_p; -extern vop_t **cd9660_fifoop_p; +extern struct vop_vector cd9660_vnodeops; +extern struct vop_vector cd9660_fifoops; int isochar(u_char *, u_char *, int, u_short *, int *, int, void *); int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *); diff --git a/sys/kern/posix4_mib.c b/sys/kern/posix4_mib.c index 3c6bb976a733..19092164a9ec 100644 --- a/sys/kern/posix4_mib.c +++ b/sys/kern/posix4_mib.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index fe36724dd23e..e122077cf7e4 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -70,40 +70,33 @@ static int vop_nostrategy(struct vop_strategy_args *); * */ -vop_t **default_vnodeop_p; -static struct vnodeopv_entry_desc default_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_eopnotsupp }, - { &vop_advlock_desc, (vop_t *) vop_einval }, - { &vop_bmap_desc, (vop_t *) vop_stdbmap }, - { &vop_close_desc, (vop_t *) vop_null }, - { &vop_createvobject_desc, (vop_t *) vop_stdcreatevobject }, - { &vop_destroyvobject_desc, (vop_t *) vop_stddestroyvobject }, - { &vop_fsync_desc, (vop_t *) vop_null }, - { &vop_getpages_desc, (vop_t *) vop_stdgetpages }, - { &vop_getvobject_desc, (vop_t *) vop_stdgetvobject }, - { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, - { &vop_inactive_desc, (vop_t *) vop_stdinactive }, - { &vop_ioctl_desc, (vop_t *) vop_enotty }, - { &vop_islocked_desc, (vop_t *) vop_stdislocked }, - { &vop_lease_desc, (vop_t *) vop_null }, - { &vop_lock_desc, (vop_t *) vop_stdlock }, - { &vop_lookup_desc, (vop_t *) vop_nolookup }, - { &vop_open_desc, (vop_t *) vop_null }, - { &vop_pathconf_desc, (vop_t *) vop_einval }, - { &vop_poll_desc, (vop_t *) vop_nopoll }, - { &vop_putpages_desc, (vop_t *) vop_stdputpages }, - { &vop_readlink_desc, (vop_t *) vop_einval }, - { &vop_revoke_desc, (vop_t *) vop_panic }, - { &vop_strategy_desc, (vop_t *) vop_nostrategy }, - { &vop_unlock_desc, (vop_t *) vop_stdunlock }, - { NULL, NULL } +struct vop_vector default_vnodeops = { + .vop_default = NULL, + .vop_advlock = VOP_EINVAL, + .vop_bmap = vop_stdbmap, + .vop_close = VOP_NULL, + .vop_createvobject = vop_stdcreatevobject, + .vop_destroyvobject = vop_stddestroyvobject, + .vop_fsync = VOP_NULL, + .vop_getpages = vop_stdgetpages, + .vop_getvobject = vop_stdgetvobject, + .vop_getwritemount = vop_stdgetwritemount, + .vop_inactive = vop_stdinactive, + .vop_ioctl = VOP_ENOTTY, + .vop_islocked = vop_stdislocked, + .vop_lease = VOP_NULL, + .vop_lock = vop_stdlock, + .vop_lookup = vop_nolookup, + .vop_open = VOP_NULL, + .vop_pathconf = VOP_EINVAL, + .vop_poll = vop_nopoll, + .vop_putpages = vop_stdputpages, + .vop_readlink = VOP_EINVAL, + .vop_revoke = VOP_PANIC, + .vop_strategy = vop_nostrategy, + .vop_unlock = vop_stdunlock, }; -static struct vnodeopv_desc default_vnodeop_opv_desc = - { &default_vnodeop_p, default_vnodeop_entries }; - -VNODEOP_SET(default_vnodeop_opv_desc); - /* * Series of placeholder functions for various error returns for * VOPs. @@ -147,16 +140,6 @@ vop_null(struct vop_generic_args *ap) return (0); } -/* - * Used to make a defined VOP fall back to the default VOP. - */ -int -vop_defaultop(struct vop_generic_args *ap) -{ - - return (VOCALL(default_vnodeop_p, ap->a_desc->vdesc_offset, ap)); -} - /* * Helper function to panic on some bad VOPs in some filesystems. */ diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index bba6c5255dfc..343f5f76f54f 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -83,278 +83,36 @@ struct vattr va_null; * that is a(whole)nother story.) This is a feature. */ -/* Table of known vnodeop vectors (list of VFS vnode vectors) */ -static const struct vnodeopv_desc **vnodeopv_descs; -static int vnodeopv_num; - -/* Table of known descs (list of vnode op handlers "vop_access_desc") */ -static struct vnodeop_desc **vfs_op_descs; -/* Reference counts for vfs_op_descs */ -static int *vfs_op_desc_refs; -/* Number of descriptions */ -static int num_op_descs; -/* Number of entries in each description */ -static int vfs_opv_numops = 64; - -/* Allow this number to be tuned at boot */ -TUNABLE_INT("vfs.opv_numops", &vfs_opv_numops); -SYSCTL_INT(_vfs, OID_AUTO, opv_numops, CTLFLAG_RDTUN, &vfs_opv_numops, - 0, "Maximum number of operations in vop_t vector"); - -static int int_cmp(const void *a, const void *b); - -static int -int_cmp(const void *a, const void *b) -{ - return(*(const int *)a - *(const int *)b); -} - -/* - * Recalculate the operations vector/description (those parts of it that can - * be recalculated, that is.) - * Always allocate operations vector large enough to hold vfs_opv_numops - * entries. The vector is never freed or deallocated once it is initialized, - * so that vnodes might safely reference it through their v_op pointer without - * vector changing suddenly from under them. - */ -static void -vfs_opv_recalc(void) -{ - int i, j, k; - int *vfs_op_offsets; - vop_t ***opv_desc_vector_p; - vop_t **opv_desc_vector; - struct vnodeopv_entry_desc *opve_descp; - const struct vnodeopv_desc *opv; - - if (vfs_op_descs == NULL) - panic("vfs_opv_recalc called with null vfs_op_descs"); - - /* - * Allocate and initialize temporary array to store - * offsets. Sort it to put all uninitialized entries - * first and to make holes in existing offset sequence - * detectable. - */ - MALLOC(vfs_op_offsets, int *, - num_op_descs * sizeof(int), M_TEMP, M_WAITOK); - if (vfs_op_offsets == NULL) - panic("vfs_opv_recalc: no memory"); - for (i = 0; i < num_op_descs; i++) - vfs_op_offsets[i] = vfs_op_descs[i]->vdesc_offset; - qsort(vfs_op_offsets, num_op_descs, sizeof(int), int_cmp); - - /* - * Run through and make sure all known descs have an offset. - * Use vfs_op_offsets to locate holes in offset sequence and - * reuse them. - * vop_default_desc is hardwired at offset 1, and offset 0 - * is a panic sanity check. - */ - j = 1; k = 1; - for (i = 0; i < num_op_descs; i++) { - if (vfs_op_descs[i]->vdesc_offset != 0) - continue; - /* - * Look at two adjacent entries vfs_op_offsets[j - 1] and - * vfs_op_offsets[j] and see if we can fit a new offset - * number in between. If not, look at the next pair until - * hole is found or the end of the vfs_op_offsets vector is - * reached. j has been initialized to 1 above so that - * referencing (j-1)-th element is safe and the loop will - * never execute if num_op_descs is 1. For each new value s - * of i the j loop pick up from where previous iteration has - * left off. When the last hole has been consumed or if no - * hole has been found, we will start allocating new numbers - * starting from the biggest already available offset + 1. - */ - for (; j < num_op_descs; j++) { - if (vfs_op_offsets[j - 1] < k && vfs_op_offsets[j] > k) - break; - k = vfs_op_offsets[j] + 1; - } - vfs_op_descs[i]->vdesc_offset = k++; - } - FREE(vfs_op_offsets, M_TEMP); - - /* Panic if new vops will cause vector overflow */ - if (k > vfs_opv_numops) - panic("VFS: Ran out of vop_t vector entries. %d entries required, only %d available.\n", k, vfs_opv_numops); - - /* - * Allocate and fill in the vectors - */ - for (i = 0; i < vnodeopv_num; i++) { - opv = vnodeopv_descs[i]; - opv_desc_vector_p = opv->opv_desc_vector_p; - if (*opv_desc_vector_p == NULL) - MALLOC(*opv_desc_vector_p, vop_t **, - vfs_opv_numops * sizeof(vop_t *), M_VNODE, - M_WAITOK | M_ZERO); - - /* Fill in, with slot 0 being to return EOPNOTSUPP */ - opv_desc_vector = *opv_desc_vector_p; - opv_desc_vector[0] = (vop_t *)vop_eopnotsupp; - for (j = 0; opv->opv_desc_ops[j].opve_op; j++) { - opve_descp = &(opv->opv_desc_ops[j]); - opv_desc_vector[opve_descp->opve_op->vdesc_offset] = - opve_descp->opve_impl; - } - - /* Replace unfilled routines with their default (slot 1). */ - opv_desc_vector = *(opv->opv_desc_vector_p); - if (opv_desc_vector[1] == NULL) - panic("vfs_opv_recalc: vector without a default."); - for (j = 0; j < vfs_opv_numops; j++) - if (opv_desc_vector[j] == NULL) - opv_desc_vector[j] = opv_desc_vector[1]; - } -} - -/* Add a set of vnode operations (a description) to the table above. */ -void -vfs_add_vnodeops(const void *data) -{ - const struct vnodeopv_desc *opv; - const struct vnodeopv_desc **newopv; - struct vnodeop_desc **newop; - int *newref; - struct vnodeop_desc *desc; - int i, j; - - opv = (const struct vnodeopv_desc *)data; - MALLOC(newopv, const struct vnodeopv_desc **, - (vnodeopv_num + 1) * sizeof(*newopv), M_VNODE, M_WAITOK); - if (vnodeopv_descs) { - bcopy(vnodeopv_descs, newopv, vnodeopv_num * sizeof(*newopv)); - FREE(vnodeopv_descs, M_VNODE); - } - newopv[vnodeopv_num] = opv; - vnodeopv_descs = newopv; - vnodeopv_num++; - - /* See if we have turned up a new vnode op desc */ - for (i = 0; (desc = opv->opv_desc_ops[i].opve_op); i++) { - for (j = 0; j < num_op_descs; j++) { - if (desc == vfs_op_descs[j]) { - /* found it, increase reference count */ - vfs_op_desc_refs[j]++; - break; - } - } - if (j == num_op_descs) { - /* not found, new entry */ - MALLOC(newop, struct vnodeop_desc **, - (num_op_descs + 1) * sizeof(*newop), - M_VNODE, M_WAITOK); - /* new reference count (for unload) */ - MALLOC(newref, int *, - (num_op_descs + 1) * sizeof(*newref), - M_VNODE, M_WAITOK); - if (vfs_op_descs) { - bcopy(vfs_op_descs, newop, - num_op_descs * sizeof(*newop)); - FREE(vfs_op_descs, M_VNODE); - } - if (vfs_op_desc_refs) { - bcopy(vfs_op_desc_refs, newref, - num_op_descs * sizeof(*newref)); - FREE(vfs_op_desc_refs, M_VNODE); - } - newop[num_op_descs] = desc; - newref[num_op_descs] = 1; - vfs_op_descs = newop; - vfs_op_desc_refs = newref; - num_op_descs++; - } - } - vfs_opv_recalc(); -} - -/* Remove a vnode type from the vnode description table above. */ -void -vfs_rm_vnodeops(const void *data) -{ - const struct vnodeopv_desc *opv; - const struct vnodeopv_desc **newopv; - struct vnodeop_desc **newop; - int *newref; - vop_t **opv_desc_vector; - struct vnodeop_desc *desc; - int i, j, k; - - opv = (const struct vnodeopv_desc *)data; - /* Lower ref counts on descs in the table and release if zero */ - for (i = 0; (desc = opv->opv_desc_ops[i].opve_op); i++) { - for (j = 0; j < num_op_descs; j++) { - if (desc == vfs_op_descs[j]) { - /* found it, decrease reference count */ - vfs_op_desc_refs[j]--; - break; - } - } - for (j = 0; j < num_op_descs; j++) { - if (vfs_op_desc_refs[j] > 0) - continue; - if (vfs_op_desc_refs[j] < 0) - panic("vfs_remove_vnodeops: negative refcnt"); - /* Entry is going away - replace it with defaultop */ - for (k = 0; k < vnodeopv_num; k++) { - opv_desc_vector = - *(vnodeopv_descs[k]->opv_desc_vector_p); - if (opv_desc_vector != NULL) - opv_desc_vector[desc->vdesc_offset] = - opv_desc_vector[1]; - } - MALLOC(newop, struct vnodeop_desc **, - (num_op_descs - 1) * sizeof(*newop), - M_VNODE, M_WAITOK); - /* new reference count (for unload) */ - MALLOC(newref, int *, - (num_op_descs - 1) * sizeof(*newref), - M_VNODE, M_WAITOK); - for (k = j; k < (num_op_descs - 1); k++) { - vfs_op_descs[k] = vfs_op_descs[k + 1]; - vfs_op_desc_refs[k] = vfs_op_desc_refs[k + 1]; - } - bcopy(vfs_op_descs, newop, - (num_op_descs - 1) * sizeof(*newop)); - bcopy(vfs_op_desc_refs, newref, - (num_op_descs - 1) * sizeof(*newref)); - FREE(vfs_op_descs, M_VNODE); - FREE(vfs_op_desc_refs, M_VNODE); - vfs_op_descs = newop; - vfs_op_desc_refs = newref; - num_op_descs--; - } - } - - for (i = 0; i < vnodeopv_num; i++) { - if (vnodeopv_descs[i] == opv) { - for (j = i; j < (vnodeopv_num - 1); j++) - vnodeopv_descs[j] = vnodeopv_descs[j + 1]; - break; - } - } - if (i == vnodeopv_num) - panic("vfs_remove_vnodeops: opv not found"); - opv_desc_vector = *(opv->opv_desc_vector_p); - if (opv_desc_vector != NULL) - FREE(opv_desc_vector, M_VNODE); - MALLOC(newopv, const struct vnodeopv_desc **, - (vnodeopv_num - 1) * sizeof(*newopv), M_VNODE, M_WAITOK); - bcopy(vnodeopv_descs, newopv, (vnodeopv_num - 1) * sizeof(*newopv)); - FREE(vnodeopv_descs, M_VNODE); - vnodeopv_descs = newopv; - vnodeopv_num--; - - vfs_opv_recalc(); -} - /* * Routines having to do with the management of the vnode table. */ +/* + * XXX: hack alert + */ +int +vcall(struct vnode *vp, u_int off, void *ap) +{ + struct vop_vector *vop = vp->v_op; + vop_bypass_t **bpt; + int rc; + + for(;;) { + bpt = (void *)((u_char *)vop + off); + if (vop != NULL && *bpt == NULL && vop->vop_bypass == NULL) { + vop = vop->vop_default; + continue; + } + break; + } + KASSERT(vop != NULL, ("No VCALL(%p...)", vp)); + if (*bpt != NULL) + rc = (*bpt)(ap); + else + rc = vop->vop_bypass(ap); + return (rc); +} + struct vfsconf * vfs_byname(const char *name) { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 95748df66fb9..4ae483c30b38 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -729,7 +729,7 @@ int getnewvnode(tag, mp, vops, vpp) const char *tag; struct mount *mp; - vop_t **vops; + struct vop_vector *vops; struct vnode **vpp; { struct vnode *vp = NULL; @@ -1772,7 +1772,7 @@ bdevvp(dev, vpp) if (vfinddev(dev, vpp)) return (0); - error = getnewvnode("none", (struct mount *)0, devfs_specop_p, &nvp); + error = getnewvnode("none", (struct mount *)0, &devfs_specops, &nvp); if (error) { *vpp = NULLVP; return (error); @@ -1811,7 +1811,7 @@ addaliasu(nvp, nvp_rdev) dev_t nvp_rdev; { struct vnode *ovp; - vop_t **ops; + struct vop_vector *ops; struct cdev *dev; if (nvp->v_type == VBLK) @@ -2438,7 +2438,7 @@ vclean(vp, flags, td) * notify sleepers of the grim news. */ vp->v_vnlock = &vp->v_lock; - vp->v_op = dead_vnodeop_p; + vp->v_op = &dead_vnodeops; if (vp->v_pollinfo != NULL) vn_pollgone(vp); vp->v_tag = "none"; @@ -2511,14 +2511,14 @@ vgonechrl(struct vnode *vp, struct thread *td) VOP_UNLOCK(vp, 0, td); vp->v_vnlock = &vp->v_lock; vp->v_tag = "orphanchr"; - vp->v_op = devfs_specop_p; + vp->v_op = &devfs_specops; delmntque(vp); cache_purge(vp); vrele(vp); VI_LOCK(vp); } else vclean(vp, 0, td); - vp->v_op = devfs_specop_p; + vp->v_op = &devfs_specops; vx_unlock(vp); VI_UNLOCK(vp); } @@ -3186,22 +3186,16 @@ static int sync_fsync(struct vop_fsync_args *); static int sync_inactive(struct vop_inactive_args *); static int sync_reclaim(struct vop_reclaim_args *); -static vop_t **sync_vnodeop_p; -static struct vnodeopv_entry_desc sync_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_eopnotsupp }, - { &vop_close_desc, (vop_t *) sync_close }, /* close */ - { &vop_fsync_desc, (vop_t *) sync_fsync }, /* fsync */ - { &vop_inactive_desc, (vop_t *) sync_inactive }, /* inactive */ - { &vop_reclaim_desc, (vop_t *) sync_reclaim }, /* reclaim */ - { &vop_lock_desc, (vop_t *) vop_stdlock }, /* lock */ - { &vop_unlock_desc, (vop_t *) vop_stdunlock }, /* unlock */ - { &vop_islocked_desc, (vop_t *) vop_stdislocked }, /* islocked */ - { NULL, NULL } +static struct vop_vector sync_vnodeops = { + .vop_bypass = VOP_EOPNOTSUPP, + .vop_close = sync_close, /* close */ + .vop_fsync = sync_fsync, /* fsync */ + .vop_inactive = sync_inactive, /* inactive */ + .vop_reclaim = sync_reclaim, /* reclaim */ + .vop_lock = vop_stdlock, /* lock */ + .vop_unlock = vop_stdunlock, /* unlock */ + .vop_islocked = vop_stdislocked, /* islocked */ }; -static struct vnodeopv_desc sync_vnodeop_opv_desc = - { &sync_vnodeop_p, sync_vnodeop_entries }; - -VNODEOP_SET(sync_vnodeop_opv_desc); /* * Create a new filesystem syncer vnode for the specified mount point. @@ -3215,7 +3209,7 @@ vfs_allocate_syncvnode(mp) int error; /* Allocate a new vnode */ - if ((error = getnewvnode("syncer", mp, sync_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("syncer", mp, &sync_vnodeops, &vp)) != 0) { mp->mnt_syncer = NULL; return (error); } diff --git a/sys/nfs4client/nfs4_vnops.c b/sys/nfs4client/nfs4_vnops.c index 22698d98fdc9..707b075e75cf 100644 --- a/sys/nfs4client/nfs4_vnops.c +++ b/sys/nfs4client/nfs4_vnops.c @@ -161,71 +161,36 @@ static vop_advlock_t nfs4_advlock; /* * Global vfs data structures for nfs */ -vop_t **nfs4_vnodeop_p; -static struct vnodeopv_entry_desc nfs4_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) nfs4_access }, - { &vop_advlock_desc, (vop_t *) nfs4_advlock }, - { &vop_close_desc, (vop_t *) nfs4_close }, - { &vop_create_desc, (vop_t *) nfs4_create }, - { &vop_fsync_desc, (vop_t *) nfs4_fsync }, - { &vop_getattr_desc, (vop_t *) nfs4_getattr }, - { &vop_getpages_desc, (vop_t *) nfs_getpages }, - { &vop_putpages_desc, (vop_t *) nfs_putpages }, - { &vop_inactive_desc, (vop_t *) nfs_inactive }, - { &vop_lease_desc, (vop_t *) vop_null }, - { &vop_link_desc, (vop_t *) nfs4_link }, - { &vop_lookup_desc, (vop_t *) nfs4_lookup }, - { &vop_mkdir_desc, (vop_t *) nfs4_mkdir }, - { &vop_mknod_desc, (vop_t *) nfs4_mknod }, - { &vop_open_desc, (vop_t *) nfs4_open }, - { &vop_print_desc, (vop_t *) nfs4_print }, - { &vop_read_desc, (vop_t *) nfs4_read }, - { &vop_readdir_desc, (vop_t *) nfs4_readdir }, - { &vop_readlink_desc, (vop_t *) nfs4_readlink }, - { &vop_reclaim_desc, (vop_t *) nfs_reclaim }, - { &vop_remove_desc, (vop_t *) nfs4_remove }, - { &vop_rename_desc, (vop_t *) nfs4_rename }, - { &vop_rmdir_desc, (vop_t *) nfs4_rmdir }, - { &vop_setattr_desc, (vop_t *) nfs4_setattr }, - { &vop_strategy_desc, (vop_t *) nfs4_strategy }, - { &vop_symlink_desc, (vop_t *) nfs4_symlink }, - { &vop_write_desc, (vop_t *) nfs_write }, - { NULL, NULL } +struct vop_vector nfs4_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = nfs4_access, + .vop_advlock = nfs4_advlock, + .vop_close = nfs4_close, + .vop_create = nfs4_create, + .vop_fsync = nfs4_fsync, + .vop_getattr = nfs4_getattr, + .vop_getpages = nfs_getpages, + .vop_putpages = nfs_putpages, + .vop_inactive = nfs_inactive, + .vop_lease = VOP_NULL, + .vop_link = nfs4_link, + .vop_lookup = nfs4_lookup, + .vop_mkdir = nfs4_mkdir, + .vop_mknod = nfs4_mknod, + .vop_open = nfs4_open, + .vop_print = nfs4_print, + .vop_read = nfs4_read, + .vop_readdir = nfs4_readdir, + .vop_readlink = nfs4_readlink, + .vop_reclaim = nfs_reclaim, + .vop_remove = nfs4_remove, + .vop_rename = nfs4_rename, + .vop_rmdir = nfs4_rmdir, + .vop_setattr = nfs4_setattr, + .vop_strategy = nfs4_strategy, + .vop_symlink = nfs4_symlink, + .vop_write = nfs_write, }; -static struct vnodeopv_desc nfs4_vnodeop_opv_desc = - { &nfs4_vnodeop_p, nfs4_vnodeop_entries }; -VNODEOP_SET(nfs4_vnodeop_opv_desc); - -#if 0 -/* - * Special device vnode ops - * - * XXX: I've commented this stuff out because it is unused. It is not clear - * XXX: however that it shouldn't be used: the current code applies the - * XXX: vector from sys/nfsclient and it would take some luck for that to - * XXX: work also in the NFS4 case I think /phk. - */ - -vop_t **fifo_nfs4nodeop_p; -static struct vnodeopv_entry_desc nfs4_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) nfsspec_access }, - { &vop_close_desc, (vop_t *) nfsfifo_close }, - { &vop_fsync_desc, (vop_t *) nfs4_fsync }, - { &vop_getattr_desc, (vop_t *) nfs4_getattr }, - { &vop_inactive_desc, (vop_t *) nfs_inactive }, - { &vop_print_desc, (vop_t *) nfs4_print }, - { &vop_read_desc, (vop_t *) nfsfifo_read }, - { &vop_reclaim_desc, (vop_t *) nfs_reclaim }, - { &vop_setattr_desc, (vop_t *) nfs4_setattr }, - { &vop_write_desc, (vop_t *) nfsfifo_write }, - { NULL, NULL } -}; -static struct vnodeopv_desc fifo_nfs4nodeop_opv_desc = - { &fifo_nfs4nodeop_p, nfs4_fifoop_entries }; -VNODEOP_SET(fifo_nfs4nodeop_opv_desc); -#endif static int nfs4_removerpc(struct vnode *dvp, const char *name, int namelen, struct ucred *cred, struct thread *td); diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index cc4a68cb10dd..60ced4f17286 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -235,9 +235,9 @@ nfs_nget(struct mount *mntp, nfsfh_t *fhp, int fhsize, struct nfsnode **npp) np = uma_zalloc(nfsnode_zone, M_WAITOK); if (nmp->nm_flag & NFSMNT_NFSV4) - error = getnewvnode("nfs4", mntp, nfs4_vnodeop_p, &nvp); + error = getnewvnode("nfs4", mntp, &nfs4_vnodeops, &nvp); else - error = getnewvnode("nfs", mntp, nfs_vnodeop_p, &nvp); + error = getnewvnode("nfs", mntp, &nfs_vnodeops, &nvp); if (error) { if (nfs_node_hash_lock < 0) wakeup(&nfs_node_hash_lock); diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index aa1887a36b27..986c74dadd9c 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -543,7 +543,7 @@ nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, if (vp->v_type != vtyp) { vp->v_type = vtyp; if (vp->v_type == VFIFO) - vp->v_op = fifo_nfsnodeop_p; + vp->v_op = &nfs_fifoops; np->n_mtime = mtime.tv_sec; } vap = &np->n_vattr; diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 0d06df9317c3..50756d3a88ce 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -131,60 +131,50 @@ static vop_advlock_t nfs_advlock; /* * Global vfs data structures for nfs */ -vop_t **nfs_vnodeop_p; -static struct vnodeopv_entry_desc nfs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_access_desc, (vop_t *) nfs_access }, - { &vop_advlock_desc, (vop_t *) nfs_advlock }, - { &vop_close_desc, (vop_t *) nfs_close }, - { &vop_create_desc, (vop_t *) nfs_create }, - { &vop_fsync_desc, (vop_t *) nfs_fsync }, - { &vop_getattr_desc, (vop_t *) nfs_getattr }, - { &vop_getpages_desc, (vop_t *) nfs_getpages }, - { &vop_putpages_desc, (vop_t *) nfs_putpages }, - { &vop_inactive_desc, (vop_t *) nfs_inactive }, - { &vop_lease_desc, (vop_t *) vop_null }, - { &vop_link_desc, (vop_t *) nfs_link }, - { &vop_lookup_desc, (vop_t *) nfs_lookup }, - { &vop_mkdir_desc, (vop_t *) nfs_mkdir }, - { &vop_mknod_desc, (vop_t *) nfs_mknod }, - { &vop_open_desc, (vop_t *) nfs_open }, - { &vop_print_desc, (vop_t *) nfs_print }, - { &vop_read_desc, (vop_t *) nfs_read }, - { &vop_readdir_desc, (vop_t *) nfs_readdir }, - { &vop_readlink_desc, (vop_t *) nfs_readlink }, - { &vop_reclaim_desc, (vop_t *) nfs_reclaim }, - { &vop_remove_desc, (vop_t *) nfs_remove }, - { &vop_rename_desc, (vop_t *) nfs_rename }, - { &vop_rmdir_desc, (vop_t *) nfs_rmdir }, - { &vop_setattr_desc, (vop_t *) nfs_setattr }, - { &vop_strategy_desc, (vop_t *) nfs_strategy }, - { &vop_symlink_desc, (vop_t *) nfs_symlink }, - { &vop_write_desc, (vop_t *) nfs_write }, - { NULL, NULL } +struct vop_vector nfs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_access = nfs_access, + .vop_advlock = nfs_advlock, + .vop_close = nfs_close, + .vop_create = nfs_create, + .vop_fsync = nfs_fsync, + .vop_getattr = nfs_getattr, + .vop_getpages = nfs_getpages, + .vop_putpages = nfs_putpages, + .vop_inactive = nfs_inactive, + .vop_lease = VOP_NULL, + .vop_link = nfs_link, + .vop_lookup = nfs_lookup, + .vop_mkdir = nfs_mkdir, + .vop_mknod = nfs_mknod, + .vop_open = nfs_open, + .vop_print = nfs_print, + .vop_read = nfs_read, + .vop_readdir = nfs_readdir, + .vop_readlink = nfs_readlink, + .vop_reclaim = nfs_reclaim, + .vop_remove = nfs_remove, + .vop_rename = nfs_rename, + .vop_rmdir = nfs_rmdir, + .vop_setattr = nfs_setattr, + .vop_strategy = nfs_strategy, + .vop_symlink = nfs_symlink, + .vop_write = nfs_write, }; -static struct vnodeopv_desc nfs_vnodeop_opv_desc = - { &nfs_vnodeop_p, nfs_vnodeop_entries }; -VNODEOP_SET(nfs_vnodeop_opv_desc); -vop_t **fifo_nfsnodeop_p; -static struct vnodeopv_entry_desc nfs_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_access_desc, (vop_t *) nfsspec_access }, - { &vop_close_desc, (vop_t *) nfsfifo_close }, - { &vop_fsync_desc, (vop_t *) nfs_fsync }, - { &vop_getattr_desc, (vop_t *) nfs_getattr }, - { &vop_inactive_desc, (vop_t *) nfs_inactive }, - { &vop_print_desc, (vop_t *) nfs_print }, - { &vop_read_desc, (vop_t *) nfsfifo_read }, - { &vop_reclaim_desc, (vop_t *) nfs_reclaim }, - { &vop_setattr_desc, (vop_t *) nfs_setattr }, - { &vop_write_desc, (vop_t *) nfsfifo_write }, - { NULL, NULL } +struct vop_vector nfs_fifoops = { + .vop_default = &fifo_specops, + .vop_access = nfsspec_access, + .vop_close = nfsfifo_close, + .vop_fsync = nfs_fsync, + .vop_getattr = nfs_getattr, + .vop_inactive = nfs_inactive, + .vop_print = nfs_print, + .vop_read = nfsfifo_read, + .vop_reclaim = nfs_reclaim, + .vop_setattr = nfs_setattr, + .vop_write = nfsfifo_write, }; -static struct vnodeopv_desc fifo_nfsnodeop_opv_desc = - { &fifo_nfsnodeop_p, nfs_fifoop_entries }; -VNODEOP_SET(fifo_nfsnodeop_opv_desc); static int nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap); @@ -3046,7 +3036,7 @@ nfsfifo_read(struct vop_read_args *ap) */ np->n_flag |= NACC; getnanotime(&np->n_atim); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap)); + return (fifo_specops.vop_read(ap)); } /* @@ -3062,7 +3052,7 @@ nfsfifo_write(struct vop_write_args *ap) */ np->n_flag |= NUPD; getnanotime(&np->n_mtim); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap)); + return (fifo_specops.vop_write(ap)); } /* @@ -3097,7 +3087,7 @@ nfsfifo_close(struct vop_close_args *ap) VOP_UNLOCK(vp, 0, ap->a_td); } } - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); + return (fifo_specops.vop_close(ap)); } /* diff --git a/sys/nfsclient/nfsnode.h b/sys/nfsclient/nfsnode.h index 220b5a82f149..6e97e71f23da 100644 --- a/sys/nfsclient/nfsnode.h +++ b/sys/nfsclient/nfsnode.h @@ -191,10 +191,10 @@ nfs_rsunlock(struct nfsnode *np, struct thread *td) (void)lockmgr(&np->n_rslock, LK_RELEASE, NULL, td); } -extern vop_t **fifo_nfsnodeop_p; -extern vop_t **nfs_vnodeop_p; +extern struct vop_vector nfs_fifoops; +extern struct vop_vector nfs_vnodeops; +extern struct vop_vector nfs4_vnodeops; extern struct buf_ops buf_ops_nfs; -extern vop_t **nfs4_vnodeop_p; extern struct buf_ops buf_ops_nfs4; /* diff --git a/sys/posix4/posix4_mib.c b/sys/posix4/posix4_mib.c index 3c6bb976a733..19092164a9ec 100644 --- a/sys/posix4/posix4_mib.c +++ b/sys/posix4/posix4_mib.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 38a90ea0468d..1cc45d181927 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -66,7 +66,6 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; * it from v_data. If non-null, this area is freed in getnewvnode(). */ -typedef int vop_t(void *); struct namecache; struct vpollinfo { @@ -135,7 +134,7 @@ struct vnode { void *v_data; /* u private data for fs */ struct lock v_lock; /* u used if fs don't have one */ struct lock *v_vnlock; /* u pointer to vnode lock */ - vop_t **v_op; /* u vnode operations vector */ + struct vop_vector *v_op; /* u vnode operations vector */ struct mount *v_mount; /* u ptr to vfs we are in */ LIST_HEAD(, namecache) v_cache_src; /* c Cache entries from us */ TAILQ_HEAD(, namecache) v_cache_dst; /* c Cache entries to us */ @@ -350,10 +349,6 @@ extern int vttoif_tab[]; #define NULLVP ((struct vnode *)NULL) -#define VNODEOP_SET(f) \ - C_SYSINIT(f##init, SI_SUB_VFS, SI_ORDER_SECOND, vfs_add_vnodeops, &f); \ - C_SYSUNINIT(f##uninit, SI_SUB_VFS, SI_ORDER_SECOND, vfs_rm_vnodeops, &f); - /* * Global vnode data. */ @@ -455,19 +450,6 @@ extern struct vnodeop_desc *vnodeop_descs[]; #define VOPARG_OFFSETTO(s_type, s_offset, struct_p) \ ((s_type)(((char*)(struct_p)) + (s_offset))) -/* - * This structure is used to configure the new vnodeops vector. - */ -struct vnodeopv_entry_desc { - struct vnodeop_desc *opve_op; /* which operation this is */ - vop_t *opve_impl; /* code implementing this operation */ -}; -struct vnodeopv_desc { - /* ptr to the ptr to the vector where op should go */ - vop_t ***opv_desc_vector_p; - struct vnodeopv_entry_desc *opv_desc_ops; /* null terminated list */ -}; - /* * A generic structure. * This can be used by bypass routines to identify generic arguments. @@ -534,17 +516,11 @@ void vop_unlock_pre(void *a); #define ASSERT_VOP_UNLOCKED(vp, str) #endif /* DEBUG_VFS_LOCKS */ -/* - * VOCALL calls an op given an ops vector. We break it out because BSD's - * vclean changes the ops vector and then wants to call ops with the old - * vector. - */ -#define VOCALL(OPSV,OFF,AP) (( *((OPSV)[(OFF)])) (AP)) /* * This call works for vnodes in the kernel. */ -#define VCALL(VP,OFF,AP) VOCALL((VP)->v_op,(OFF),(AP)) +#define VCALL(a, b, c) vcall((a), (b), (c)) #define VDESC(OP) (& __CONCAT(OP,_desc)) #define VOFFSET(OP) (VDESC(OP)->vdesc_offset) @@ -602,7 +578,7 @@ int change_dir(struct vnode *vp, struct thread *td); int change_root(struct vnode *vp, struct thread *td); void cvtstat(struct stat *st, struct ostat *ost); void cvtnstat(struct stat *sb, struct nstat *nsb); -int getnewvnode(const char *tag, struct mount *mp, vop_t **vops, +int getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, struct vnode **vpp); u_quad_t init_va_filerev(void); int lease_check(struct vop_lease_args *ap); @@ -694,12 +670,12 @@ int vop_eopnotsupp(struct vop_generic_args *ap); int vop_ebadf(struct vop_generic_args *ap); int vop_einval(struct vop_generic_args *ap); int vop_enotty(struct vop_generic_args *ap); -int vop_defaultop(struct vop_generic_args *ap); int vop_null(struct vop_generic_args *ap); int vop_panic(struct vop_generic_args *ap); int vop_stdcreatevobject(struct vop_createvobject_args *ap); int vop_stddestroyvobject(struct vop_destroyvobject_args *ap); int vop_stdgetvobject(struct vop_getvobject_args *ap); +int vcall(struct vnode *vp, u_int off, void *ap); void vfree(struct vnode *); void vput(struct vnode *vp); @@ -709,9 +685,19 @@ int vrefcnt(struct vnode *vp); void vbusy(struct vnode *vp); void v_addpollinfo(struct vnode *vp); -extern vop_t **default_vnodeop_p; -extern vop_t **dead_vnodeop_p; -extern vop_t **devfs_specop_p; + +extern struct vop_vector devfs_specops; +extern struct vop_vector fifo_specops; +extern struct vop_vector dead_vnodeops; +extern struct vop_vector default_vnodeops; + +#define VOP_PANIC ((void*)(uintptr_t)vop_panic) +#define VOP_NULL ((void*)(uintptr_t)vop_null) +#define VOP_EBADF ((void*)(uintptr_t)vop_ebadf) +#define VOP_ENOTTY ((void*)(uintptr_t)vop_enotty) +#define VOP_EINVAL ((void*)(uintptr_t)vop_einval) +#define VOP_EOPNOTSUPP ((void*)(uintptr_t)vop_eopnotsupp) + #endif /* _KERNEL */ diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk index 026db30f3347..4e21f23c55a3 100644 --- a/sys/tools/vnode_if.awk +++ b/sys/tools/vnode_if.awk @@ -39,7 +39,7 @@ function usage() { - print "usage: vnode_if.awk [-c|-h]"; + print "usage: vnode_if.awk [-c|-h|-p|-q]"; exit 1; } @@ -58,6 +58,8 @@ function t_spc(type) # These are just for convenience ... function printc(s) {print s > cfile;} function printh(s) {print s > hfile;} +function printp(s) {print s > pfile;} +function printq(s) {print s > qfile;} function add_debug_code(name, arg, pos) { @@ -117,18 +119,22 @@ BEGIN{ # Process the command line for (i = 1; i < ARGC; i++) { arg = ARGV[i]; - if (arg !~ /^-[ch]+$/ && arg !~ /\.src$/) + if (arg !~ /^-[chpq]+$/ && arg !~ /\.src$/) usage(); if (arg ~ /^-.*c/) cfile = "vnode_if.c"; if (arg ~ /^-.*h/) hfile = "vnode_if.h"; + if (arg ~ /^-.*p/) + pfile = "vnode_if_newproto.h"; + if (arg ~ /^-.*q/) + qfile = "vnode_if_typedef.h"; if (arg ~ /\.src$/) srcfile = arg; } ARGC = 1; -if (!cfile && !hfile) +if (!cfile && !hfile && !pfile && !qfile) exit 0; if (!srcfile) @@ -143,8 +149,24 @@ common_head = \ " */\n" \ "\n"; -if (hfile) +if (pfile) { + printp(common_head) + printp("struct vop_vector {") + printp("\tstruct vop_vector\t*vop_default;") + printp("\tvop_bypass_t\t*vop_bypass;") +} + +if (qfile) { + printq(common_head) + printq("struct vop_generic_args;") + printq("typedef int vop_bypass_t(struct vop_generic_args *);\n") +} + +if (hfile) { printh(common_head "extern struct vnodeop_desc vop_default_desc;"); + printh("#include \"vnode_if_typedef.h\"") + printh("#include \"vnode_if_newproto.h\"") +} if (cfile) { printc(common_head \ @@ -262,6 +284,14 @@ while ((getline < srcfile) > 0) { ctrstr = ctrstr ", " args[i]; ctrstr = ctrstr ");"; + if (pfile) { + printp("\t"name"_t\t*"name";") + } + if (qfile) { + printq("struct "name"_args;") + printq("typedef int "name"_t(struct "name"_args *);\n") + } + if (hfile) { # Print out the vop_F_args structure. printh("struct "name"_args {\n\tstruct vnodeop_desc *a_desc;"); @@ -286,7 +316,16 @@ while ((getline < srcfile) > 0) { for (i = 0; i < numargs; ++i) add_debug_code(name, args[i], "Entry"); add_debug_pre(name); - printh("\trc = VCALL(" args[0] ", VOFFSET(" name "), &a);"); + printh("\t{") + printh("\t\tstruct vop_vector *vop = "args[0]"->v_op;") + printh("\t\twhile(vop != NULL && vop->"name" == NULL && vop->vop_bypass == NULL)") + printh("\t\t\tvop = vop->vop_default;") + printh("\t\tKASSERT(vop != NULL, (\"No "name"(%p...)\", "args[0]"));") + printh("\t\tif (vop->"name" != NULL)") + printh("\t\t\trc = vop->"name"(&a);") + printh("\t\telse") + printh("\t\t\trc = vop->vop_bypass((struct vop_generic_args *)&a);") + printh("\t}") printh(ctrstr); printh("if (rc == 0) {"); for (i = 0; i < numargs; ++i) @@ -297,7 +336,6 @@ while ((getline < srcfile) > 0) { printh("}"); add_debug_post(name); printh("\treturn (rc);\n}"); - printh("typedef int "name"_t(struct "name"_args *);\n") } if (cfile) { @@ -326,7 +364,7 @@ while ((getline < srcfile) > 0) { # Print out the vnodeop_desc structure. printc("struct vnodeop_desc " name "_desc = {"); # offset - printc("\t0,"); + printc("\toffsetof(struct vop_vector, "name"),"); # printable name printc("\t\"" name "\","); # flags @@ -357,10 +395,15 @@ while ((getline < srcfile) > 0) { } } +if (pfile) + printp("};") + if (hfile) close(hfile); if (cfile) close(cfile); +if (pfile) + close(pfile); close(srcfile); exit 0; diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index a56d6de172c4..6de7a82ea064 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -89,8 +89,8 @@ int ffs_vfree(struct vnode *, ino_t, int); vfs_vget_t ffs_vget; vfs_vptofh_t ffs_vptofh; -extern vop_t **ffs_vnodeop_p; -extern vop_t **ffs_fifoop_p; +extern struct vop_vector ffs_vnodeops; +extern struct vop_vector ffs_fifoops; /* * Soft update function prototypes. diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index fc97618be54a..4252344b4778 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1242,7 +1242,7 @@ ffs_vget(mp, ino, flags, vpp) ip = uma_zalloc(uma_inode, M_WAITOK); /* Allocate a new vnode/inode. */ - error = getnewvnode("ufs", mp, ffs_vnodeop_p, &vp); + error = getnewvnode("ufs", mp, &ffs_vnodeops, &vp); if (error) { *vpp = NULL; uma_zfree(uma_inode, ip); @@ -1322,7 +1322,7 @@ ffs_vget(mp, ino, flags, vpp) * Initialize the vnode from the inode, check for aliases. * Note that the underlying vnode may have changed. */ - error = ufs_vinit(mp, ffs_fifoop_p, &vp); + error = ufs_vinit(mp, &ffs_fifoops, &vp); if (error) { vput(vp); *vpp = NULL; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index f2722a2bcecb..1b901299aed4 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -118,44 +118,33 @@ static vop_setextattr_t ffs_setextattr; /* Global vfs data structures for ufs. */ -vop_t **ffs_vnodeop_p; -static struct vnodeopv_entry_desc ffs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) ufs_vnoperate }, - { &vop_fsync_desc, (vop_t *) ffs_fsync }, - { &vop_getpages_desc, (vop_t *) ffs_getpages }, - { &vop_read_desc, (vop_t *) ffs_read }, - { &vop_reallocblks_desc, (vop_t *) ffs_reallocblks }, - { &vop_write_desc, (vop_t *) ffs_write }, - { &vop_closeextattr_desc, (vop_t *) ffs_closeextattr }, - { &vop_deleteextattr_desc, (vop_t *) ffs_deleteextattr }, - { &vop_getextattr_desc, (vop_t *) ffs_getextattr }, - { &vop_listextattr_desc, (vop_t *) ffs_listextattr }, - { &vop_openextattr_desc, (vop_t *) ffs_openextattr }, - { &vop_setextattr_desc, (vop_t *) ffs_setextattr }, - { NULL, NULL } +struct vop_vector ffs_vnodeops = { + .vop_default = &ufs_vnodeops, + .vop_fsync = ffs_fsync, + .vop_getpages = ffs_getpages, + .vop_read = ffs_read, + .vop_reallocblks = ffs_reallocblks, + .vop_write = ffs_write, + .vop_closeextattr = ffs_closeextattr, + .vop_deleteextattr = ffs_deleteextattr, + .vop_getextattr = ffs_getextattr, + .vop_listextattr = ffs_listextattr, + .vop_openextattr = ffs_openextattr, + .vop_setextattr = ffs_setextattr, }; -static struct vnodeopv_desc ffs_vnodeop_opv_desc = - { &ffs_vnodeop_p, ffs_vnodeop_entries }; -vop_t **ffs_fifoop_p; -static struct vnodeopv_entry_desc ffs_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) ufs_vnoperatefifo }, - { &vop_fsync_desc, (vop_t *) ffs_fsync }, - { &vop_reallocblks_desc, (vop_t *) ffs_reallocblks }, - { &vop_strategy_desc, (vop_t *) ffsext_strategy }, - { &vop_closeextattr_desc, (vop_t *) ffs_closeextattr }, - { &vop_deleteextattr_desc, (vop_t *) ffs_deleteextattr }, - { &vop_getextattr_desc, (vop_t *) ffs_getextattr }, - { &vop_listextattr_desc, (vop_t *) ffs_listextattr }, - { &vop_openextattr_desc, (vop_t *) ffs_openextattr }, - { &vop_setextattr_desc, (vop_t *) ffs_setextattr }, - { NULL, NULL } +struct vop_vector ffs_fifoops = { + .vop_default = &ufs_fifoops, + .vop_fsync = ffs_fsync, + .vop_reallocblks = ffs_reallocblks, + .vop_strategy = ffsext_strategy, + .vop_closeextattr = ffs_closeextattr, + .vop_deleteextattr = ffs_deleteextattr, + .vop_getextattr = ffs_getextattr, + .vop_listextattr = ffs_listextattr, + .vop_openextattr = ffs_openextattr, + .vop_setextattr = ffs_setextattr, }; -static struct vnodeopv_desc ffs_fifoop_opv_desc = - { &ffs_fifoop_p, ffs_fifoop_entries }; - -VNODEOP_SET(ffs_vnodeop_opv_desc); -VNODEOP_SET(ffs_fifoop_opv_desc); /* * Synch an open file. @@ -1226,9 +1215,9 @@ struct vop_strategy_args { lbn = ap->a_bp->b_lblkno; if (VTOI(vp)->i_fs->fs_magic == FS_UFS2_MAGIC && lbn < 0 && lbn >= -NXADDR) - return (ufs_vnoperate((struct vop_generic_args *)ap)); + return ufs_vnodeops.vop_strategy(ap); if (vp->v_type == VFIFO) - return (ufs_vnoperatefifo((struct vop_generic_args *)ap)); + return ufs_fifoops.vop_strategy(ap); panic("spec nodes went here"); } @@ -1252,7 +1241,7 @@ struct vop_openextattr_args { ip = VTOI(ap->a_vp); fs = ip->i_fs; if (fs->fs_magic == FS_UFS1_MAGIC) - return (ufs_vnoperate((struct vop_generic_args *)ap)); + return (ufs_vnodeops.vop_openextattr(ap)); if (ap->a_vp->v_type == VCHR) return (EOPNOTSUPP); @@ -1282,7 +1271,7 @@ struct vop_closeextattr_args { ip = VTOI(ap->a_vp); fs = ip->i_fs; if (fs->fs_magic == FS_UFS1_MAGIC) - return (ufs_vnoperate((struct vop_generic_args *)ap)); + return (ufs_vnodeops.vop_closeextattr(ap)); if (ap->a_vp->v_type == VCHR) return (EOPNOTSUPP); @@ -1316,7 +1305,7 @@ vop_deleteextattr { fs = ip->i_fs; if (fs->fs_magic == FS_UFS1_MAGIC) - return (ufs_vnoperate((struct vop_generic_args *)ap)); + return (ufs_vnodeops.vop_deleteextattr(ap)); if (ap->a_vp->v_type == VCHR) return (EOPNOTSUPP); @@ -1406,7 +1395,7 @@ vop_getextattr { fs = ip->i_fs; if (fs->fs_magic == FS_UFS1_MAGIC) - return (ufs_vnoperate((struct vop_generic_args *)ap)); + return (ufs_vnodeops.vop_getextattr(ap)); if (ap->a_vp->v_type == VCHR) return (EOPNOTSUPP); @@ -1469,7 +1458,7 @@ vop_listextattr { fs = ip->i_fs; if (fs->fs_magic == FS_UFS1_MAGIC) - return (ufs_vnoperate((struct vop_generic_args *)ap)); + return (ufs_vnodeops.vop_listextattr(ap)); if (ap->a_vp->v_type == VCHR) return (EOPNOTSUPP); @@ -1542,7 +1531,7 @@ vop_setextattr { fs = ip->i_fs; if (fs->fs_magic == FS_UFS1_MAGIC) - return (ufs_vnoperate((struct vop_generic_args *)ap)); + return (ufs_vnodeops.vop_setextattr(ap)); if (ap->a_vp->v_type == VCHR) return (EOPNOTSUPP); diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index 5e124e96dcf0..3c71d774e130 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -51,8 +51,8 @@ struct vop_generic_args; struct vop_inactive_args; struct vop_reclaim_args; -int ufs_vnoperate(struct vop_generic_args *); -int ufs_vnoperatefifo(struct vop_generic_args *); +extern struct vop_vector ufs_fifoops; +extern struct vop_vector ufs_vnodeops; int ufs_bmap(struct vop_bmap_args *); int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *, @@ -87,7 +87,7 @@ int ufs_reclaim(struct vop_reclaim_args *); void ffs_snapgone(struct inode *); vfs_root_t ufs_root; int ufs_uninit(struct vfsconf *); -int ufs_vinit(struct mount *, vop_t **, struct vnode **); +int ufs_vinit(struct mount *, struct vop_vector *, struct vnode **); /* * Soft update function prototypes. diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 166e84883d01..ede11e33a9e2 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2020,7 +2020,7 @@ ufsfifo_read(ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_read), ap); + error = fifo_specops.vop_read(ap); ip = VTOI(ap->a_vp); if ((ap->a_vp->v_mount->mnt_flag & MNT_NOATIME) == 0 && ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) @@ -2046,7 +2046,7 @@ ufsfifo_write(ap) uio = ap->a_uio; resid = uio->uio_resid; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_write), ap); + error = fifo_specops.vop_write(ap); ip = VTOI(ap->a_vp); if (ip != NULL && (uio->uio_resid != resid || (error == 0 && resid != 0))) ip->i_flag |= IN_CHANGE | IN_UPDATE; @@ -2073,7 +2073,7 @@ ufsfifo_close(ap) if (vp->v_usecount > 1) ufs_itimes(vp); VI_UNLOCK(vp); - return (VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), ap)); + return (fifo_specops.vop_close(ap)); } /* @@ -2087,7 +2087,7 @@ ufsfifo_kqfilter(ap) { int error; - error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_kqfilter), ap); + error = fifo_specops.vop_kqfilter(ap); if (error) error = ufs_kqfilter(ap); return (error); @@ -2221,7 +2221,7 @@ ufs_advlock(ap) int ufs_vinit(mntp, fifoops, vpp) struct mount *mntp; - vop_t **fifoops; + struct vop_vector *fifoops; struct vnode **vpp; { struct inode *ip; @@ -2574,108 +2574,79 @@ filt_ufsvnode(struct knote *kn, long hint) } /* Global vfs data structures for ufs. */ -static vop_t **ufs_vnodeop_p; -static struct vnodeopv_entry_desc ufs_vnodeop_entries[] = { - { &vop_default_desc, (vop_t *) vop_defaultop }, - { &vop_fsync_desc, (vop_t *) vop_panic }, - { &vop_read_desc, (vop_t *) vop_panic }, - { &vop_reallocblks_desc, (vop_t *) vop_panic }, - { &vop_write_desc, (vop_t *) vop_panic }, - { &vop_access_desc, (vop_t *) ufs_access }, - { &vop_advlock_desc, (vop_t *) ufs_advlock }, - { &vop_lock_desc, (vop_t *) ufs_lock }, - { &vop_bmap_desc, (vop_t *) ufs_bmap }, - { &vop_cachedlookup_desc, (vop_t *) ufs_lookup }, - { &vop_close_desc, (vop_t *) ufs_close }, - { &vop_create_desc, (vop_t *) ufs_create }, - { &vop_getattr_desc, (vop_t *) ufs_getattr }, - { &vop_inactive_desc, (vop_t *) ufs_inactive }, - { &vop_link_desc, (vop_t *) ufs_link }, - { &vop_lookup_desc, (vop_t *) vfs_cache_lookup }, - { &vop_mkdir_desc, (vop_t *) ufs_mkdir }, - { &vop_mknod_desc, (vop_t *) ufs_mknod }, - { &vop_open_desc, (vop_t *) ufs_open }, - { &vop_pathconf_desc, (vop_t *) ufs_pathconf }, - { &vop_poll_desc, (vop_t *) vop_stdpoll }, - { &vop_kqfilter_desc, (vop_t *) ufs_kqfilter }, - { &vop_print_desc, (vop_t *) ufs_print }, - { &vop_readdir_desc, (vop_t *) ufs_readdir }, - { &vop_readlink_desc, (vop_t *) ufs_readlink }, - { &vop_reclaim_desc, (vop_t *) ufs_reclaim }, - { &vop_remove_desc, (vop_t *) ufs_remove }, - { &vop_rename_desc, (vop_t *) ufs_rename }, - { &vop_rmdir_desc, (vop_t *) ufs_rmdir }, - { &vop_setattr_desc, (vop_t *) ufs_setattr }, +struct vop_vector ufs_vnodeops = { + .vop_default = &default_vnodeops, + .vop_fsync = VOP_PANIC, + .vop_read = VOP_PANIC, + .vop_reallocblks = VOP_PANIC, + .vop_write = VOP_PANIC, + .vop_access = ufs_access, + .vop_advlock = ufs_advlock, + .vop_lock = ufs_lock, + .vop_bmap = ufs_bmap, + .vop_cachedlookup = ufs_lookup, + .vop_close = ufs_close, + .vop_create = ufs_create, + .vop_getattr = ufs_getattr, + .vop_inactive = ufs_inactive, + .vop_link = ufs_link, + .vop_lookup = vfs_cache_lookup, + .vop_mkdir = ufs_mkdir, + .vop_mknod = ufs_mknod, + .vop_open = ufs_open, + .vop_pathconf = ufs_pathconf, + .vop_poll = vop_stdpoll, + .vop_kqfilter = ufs_kqfilter, + .vop_print = ufs_print, + .vop_readdir = ufs_readdir, + .vop_readlink = ufs_readlink, + .vop_reclaim = ufs_reclaim, + .vop_remove = ufs_remove, + .vop_rename = ufs_rename, + .vop_rmdir = ufs_rmdir, + .vop_setattr = ufs_setattr, #ifdef MAC - { &vop_setlabel_desc, (vop_t *) vop_stdsetlabel_ea }, + .vop_setlabel = vop_stdsetlabel_ea, #endif - { &vop_strategy_desc, (vop_t *) ufs_strategy }, - { &vop_symlink_desc, (vop_t *) ufs_symlink }, - { &vop_whiteout_desc, (vop_t *) ufs_whiteout }, + .vop_strategy = ufs_strategy, + .vop_symlink = ufs_symlink, + .vop_whiteout = ufs_whiteout, #ifdef UFS_EXTATTR - { &vop_getextattr_desc, (vop_t *) ufs_getextattr }, - { &vop_deleteextattr_desc, (vop_t *) ufs_deleteextattr }, - { &vop_setextattr_desc, (vop_t *) ufs_setextattr }, + .vop_getextattr = ufs_getextattr, + .vop_deleteextattr = ufs_deleteextattr, + .vop_setextattr = ufs_setextattr, #endif #ifdef UFS_ACL - { &vop_getacl_desc, (vop_t *) ufs_getacl }, - { &vop_setacl_desc, (vop_t *) ufs_setacl }, - { &vop_aclcheck_desc, (vop_t *) ufs_aclcheck }, + .vop_getacl = ufs_getacl, + .vop_setacl = ufs_setacl, + .vop_aclcheck = ufs_aclcheck, #endif - { NULL, NULL } }; -static struct vnodeopv_desc ufs_vnodeop_opv_desc = - { &ufs_vnodeop_p, ufs_vnodeop_entries }; -static vop_t **ufs_fifoop_p; -static struct vnodeopv_entry_desc ufs_fifoop_entries[] = { - { &vop_default_desc, (vop_t *) fifo_vnoperate }, - { &vop_fsync_desc, (vop_t *) vop_panic }, - { &vop_access_desc, (vop_t *) ufs_access }, - { &vop_close_desc, (vop_t *) ufsfifo_close }, - { &vop_getattr_desc, (vop_t *) ufs_getattr }, - { &vop_inactive_desc, (vop_t *) ufs_inactive }, - { &vop_kqfilter_desc, (vop_t *) ufsfifo_kqfilter }, - { &vop_print_desc, (vop_t *) ufs_print }, - { &vop_read_desc, (vop_t *) ufsfifo_read }, - { &vop_reclaim_desc, (vop_t *) ufs_reclaim }, - { &vop_setattr_desc, (vop_t *) ufs_setattr }, +struct vop_vector ufs_fifoops = { + .vop_default = &fifo_specops, + .vop_fsync = VOP_PANIC, + .vop_access = ufs_access, + .vop_close = ufsfifo_close, + .vop_getattr = ufs_getattr, + .vop_inactive = ufs_inactive, + .vop_kqfilter = ufsfifo_kqfilter, + .vop_print = ufs_print, + .vop_read = ufsfifo_read, + .vop_reclaim = ufs_reclaim, + .vop_setattr = ufs_setattr, #ifdef MAC - { &vop_setlabel_desc, (vop_t *) vop_stdsetlabel_ea }, + .vop_setlabel = vop_stdsetlabel_ea, #endif - { &vop_write_desc, (vop_t *) ufsfifo_write }, + .vop_write = ufsfifo_write, #ifdef UFS_EXTATTR - { &vop_getextattr_desc, (vop_t *) ufs_getextattr }, - { &vop_deleteextattr_desc, (vop_t *) ufs_deleteextattr }, - { &vop_setextattr_desc, (vop_t *) ufs_setextattr }, + .vop_getextattr = ufs_getextattr, + .vop_deleteextattr = ufs_deleteextattr, + .vop_setextattr = ufs_setextattr, #endif #ifdef UFS_ACL - { &vop_getacl_desc, (vop_t *) ufs_getacl }, - { &vop_setacl_desc, (vop_t *) ufs_setacl }, - { &vop_aclcheck_desc, (vop_t *) ufs_aclcheck }, + .vop_getacl = ufs_getacl, + .vop_setacl = ufs_setacl, + .vop_aclcheck = ufs_aclcheck, #endif - { NULL, NULL } }; -static struct vnodeopv_desc ufs_fifoop_opv_desc = - { &ufs_fifoop_p, ufs_fifoop_entries }; - -VNODEOP_SET(ufs_vnodeop_opv_desc); -VNODEOP_SET(ufs_fifoop_opv_desc); - -int -ufs_vnoperate(ap) - struct vop_generic_args /* { - struct vnodeop_desc *a_desc; - } */ *ap; -{ - return (VOCALL(ufs_vnodeop_p, ap->a_desc->vdesc_offset, ap)); -} - -int -ufs_vnoperatefifo(ap) - struct vop_generic_args /* { - struct vnodeop_desc *a_desc; - } */ *ap; -{ - return (VOCALL(ufs_fifoop_p, ap->a_desc->vdesc_offset, ap)); -}