diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2007-02-15 22:08:35 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2007-02-15 22:08:35 +0000 |
commit | 10bcafe9abdb866e20e561bf567f15c0a06a0114 (patch) | |
tree | d0649ac0ff4a69d709b0c801322ed78174e44d1c /sys/gnu/fs | |
parent | 233fcaed71e100aab87e94b9f579d3c23422d4db (diff) | |
download | src-10bcafe9abdb866e20e561bf567f15c0a06a0114.tar.gz src-10bcafe9abdb866e20e561bf567f15c0a06a0114.zip |
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
Notes
Notes:
svn path=/head/; revision=166774
Diffstat (limited to 'sys/gnu/fs')
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vfsops.c | 22 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vnops.c | 25 | ||||
-rw-r--r-- | sys/gnu/fs/reiserfs/reiserfs_vfsops.c | 26 | ||||
-rw-r--r-- | sys/gnu/fs/reiserfs/reiserfs_vnops.c | 29 | ||||
-rw-r--r-- | sys/gnu/fs/xfs/FreeBSD/xfs_mountops.c | 11 | ||||
-rw-r--r-- | sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c | 16 |
6 files changed, 70 insertions, 59 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 4168f911797d..7abcb7e62d00 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 4ea62c6f6ba6..5ed7d117b2c8 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 <gnu/fs/ext2fs/ext2_readwrite.c> @@ -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 4ace2da62aee..e947379a64bb 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 9b0ba7d2e509..14242464df9e 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 da3650b3993b..683024a6461f 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 be95936fbfc4..c894095bdd79 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; +} |