Browse Source

Plan 9 from Bell Labs 2007-11-21

David du Colombier 16 years ago
parent
commit
89bfbec945
4 changed files with 23 additions and 12 deletions
  1. 1 1
      dist/replica/_plan9.db
  2. 1 1
      dist/replica/plan9.db
  3. 1 0
      dist/replica/plan9.log
  4. 20 10
      sys/src/9/port/chan.c

+ 1 - 1
dist/replica/_plan9.db

@@ -8201,7 +8201,7 @@ sys/src/9/port/allocb.c - 664 sys sys 1123676437 3340
 sys/src/9/port/aoe.h - 664 sys sys 1187043215 806
 sys/src/9/port/auth.c - 664 sys sys 1123647282 2392
 sys/src/9/port/cache.c - 664 sys sys 1170456667 9285
-sys/src/9/port/chan.c - 664 sys sys 1146151714 34773
+sys/src/9/port/chan.c - 664 sys sys 1195585806 34962
 sys/src/9/port/cis.c - 664 sys sys 1099761153 9248
 sys/src/9/port/debugalloc.c - 664 sys sys 1014931171 10402
 sys/src/9/port/dev.c - 664 sys sys 1146151714 8177

+ 1 - 1
dist/replica/plan9.db

@@ -8201,7 +8201,7 @@ sys/src/9/port/allocb.c - 664 sys sys 1123676437 3340
 sys/src/9/port/aoe.h - 664 sys sys 1187043215 806
 sys/src/9/port/auth.c - 664 sys sys 1123647282 2392
 sys/src/9/port/cache.c - 664 sys sys 1170456667 9285
-sys/src/9/port/chan.c - 664 sys sys 1146151714 34773
+sys/src/9/port/chan.c - 664 sys sys 1195585806 34962
 sys/src/9/port/cis.c - 664 sys sys 1099761153 9248
 sys/src/9/port/debugalloc.c - 664 sys sys 1014931171 10402
 sys/src/9/port/dev.c - 664 sys sys 1146151714 8177

+ 1 - 0
dist/replica/plan9.log

@@ -53365,3 +53365,4 @@
 1195164004 1 c sys/games/lib/fortunes - 664 sys sys 1195163116 267897
 1195282805 0 c sys/src/cmd/disk/9660/sysuse.c - 664 sys sys 1195281485 13953
 1195507804 0 c sys/src/boot/pc/x16.h - 664 sys sys 1195507126 5264
+1195587005 0 c sys/src/9/port/chan.c - 664 sys sys 1195585806 34962

+ 20 - 10
sys/src/9/port/chan.c

@@ -113,7 +113,7 @@ decref(Ref *r)
 	x = --r->ref;
 	unlock(r);
 	if(x < 0)
-		panic("deccnt pc=0x%lux", getcallerpc(&r));
+		panic("decref pc=0x%lux", getcallerpc(&r));
 
 	return x;
 }
@@ -947,7 +947,7 @@ static char Edoesnotexist[] = "does not exist";
 int
 walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
 {
-	int dev, dotdot, i, n, nhave, ntry, type;
+	int dev, didmount, dotdot, i, n, nhave, ntry, type;
 	Chan *c, *nc, *mtpt;
 	Path *path;
 	Mhead *mh, *nmh;
@@ -967,9 +967,13 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
 	 *    3. move to the first mountpoint along the way.
 	 *    4. repeat.
 	 *
-	 * An invariant is that each time through the loop, c is on the undomount
-	 * side of the mount point, and c's full path is path.
+	 * Each time through the loop:
+	 *
+	 *	If didmount==0, c is on the undomount side of the mount point.
+	 *	If didmount==1, c is on the domount side of the mount point.
+	 * 	Either way, c's full path is path.
 	 */
+	didmount = 0;
 	for(nhave=0; nhave<nnames; nhave+=n){
 		if((c->qid.type&QTDIR)==0){
 			if(nerror)
@@ -996,9 +1000,9 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
 			}
 		}
 
-		if(!dotdot && !nomount)
+		if(!dotdot && !nomount && !didmount)
 			domount(&c, &mh, &path);
-				
+		
 		type = c->type;
 		dev = c->dev;
 
@@ -1029,21 +1033,26 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
 			}
 		}
 
-		nmh = nil;
+		didmount = 0;
 		if(dotdot){
 			assert(wq->nqid == 1);
 			assert(wq->clone != nil);
 
 			path = addelem(path, "..", nil);
 			nc = undomount(wq->clone, path);
+			nmh = nil;
 			n = 1;
 		}else{
 			nc = nil;
 			nmh = nil;
-			if(!nomount)
-				for(i=0; i<wq->nqid && i<ntry-1; i++)
-					if(findmount(&nc, &nmh, type, dev, wq->qid[i]))
+			if(!nomount){
+				for(i=0; i<wq->nqid && i<ntry-1; i++){
+					if(findmount(&nc, &nmh, type, dev, wq->qid[i])){
+						didmount = 1;
 						break;
+					}
+				}
+			}
 			if(nc == nil){	/* no mount points along path */
 				if(wq->clone == nil){
 					cclose(c);
@@ -1065,6 +1074,7 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
 				n = wq->nqid;
 				nc = wq->clone;
 			}else{		/* stopped early, at a mount point */
+				didmount = 1;
 				if(wq->clone != nil){
 					cclose(wq->clone);
 					wq->clone = nil;