diff options
author | pjd <pjd@FreeBSD.org> | 2007-02-15 22:08:35 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-02-15 22:08:35 +0000 |
commit | cb2d7c85a85791923bd76d6e730efe888d456b05 (patch) | |
tree | d0649ac0ff4a69d709b0c801322ed78174e44d1c /sys/kern | |
parent | 8442403943388cc79bc6f4b7d43bfe916ee194ef (diff) | |
download | FreeBSD-src-cb2d7c85a85791923bd76d6e730efe888d456b05.zip FreeBSD-src-cb2d7c85a85791923bd76d6e730efe888d456b05.tar.gz |
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
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_default.c | 11 | ||||
-rw-r--r-- | sys/kern/vfs_export.c | 2 | ||||
-rw-r--r-- | sys/kern/vfs_init.c | 4 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 4 | ||||
-rw-r--r-- | sys/kern/vnode_if.src | 8 |
5 files changed, 26 insertions, 3 deletions
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; +}; |