mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
file: Remove the fd parameter to fgetvp_lookup() and fgetvp_lookup_smr()
The fd is always obtained from nameidata, so just fetch it from there instead. No functional change intended. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43257
This commit is contained in:
parent
27f4eda3dd
commit
55edc40e0c
|
@ -2962,7 +2962,7 @@ fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp,
|
|||
|
||||
#ifdef CAPABILITIES
|
||||
int
|
||||
fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsearch)
|
||||
fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch)
|
||||
{
|
||||
const struct filedescent *fde;
|
||||
const struct fdescenttbl *fdt;
|
||||
|
@ -2972,9 +2972,11 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear
|
|||
const cap_rights_t *haverights;
|
||||
cap_rights_t rights;
|
||||
seqc_t seq;
|
||||
int fd;
|
||||
|
||||
VFS_SMR_ASSERT_ENTERED();
|
||||
|
||||
fd = ndp->ni_dirfd;
|
||||
rights = *ndp->ni_rightsneeded;
|
||||
cap_rights_set_one(&rights, CAP_LOOKUP);
|
||||
|
||||
|
@ -3028,15 +3030,17 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear
|
|||
}
|
||||
#else
|
||||
int
|
||||
fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsearch)
|
||||
fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch)
|
||||
{
|
||||
const struct fdescenttbl *fdt;
|
||||
struct filedesc *fdp;
|
||||
struct file *fp;
|
||||
struct vnode *vp;
|
||||
int fd;
|
||||
|
||||
VFS_SMR_ASSERT_ENTERED();
|
||||
|
||||
fd = ndp->ni_dirfd;
|
||||
fdp = curproc->p_fd;
|
||||
fdt = fdp->fd_files;
|
||||
if (__predict_false((u_int)fd >= fdt->fdt_nfiles))
|
||||
|
@ -3064,7 +3068,7 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear
|
|||
#endif
|
||||
|
||||
int
|
||||
fgetvp_lookup(int fd, struct nameidata *ndp, struct vnode **vpp)
|
||||
fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp)
|
||||
{
|
||||
struct thread *td;
|
||||
struct file *fp;
|
||||
|
|
|
@ -4509,7 +4509,7 @@ cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp)
|
|||
ndp = fpl->ndp;
|
||||
cnp = fpl->cnp;
|
||||
|
||||
error = fgetvp_lookup_smr(ndp->ni_dirfd, ndp, vpp, &fsearch);
|
||||
error = fgetvp_lookup_smr(ndp, vpp, &fsearch);
|
||||
if (__predict_false(error != 0)) {
|
||||
return (cache_fpl_aborted(fpl));
|
||||
}
|
||||
|
|
|
@ -358,7 +358,7 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp)
|
|||
if (cnp->cn_flags & AUDITVNODE2)
|
||||
AUDIT_ARG_ATFD2(ndp->ni_dirfd);
|
||||
|
||||
error = fgetvp_lookup(ndp->ni_dirfd, ndp, dpp);
|
||||
error = fgetvp_lookup(ndp, dpp);
|
||||
}
|
||||
if (error == 0 && (*dpp)->v_type != VDIR &&
|
||||
(cnp->cn_pnbuf[0] != '\0' ||
|
||||
|
|
|
@ -289,8 +289,8 @@ int fgetvp_read(struct thread *td, int fd, cap_rights_t *rightsp,
|
|||
struct vnode **vpp);
|
||||
int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp,
|
||||
struct vnode **vpp);
|
||||
int fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsearch);
|
||||
int fgetvp_lookup(int fd, struct nameidata *ndp, struct vnode **vpp);
|
||||
int fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch);
|
||||
int fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp);
|
||||
|
||||
static __inline __result_use_check bool
|
||||
fhold(struct file *fp)
|
||||
|
|
Loading…
Reference in a new issue