Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Improve namei_start to pass back its result instead...
details: https://anonhg.NetBSD.org/src/rev/61c0e2871348
branches: trunk
changeset: 764053:61c0e2871348
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Apr 11 01:38:10 2011 +0000
description:
Improve namei_start to pass back its result instead of updating the
global state.
diffstat:
sys/kern/vfs_lookup.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (61 lines):
diff -r ddb0f8e70e55 -r 61c0e2871348 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c Mon Apr 11 01:37:43 2011 +0000
+++ b/sys/kern/vfs_lookup.c Mon Apr 11 01:38:10 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_lookup.c,v 1.139 2011/04/11 01:37:43 dholland Exp $ */
+/* $NetBSD: vfs_lookup.c,v 1.140 2011/04/11 01:38:10 dholland Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.139 2011/04/11 01:37:43 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.140 2011/04/11 01:38:10 dholland Exp $");
#include "opt_magiclinks.h"
@@ -593,9 +593,11 @@
* appropriate.
*/
static int
-namei_start(struct namei_state *state, struct vnode *forcecwd)
+namei_start(struct namei_state *state, struct vnode *forcecwd,
+ struct vnode **startdir_ret)
{
struct nameidata *ndp = state->ndp;
+ struct vnode *startdir;
/* length includes null terminator (was originally from copyinstr) */
ndp->ni_pathlen = strlen(ndp->ni_pnbuf) + 1;
@@ -612,16 +614,16 @@
/* Get starting directory, set up root, and ktrace. */
if (forcecwd != NULL) {
- state->namei_startdir = namei_getstartdir_for_nfsd(state,
- forcecwd);
+ startdir = namei_getstartdir_for_nfsd(state, forcecwd);
/* no ktrace */
} else {
- state->namei_startdir = namei_getstartdir(state);
+ startdir = namei_getstartdir(state);
namei_ktrace(state);
}
- vn_lock(state->namei_startdir, LK_EXCLUSIVE | LK_RETRY);
+ vn_lock(startdir, LK_EXCLUSIVE | LK_RETRY);
+ *startdir_ret = startdir;
return 0;
}
@@ -1044,7 +1046,7 @@
const char *cp;
int error;
- error = namei_start(state, forcecwd);
+ error = namei_start(state, forcecwd, &state->namei_startdir);
if (error) {
return error;
}
Home |
Main Index |
Thread Index |
Old Index