From 2f80f04d0b7f6476762ec49964adfe930847182e Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 14 Feb 1997 01:24:02 +0000 Subject: (diskfs_lookup): Remove DEPTH & NEW_DEPTH params. Check CRED->po->shadow_root for root traversals, and get rid of assert that EAGAIN isn't returned from diskfs_lookup_hard. --- libdiskfs/lookup.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'libdiskfs') diff --git a/libdiskfs/lookup.c b/libdiskfs/lookup.c index 7c1c7133..df8b4bff 100644 --- a/libdiskfs/lookup.c +++ b/libdiskfs/lookup.c @@ -66,10 +66,6 @@ static spin_lock_t cm_lock = SPIN_LOCK_INITIALIZER; locked, so don't lock it or add a reference to it. (SPEC_DOTDOT will not be given with CREATE.) - DEPTH is the number of nodes between DP and the filesystem root. - If NEW_DEPTH is non-zero, then for a non-error return, the depth of the - resulting node NP is returned in it. - Return ENOTDIR if DP is not a directory. Return EACCES if CRED isn't allowed to search DP. Return EACCES if completing the operation will require writing @@ -82,8 +78,7 @@ static spin_lock_t cm_lock = SPIN_LOCK_INITIALIZER; */ error_t diskfs_lookup (struct node *dp, char *name, enum lookup_type type, - struct node **np, struct dirstat *ds, - struct protid *cred, unsigned depth, unsigned *new_depth) + struct node **np, struct dirstat *ds, struct protid *cred) { error_t err; struct node *cached; @@ -106,7 +101,8 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type, return err; } - if (depth == 0 && name[0] == '.' && name[1] == '.' && name[2] == '\0') + if (dp == cred->po->shadow_root + && name[0] == '.' && name[1] == '.' && name[2] == '\0') /* Ran into the root. */ { if (ds) @@ -145,8 +141,6 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type, else { err = diskfs_lookup_hard (dp, name, type, np, ds, cred); - assert (err != EAGAIN); /* We should never get EAGAIN now that we're - detecting the root ourselves. */ spin_lock (&cm_lock); if (type == LOOKUP) @@ -191,17 +185,6 @@ diskfs_lookup (struct node *dp, char *name, enum lookup_type type, diskfs_enter_lookup_cache (dp, 0, name); } - if (!err && new_depth) - if (name[0] == '.') - if (name[1] == '\0') - *new_depth = depth; - else if (name[1] == '.' && name[2] == '\0') - *new_depth = depth - 1; - else - *new_depth = depth + 1; - else - *new_depth = depth + 1; - return err; } -- cgit v1.2.3