From cb2d7c85a85791923bd76d6e730efe888d456b05 Mon Sep 17 00:00:00 2001 From: pjd Date: Thu, 15 Feb 2007 22:08:35 +0000 Subject: Move vnode-to-file-handle translation from vfs_vptofh to vop_vptofh method. This way we may support multiple structures in v_data vnode field within one file system without using black magic. Vnode-to-file-handle should be VOP in the first place, but was made VFS operation to keep interface as compatible as possible with SUN's VFS. BTW. Now Solaris also implements vnode-to-file-handle as VOP operation. VFS_VPTOFH() was left for API backward compatibility, but is marked for removal before 8.0-RELEASE. Approved by: mckusick Discussed with: many (on IRC) Tested with: ufs, msdosfs, cd9660, nullfs and zfs --- sys/fs/cd9660/cd9660_vfsops.c | 34 ---------------------------------- sys/fs/cd9660/cd9660_vnops.c | 29 +++++++++++++++++++++++++++++ sys/fs/cd9660/iso.h | 7 +++++++ sys/fs/hpfs/hpfs_vfsops.c | 18 ------------------ sys/fs/hpfs/hpfs_vnops.c | 20 ++++++++++++++++++++ sys/fs/msdosfs/msdosfs_vfsops.c | 17 ----------------- sys/fs/msdosfs/msdosfs_vnops.c | 21 +++++++++++++++++++++ sys/fs/ntfs/ntfs_vfsops.c | 20 -------------------- sys/fs/ntfs/ntfs_vnops.c | 22 ++++++++++++++++++++++ sys/fs/nullfs/null_vfsops.c | 13 ------------- sys/fs/nullfs/null_vnops.c | 10 ++++++++++ sys/fs/udf/udf.h | 7 +++++++ sys/fs/udf/udf_vfsops.c | 23 ----------------------- sys/fs/udf/udf_vnops.c | 16 ++++++++++++++++ sys/fs/umapfs/umap_vfsops.c | 13 ------------- sys/fs/umapfs/umap_vnops.c | 15 +++++++++++++++ sys/fs/unionfs/union_vfsops.c | 8 -------- sys/fs/unionfs/union_vnops.c | 7 +++++++ sys/gnu/fs/ext2fs/ext2_vfsops.c | 22 ---------------------- sys/gnu/fs/ext2fs/ext2_vnops.c | 25 +++++++++++++++++++++++++ sys/gnu/fs/reiserfs/reiserfs_vfsops.c | 26 -------------------------- sys/gnu/fs/reiserfs/reiserfs_vnops.c | 29 +++++++++++++++++++++++++++++ sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c | 11 ----------- sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c | 16 ++++++++++++++++ sys/kern/vfs_default.c | 11 +++++++++++ sys/kern/vfs_export.c | 2 +- sys/kern/vfs_init.c | 4 ++++ sys/kern/vfs_syscalls.c | 4 ++-- sys/kern/vnode_if.src | 8 ++++++++ sys/nfsserver/nfs_serv.c | 12 ++++++------ sys/sys/mount.h | 18 +++++++++++++++++- sys/sys/vnode.h | 1 + sys/ufs/ffs/ffs_vfsops.c | 22 ---------------------- sys/ufs/ffs/ffs_vnops.c | 28 ++++++++++++++++++++++++++++ 34 files changed, 302 insertions(+), 237 deletions(-) diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 8f94c6a..319b192 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -75,7 +75,6 @@ static vfs_root_t cd9660_root; static vfs_statfs_t cd9660_statfs; static vfs_vget_t cd9660_vget; static vfs_fhtovp_t cd9660_fhtovp; -static vfs_vptofh_t cd9660_vptofh; static struct vfsops cd9660_vfsops = { .vfs_fhtovp = cd9660_fhtovp, @@ -85,7 +84,6 @@ static struct vfsops cd9660_vfsops = { .vfs_statfs = cd9660_statfs, .vfs_unmount = cd9660_unmount, .vfs_vget = cd9660_vget, - .vfs_vptofh = cd9660_vptofh, }; VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY); MODULE_VERSION(cd9660, 1); @@ -595,13 +593,6 @@ cd9660_statfs(mp, sbp, td) * - check that the generation number matches */ -struct ifid { - u_short ifid_len; - u_short ifid_pad; - int ifid_ino; - long ifid_start; -}; - /* ARGSUSED */ static int cd9660_fhtovp(mp, fhp, vpp) @@ -821,28 +812,3 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) *vpp = vp; return (0); } - -/* - * Vnode pointer to File handle - */ -/* ARGSUSED */ -static int -cd9660_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - struct iso_node *ip = VTOI(vp); - struct ifid *ifhp; - - ifhp = (struct ifid *)fhp; - ifhp->ifid_len = sizeof(struct ifid); - - ifhp->ifid_ino = ip->i_number; - ifhp->ifid_start = ip->iso_start; - -#ifdef ISOFS_DBG - printf("vptofh: ino %d, start %ld\n", - ifhp->ifid_ino,ifhp->ifid_start); -#endif - return 0; -} diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 1cbfaee..ab6fea8 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -74,6 +74,7 @@ static int iso_shipdir(struct isoreaddir *idp); static vop_readdir_t cd9660_readdir; static vop_readlink_t cd9660_readlink; static vop_strategy_t cd9660_strategy; +static vop_vptofh_t cd9660_vptofh; /* * Setattr call. Only allowed for block and character special devices. @@ -798,6 +799,32 @@ cd9660_pathconf(ap) } /* + * Vnode pointer to File handle + */ +static int +cd9660_vptofh(ap) + struct vop_vptofh_args /* { + struct vnode *a_vp; + struct fid *a_fhp; + } */ *ap; +{ + struct iso_node *ip = VTOI(ap->a_vp); + struct ifid *ifhp; + + ifhp = (struct ifid *)ap->a_fhp; + ifhp->ifid_len = sizeof(struct ifid); + + ifhp->ifid_ino = ip->i_number; + ifhp->ifid_start = ip->iso_start; + +#ifdef ISOFS_DBG + printf("vptofh: ino %d, start %ld\n", + ifhp->ifid_ino,ifhp->ifid_start); +#endif + return 0; +} + +/* * Global vfs data structures for cd9660 */ struct vop_vector cd9660_vnodeops = { @@ -817,6 +844,7 @@ struct vop_vector cd9660_vnodeops = { .vop_reclaim = cd9660_reclaim, .vop_setattr = cd9660_setattr, .vop_strategy = cd9660_strategy, + .vop_vptofh = cd9660_vptofh, }; /* @@ -830,4 +858,5 @@ struct vop_vector cd9660_fifoops = { .vop_inactive = cd9660_inactive, .vop_reclaim = cd9660_reclaim, .vop_setattr = cd9660_setattr, + .vop_vptofh = cd9660_vptofh, }; diff --git a/sys/fs/cd9660/iso.h b/sys/fs/cd9660/iso.h index 0851341..0988bf6 100644 --- a/sys/fs/cd9660/iso.h +++ b/sys/fs/cd9660/iso.h @@ -249,6 +249,13 @@ struct iso_mnt { void *im_l2d; }; +struct ifid { + u_short ifid_len; + u_short ifid_pad; + int ifid_ino; + long ifid_start; +}; + #define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data)) #define blkoff(imp, loc) ((loc) & (imp)->im_bmask) diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 92735ec..b0a303a 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -68,7 +68,6 @@ static vfs_mount_t hpfs_mount; static vfs_root_t hpfs_root; static vfs_statfs_t hpfs_statfs; static vfs_unmount_t hpfs_unmount; -static vfs_vptofh_t hpfs_vptofh; static int hpfs_cmount ( @@ -435,22 +434,6 @@ hpfs_fhtovp( } static int -hpfs_vptofh( - struct vnode *vp, - struct fid *fhp) -{ - register struct hpfsnode *hpp; - register struct hpfid *hpfhp; - - hpp = VTOHP(vp); - hpfhp = (struct hpfid *)fhp; - hpfhp->hpfid_len = sizeof(struct hpfid); - hpfhp->hpfid_ino = hpp->h_no; - /* hpfhp->hpfid_gen = hpp->h_gen; */ - return (0); -} - -static int hpfs_vget( struct mount *mp, ino_t ino, @@ -550,6 +533,5 @@ static struct vfsops hpfs_vfsops = { .vfs_statfs = hpfs_statfs, .vfs_unmount = hpfs_unmount, .vfs_vget = hpfs_vget, - .vfs_vptofh = hpfs_vptofh, }; VFS_SET(hpfs_vfsops, hpfs, 0); diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index 550f613..ffe13d9 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -78,6 +78,7 @@ static vop_remove_t hpfs_remove; static vop_bmap_t hpfs_bmap; static vop_fsync_t hpfs_fsync; static vop_pathconf_t hpfs_pathconf; +static vop_vptofh_t hpfs_vptofh; static int hpfs_fsync(ap) @@ -1208,6 +1209,24 @@ hpfs_pathconf(ap) /* NOTREACHED */ } +int +hpfs_vptofh(ap) + struct vop_vptofh_args /* { + struct vnode *a_vp; + struct fid *a_fhp; + } */ *ap; +{ + register struct hpfsnode *hpp; + register struct hpfid *hpfhp; + + hpp = VTOHP(ap->a_vp); + hpfhp = (struct hpfid *)ap->a_fhp; + hpfhp->hpfid_len = sizeof(struct hpfid); + hpfhp->hpfid_ino = hpp->h_no; + /* hpfhp->hpfid_gen = hpp->h_gen; */ + return (0); +} + /* * Global vfs data structures @@ -1235,4 +1254,5 @@ struct vop_vector hpfs_vnodeops = { .vop_setattr = hpfs_setattr, .vop_strategy = hpfs_strategy, .vop_write = hpfs_write, + .vop_vptofh = hpfs_vptofh, }; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index adefd76..3b53b0a 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -112,7 +112,6 @@ static vfs_root_t msdosfs_root; static vfs_statfs_t msdosfs_statfs; static vfs_sync_t msdosfs_sync; static vfs_unmount_t msdosfs_unmount; -static vfs_vptofh_t msdosfs_vptofh; /* Maximum length of a character set name (arbitrary). */ #define MAXCSLEN 64 @@ -931,21 +930,6 @@ msdosfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) return (0); } -static int -msdosfs_vptofh(struct vnode *vp, struct fid *fhp) -{ - struct denode *dep; - struct defid *defhp; - - dep = VTODE(vp); - defhp = (struct defid *)fhp; - defhp->defid_len = sizeof(struct defid); - defhp->defid_dirclust = dep->de_dirclust; - defhp->defid_dirofs = dep->de_diroffset; - /* defhp->defid_gen = dep->de_gen; */ - return (0); -} - static struct vfsops msdosfs_vfsops = { .vfs_fhtovp = msdosfs_fhtovp, .vfs_mount = msdosfs_mount, @@ -954,7 +938,6 @@ static struct vfsops msdosfs_vfsops = { .vfs_statfs = msdosfs_statfs, .vfs_sync = msdosfs_sync, .vfs_unmount = msdosfs_unmount, - .vfs_vptofh = msdosfs_vptofh, }; VFS_SET(msdosfs_vfsops, msdosfs, 0); diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 589f13a..33e5292 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -107,6 +107,7 @@ static vop_bmap_t msdosfs_bmap; static vop_strategy_t msdosfs_strategy; static vop_print_t msdosfs_print; static vop_pathconf_t msdosfs_pathconf; +static vop_vptofh_t msdosfs_vptofh; /* * Some general notes: @@ -1904,6 +1905,25 @@ msdosfs_advlock(ap) return (lf_advlock(ap, &dep->de_lockf, dep->de_FileSize)); } +static int +msdosfs_vptofh(ap) + struct vop_vptofh_args /* { + struct vnode *a_vp; + struct fid *a_fhp; + } */ *ap; +{ + struct denode *dep; + struct defid *defhp; + + dep = VTODE(ap->a_vp); + defhp = (struct defid *)ap->a_fhp; + defhp->defid_len = sizeof(struct defid); + defhp->defid_dirclust = dep->de_dirclust; + defhp->defid_dirofs = dep->de_diroffset; + /* defhp->defid_gen = dep->de_gen; */ + return (0); +} + /* Global vfs data structures for msdosfs */ struct vop_vector msdosfs_vnodeops = { .vop_default = &default_vnodeops, @@ -1934,4 +1954,5 @@ struct vop_vector msdosfs_vnodeops = { .vop_strategy = msdosfs_strategy, .vop_symlink = msdosfs_symlink, .vop_write = msdosfs_write, + .vop_vptofh = msdosfs_vptofh, }; diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 1f46d01..30c7a59 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -80,7 +80,6 @@ static vfs_mount_t ntfs_mount; static vfs_root_t ntfs_root; static vfs_statfs_t ntfs_statfs; static vfs_unmount_t ntfs_unmount; -static vfs_vptofh_t ntfs_vptofh; static b_strategy_t ntfs_bufstrategy; @@ -622,24 +621,6 @@ ntfs_fhtovp( return (0); } -static int -ntfs_vptofh( - struct vnode *vp, - struct fid *fhp) -{ - register struct ntnode *ntp; - register struct ntfid *ntfhp; - - ddprintf(("ntfs_fhtovp(): %p\n", vp)); - - ntp = VTONT(vp); - ntfhp = (struct ntfid *)fhp; - ntfhp->ntfid_len = sizeof(struct ntfid); - ntfhp->ntfid_ino = ntp->i_number; - /* ntfhp->ntfid_gen = ntp->i_gen; */ - return (0); -} - int ntfs_vgetex( struct mount *mp, @@ -787,7 +768,6 @@ static struct vfsops ntfs_vfsops = { .vfs_uninit = ntfs_uninit, .vfs_unmount = ntfs_unmount, .vfs_vget = ntfs_vget, - .vfs_vptofh = ntfs_vptofh, }; VFS_SET(ntfs_vfsops, ntfs, 0); MODULE_VERSION(ntfs, 1); diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index 0b90b60..bc30044 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -80,6 +80,7 @@ static vop_readdir_t ntfs_readdir; static vop_cachedlookup_t ntfs_lookup; static vop_fsync_t ntfs_fsync; static vop_pathconf_t ntfs_pathconf; +static vop_vptofh_t ntfs_vptofh; int ntfs_prtactive = 1; /* 1 => print out reclaim of active vnodes */ @@ -731,6 +732,26 @@ ntfs_pathconf(ap) /* NOTREACHED */ } +int +ntfs_vptofh(ap) + struct vop_vptofh_args /* { + struct vnode *a_vp; + struct fid *a_fhp; + } */ *ap; +{ + register struct ntnode *ntp; + register struct ntfid *ntfhp; + + ddprintf(("ntfs_fhtovp(): %p\n", ap->a_vp)); + + ntp = VTONT(ap->a_vp); + ntfhp = (struct ntfid *)ap->a_fhp; + ntfhp->ntfid_len = sizeof(struct ntfid); + ntfhp->ntfid_ino = ntp->i_number; + /* ntfhp->ntfid_gen = ntp->i_gen; */ + return (0); +} + /* * Global vfs data structures */ @@ -752,4 +773,5 @@ struct vop_vector ntfs_vnodeops = { .vop_reclaim = ntfs_reclaim, .vop_strategy = ntfs_strategy, .vop_write = ntfs_write, + .vop_vptofh = ntfs_vptofh, }; diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 125c67a..7094cfb 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -63,7 +63,6 @@ static vfs_sync_t nullfs_sync; static vfs_statfs_t nullfs_statfs; static vfs_unmount_t nullfs_unmount; static vfs_vget_t nullfs_vget; -static vfs_vptofh_t nullfs_vptofh; static vfs_extattrctl_t nullfs_extattrctl; /* @@ -344,17 +343,6 @@ nullfs_fhtovp(mp, fidp, vpp) return (null_nodeget(mp, *vpp, vpp)); } -static int -nullfs_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - struct vnode *lvp; - - lvp = NULLVPTOLOWERVP(vp); - return VFS_VPTOFH(lvp, fhp); -} - static int nullfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td) struct mount *mp; @@ -381,7 +369,6 @@ static struct vfsops null_vfsops = { .vfs_uninit = nullfs_uninit, .vfs_unmount = nullfs_unmount, .vfs_vget = nullfs_vget, - .vfs_vptofh = nullfs_vptofh, }; VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK); diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 4459fe1..fb20667 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -708,6 +708,15 @@ null_getwritemount(struct vop_getwritemount_args *ap) return (0); } +static int +null_vptofh(struct vop_vptofh_args *ap) +{ + struct vnode *lvp; + + lvp = NULLVPTOLOWERVP(ap->a_vp); + return VOP_VPTOFH(lvp, ap->a_fhp); +} + /* * Global vfs data structures */ @@ -728,4 +737,5 @@ struct vop_vector null_vnodeops = { .vop_setattr = null_setattr, .vop_strategy = VOP_EOPNOTSUPP, .vop_unlock = null_unlock, + .vop_vptofh = null_vptofh, }; diff --git a/sys/fs/udf/udf.h b/sys/fs/udf/udf.h index a43f0cd..05eb2e4 100644 --- a/sys/fs/udf/udf.h +++ b/sys/fs/udf/udf.h @@ -74,6 +74,13 @@ struct udf_dirstream { int fid_fragment; }; +struct ifid { + u_short ifid_len; + u_short ifid_pad; + int ifid_ino; + long ifid_start; +}; + #define VFSTOUDFFS(mp) ((struct udf_mnt *)((mp)->mnt_data)) #define VTON(vp) ((struct udf_node *)((vp)->v_data)) diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c index 78247f3..ee58725 100644 --- a/sys/fs/udf/udf_vfsops.c +++ b/sys/fs/udf/udf_vfsops.c @@ -117,7 +117,6 @@ static vfs_root_t udf_root; static vfs_statfs_t udf_statfs; static vfs_unmount_t udf_unmount; static vfs_fhtovp_t udf_fhtovp; -static vfs_vptofh_t udf_vptofh; static int udf_find_partmaps(struct udf_mnt *, struct logvol_desc *); @@ -130,7 +129,6 @@ static struct vfsops udf_vfsops = { .vfs_uninit = udf_uninit, .vfs_unmount = udf_unmount, .vfs_vget = udf_vget, - .vfs_vptofh = udf_vptofh, }; VFS_SET(udf_vfsops, udf, VFCF_READONLY); @@ -687,13 +685,6 @@ udf_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) return (0); } -struct ifid { - u_short ifid_len; - u_short ifid_pad; - int ifid_ino; - long ifid_start; -}; - static int udf_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) { @@ -719,20 +710,6 @@ udf_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) } static int -udf_vptofh (struct vnode *vp, struct fid *fhp) -{ - struct udf_node *node; - struct ifid *ifhp; - - node = VTON(vp); - ifhp = (struct ifid *)fhp; - ifhp->ifid_len = sizeof(struct ifid); - ifhp->ifid_ino = node->hash_id; - - return (0); -} - -static int udf_find_partmaps(struct udf_mnt *udfmp, struct logvol_desc *lvd) { struct part_map_spare *pms; diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index 32ffc47..b0c6fcd 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -67,6 +67,7 @@ static vop_strategy_t udf_strategy; static vop_bmap_t udf_bmap; static vop_cachedlookup_t udf_lookup; static vop_reclaim_t udf_reclaim; +static vop_vptofh_t udf_vptofh; static int udf_readatoffset(struct udf_node *node, int *size, off_t offset, struct buf **bp, uint8_t **data); static int udf_bmap_internal(struct udf_node *node, off_t offset, @@ -88,6 +89,7 @@ static struct vop_vector udf_vnodeops = { .vop_readlink = udf_readlink, .vop_reclaim = udf_reclaim, .vop_strategy = udf_strategy, + .vop_vptofh = udf_vptofh, }; MALLOC_DEFINE(M_UDFFID, "udf_fid", "UDF FileId structure"); @@ -1022,6 +1024,20 @@ udf_reclaim(struct vop_reclaim_args *a) return (0); } +static int +udf_vptofh(struct vop_vptofh_args *a) +{ + struct udf_node *node; + struct ifid *ifhp; + + node = VTON(a->a_vp); + ifhp = (struct ifid *)a->a_fhp; + ifhp->ifid_len = sizeof(struct ifid); + ifhp->ifid_ino = node->hash_id; + + return (0); +} + /* * Read the block and then set the data pointer to correspond with the * offset passed in. Only read in at most 'size' bytes, and then set 'size' diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c index 694ce33..d40dd56 100644 --- a/sys/fs/umapfs/umap_vfsops.c +++ b/sys/fs/umapfs/umap_vfsops.c @@ -59,7 +59,6 @@ static vfs_quotactl_t umapfs_quotactl; static vfs_statfs_t umapfs_statfs; static vfs_unmount_t umapfs_unmount; static vfs_fhtovp_t umapfs_fhtovp; -static vfs_vptofh_t umapfs_vptofh; static vfs_checkexp_t umapfs_checkexp; static vfs_vget_t umapfs_vget; static vfs_extattrctl_t umapfs_extattrctl; @@ -384,17 +383,6 @@ umapfs_checkexp(mp, nam, exflagsp, credanonp) } static int -umapfs_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - struct vnode *lvp; - - lvp = UMAPVPTOLOWERVP(vp); - return (VFS_VPTOFH(lvp, fhp)); -} - -static int umapfs_extattrctl(mp, cmd, filename_vp, namespace, attrname, td) struct mount *mp; int cmd; @@ -419,7 +407,6 @@ static struct vfsops umap_vfsops = { .vfs_statfs = umapfs_statfs, .vfs_unmount = umapfs_unmount, .vfs_vget = umapfs_vget, - .vfs_vptofh = umapfs_vptofh, }; VFS_SET(umap_vfsops, umapfs, VFCF_LOOPBACK); diff --git a/sys/fs/umapfs/umap_vnops.c b/sys/fs/umapfs/umap_vnops.c index 92a3bc4..eb78b98 100644 --- a/sys/fs/umapfs/umap_vnops.c +++ b/sys/fs/umapfs/umap_vnops.c @@ -62,6 +62,7 @@ static vop_print_t umap_print; static vop_reclaim_t umap_reclaim; static vop_rename_t umap_rename; static vop_unlock_t umap_unlock; +static vop_vptofh_t umap_vptofh; /* * This is the 10-Apr-92 bypass routine. @@ -498,6 +499,19 @@ umap_rename(ap) return error; } +static int +umap_vptofh(ap) + struct vop_vptofh_args /* { + struct vnode *a_vp; + struct fid *a_fhp; + } */ *ap; +{ + struct vnode *lvp; + + lvp = UMAPVPTOLOWERVP(ap->a_vp); + return (VOP_VPTOFH(lvp, ap->a_fhp)); +} + /* * Global vfs data structures */ @@ -516,4 +530,5 @@ static struct vop_vector umap_vnodeops = { .vop_reclaim = umap_reclaim, .vop_rename = umap_rename, .vop_unlock = umap_unlock, + .vop_vptofh = umap_vptofh, }; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index 53baf52..cb7b504 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -61,7 +61,6 @@ static vfs_sync_t unionfs_sync; static vfs_statfs_t unionfs_statfs; static vfs_unmount_t unionfs_unmount; static vfs_vget_t unionfs_vget; -static vfs_vptofh_t unionfs_vptofh; static vfs_extattrctl_t unionfs_extattrctl; static struct vfsops unionfs_vfsops; @@ -505,12 +504,6 @@ unionfs_checkexp(struct mount *mp, struct sockaddr *nam, int *extflagsp, } static int -unionfs_vptofh(struct vnode *vp, struct fid *fhp) -{ - return (EOPNOTSUPP); -} - -static int unionfs_extattrctl(struct mount *mp, int cmd, struct vnode *filename_vp, int namespace, const char *attrname, struct thread *td) { @@ -542,7 +535,6 @@ static struct vfsops unionfs_vfsops = { .vfs_uninit = unionfs_uninit, .vfs_unmount = unionfs_unmount, .vfs_vget = unionfs_vget, - .vfs_vptofh = unionfs_vptofh, }; VFS_SET(unionfs_vfsops, unionfs, VFCF_LOOPBACK); diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 0e35d21..42d6dce 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -2229,6 +2229,12 @@ unionfs_setlabel(struct vop_setlabel_args *ap) return (error); } +static int +unionfs_vptofh(struct vop_vptofh_args *ap) +{ + return (EOPNOTSUPP); +} + struct vop_vector unionfs_vnodeops = { .vop_default = &default_vnodeops, @@ -2275,4 +2281,5 @@ struct vop_vector unionfs_vnodeops = { .vop_unlock = unionfs_unlock, .vop_whiteout = unionfs_whiteout, .vop_write = unionfs_write, + .vop_vptofh = unionfs_vptofh, }; diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 4168f91..7abcb7e 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -92,7 +92,6 @@ static vfs_statfs_t ext2_statfs; static vfs_sync_t ext2_sync; static vfs_vget_t ext2_vget; static vfs_fhtovp_t ext2_fhtovp; -static vfs_vptofh_t ext2_vptofh; static vfs_mount_t ext2_mount; MALLOC_DEFINE(M_EXT2NODE, "ext2_node", "EXT2 vnode private part"); @@ -106,7 +105,6 @@ static struct vfsops ext2fs_vfsops = { .vfs_sync = ext2_sync, .vfs_unmount = ext2_unmount, .vfs_vget = ext2_vget, - .vfs_vptofh = ext2_vptofh, }; VFS_SET(ext2fs_vfsops, ext2fs, 0); @@ -1099,26 +1097,6 @@ ext2_fhtovp(mp, fhp, vpp) } /* - * Vnode pointer to File handle - */ -/* ARGSUSED */ -static int -ext2_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - struct inode *ip; - struct ufid *ufhp; - - ip = VTOI(vp); - ufhp = (struct ufid *)fhp; - ufhp->ufid_len = sizeof(struct ufid); - ufhp->ufid_ino = ip->i_number; - ufhp->ufid_gen = ip->i_gen; - return (0); -} - -/* * Write a superblock and associated information back to disk. */ static int diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index 4ea62c6..5ed7d11 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -107,6 +107,7 @@ static vop_setattr_t ext2_setattr; static vop_strategy_t ext2_strategy; static vop_symlink_t ext2_symlink; static vop_write_t ext2_write; +static vop_vptofh_t ext2_vptofh; static vop_close_t ext2fifo_close; static vop_kqfilter_t ext2fifo_kqfilter; static int filt_ext2read(struct knote *kn, long hint); @@ -147,6 +148,7 @@ struct vop_vector ext2_vnodeops = { .vop_strategy = ext2_strategy, .vop_symlink = ext2_symlink, .vop_write = ext2_write, + .vop_vptofh = ext2_vptofh, }; struct vop_vector ext2_fifoops = { @@ -162,6 +164,7 @@ struct vop_vector ext2_fifoops = { .vop_reclaim = ext2_reclaim, .vop_setattr = ext2_setattr, .vop_write = VOP_PANIC, + .vop_vptofh = ext2_vptofh, }; #include @@ -1542,6 +1545,28 @@ ext2_advlock(ap) } /* + * Vnode pointer to File handle + */ +/* ARGSUSED */ +static int +ext2_vptofh(ap) + struct vop_vptofh_args /* { + struct vnode *a_vp; + struct fid *a_fhp; + } */ *ap; +{ + struct inode *ip; + struct ufid *ufhp; + + ip = VTOI(ap->a_vp); + ufhp = (struct ufid *)ap->a_fhp; + ufhp->ufid_len = sizeof(struct ufid); + ufhp->ufid_ino = ip->i_number; + ufhp->ufid_gen = ip->i_gen; + return (0); +} + +/* * Initialize the vnode associated with a new inode, handle aliased * vnodes. */ diff --git a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c index 4ace2da..e947379 100644 --- a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c +++ b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c @@ -26,7 +26,6 @@ static vfs_mount_t reiserfs_mount; static vfs_root_t reiserfs_root; static vfs_statfs_t reiserfs_statfs; static vfs_unmount_t reiserfs_unmount; -static vfs_vptofh_t reiserfs_vptofh; static int reiserfs_mountfs(struct vnode *devvp, struct mount *mp, struct thread *td); @@ -377,30 +376,6 @@ reiserfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) return (0); } -/* - * Vnode pointer to File handle - */ -static int -reiserfs_vptofh(struct vnode *vp, struct fid *fhp) -{ - struct rfid *rfhp; - struct reiserfs_node *ip; - - ip = VTOI(vp); - reiserfs_log(LOG_DEBUG, - "fill *fhp with inode (dirid=%d, objectid=%d)\n", - ip->i_ino, ip->i_number); - - rfhp = (struct rfid *)fhp; - rfhp->rfid_len = sizeof(struct rfid); - rfhp->rfid_dirid = ip->i_ino; - rfhp->rfid_objectid = ip->i_number; - rfhp->rfid_gen = ip->i_generation; - - reiserfs_log(LOG_DEBUG, "return it\n"); - return (0); -} - /* ------------------------------------------------------------------- * Functions for the journal * -------------------------------------------------------------------*/ @@ -1180,7 +1155,6 @@ static struct vfsops reiser_vfsops = { .vfs_statfs = reiserfs_statfs, //.vfs_sync = reiserfs_sync, //.vfs_vget = reiserfs_vget, - .vfs_vptofh = reiserfs_vptofh, }; VFS_SET(reiser_vfsops, reiserfs, VFCF_READONLY); diff --git a/sys/gnu/fs/reiserfs/reiserfs_vnops.c b/sys/gnu/fs/reiserfs/reiserfs_vnops.c index 9b0ba7d..14242464 100644 --- a/sys/gnu/fs/reiserfs/reiserfs_vnops.c +++ b/sys/gnu/fs/reiserfs/reiserfs_vnops.c @@ -16,6 +16,7 @@ static vop_open_t reiserfs_open; static vop_pathconf_t reiserfs_pathconf; static vop_readlink_t reiserfs_readlink; static vop_strategy_t reiserfs_strategy; +static vop_vptofh_t reiserfs_vptofh; /* Global vfs data structures for ReiserFS */ struct vop_vector reiserfs_vnodeops = { @@ -34,6 +35,7 @@ struct vop_vector reiserfs_vnodeops = { .vop_readlink = reiserfs_readlink, .vop_pathconf = reiserfs_pathconf, .vop_strategy = reiserfs_strategy, + .vop_vptofh = reiserfs_vptofh, }; struct vop_vector reiserfs_specops = { @@ -351,3 +353,30 @@ reiserfs_strategy(struct vop_strategy_args /* { bufdone(bp); return (error); } + +/* + * Vnode pointer to File handle + */ +static int +reiserfs_vptofh(struct vop_vptofh_args /* { + struct vnode *a_vp; + struct fid *a_fhp; + } */ *ap) +{ + struct rfid *rfhp; + struct reiserfs_node *ip; + + ip = VTOI(ap->a_vp); + reiserfs_log(LOG_DEBUG, + "fill *fhp with inode (dirid=%d, objectid=%d)\n", + ip->i_ino, ip->i_number); + + rfhp = (struct rfid *)ap->a_fhp; + rfhp->rfid_len = sizeof(struct rfid); + rfhp->rfid_dirid = ip->i_ino; + rfhp->rfid_objectid = ip->i_number; + rfhp->rfid_gen = ip->i_generation; + + reiserfs_log(LOG_DEBUG, "return it\n"); + return (0); +} diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c index da3650b..683024a 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c @@ -81,7 +81,6 @@ static vfs_statfs_t _xfs_statfs; static vfs_sync_t _xfs_sync; static vfs_vget_t _xfs_vget; static vfs_fhtovp_t _xfs_fhtovp; -static vfs_vptofh_t _xfs_vptofh; static vfs_init_t _xfs_init; static vfs_uninit_t _xfs_uninit; static vfs_extattrctl_t _xfs_extattrctl; @@ -383,15 +382,6 @@ _xfs_fhtovp(mp, fidp, vpp) } static int -_xfs_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - printf("xfs_vptofh"); - return ENOSYS; -} - -static int _xfs_extattrctl(struct mount *mp, int cm, struct vnode *filename_v, int attrnamespace, const char *attrname, @@ -429,7 +419,6 @@ static struct vfsops xfs_fsops = { .vfs_sync = _xfs_sync, .vfs_vget = _xfs_vget, .vfs_fhtovp = _xfs_fhtovp, - .vfs_vptofh = _xfs_vptofh, .vfs_init = _xfs_init, .vfs_uninit = _xfs_uninit, .vfs_extattrctl = _xfs_extattrctl, diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c b/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c index be95936..c894095 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c @@ -115,6 +115,7 @@ static vop_setextattr_t _xfs_setextattr; static vop_strategy_t _xfs_strategy; static vop_symlink_t _xfs_symlink; static vop_write_t _xfs_write; +static vop_vptofh_t _xfs_vptofh; struct vop_vector xfs_vnops = { .vop_default = &default_vnodeops, @@ -148,6 +149,7 @@ struct vop_vector xfs_vnops = { .vop_strategy = _xfs_strategy, .vop_symlink = _xfs_symlink, .vop_write = _xfs_write, + .vop_vptofh = _xfs_vptofh, }; /* @@ -171,6 +173,7 @@ struct vop_vector xfs_fifoops = { .vop_reclaim = _xfs_reclaim, .vop_setattr = _xfs_setattr, .vop_write = _xfsfifo_write, + .vop_vptofh = _xfs_vptofh, }; static int @@ -1681,3 +1684,16 @@ vop_deleteextattr { ap->a_cred, error); return (error); } + +static int +_xfs_vptofh(struct vop_vptofh_args *ap) +/* +vop_vptofh { + IN struct vnode *a_vp; + IN struct fid *a_fhp; +}; +*/ +{ + printf("xfs_vptofh"); + return ENOSYS; +} diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 38f0e47..92d920a 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -96,6 +96,7 @@ struct vop_vector default_vnodeops = { .vop_revoke = VOP_PANIC, .vop_strategy = vop_nostrategy, .vop_unlock = vop_stdunlock, + .vop_vptofh = vop_stdvptofh, }; /* @@ -511,6 +512,12 @@ vop_stdputpages(ap) ap->a_sync, ap->a_rtvals); } +int +vop_stdvptofh(struct vop_vptofh_args *ap) +{ + return VFS_VPTOFH(ap->a_vp, ap->a_fhp); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. @@ -536,6 +543,7 @@ vfs_stdstatfs (mp, sbp, td) return (EOPNOTSUPP); } +#if __FreeBSD_version < 800000 int vfs_stdvptofh (vp, fhp) struct vnode *vp; @@ -544,6 +552,9 @@ vfs_stdvptofh (vp, fhp) return (EOPNOTSUPP); } +#else +#error Remove this code, vfs_vptofh was replaced with vop_vptofh. +#endif int vfs_stdquotactl (mp, cmds, uid, arg, td) diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 8a2906b..e1d6187 100644 --- a/sys/kern/vfs_export.c +++ b/sys/kern/vfs_export.c @@ -337,7 +337,7 @@ vfs_setpublicfs(struct mount *mp, struct netexport *nep, if ((error = VFS_ROOT(mp, LK_EXCLUSIVE, &rvp, curthread /* XXX */))) return (error); - if ((error = VFS_VPTOFH(rvp, &nfs_pub.np_handle.fh_fid))) + if ((error = VOP_VPTOFH(rvp, &nfs_pub.np_handle.fh_fid))) return (error); vput(rvp); diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index 143eaf5..7b2aeef 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -215,9 +215,13 @@ vfs_register(struct vfsconf *vfc) if (vfsops->vfs_checkexp == NULL) /* check if file system is exported */ vfsops->vfs_checkexp = vfs_stdcheckexp; +#if __FreeBSD_version < 800000 if (vfsops->vfs_vptofh == NULL) /* turn a vnode into an NFS file handle */ vfsops->vfs_vptofh = vfs_stdvptofh; +#else +#error Remove this code, vfs_vptofh was replaced with vop_vptofh. +#endif if (vfsops->vfs_init == NULL) /* file system specific initialisation */ vfsops->vfs_init = vfs_stdinit; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 2f18652..47a6372 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3979,7 +3979,7 @@ lgetfh(td, uap) vp = nd.ni_vp; bzero(&fh, sizeof(fh)); fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(vp, &fh.fh_fid); + error = VOP_VPTOFH(vp, &fh.fh_fid); vput(vp); VFS_UNLOCK_GIANT(vfslocked); if (error) @@ -4018,7 +4018,7 @@ getfh(td, uap) vp = nd.ni_vp; bzero(&fh, sizeof(fh)); fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(vp, &fh.fh_fid); + error = VOP_VPTOFH(vp, &fh.fh_fid); vput(vp); VFS_UNLOCK_GIANT(vfslocked); if (error) diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index e3b338b..d29043e 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -579,3 +579,11 @@ vop_setlabel { IN struct ucred *cred; IN struct thread *td; }; + + +%% setlabel vp = = = + +vop_vptofh { + IN struct vnode *vp; + IN struct fid *fhp; +}; diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index 9418672..4b5ba21 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -634,7 +634,7 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, vp = ndp->ni_vp; bzero((caddr_t)fhp, sizeof(nfh)); fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(vp, &fhp->fh_fid); + error = VOP_VPTOFH(vp, &fhp->fh_fid); if (!error) error = VOP_GETATTR(vp, vap, cred, td); @@ -1977,7 +1977,7 @@ nfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (!error) { bzero((caddr_t)fhp, sizeof(nfh)); fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(nd.ni_vp, &fhp->fh_fid); + error = VOP_VPTOFH(nd.ni_vp, &fhp->fh_fid); if (!error) error = VOP_GETATTR(nd.ni_vp, vap, cred, td); } @@ -2205,7 +2205,7 @@ out: if (!error) { bzero((caddr_t)fhp, sizeof(nfh)); fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(vp, &fhp->fh_fid); + error = VOP_VPTOFH(vp, &fhp->fh_fid); if (!error) error = VOP_GETATTR(vp, vap, cred, td); } @@ -2952,7 +2952,7 @@ nfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (error == 0) { bzero((caddr_t)fhp, sizeof(nfh)); fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(nd.ni_vp, &fhp->fh_fid); + error = VOP_VPTOFH(nd.ni_vp, &fhp->fh_fid); if (!error) error = VOP_GETATTR(nd.ni_vp, vap, cred, td); @@ -3130,7 +3130,7 @@ nfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, if (!error) { bzero((caddr_t)fhp, sizeof(nfh)); fhp->fh_fsid = nd.ni_vp->v_mount->mnt_stat.f_fsid; - error = VFS_VPTOFH(nd.ni_vp, &fhp->fh_fid); + error = VOP_VPTOFH(nd.ni_vp, &fhp->fh_fid); if (!error) error = VOP_GETATTR(nd.ni_vp, vap, cred, td); } @@ -3947,7 +3947,7 @@ again: */ KASSERT(nvp->v_mount == vp->v_mount, ("nfsrv_readdirplus: nvp mount != vp mount")); - if (VFS_VPTOFH(nvp, &nfhp->fh_fid)) { + if (VOP_VPTOFH(nvp, &nfhp->fh_fid)) { vput(nvp); nvp = NULL; goto invalid; diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 640646b..fc1c186 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -525,7 +525,11 @@ typedef int vfs_vget_t(struct mount *mp, ino_t ino, int flags, typedef int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp); typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam, int *extflagsp, struct ucred **credanonp); +#if __FreeBSD_version < 800000 typedef int vfs_vptofh_t(struct vnode *vp, struct fid *fhp); +#else +#error Remove this code, vfs_vptofh was replaced with vop_vptofh. +#endif typedef int vfs_init_t(struct vfsconf *); typedef int vfs_uninit_t(struct vfsconf *); typedef int vfs_extattrctl_t(struct mount *mp, int cmd, @@ -546,7 +550,11 @@ struct vfsops { vfs_vget_t *vfs_vget; vfs_fhtovp_t *vfs_fhtovp; vfs_checkexp_t *vfs_checkexp; +#if __FreeBSD_version < 800000 vfs_vptofh_t *vfs_vptofh; +#else +#error Remove this code, vfs_vptofh was replaced with vop_vptofh. +#endif vfs_init_t *vfs_init; vfs_uninit_t *vfs_uninit; vfs_extattrctl_t *vfs_extattrctl; @@ -566,7 +574,11 @@ vfs_statfs_t __vfs_statfs; (*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP) #define VFS_FHTOVP(MP, FIDP, VPP) \ (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP) -#define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP) +#if __FreeBSD_version < 800000 +#define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP) +#else +#error Remove this code, vfs_vptofh was replaced with vop_vptofh. +#endif #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \ (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED) #define VFS_EXTATTRCTL(MP, C, FN, NS, N, P) \ @@ -693,7 +705,11 @@ vfs_sync_t vfs_stdnosync; vfs_vget_t vfs_stdvget; vfs_fhtovp_t vfs_stdfhtovp; vfs_checkexp_t vfs_stdcheckexp; +#if __FreeBSD_version < 800000 vfs_vptofh_t vfs_stdvptofh; +#else +#error Remove this code, vfs_vptofh was replaced with vop_vptofh. +#endif vfs_init_t vfs_stdinit; vfs_uninit_t vfs_stduninit; vfs_extattrctl_t vfs_stdextattrctl; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 8ae6fef..15bfe6b 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -652,6 +652,7 @@ int vop_stdunlock(struct vop_unlock_args *); int vop_nopoll(struct vop_poll_args *); int vop_stdpathconf(struct vop_pathconf_args *); int vop_stdpoll(struct vop_poll_args *); +int vop_stdvptofh(struct vop_vptofh_args *ap); int vop_eopnotsupp(struct vop_generic_args *ap); int vop_ebadf(struct vop_generic_args *ap); int vop_einval(struct vop_generic_args *ap); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 225dd8a..788eb2f 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -87,7 +87,6 @@ static vfs_unmount_t ffs_unmount; static vfs_mount_t ffs_mount; static vfs_statfs_t ffs_statfs; static vfs_fhtovp_t ffs_fhtovp; -static vfs_vptofh_t ffs_vptofh; static vfs_sync_t ffs_sync; static struct vfsops ufs_vfsops = { @@ -103,7 +102,6 @@ static struct vfsops ufs_vfsops = { .vfs_uninit = ffs_uninit, .vfs_unmount = ffs_unmount, .vfs_vget = ffs_vget, - .vfs_vptofh = ffs_vptofh, }; VFS_SET(ufs_vfsops, ufs, 0); @@ -1511,26 +1509,6 @@ ffs_fhtovp(mp, fhp, vpp) } /* - * Vnode pointer to File handle - */ -/* ARGSUSED */ -static int -ffs_vptofh(vp, fhp) - struct vnode *vp; - struct fid *fhp; -{ - struct inode *ip; - struct ufid *ufhp; - - ip = VTOI(vp); - ufhp = (struct ufid *)fhp; - ufhp->ufid_len = sizeof(struct ufid); - ufhp->ufid_ino = ip->i_number; - ufhp->ufid_gen = ip->i_gen; - return (0); -} - -/* * Initialize the filesystem. */ static int diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 3ebadeb..77c5958 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -118,6 +118,7 @@ static vop_getextattr_t ffs_getextattr; static vop_listextattr_t ffs_listextattr; static vop_openextattr_t ffs_openextattr; static vop_setextattr_t ffs_setextattr; +static vop_vptofh_t ffs_vptofh; /* Global vfs data structures for ufs. */ @@ -129,12 +130,14 @@ struct vop_vector ffs_vnodeops1 = { .vop_read = ffs_read, .vop_reallocblks = ffs_reallocblks, .vop_write = ffs_write, + .vop_vptofh = ffs_vptofh, }; struct vop_vector ffs_fifoops1 = { .vop_default = &ufs_fifoops, .vop_fsync = ffs_fsync, .vop_reallocblks = ffs_reallocblks, /* XXX: really ??? */ + .vop_vptofh = ffs_vptofh, }; /* Global vfs data structures for ufs. */ @@ -152,6 +155,7 @@ struct vop_vector ffs_vnodeops2 = { .vop_listextattr = ffs_listextattr, .vop_openextattr = ffs_openextattr, .vop_setextattr = ffs_setextattr, + .vop_vptofh = ffs_vptofh, }; struct vop_vector ffs_fifoops2 = { @@ -166,6 +170,7 @@ struct vop_vector ffs_fifoops2 = { .vop_listextattr = ffs_listextattr, .vop_openextattr = ffs_openextattr, .vop_setextattr = ffs_setextattr, + .vop_vptofh = ffs_vptofh, }; /* @@ -1690,3 +1695,26 @@ vop_setextattr { error = ffs_close_ea(ap->a_vp, 1, ap->a_cred, ap->a_td); return(error); } + +/* + * Vnode pointer to File handle + */ +static int +ffs_vptofh(struct vop_vptofh_args *ap) +/* +vop_vptofh { + IN struct vnode *a_vp; + IN struct fid *a_fhp; +}; +*/ +{ + struct inode *ip; + struct ufid *ufhp; + + ip = VTOI(ap->a_vp); + ufhp = (struct ufid *)ap->a_fhp; + ufhp->ufid_len = sizeof(struct ufid); + ufhp->ufid_ino = ip->i_number; + ufhp->ufid_gen = ip->i_gen; + return (0); +} -- cgit v1.1