vfs: mostly depessimize NDINIT_ALL

1) filecaps_init was unnecesarily a function call
2) an asignment at the end was preventing tail calling of cap_rights_init

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2018-12-14 03:55:08 +00:00
parent 49ea0a812a
commit 24d64be4c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342058
3 changed files with 9 additions and 14 deletions

View File

@ -1464,17 +1464,6 @@ kern_fpathconf(struct thread *td, int fd, int name, long *valuep)
return (error);
}
/*
* Initialize filecaps structure.
*/
void
filecaps_init(struct filecaps *fcaps)
{
bzero(fcaps, sizeof(*fcaps));
fcaps->fc_nioctls = -1;
}
/*
* Copy filecaps structure allocating memory for ioctls array if needed.
*

View File

@ -1302,12 +1302,12 @@ NDINIT_ALL(struct nameidata *ndp, u_long op, u_long flags, enum uio_seg segflg,
ndp->ni_dirp = namep;
ndp->ni_dirfd = dirfd;
ndp->ni_startdir = startdir;
filecaps_init(&ndp->ni_filecaps);
ndp->ni_cnd.cn_thread = td;
if (rightsp != NULL)
ndp->ni_rightsneeded = *rightsp;
else
cap_rights_init(&ndp->ni_rightsneeded);
filecaps_init(&ndp->ni_filecaps);
ndp->ni_cnd.cn_thread = td;
}
/*

View File

@ -154,7 +154,13 @@ enum {
struct thread;
void filecaps_init(struct filecaps *fcaps);
static __inline void
filecaps_init(struct filecaps *fcaps)
{
bzero(fcaps, sizeof(*fcaps));
fcaps->fc_nioctls = -1;
}
bool filecaps_copy(const struct filecaps *src, struct filecaps *dst,
bool locked);
void filecaps_move(struct filecaps *src, struct filecaps *dst);