diff --git a/sys/src/cmd/hjfs/auth.c b/sys/src/cmd/hjfs/auth.c index ede0286e5..ec9c5e00b 100644 --- a/sys/src/cmd/hjfs/auth.c +++ b/sys/src/cmd/hjfs/auth.c @@ -455,7 +455,7 @@ found: } continue; erropt: - dprint("hjfs: newuser: ignoring erroneous option %s\n", argv[i]); + dprint("newuser: ignoring erroneous option %s\n", argv[i]); } if(resort) qsort(fs->udata, fs->nudata, sizeof(User), usercomp); diff --git a/sys/src/cmd/hjfs/buf.c b/sys/src/cmd/hjfs/buf.c index 1850bf6db..b8eca9bdf 100644 --- a/sys/src/cmd/hjfs/buf.c +++ b/sys/src/cmd/hjfs/buf.c @@ -274,7 +274,7 @@ getbuf(Dev *d, uvlong off, int type, int nodata) if(nodata) b->type = type; if(b->type != type && type != -1){ - dprint("hjfs: type mismatch, dev %s, block %lld, got %T, want %T, caller %#p\n", + dprint("type mismatch, dev %s, block %lld, got %T, want %T, caller %#p\n", d->name, off, b->type, type, getcallerpc(&d)); werrstr("phase error -- type mismatch"); putbuf(b); diff --git a/sys/src/cmd/hjfs/cons.c b/sys/src/cmd/hjfs/cons.c index b97e3610e..00312f557 100644 --- a/sys/src/cmd/hjfs/cons.c +++ b/sys/src/cmd/hjfs/cons.c @@ -67,7 +67,7 @@ int cmdsync(int, char **) { sync(1); - dprint("hjfs: sync\n"); + dprint("sync\n"); return 0; } @@ -82,7 +82,7 @@ int cmddump(int, char **) { fsdump(fsmain); - dprint("hjfs: dumped\n"); + dprint("dumped\n"); return 0; } @@ -90,7 +90,7 @@ int cmdallow(int, char **) { fsmain->flags |= FSNOPERM | FSCHOWN; - dprint("hjfs: allow\n"); + dprint("allow\n"); return 0; } @@ -123,15 +123,15 @@ checkfile(FLoc *l, Buf *b) for(i = 0; i < d->size; i++){ if(getblk(fsmain, l, b, i, &r, GBREAD) <= 0){ - dprint("hjfs: %s in block %ulld at index %d has a bad block at index %ulld: %r\n", ftype, l->blk, l->deind, i); + dprint("%s in block %ulld at index %d has a bad block at index %ulld: %r\n", ftype, l->blk, l->deind, i); continue; } c = getbuf(fsmain->d, r, btype, 0); if(c == nil) - dprint("hjfs: %s in block %ulld at index %d has a bad block %ulld at directory index %ulld: %r\n", ftype, l->blk, l->deind, r, i); + dprint("%s in block %ulld at index %d has a bad block %ulld at directory index %ulld: %r\n", ftype, l->blk, l->deind, r, i); putbuf(c); if(chref(fsmain, r, 0) == 0) - dprint("hjfs: %s in block %ulld at index %d has a block %ulld at index %ulld whose reference count is 0", ftype, l->blk, l->deind, r, i); + dprint("%s in block %ulld at index %d has a block %ulld at index %ulld whose reference count is 0", ftype, l->blk, l->deind, r, i); } } @@ -148,7 +148,7 @@ checkblk(uvlong blk) return -1; switch(type = b->type){ case TSUPERBLOCK: - dprint("hjfs: checkblk: should not have found superblock at %ulld\n", blk); + dprint("checkblk: should not have found superblock at %ulld\n", blk); break; case TDENTRY: l.blk = blk; @@ -214,11 +214,11 @@ cmdcheck(int, char**) putbuf(b); } wunlock(fsmain); - dprint("hjfs: %T block count %ulld\n", TDENTRY, ndentry); - dprint("hjfs: %T block count %ulld\n", TINDIR, nindir); - dprint("hjfs: %T block count %ulld\n", TRAW, nraw); - dprint("hjfs: %T block count %ulld\n", TREF, nref); - dprint("hjfs: %T block count %ulld\n", TSUPERBLOCK, nsuperblock); + dprint("%T block count %ulld\n", TDENTRY, ndentry); + dprint("%T block count %ulld\n", TINDIR, nindir); + dprint("%T block count %ulld\n", TRAW, nraw); + dprint("%T block count %ulld\n", TREF, nref); + dprint("%T block count %ulld\n", TSUPERBLOCK, nsuperblock); return 1; } @@ -226,7 +226,7 @@ int cmddisallow(int, char **) { fsmain->flags &= ~(FSNOPERM | FSCHOWN); - dprint("hjfs: disallow\n"); + dprint("disallow\n"); return 0; } @@ -235,9 +235,9 @@ cmdnoauth(int, char **) { fsmain->flags ^= FSNOAUTH; if((fsmain->flags & FSNOAUTH) == 0) - dprint("hjfs: auth enabled\n"); + dprint("auth enabled\n"); else - dprint("hjfs: auth disabled\n"); + dprint("auth disabled\n"); return 1; } @@ -317,8 +317,8 @@ cmddf(int, char **) n++; putbuf(b); } - dprint("hjfs: (blocks) free %ulld, used %ulld, total %ulld\n", n, sb->sb.size - n, sb->sb.size); - dprint("hjfs: (MB) free %ulld, used %ulld, total %ulld\n", n * BLOCK / 1048576, (sb->sb.size - n) * BLOCK / 1048576, sb->sb.size * BLOCK / 1048576); + dprint("(blocks) free %ulld, used %ulld, total %ulld\n", n, sb->sb.size - n, sb->sb.size); + dprint("(MB) free %ulld, used %ulld, total %ulld\n", n * BLOCK / 1048576, (sb->sb.size - n) * BLOCK / 1048576, sb->sb.size * BLOCK / 1048576); putbuf(sb); wunlock(fsmain); return 1; @@ -338,18 +338,18 @@ cmddebugdeind(int, char **argv) if(walkpath(ch, argv[1], nil) < 0) goto error; rlock(fsmain); - dprint("hjfs: loc %ulld / %uld, offset %ulld\n", ch->loc->blk, ch->loc->deind, BLOCK * ch->loc->blk + (RBLOCK - BLOCK) + DENTRYSIZ * ch->loc->deind); + dprint("loc %ulld / %uld, offset %ulld\n", ch->loc->blk, ch->loc->deind, BLOCK * ch->loc->blk + (RBLOCK - BLOCK) + DENTRYSIZ * ch->loc->deind); b = getbuf(fsmain->d, ch->loc->blk, TDENTRY, 0); if(b == nil){ runlock(fsmain); goto error; } d = &b->de[ch->loc->deind]; - dprint("hjfs: name %s\n", d->name); - dprint("hjfs: uid %d, muid %d, gid %d\n", d->uid, d->muid, d->gid); - dprint("hjfs: mode %#o, qid %ulld, type %#x, version %d\n", d->mode, d->path, d->type, d->vers); - dprint("hjfs: size %d\n", d->size); - dprint("hjfs: atime %ulld, mtime %ulld\n", d->atime, d->mtime); + dprint("name %s\n", d->name); + dprint("uid %d, muid %d, gid %d\n", d->uid, d->muid, d->gid); + dprint("mode %#o, qid %ulld, type %#x, version %d\n", d->mode, d->path, d->type, d->vers); + dprint("size %d\n", d->size); + dprint("atime %ulld, mtime %ulld\n", d->atime, d->mtime); putbuf(b); runlock(fsmain); chanclunk(ch); @@ -384,7 +384,7 @@ cmddebugchdeind(int, char **argv) goto error; } c = (uchar *) &b->de[ch->loc->deind]; - dprint("hjfs: loc %d, old value %#.2x, new value %#.2x\n", loc, c[loc], new); + dprint("loc %d, old value %#.2x, new value %#.2x\n", loc, c[loc], new); c[loc] = new; b->op |= BDELWRI; putbuf(b); @@ -426,11 +426,11 @@ cmddebuggetblk(int argc, char **argv) for(i = start; i <= end; i++){ rc = getblk(fsmain, ch->loc, b, i, &r, GBREAD); if(rc > 0) - dprint("hjfs: getblk %ulld = %ulld\n", i, r); + dprint("getblk %ulld = %ulld\n", i, r); if(rc == 0) - dprint("hjfs: getblk %ulld not found\n", i); + dprint("getblk %ulld not found\n", i); if(rc < 0) - dprint("hjfs: getblk %ulld: %r\n", i); + dprint("getblk %ulld: %r\n", i); } putbuf(b); runlock(fsmain); @@ -484,7 +484,7 @@ consproc(void *v) if(s == nil) continue; if(echo) - dprint("hjfs: >%s\n", s); + dprint(">%s\n", s); rc = tokenize(s, args, MAXARGS); if(rc == 0) goto syntax; @@ -497,12 +497,12 @@ consproc(void *v) if(rc == -9001) goto syntax; if(rc < 0) - dprint("hjfs: %r\n"); + dprint("%r\n"); goto done; } } syntax: - dprint("hjfs: syntax error\n"); + dprint("syntax error\n"); done: free(s); } diff --git a/sys/src/cmd/hjfs/dev.c b/sys/src/cmd/hjfs/dev.c index 4826b4bdd..6c17f4fb3 100644 --- a/sys/src/cmd/hjfs/dev.c +++ b/sys/src/cmd/hjfs/dev.c @@ -35,7 +35,7 @@ devwork(void *v) memset(buf, 0, sizeof(buf)); pack(b, buf); if(pwrite(d->fd, buf, BLOCK, b->off*BLOCK) < BLOCK){ - dprint("hjfs: write: %r\n"); + dprint("write: %r\n"); b->error = Eio; } }else{ @@ -44,7 +44,7 @@ devwork(void *v) for(n = 0; n < BLOCK; n += m){ m = pread(d->fd, buf+n, BLOCK-n, b->off*BLOCK+n); if(m < 0) - dprint("hjfs: read: %r\n"); + dprint("read: %r\n"); if(m <= 0) break; } diff --git a/sys/src/cmd/hjfs/dump.c b/sys/src/cmd/hjfs/dump.c index 4a9982693..bef3f8ef7 100644 --- a/sys/src/cmd/hjfs/dump.c +++ b/sys/src/cmd/hjfs/dump.c @@ -134,7 +134,7 @@ again: if(rc < 0) goto err; if(rc == 0){ - dprint("hjfs: willmodify: block %lld has refcount 0\n", l->blk); + dprint("willmodify: block %lld has refcount 0\n", l->blk); werrstr("phase error -- willmodify"); goto err; } diff --git a/sys/src/cmd/hjfs/fs1.c b/sys/src/cmd/hjfs/fs1.c index 244ad0e23..a8dc65a64 100644 --- a/sys/src/cmd/hjfs/fs1.c +++ b/sys/src/cmd/hjfs/fs1.c @@ -50,13 +50,13 @@ getdent(FLoc *l, Buf *b) d = &b->de[l->deind]; if((d->mode & (DGONE | DALLOC)) == 0){ - dprint("hjfs: getdent: file gone, d=%llux, l=%llud/%d %llux, callerpc %#p\n", + dprint("getdent: file gone, d=%llux, l=%llud/%d %llux, callerpc %#p\n", d->path, l->blk, l->deind, l->path, getcallerpc(&l)); werrstr("phase error -- directory entry for nonexistent file"); return nil; } if(qidcmp(d, l) != 0){ - dprint("hjfs: getdent: wrong qid d=%llux != l=%llud/%d %llux, callerpc %#p\n", + dprint("getdent: wrong qid d=%llux != l=%llud/%d %llux, callerpc %#p\n", d->path, l->blk, l->deind, l->path, getcallerpc(&l)); werrstr("phase error -- qid mismatch"); return nil; @@ -213,7 +213,7 @@ writeusers(Fs *fs) error: if(ch != nil) chanclunk(ch); - dprint("hjfs: writeusers: %r\n"); + dprint("writeusers: %r\n"); } void @@ -238,7 +238,7 @@ readusers(Fs *fs) err: if(ch != nil) chanclunk(ch); - dprint("hjfs: readusers: %r\nhjfs: using default user db\n"); + dprint("readusers: %r\nhjfs: using default user db\n"); } void @@ -250,7 +250,7 @@ ream(Fs *fs) int j, je; d = fs->d; - dprint("hjfs: reaming %s\n", d->name); + dprint("reaming %s\n", d->name); b = getbuf(d, SUPERBLK, TSUPERBLOCK, 1); if(b == nil) err: @@ -292,7 +292,7 @@ ream(Fs *fs) putbuf(b); createroot(fs); sync(1); - dprint("hjfs: ream successful\n"); + dprint("ream successful\n"); } Fs * @@ -326,7 +326,7 @@ initfs(Dev *d, int doream, int flags) if(doream) writeusers(fs); readusers(fs); - dprint("hjfs: fs is %s\n", d->name); + dprint("fs is %s\n", d->name); return fs; error: @@ -569,7 +569,7 @@ getblk(Fs *fs, FLoc *L, Buf *bd, uvlong blk, uvlong *r, int mode) b = bd; d = getdent(L, b); if(d == nil){ - dprint("hjfs: getblk: dirent gone\n"); + dprint("getblk: dirent gone\n"); return -1; } if(blk < NDIRECT){ @@ -654,7 +654,7 @@ found: if(rc < 0) goto end; if(rc == 0){ - dprint("hjfs: getblk: block %lld has refcount 0\n"); + dprint("getblk: block %lld has refcount 0\n"); werrstr("phase error -- getblk"); rc = -1; goto end; diff --git a/sys/src/cmd/hjfs/main.c b/sys/src/cmd/hjfs/main.c index 947032723..49b41f006 100644 --- a/sys/src/cmd/hjfs/main.c +++ b/sys/src/cmd/hjfs/main.c @@ -65,12 +65,17 @@ Fs *fsmain; int dprint(char *fmt, ...) { + static char buf[2048]; + static QLock lk; va_list va; int rc; - + + qlock(lk); va_start(va, fmt); - rc = vfprint(2, fmt, va); + snprint(buf, 2048, "hjfs: %s", fmt); + rc = vfprint(2, buf, va); va_end(va); + qunlock(lk); return rc; } @@ -149,7 +154,7 @@ shutdown(void) { wlock(fsmain); sync(1); - dprint("hjfs: ending\n"); + dprint("ending\n"); sleep(1000); sync(1); threadexitsall(nil);