diff options
author | aiju <devnull@localhost> | 2012-10-03 18:10:56 +0200 |
---|---|---|
committer | aiju <devnull@localhost> | 2012-10-03 18:10:56 +0200 |
commit | 0ebd85f72c5db86bb3b75595c1ce89ded696d9ca (patch) | |
tree | a413c8ca10f8f9130d8e5d501441b53a97e2fd57 /sys/src/cmd/hjfs | |
parent | 87b66bade20523cbaa4368acab277994efd19ce8 (diff) |
hjfs: debug-chdeind and sync commands added
Diffstat (limited to 'sys/src/cmd/hjfs')
-rw-r--r-- | sys/src/cmd/hjfs/cons.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sys/src/cmd/hjfs/cons.c b/sys/src/cmd/hjfs/cons.c index b7eb92cca..0c4e31a2f 100644 --- a/sys/src/cmd/hjfs/cons.c +++ b/sys/src/cmd/hjfs/cons.c @@ -64,6 +64,14 @@ walkpath(Chan *ch, char *path, char **cr) } int +cmdsync(int, char **) +{ + sync(1); + dprint("hjfs: sync\n"); + return 0; +} + +int cmdhalt(int, char **) { shutdown(); @@ -232,6 +240,43 @@ error: } int +cmddebugchdeind(int, char **argv) +{ + Chan *ch; + uchar *c; + Buf *b; + int loc, new; + + loc = strtol(argv[2], nil, 0); + new = strtol(argv[3], nil, 0); + if(loc >= DENTRYSIZ) + return -9001; + ch = chanattach(fsmain, 0); + if(ch == nil) + return -1; + ch->uid = -1; + if(walkpath(ch, argv[1], nil) < 0) + goto error; + rlock(fsmain); + b = getbuf(fsmain->d, ch->loc->blk, TDENTRY, 0); + if(b == nil){ + runlock(fsmain); + goto error; + } + c = (uchar *) &b->de[ch->loc->deind]; + dprint("hjfs: loc %d, old value %#.2x, new value %#.2x\n", loc, c[loc], new); + c[loc] = new; + b->op |= BDELWRI; + putbuf(b); + runlock(fsmain); + chanclunk(ch); + return 0; +error: + chanclunk(ch); + return -1; +} + +int cmddebuggetblk(int argc, char **argv) { Chan *ch; @@ -285,12 +330,14 @@ Cmd cmds[] = { {"create", 0, cmdcreate}, {"disallow", 1, cmddisallow}, {"dump", 1, cmddump}, + {"sync", 1, cmdsync}, {"halt", 1, cmdhalt}, {"newuser", 0, cmdnewuser}, {"echo", 2, cmdecho}, {"df", 1, cmddf}, {"debug-deind", 2, cmddebugdeind}, {"debug-getblk", 0, cmddebuggetblk}, + {"debug-chdeind", 4, cmddebugchdeind}, }; |