shithub: gefs

Download patch

ref: 7e13013aa4033f7d76328d8b28b714c4aad00037
parent: 2354024d13b1d899cca1f0bce8f953e8b1a093c1
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Sep 27 10:18:02 EDT 2021

fscons: tweak 'show' to take args

--- a/blk.c
+++ b/blk.c
@@ -419,8 +419,6 @@
 	finalize(ab);
 	if(syncblk(ab) == -1)
 		return -1;
-checkfs();
-showfree("postcompress");
 	if(oldhd != -1){
 		for(bp = oldhd; bp != -1; bp = nb){
 			nb = -1;
@@ -445,7 +443,6 @@
 	finalize(a->logtl);
 	if(syncblk(a->logtl) == -1)
 		return -1;
-showfree("postreclaim");
 	return 0;
 }
 /*
--- a/fs.c
+++ b/fs.c
@@ -66,7 +66,6 @@
 	int err;
 
 	h = (ihash(d->qid.path) ^ ihash(root)) % Ndtab;
-	dprint("hash: %d\n", h);
 	lock(&fs->dtablk);
 	for(e = fs->dtab[h]; e != nil; e = e->next){
 		if(e->qid.path == d->qid.path && e->rootb == root){
@@ -124,23 +123,20 @@
 }
 
 void
-showfids(void)
+showfids(int fd)
 {
 	int i;
 	Fid *f;
 
-	if(!debug)
-		return;
-	fprint(2, "fids:---\n");
 	lock(&fs->fidtablk);
+	fprint(fd, "fids:---\n");
 	for(i = 0; i < Nfidtab; i++)
 		for(f = fs->fidtab[i]; f != nil; f = f->next){
 			rlock(f->dent);
-			fprint(2, "\tfid[%d]: %d [refs=%ld, k=%K]\n", i, f->fid, f->dent->ref, &f->dent->Key);
+			fprint(fd, "\tfid[%d]: %d [refs=%ld, k=%K]\n", i, f->fid, f->dent->ref, &f->dent->Key);
 			runlock(f->dent);
 		}
 	unlock(&fs->fidtablk);
-
 }
 
 Fid*
@@ -360,7 +356,6 @@
 {
 	Fcall r;
 
-	showfids();
 	r.type = Rerror;
 	r.ename = "unimplemented auth";
 	respond(m, &r);
@@ -421,7 +416,6 @@
 	f.root.bp = -1;
 	f.iounit = iounit;
 	f.dent = e;
-showfids();
 	if(dupfid(m->fid, &f) == nil){
 		rerror(m, Enomem);
 		return;
@@ -522,7 +516,6 @@
 	Blk *b;
 	int n;
 
-	showfids();
 	if((f = getfid(m->fid)) == nil){
 		rerror(m, "no such fid");
 		return;
@@ -1140,9 +1133,14 @@
 		narg = tokenize(buf, arg, nelem(arg));
 		if(narg == 0 || strlen(arg[0]) == 0)
 			continue;
-		if(strcmp(arg[0], "show") == 0)
-			fshowfs(fd, "show");
-		else if(strcmp(arg[0], "check") == 0)
+		if(strcmp(arg[0], "show") == 0){
+			if(narg == 0)
+				fshowfs(fd, "show");
+			if(narg == 2 && strcmp(arg[1], "fid") == 0)
+				showfids(fd);
+			else
+				fprint(fd, "show me yours first");
+		}else if(strcmp(arg[0], "check") == 0)
 			checkfs();
 		else if(strcmp(arg[0], "dbg") && narg == 2)
 			debug = atoi(arg[1]);