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/gnu/fs/reiserfs/reiserfs_vnops.c | |
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/gnu/fs/reiserfs/reiserfs_vnops.c')
-rw-r--r-- | sys/gnu/fs/reiserfs/reiserfs_vnops.c | 29 |
1 files changed, 29 insertions, 0 deletions
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); +} |