Merge ufs_fhtovp() into ffs_inotovp().

(cherry picked from commit 89fd61d955)
This commit is contained in:
Konstantin Belousov 2021-01-28 14:20:48 +02:00
parent e3e958f3a4
commit ed06398293
3 changed files with 17 additions and 30 deletions

View file

@ -2170,6 +2170,7 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
{
struct ufsmount *ump;
struct vnode *nvp;
struct inode *ip;
struct fs *fs;
struct cg *cgp;
struct buf *bp;
@ -2178,6 +2179,8 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
ump = VFSTOUFS(mp);
fs = ump->um_fs;
*vpp = NULL;
if (ino < UFS_ROOTINO || ino >= fs->fs_ncg * fs->fs_ipg)
return (ESTALE);
@ -2198,10 +2201,20 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
}
error = ffs_vgetf(mp, ino, lflags, &nvp, ffs_flags);
if (error == 0)
error = ufs_fhtovp(mp, nvp, gen);
*vpp = error == 0 ? nvp : NULLVP;
return (error);
if (error != 0)
return (error);
ip = VTOI(nvp);
if (ip->i_mode == 0 || ip->i_gen != gen || ip->i_effnlink <= 0) {
if (ip->i_mode == 0)
vgone(nvp);
vput(nvp);
return (ESTALE);
}
vnode_create_vobject(nvp, DIP(ip, i_size), curthread);
*vpp = nvp;
return (0);
}
/*

View file

@ -59,7 +59,6 @@ int ufs_bmap(struct vop_bmap_args *);
int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *,
struct buf *, int *, int *);
int ufs_bmap_seekdata(struct vnode *, off_t *);
int ufs_fhtovp(struct mount *, struct vnode *, u_int64_t);
int ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *);
void ufs_dirbad(struct inode *, doff_t, char *);
int ufs_dirbadentry(struct vnode *, struct direct *, int);

View file

@ -214,28 +214,3 @@ ufs_uninit(vfsp)
#endif
return (0);
}
/*
* This is the generic part of fhtovp called after the underlying
* filesystem has validated the file handle.
*
* Call the VFS_CHECKEXP beforehand to verify access.
*/
int
ufs_fhtovp(mp, nvp, gen)
struct mount *mp;
struct vnode *nvp;
u_int64_t gen;
{
struct inode *ip;
ip = VTOI(nvp);
if (ip->i_mode == 0 || ip->i_gen != gen || ip->i_effnlink <= 0) {
if (ip->i_mode == 0)
vgone(nvp);
vput(nvp);
return (ESTALE);
}
vnode_create_vobject(nvp, DIP(ip, i_size), curthread);
return (0);
}