diff options
author | joerg <joerg@FreeBSD.org> | 2002-01-26 15:53:23 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 2002-01-26 15:53:23 +0000 |
commit | 0b95dce6f94b33b69a36e8dd5d460e34409ae3b1 (patch) | |
tree | a0ad263f7ec6024848b3c5912bed7cf01616dc6a /sbin/fsdb/fsdb.c | |
parent | 23425be38a1383ce13778af372cb09020309d7ee (diff) | |
download | FreeBSD-src-0b95dce6f94b33b69a36e8dd5d460e34409ae3b1.zip FreeBSD-src-0b95dce6f94b33b69a36e8dd5d460e34409ae3b1.tar.gz |
Something i always wanted to see: add a function to print the list of
blocks allocated by some inode. Indirect blocks are printed
recursively, so beware :), the list could become lengthy...
(We should probably add some output pager to fsdb.)
MFC after: 1 month
Diffstat (limited to 'sbin/fsdb/fsdb.c')
-rw-r--r-- | sbin/fsdb/fsdb.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index 85e34f6..5b4bbcd 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -125,6 +125,7 @@ main(argc, argv) CMDFUNC(helpfn); CMDFUNC(focus); /* focus on inode */ CMDFUNC(active); /* print active inode */ +CMDFUNC(blocks); /* print blocks for active inode */ CMDFUNC(focusname); /* focus by name */ CMDFUNC(zapi); /* clear inode */ CMDFUNC(uplink); /* incr link */ @@ -158,6 +159,7 @@ struct cmdtable cmds[] = { { "back", "Go to previous active inode", 1, 1, FL_RO, back }, { "active", "Print active inode", 1, 1, FL_RO, active }, { "print", "Print active inode", 1, 1, FL_RO, active }, + { "blocks", "Print block numbers of active inode", 1, 1, FL_RO, blocks }, { "uplink", "Increment link count", 1, 1, FL_WR, uplink }, { "downlink", "Decrement link count", 1, 1, FL_WR, downlink }, { "linkcount", "Set link count to COUNT", 2, 2, FL_WR, linkcount }, @@ -224,7 +226,7 @@ cmdloop() curinode = ginode(ROOTINO); curinum = ROOTINO; - printactive(); + printactive(0); hist = history_init(); history(hist, &he, H_EVENT, 100); /* 100 elt history buffer */ @@ -307,7 +309,7 @@ CMDFUNCSTART(focus) curinode = ginode(inum); ocurrent = curinum; curinum = inum; - printactive(); + printactive(0); return 0; } @@ -315,7 +317,7 @@ CMDFUNCSTART(back) { curinum = ocurrent; curinode = ginode(curinum); - printactive(); + printactive(0); return 0; } @@ -336,10 +338,15 @@ CMDFUNCSTART(zapi) CMDFUNCSTART(active) { - printactive(); + printactive(0); return 0; } +CMDFUNCSTART(blocks) +{ + printactive(1); + return 0; +} CMDFUNCSTART(quit) { @@ -431,7 +438,7 @@ dolookup(name) if (ckinode(curinode, &idesc) & FOUND) { curinum = idesc.id_parent; curinode = ginode(curinum); - printactive(); + printactive(0); return 1; } else { warnx("name `%s' not found in current inode directory", name); @@ -639,7 +646,7 @@ CMDFUNCSTART(newtype) curinode->di_mode &= ~IFMT; curinode->di_mode |= type; inodirty(); - printactive(); + printactive(0); return 0; } @@ -660,7 +667,7 @@ CMDFUNCSTART(chlen) curinode->di_size = len; inodirty(); - printactive(); + printactive(0); return rval; } @@ -682,7 +689,7 @@ CMDFUNCSTART(chmode) curinode->di_mode &= ~07777; curinode->di_mode |= modebits; inodirty(); - printactive(); + printactive(0); return rval; } @@ -707,7 +714,7 @@ CMDFUNCSTART(chaflags) } curinode->di_flags = flags; inodirty(); - printactive(); + printactive(0); return rval; } @@ -732,7 +739,7 @@ CMDFUNCSTART(chgen) } curinode->di_gen = gen; inodirty(); - printactive(); + printactive(0); return rval; } @@ -757,7 +764,7 @@ CMDFUNCSTART(linkcount) curinode->di_nlink = lcnt; inodirty(); - printactive(); + printactive(0); return rval; } @@ -784,7 +791,7 @@ CMDFUNCSTART(chowner) curinode->di_uid = uid; inodirty(); - printactive(); + printactive(0); return rval; } @@ -810,7 +817,7 @@ CMDFUNCSTART(chgroup) curinode->di_gid = gid; inodirty(); - printactive(); + printactive(0); return rval; } @@ -876,7 +883,7 @@ CMDFUNCSTART(chmtime) if (dotime(argv[1], &curinode->di_ctime)) return 1; inodirty(); - printactive(); + printactive(0); return 0; } @@ -885,7 +892,7 @@ CMDFUNCSTART(chatime) if (dotime(argv[1], &curinode->di_ctime)) return 1; inodirty(); - printactive(); + printactive(0); return 0; } @@ -894,6 +901,6 @@ CMDFUNCSTART(chctime) if (dotime(argv[1], &curinode->di_ctime)) return 1; inodirty(); - printactive(); + printactive(0); return 0; } |