Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/tmpfs/tmpfs_vnops.c
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
tmpfs_vn_get_ino_alloc(struct mount *mp, void *arg, int lkflags, | tmpfs_vn_get_ino_alloc(struct mount *mp, void *arg, int lkflags, | ||||
struct vnode **rvp) | struct vnode **rvp) | ||||
{ | { | ||||
return (tmpfs_alloc_vp(mp, arg, lkflags, rvp)); | return (tmpfs_alloc_vp(mp, arg, lkflags, rvp)); | ||||
} | } | ||||
static int | static int | ||||
tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) | tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, | ||||
bool cached) | |||||
{ | { | ||||
struct tmpfs_dirent *de; | struct tmpfs_dirent *de; | ||||
struct tmpfs_node *dnode, *pnode; | struct tmpfs_node *dnode, *pnode; | ||||
struct tmpfs_mount *tm; | struct tmpfs_mount *tm; | ||||
int error; | int error; | ||||
dnode = VP_TO_TMPFS_DIR(dvp); | dnode = VP_TO_TMPFS_DIR(dvp); | ||||
*vpp = NULLVP; | *vpp = NULLVP; | ||||
/* Check accessibility of requested node as a first step. */ | /* | ||||
* Check accessibility of requested node as a first step. If we are | |||||
* coming in via VOP_CACHEDLOOKUP, then this has already been done for | |||||
* us and we must not check again. | |||||
*/ | |||||
if (!cached) { | |||||
kib: Instead of adding cached param, you can move vn_dir_check_exec() into tmpfs_lookup(). | |||||
error = vn_dir_check_exec(dvp, cnp); | error = vn_dir_check_exec(dvp, cnp); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
} | |||||
/* We cannot be requesting the parent directory of the root node. */ | /* We cannot be requesting the parent directory of the root node. */ | ||||
MPASS(IMPLIES(dnode->tn_type == VDIR && | MPASS(IMPLIES(dnode->tn_type == VDIR && | ||||
dnode->tn_dir.tn_parent == dnode, | dnode->tn_dir.tn_parent == dnode, | ||||
!(cnp->cn_flags & ISDOTDOT))); | !(cnp->cn_flags & ISDOTDOT))); | ||||
TMPFS_ASSERT_LOCKED(dnode); | TMPFS_ASSERT_LOCKED(dnode); | ||||
if (dnode->tn_dir.tn_parent == NULL) { | if (dnode->tn_dir.tn_parent == NULL) { | ||||
▲ Show 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | out: | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
tmpfs_cached_lookup(struct vop_cachedlookup_args *v) | tmpfs_cached_lookup(struct vop_cachedlookup_args *v) | ||||
{ | { | ||||
return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp)); | return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp, true)); | ||||
} | } | ||||
static int | static int | ||||
tmpfs_lookup(struct vop_lookup_args *v) | tmpfs_lookup(struct vop_lookup_args *v) | ||||
{ | { | ||||
return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp)); | return (tmpfs_lookup1(v->a_dvp, v->a_vpp, v->a_cnp, false)); | ||||
} | } | ||||
static int | static int | ||||
tmpfs_create(struct vop_create_args *v) | tmpfs_create(struct vop_create_args *v) | ||||
{ | { | ||||
struct vnode *dvp = v->a_dvp; | struct vnode *dvp = v->a_dvp; | ||||
struct vnode **vpp = v->a_vpp; | struct vnode **vpp = v->a_vpp; | ||||
struct componentname *cnp = v->a_cnp; | struct componentname *cnp = v->a_cnp; | ||||
▲ Show 20 Lines • Show All 1,622 Lines • Show Last 20 Lines |
Instead of adding cached param, you can move vn_dir_check_exec() into tmpfs_lookup().