cwfs: make /srv/cwfs.cmd redable to receive command output
before, cwfs would print everything to /dev/cons. this change will redirect the output of commands to the /srv/cwfs.cmd pipe so one can use: con -C /srv/cwfs.cmd and not have the fish for the output in /dev/kmesg. use standard error (/dev/cons) for unsolicited messages as there is not always a reader on the command file.
This commit is contained in:
parent
53f5bdfd06
commit
8e11ff283f
18 changed files with 166 additions and 225 deletions
|
@ -15,14 +15,14 @@ static void
|
|||
f_nop(Chan *cp, Fcall*, Fcall*)
|
||||
{
|
||||
if(CHAT(cp))
|
||||
print("c_nop %d\n", cp->chan);
|
||||
fprint(2, "c_nop %d\n", cp->chan);
|
||||
}
|
||||
|
||||
static void
|
||||
f_flush(Chan *cp, Fcall*, Fcall*)
|
||||
{
|
||||
if(CHAT(cp))
|
||||
print("c_flush %d\n", cp->chan);
|
||||
fprint(2, "c_flush %d\n", cp->chan);
|
||||
runlock(&cp->reflock);
|
||||
wlock(&cp->reflock);
|
||||
wunlock(&cp->reflock);
|
||||
|
@ -53,7 +53,7 @@ f_session(Chan *cp, Fcall *in, Fcall *ou)
|
|||
aip = (Authinfo*)cp->authinfo;
|
||||
|
||||
if(CHAT(cp))
|
||||
print("c_session %d\n", cp->chan);
|
||||
fprint(2, "c_session %d\n", cp->chan);
|
||||
memmove(aip->rchal, in->chal, sizeof(aip->rchal));
|
||||
mkchallenge(aip);
|
||||
memmove(ou->chal, aip->chal, sizeof(ou->chal));
|
||||
|
@ -90,21 +90,21 @@ authorize(Chan *cp, Fcall *in, Fcall *ou)
|
|||
/* decrypt and unpack ticket */
|
||||
convM2T9p1(in->ticket, &t, nvr.machkey);
|
||||
if(t.num != AuthTs){
|
||||
print("9p1: bad AuthTs num\n");
|
||||
fprint(2, "9p1: bad AuthTs num\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* decrypt and unpack authenticator */
|
||||
convM2A9p1(in->auth, &a, t.key);
|
||||
if(a.num != AuthAc){
|
||||
print("9p1: bad AuthAc num\n");
|
||||
fprint(2, "9p1: bad AuthAc num\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* challenges must match */
|
||||
aip = (Authinfo*)cp->authinfo;
|
||||
if(memcmp(a.chal, aip->chal, sizeof(a.chal)) != 0){
|
||||
print("9p1: bad challenge\n");
|
||||
fprint(2, "9p1: bad challenge\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ authorize(Chan *cp, Fcall *in, Fcall *ou)
|
|||
bit = 1<<x;
|
||||
if(x < 0 || x > 31 || (bit&aip->idvec)){
|
||||
unlock(&aip->idlock);
|
||||
print("9p1: id out of range: idoff %ld idvec %lux id %ld\n",
|
||||
fprint(2, "9p1: id out of range: idoff %ld idvec %lux id %ld\n",
|
||||
aip->idoffset, aip->idvec, a.id);
|
||||
return 0;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ authorize(Chan *cp, Fcall *in, Fcall *ou)
|
|||
|
||||
/* ticket name and attach name must match */
|
||||
if(memcmp(in->uname, t.cuid, sizeof(in->uname)) != 0){
|
||||
print("9p1: names don't match\n");
|
||||
fprint(2, "9p1: names don't match\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -196,10 +196,10 @@ f_attach(Chan *cp, Fcall *in, Fcall *ou)
|
|||
Off raddr;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_attach %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
print("\tuid = %s\n", in->uname);
|
||||
print("\targ = %s\n", in->aname);
|
||||
fprint(2, "c_attach %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
fprint(2, "\tuid = %s\n", in->uname);
|
||||
fprint(2, "\targ = %s\n", in->aname);
|
||||
}
|
||||
|
||||
ou->qid = QID9P1(0,0);
|
||||
|
@ -283,9 +283,9 @@ f_clone(Chan *cp, Fcall *in, Fcall *ou)
|
|||
int fid, fid1;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_clone %d\n", cp->chan);
|
||||
print("\told fid = %d\n", in->fid);
|
||||
print("\tnew fid = %d\n", in->newfid);
|
||||
fprint(2, "c_clone %d\n", cp->chan);
|
||||
fprint(2, "\told fid = %d\n", in->fid);
|
||||
fprint(2, "\tnew fid = %d\n", in->newfid);
|
||||
}
|
||||
|
||||
fid = in->fid;
|
||||
|
@ -343,9 +343,9 @@ f_walk(Chan *cp, Fcall *in, Fcall *ou)
|
|||
Off addr, qpath;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_walk %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
print("\tname = %s\n", in->name);
|
||||
fprint(2, "c_walk %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
fprint(2, "\tname = %s\n", in->name);
|
||||
}
|
||||
|
||||
ou->fid = in->fid;
|
||||
|
@ -470,9 +470,9 @@ f_open(Chan *cp, Fcall *in, Fcall *ou)
|
|||
int ro, fmod, wok;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_open %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
print("\tmode = %o\n", in->mode);
|
||||
fprint(2, "c_open %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
fprint(2, "\tmode = %o\n", in->mode);
|
||||
}
|
||||
|
||||
wok = 0;
|
||||
|
@ -622,12 +622,12 @@ f_create(Chan *cp, Fcall *in, Fcall *ou)
|
|||
Wpath *w;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_create %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
print("\tname = %s\n", in->name);
|
||||
print("\tperm = %lx+%lo\n", (in->perm>>28)&0xf,
|
||||
fprint(2, "c_create %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
fprint(2, "\tname = %s\n", in->name);
|
||||
fprint(2, "\tperm = %lx+%lo\n", (in->perm>>28)&0xf,
|
||||
in->perm&0777);
|
||||
print("\tmode = %o\n", in->mode);
|
||||
fprint(2, "\tmode = %o\n", in->mode);
|
||||
}
|
||||
|
||||
wok = 0;
|
||||
|
@ -818,10 +818,10 @@ f_read(Chan *cp, Fcall *in, Fcall *ou)
|
|||
int nread, count, mask, n, o, slot;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_read %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
print("\toffset = %lld\n", (Wideoff)in->offset);
|
||||
print("\tcount = %ld\n", in->count);
|
||||
fprint(2, "c_read %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
fprint(2, "\toffset = %lld\n", (Wideoff)in->offset);
|
||||
fprint(2, "\tcount = %ld\n", in->count);
|
||||
}
|
||||
|
||||
p = 0;
|
||||
|
@ -983,7 +983,7 @@ dread:
|
|||
goto out;
|
||||
}
|
||||
if(convD2M9p1(d1, ou->data+nread) != n)
|
||||
print("9p1: dirread convD2M1990\n");
|
||||
fprint(2, "9p1: dirread convD2M1990\n");
|
||||
nread += n;
|
||||
count -= n;
|
||||
}
|
||||
|
@ -1001,7 +1001,7 @@ out:
|
|||
ou->fid = in->fid;
|
||||
ou->count = nread;
|
||||
if(CHAT(cp))
|
||||
print("\tnread = %d\n", nread);
|
||||
fprint(2, "\tnread = %d\n", nread);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1016,10 +1016,10 @@ f_write(Chan *cp, Fcall *in, Fcall *ou)
|
|||
int count, nwrite, o, n;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_write %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
print("\toffset = %lld\n", (Wideoff)in->offset);
|
||||
print("\tcount = %ld\n", in->count);
|
||||
fprint(2, "c_write %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
fprint(2, "\toffset = %lld\n", (Wideoff)in->offset);
|
||||
fprint(2, "\tcount = %ld\n", in->count);
|
||||
}
|
||||
|
||||
offset = in->offset;
|
||||
|
@ -1103,7 +1103,7 @@ f_write(Chan *cp, Fcall *in, Fcall *ou)
|
|||
offset += n;
|
||||
}
|
||||
if(CHAT(cp))
|
||||
print("\tnwrite = %d\n", nwrite);
|
||||
fprint(2, "\tnwrite = %d\n", nwrite);
|
||||
|
||||
out:
|
||||
if(p)
|
||||
|
@ -1225,8 +1225,8 @@ f_clunk(Chan *cp, Fcall *in, Fcall *ou)
|
|||
File *f;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_clunk %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
fprint(2, "c_clunk %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
}
|
||||
|
||||
f = filep(cp, in->fid, 0);
|
||||
|
@ -1245,8 +1245,8 @@ f_remove(Chan *cp, Fcall *in, Fcall *ou)
|
|||
File *f;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_remove %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
fprint(2, "c_remove %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
}
|
||||
|
||||
f = filep(cp, in->fid, 0);
|
||||
|
@ -1267,8 +1267,8 @@ f_stat(Chan *cp, Fcall *in, Fcall *ou)
|
|||
File *f;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_stat %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
fprint(2, "c_stat %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
}
|
||||
|
||||
p = 0;
|
||||
|
@ -1289,7 +1289,7 @@ f_stat(Chan *cp, Fcall *in, Fcall *ou)
|
|||
if(d->qid.path == QPROOT) /* stat of root gives time */
|
||||
d->atime = time(nil);
|
||||
if(convD2M9p1(d, ou->stat) != DIRREC)
|
||||
print("9p1: stat convD2M\n");
|
||||
fprint(2, "9p1: stat convD2M\n");
|
||||
|
||||
out:
|
||||
if(p)
|
||||
|
@ -1309,8 +1309,8 @@ f_wstat(Chan *cp, Fcall *in, Fcall *ou)
|
|||
Off addr;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_wstat %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
fprint(2, "c_wstat %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
}
|
||||
|
||||
p = 0;
|
||||
|
@ -1349,10 +1349,10 @@ f_wstat(Chan *cp, Fcall *in, Fcall *ou)
|
|||
|
||||
convM2D9p1(in->stat, &xd);
|
||||
if(CHAT(cp)) {
|
||||
print("\td.name = %s\n", xd.name);
|
||||
print("\td.uid = %d\n", xd.uid);
|
||||
print("\td.gid = %d\n", xd.gid);
|
||||
print("\td.mode = %o\n", xd.mode);
|
||||
fprint(2, "\td.name = %s\n", xd.name);
|
||||
fprint(2, "\td.uid = %d\n", xd.uid);
|
||||
fprint(2, "\td.gid = %d\n", xd.gid);
|
||||
fprint(2, "\td.mode = %o\n", xd.mode);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1481,7 +1481,7 @@ f_clwalk(Chan *cp, Fcall *in, Fcall *ou)
|
|||
int er, fid;
|
||||
|
||||
if(CHAT(cp))
|
||||
print("c_clwalk macro\n");
|
||||
fprint(2, "c_clwalk macro\n");
|
||||
|
||||
f_clone(cp, in, ou); /* sets tag, fid */
|
||||
if(ou->err)
|
||||
|
@ -1500,7 +1500,7 @@ f_clwalk(Chan *cp, Fcall *in, Fcall *ou)
|
|||
ou->err = 0;
|
||||
ou->fid = fid;
|
||||
if(CHAT(cp))
|
||||
print("\terror: %s\n", errstr9p[er]);
|
||||
fprint(2, "\terror: %s\n", errstr9p[er]);
|
||||
} else if(er) {
|
||||
/*
|
||||
* if any other error
|
||||
|
@ -1542,16 +1542,8 @@ error9p1(Chan* cp, Msgbuf* mb)
|
|||
{
|
||||
Msgbuf *mb1;
|
||||
|
||||
print("type=%d count=%d\n", mb->data[0], mb->count);
|
||||
print(" %.2x %.2x %.2x %.2x\n",
|
||||
mb->data[1]&0xff, mb->data[2]&0xff,
|
||||
mb->data[3]&0xff, mb->data[4]&0xff);
|
||||
print(" %.2x %.2x %.2x %.2x\n",
|
||||
mb->data[5]&0xff, mb->data[6]&0xff,
|
||||
mb->data[7]&0xff, mb->data[8]&0xff);
|
||||
print(" %.2x %.2x %.2x %.2x\n",
|
||||
mb->data[9]&0xff, mb->data[10]&0xff,
|
||||
mb->data[11]&0xff, mb->data[12]&0xff);
|
||||
fprint(2, "type=%d count=%d\n", mb->data[0], mb->count);
|
||||
hexdump(mb->data, 12);
|
||||
|
||||
mb1 = mballoc(3, cp, Mbreply4);
|
||||
mb1->data[0] = Rnop; /* your nop was ok */
|
||||
|
@ -1579,13 +1571,13 @@ serve9p1(Msgbuf* mb)
|
|||
assert(cp != nil);
|
||||
if(cp->protocol == nil)
|
||||
return 0;
|
||||
print("9p1: bad M2S conversion\n");
|
||||
fprint(2, "9p1: bad M2S conversion\n");
|
||||
return error9p1(cp, mb);
|
||||
}
|
||||
|
||||
t = fi.type;
|
||||
if(t < 0 || t >= MAXSYSCALL || (t&1) || !call9p1[t]) {
|
||||
print("9p1: bad message type\n");
|
||||
fprint(2, "9p1: bad message type\n");
|
||||
return error9p1(cp, mb);
|
||||
}
|
||||
|
||||
|
@ -1611,16 +1603,16 @@ serve9p1(Msgbuf* mb)
|
|||
|
||||
if(fo.err) {
|
||||
if(cons.flags&errorflag)
|
||||
print("\ttype %d: error: %s\n", t, errstr9p[fo.err]);
|
||||
fprint(2, "\ttype %d: error: %s\n", t, errstr9p[fo.err]);
|
||||
if(CHAT(cp))
|
||||
print("\terror: %s\n", errstr9p[fo.err]);
|
||||
fprint(2, "\terror: %s\n", errstr9p[fo.err]);
|
||||
fo.type = Rerror;
|
||||
strncpy(fo.ename, errstr9p[fo.err], sizeof(fo.ename));
|
||||
}
|
||||
|
||||
n = convS2M9p1(&fo, mb1->data);
|
||||
if(n == 0) {
|
||||
print("9p1: bad S2M conversion\n");
|
||||
fprint(2, "9p1: bad S2M conversion\n");
|
||||
mbfree(mb1);
|
||||
return error9p1(cp, mb);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ convS2M9p1(Fcall *f, uchar *ap)
|
|||
SHORT(tag);
|
||||
switch(t) {
|
||||
default:
|
||||
print("convS2M9p1: bad type: %d\n", t);
|
||||
fprint(2, "convS2M9p1: bad type: %d\n", t);
|
||||
return 0;
|
||||
|
||||
case Tnop:
|
||||
|
@ -298,7 +298,7 @@ convM2S9p1(uchar *ap, Fcall *f, int n)
|
|||
* only whine if it couldn't be a 9P2000 Tversion.
|
||||
*/
|
||||
if(t != 19 || ap[4] != 100)
|
||||
print("convM2S9p1: bad type: %d\n", f->type);
|
||||
fprint(2, "convM2S9p1: bad type: %d\n", f->type);
|
||||
return 0;
|
||||
|
||||
case Tnop:
|
||||
|
|
|
@ -204,7 +204,7 @@ authorize(Chan* chan, Fcall* f)
|
|||
if(strcmp(f->uname, "none") == 0){
|
||||
uid = strtouid(f->uname);
|
||||
if(db)
|
||||
print("permission granted to none: uid %s = %d\n",
|
||||
fprint(2, "permission granted to none: uid %s = %d\n",
|
||||
f->uname, uid);
|
||||
return uid;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ authorize(Chan* chan, Fcall* f)
|
|||
if(noauth || wstatallow){
|
||||
uid = strtouid(f->uname);
|
||||
if(db)
|
||||
print("permission granted by noauth uid %s = %d\n",
|
||||
fprint(2, "permission granted by noauth uid %s = %d\n",
|
||||
f->uname, uid);
|
||||
return uid;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ authorize(Chan* chan, Fcall* f)
|
|||
af = filep(chan, f->afid, 0);
|
||||
if(af == nil){
|
||||
if(db)
|
||||
print("authorize: af == nil\n");
|
||||
fprint(2, "authorize: af == nil\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ authorize(Chan* chan, Fcall* f)
|
|||
authread(af, nil, 0);
|
||||
uid = af->uid;
|
||||
if(db)
|
||||
print("authorize: uid is %d\n", uid);
|
||||
fprint(2, "authorize: uid is %d\n", uid);
|
||||
qunlock(af);
|
||||
return uid;
|
||||
}
|
||||
|
@ -1707,18 +1707,17 @@ serve9p2(Msgbuf* mb)
|
|||
* 1 return means i dealt with it, including error
|
||||
* replies.
|
||||
*/
|
||||
if(convM2S(mb->data, mb->count, &f) != mb->count)
|
||||
{
|
||||
print("didn't like %d byte message\n", mb->count);
|
||||
if(convM2S(mb->data, mb->count, &f) != mb->count){
|
||||
fprint(2, "didn't like %d byte message\n", mb->count);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
type = f.type;
|
||||
if(type < Tversion || type >= Tmax || (type & 1) || type == Terror)
|
||||
return 0;
|
||||
|
||||
chan = mb->chan;
|
||||
if(CHAT(chan))
|
||||
print("9p2: f %F\n", &f);
|
||||
fprint(2, "9p2: f %F\n", &f);
|
||||
r.type = type+1;
|
||||
r.tag = f.tag;
|
||||
error = 0;
|
||||
|
@ -1786,7 +1785,7 @@ print("didn't like %d byte message\n", mb->count);
|
|||
r.ename = errstr9p[error];
|
||||
}
|
||||
if(CHAT(chan))
|
||||
print("9p2: r %F\n", &r);
|
||||
fprint(2, "9p2: r %F\n", &r);
|
||||
|
||||
rmb = mballoc(chan->msize, chan, Mbreply2);
|
||||
n = convS2M(&r, rmb->data, chan->msize);
|
||||
|
@ -1812,7 +1811,7 @@ print("didn't like %d byte message\n", mb->count);
|
|||
r.ename = ename;
|
||||
n = convS2M(&r, rmb->data, chan->msize);
|
||||
}
|
||||
print("%s\n", r.ename);
|
||||
fprint(2, "%s\n", r.ename);
|
||||
if(n == 0){
|
||||
/*
|
||||
* What to do here, the failure notification failed?
|
||||
|
|
|
@ -423,11 +423,9 @@ fsck(Dentry *d)
|
|||
}
|
||||
if(flags & Cpdir) {
|
||||
print("%s\n", name);
|
||||
prflush();
|
||||
}
|
||||
} else if(flags & Cpfile) {
|
||||
print("%s\n", name);
|
||||
prflush();
|
||||
}
|
||||
|
||||
/* check qid */
|
||||
|
|
|
@ -26,6 +26,9 @@ consserve(void)
|
|||
break;
|
||||
}
|
||||
|
||||
/* switch console output to the cmd pipe */
|
||||
dup(0, 1);
|
||||
|
||||
newproc(consserve1, 0, "con");
|
||||
}
|
||||
|
||||
|
@ -35,14 +38,9 @@ consserve1(void *)
|
|||
{
|
||||
char *conline;
|
||||
|
||||
for (;;) {
|
||||
do {
|
||||
if ((conline = Brdline(&bin, '\n')) != nil) {
|
||||
conline[Blinelen(&bin)-1] = '\0';
|
||||
print("%s: %s\n", service, conline);
|
||||
cmd_exec(conline);
|
||||
}
|
||||
} while (conline != nil);
|
||||
while(conline = Brdline(&bin, '\n')){
|
||||
conline[Blinelen(&bin)-1] = '\0';
|
||||
cmd_exec(conline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +110,6 @@ cmd_exec(char *arg)
|
|||
for(i=0; s=command[i].arg0; i++)
|
||||
if(strcmp(argv[0], s) == 0) {
|
||||
(*command[i].func)(argc, argv);
|
||||
prflush();
|
||||
return;
|
||||
}
|
||||
print("cmd_exec: unknown command: %s\n", argv[0]);
|
||||
|
@ -319,7 +316,6 @@ cmd_who(int argc, char *argv[])
|
|||
if(cp->whoprint)
|
||||
cp->whoprint(cp);
|
||||
print("\n");
|
||||
prflush();
|
||||
}
|
||||
if(c > 0)
|
||||
print("%d chans not listed\n", c);
|
||||
|
@ -353,7 +349,6 @@ cmd_sync(int, char *[])
|
|||
wlock(&mainlock); /* sync */
|
||||
sync("command");
|
||||
wunlock(&mainlock);
|
||||
print("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -371,7 +366,6 @@ cmd_help(int argc, char *argv[])
|
|||
}
|
||||
found:
|
||||
print("\t%s %s\n", arg, command[i].help);
|
||||
prflush();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,16 +690,14 @@ void
|
|||
cmd_noauth(int, char *[])
|
||||
{
|
||||
noauth = !noauth;
|
||||
if(noauth)
|
||||
print("authentication is DISABLED\n");
|
||||
print("authentication %s\n", noauth ? "disabled" : "enabled");
|
||||
}
|
||||
|
||||
void
|
||||
cmd_noattach(int, char *[])
|
||||
{
|
||||
noattach = !noattach;
|
||||
if(noattach)
|
||||
print("attaches are DISABLED\n");
|
||||
print("attach %s\n", noattach ? "disabled" : "enabled");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -731,7 +723,6 @@ cmd_files(int, char *[])
|
|||
for(cp = chans; cp; cp = cp->next)
|
||||
if(cp->nfile) {
|
||||
print("%3d: %5d\n", cp->chan, cp->nfile);
|
||||
prflush();
|
||||
n += cp->nfile;
|
||||
}
|
||||
print("%ld out of %ld files used\n", n, conf.nfile);
|
||||
|
|
|
@ -9,7 +9,7 @@ fcall9p1(Chan *cp, Fcall *in, Fcall *ou)
|
|||
rlock(&mainlock);
|
||||
t = in->type;
|
||||
if(t < 0 || t >= MAXSYSCALL || (t&1) || !call9p1[t]) {
|
||||
print("bad message type %d\n", t);
|
||||
fprint(2, "bad message type %d\n", t);
|
||||
panic("");
|
||||
}
|
||||
ou->type = t+1;
|
||||
|
@ -20,7 +20,7 @@ fcall9p1(Chan *cp, Fcall *in, Fcall *ou)
|
|||
runlock(&cp->reflock);
|
||||
|
||||
if(ou->err && CHAT(cp))
|
||||
print("\terror: %s\n", errstr9p[ou->err]);
|
||||
fprint(2, "\terror: %s\n", errstr9p[ou->err]);
|
||||
runlock(&mainlock);
|
||||
}
|
||||
|
||||
|
@ -205,8 +205,8 @@ f_fstat(Chan *cp, Fcall *in, Fcall *ou)
|
|||
int i;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_fstat %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
fprint(2, "c_fstat %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
}
|
||||
|
||||
p = 0;
|
||||
|
@ -246,8 +246,8 @@ f_clri(Chan *cp, Fcall *in, Fcall *ou)
|
|||
File *f;
|
||||
|
||||
if(CHAT(cp)) {
|
||||
print("c_clri %d\n", cp->chan);
|
||||
print("\tfid = %d\n", in->fid);
|
||||
fprint(2, "c_clri %d\n", cp->chan);
|
||||
fprint(2, "\tfid = %d\n", in->fid);
|
||||
}
|
||||
|
||||
f = filep(cp, in->fid, 0);
|
||||
|
|
|
@ -293,7 +293,7 @@ dumpblock(Device *dev)
|
|||
}
|
||||
if(cw->ncopy){
|
||||
if(chatty)
|
||||
print("%lld blocks copied to worm\n", (Wideoff)cw->ncopy);
|
||||
fprint(2, "%lld blocks copied to worm\n", (Wideoff)cw->ncopy);
|
||||
cw->ncopy = 0;
|
||||
}
|
||||
cw->nodump = 1;
|
||||
|
@ -370,7 +370,7 @@ stop1:
|
|||
stop:
|
||||
putbuf(p1);
|
||||
putbuf(p);
|
||||
print("stopping dump!!\n");
|
||||
fprint(2, "stopping dump!!\n");
|
||||
cw->nodump = 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ cwinit(Device *dev)
|
|||
m = h->wsize;
|
||||
if(l != m) {
|
||||
if(chatty)
|
||||
print("wdev changed size %lld to %lld\n",
|
||||
fprint(2, "wdev changed size %lld to %lld\n",
|
||||
(Wideoff)m, (Wideoff)l);
|
||||
h->wsize = l;
|
||||
cb->flags |= Bmod;
|
||||
|
@ -521,13 +521,13 @@ roread(Device *dev, Off b, void *c)
|
|||
s = cwio(d, b, c, Oread);
|
||||
if(s == Cdump || s == Cdump1 || s == Cread) {
|
||||
if(cons.flags & roflag)
|
||||
print("roread: %Z %lld -> %Z(hit)\n",
|
||||
fprint(2, "roread: %Z %lld -> %Z(hit)\n",
|
||||
dev, (Wideoff)b, d);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(cons.flags & roflag)
|
||||
print("roread: %Z %lld -> %Z(miss)\n",
|
||||
fprint(2, "roread: %Z %lld -> %Z(miss)\n",
|
||||
dev, (Wideoff)b, WDEV(d));
|
||||
return devread(WDEV(d), b, c);
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ cwio(Device *dev, Off addr, void *buf, int opcode)
|
|||
break;
|
||||
}
|
||||
if(chatty > 1)
|
||||
print("cwio: %Z %lld s=%s o=%s ns=%s\n",
|
||||
fprint(2, "cwio: %Z %lld s=%s o=%s ns=%s\n",
|
||||
dev, (Wideoff)addr, cwnames[state],
|
||||
cwnames[opcode],
|
||||
cwnames[c->state]);
|
||||
|
@ -1163,7 +1163,7 @@ rewalk1(Cw *cw, Off addr, int slot, Wpath *up)
|
|||
return addr;
|
||||
}
|
||||
if(chatty > 1)
|
||||
print("rewalk1 %lld to %lld \"%s\"\n",
|
||||
fprint(2, "rewalk1 %lld to %lld \"%s\"\n",
|
||||
(Wideoff)addr, (Wideoff)p1->addr, d->name);
|
||||
addr = p1->addr;
|
||||
p1->flags |= Bmod;
|
||||
|
@ -1197,7 +1197,7 @@ rewalk2(Cw *cw, Off addr, int slot, Wpath *up)
|
|||
return addr;
|
||||
}
|
||||
if(chatty > 1)
|
||||
print("rewalk2 %lld to %lld \"%s\"\n",
|
||||
fprint(2, "rewalk2 %lld to %lld \"%s\"\n",
|
||||
(Wideoff)addr, (Wideoff)p1->addr, d->name);
|
||||
addr = p1->addr;
|
||||
putbuf(p1);
|
||||
|
@ -1309,7 +1309,7 @@ cwrecur(Cw *cw, Off addr, int tag, int tag1, long qp)
|
|||
if(!isdirty(cw, p, addr, tag)) {
|
||||
if(!cw->all) {
|
||||
if(chatty > 1)
|
||||
print("cwrecur: %lld t=%s not dirty %s\n",
|
||||
fprint(2, "cwrecur: %lld t=%s not dirty %s\n",
|
||||
(Wideoff)addr, tagnames[tag], cw->name);
|
||||
if(p)
|
||||
putbuf(p);
|
||||
|
@ -1318,7 +1318,7 @@ cwrecur(Cw *cw, Off addr, int tag, int tag1, long qp)
|
|||
shouldstop = 1;
|
||||
}
|
||||
if(chatty > 1)
|
||||
print("cwrecur: %lld t=%s %s\n",
|
||||
fprint(2, "cwrecur: %lld t=%s %s\n",
|
||||
(Wideoff)addr, tagnames[tag], cw->name);
|
||||
if(cw->depth >= 100) {
|
||||
fprint(2, "dump depth too great %s\n", cw->name);
|
||||
|
@ -1489,14 +1489,14 @@ cfsdump(Filsys *fs)
|
|||
cw->fsize = cwsize(cw->dev);
|
||||
orba = cwraddr(cw->dev);
|
||||
if(chatty)
|
||||
print("cwroot %lld", (Wideoff)orba);
|
||||
fprint(2, "cwroot %lld", (Wideoff)orba);
|
||||
cons.noage = 1;
|
||||
cw->all = cw->allflag;
|
||||
rba = cwrecur(cw, orba, Tsuper, 0, QPROOT);
|
||||
if(rba == 0)
|
||||
rba = orba;
|
||||
if(chatty)
|
||||
print("->%lld\n", (Wideoff)rba);
|
||||
fprint(2, "->%lld\n", (Wideoff)rba);
|
||||
sync("after cw");
|
||||
|
||||
/*
|
||||
|
@ -1606,7 +1606,7 @@ found:
|
|||
cw->fsize = cwsize(cw->dev);
|
||||
oroa = cwraddr(cw->rodev); /* probably redundant */
|
||||
if(chatty)
|
||||
print("roroot %lld", (Wideoff)oroa);
|
||||
fprint(2, "roroot %lld", (Wideoff)oroa);
|
||||
|
||||
cons.noage = 0;
|
||||
cw->all = 0;
|
||||
|
@ -1614,7 +1614,7 @@ found:
|
|||
if(roa == 0)
|
||||
roa = oroa;
|
||||
if(chatty)
|
||||
print("->%lld /%.4s/%s\n", (Wideoff)roa, tstr, tstr+4);
|
||||
fprint(2, "->%lld /%.4s/%s\n", (Wideoff)roa, tstr, tstr+4);
|
||||
sync("after ro");
|
||||
|
||||
/*
|
||||
|
@ -1622,7 +1622,7 @@ found:
|
|||
*/
|
||||
a = cwsaddr(cw->dev);
|
||||
if(chatty)
|
||||
print("sblock %lld", (Wideoff)a);
|
||||
fprint(2, "sblock %lld", (Wideoff)a);
|
||||
p = getbuf(cw->dev, a, Brd|Bmod|Bimm);
|
||||
s = (Superb*)p->iobuf;
|
||||
s->last = a;
|
||||
|
@ -1636,7 +1636,7 @@ found:
|
|||
cwio(cw->dev, sba, p->iobuf, Owrite);
|
||||
cwio(cw->dev, sba, 0, Odump);
|
||||
if(chatty)
|
||||
print("->%lld (->%lld)\n", (Wideoff)sba, (Wideoff)s->next);
|
||||
fprint(2, "->%lld (->%lld)\n", (Wideoff)sba, (Wideoff)s->next);
|
||||
|
||||
putbuf(p);
|
||||
|
||||
|
@ -1654,8 +1654,8 @@ found:
|
|||
sync("all done");
|
||||
|
||||
if(chatty){
|
||||
print("%lld blocks queued for worm\n", (Wideoff)cw->ndump);
|
||||
print("%lld falsehits\n", (Wideoff)cw->falsehits);
|
||||
fprint(2, "%lld blocks queued for worm\n", (Wideoff)cw->ndump);
|
||||
fprint(2, "%lld falsehits\n", (Wideoff)cw->falsehits);
|
||||
}
|
||||
cw->nodump = 0;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ rel2abs(Iobuf *p, Dentry *d, Off a, int tag, int putb, int uid)
|
|||
Device *dev;
|
||||
|
||||
if(a < 0) {
|
||||
print("rel2abs: neg offset\n");
|
||||
fprint(2, "rel2abs: neg offset\n");
|
||||
if(putb)
|
||||
putbuf(p);
|
||||
return 0;
|
||||
|
@ -111,7 +111,7 @@ rel2abs(Iobuf *p, Dentry *d, Off a, int tag, int putb, int uid)
|
|||
putbuf(p);
|
||||
|
||||
/* quintuple-indirect blocks not implemented. */
|
||||
print("rel2abs: no %d-deep indirect\n", NIBLOCK+1);
|
||||
fprint(2, "rel2abs: no %d-deep indirect\n", NIBLOCK+1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -186,10 +186,10 @@ indfetch(Device* d, Off qpath, Off addr, Off a, int itag, int tag, int uid)
|
|||
bp = getbuf(d, addr, Brd);
|
||||
if(!bp || checktag(bp, itag, qpath)) {
|
||||
if(!bp) {
|
||||
print("ind fetch bp = 0\n");
|
||||
fprint(2, "ind fetch bp = 0\n");
|
||||
return 0;
|
||||
}
|
||||
print("ind fetch tag\n");
|
||||
fprint(2, "ind fetch tag\n");
|
||||
putbuf(bp);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ fwormread(Device *d, Off b, void *c)
|
|||
Devsize l;
|
||||
|
||||
if(chatty > 1)
|
||||
print("fworm read %lld\n", (Wideoff)b);
|
||||
fprint(2, "fworm read %lld\n", (Wideoff)b);
|
||||
fdev = FDEV(d);
|
||||
l = devsize(fdev);
|
||||
l -= l/(BUFSIZE*8) + 1;
|
||||
|
@ -83,7 +83,7 @@ fwormwrite(Device *d, Off b, void *c)
|
|||
Devsize l;
|
||||
|
||||
if(chatty > 1)
|
||||
print("fworm write %lld\n", (Wideoff)b);
|
||||
fprint(2, "fworm write %lld\n", (Wideoff)b);
|
||||
fdev = FDEV(d);
|
||||
l = devsize(fdev);
|
||||
l -= l/(BUFSIZE*8) + 1;
|
||||
|
|
|
@ -12,7 +12,7 @@ getbuf(Device *d, Off addr, int flag)
|
|||
Off h;
|
||||
|
||||
if(chatty > 1)
|
||||
print("getbuf %Z(%lld) f=%x\n", d, (Wideoff)addr, flag);
|
||||
fprint(2, "getbuf %Z(%lld) f=%x\n", d, (Wideoff)addr, flag);
|
||||
h = addr + (Off)(uintptr)d*1009;
|
||||
if(h < 0)
|
||||
h = ~h;
|
||||
|
@ -174,7 +174,7 @@ sync(char *reason)
|
|||
long i;
|
||||
|
||||
if(chatty)
|
||||
print("sync: %s\n", reason);
|
||||
fprint(2, "sync: %s\n", reason);
|
||||
for(i=10*nhiob; i>0; i--)
|
||||
if(!syncblock())
|
||||
return;
|
||||
|
|
|
@ -161,7 +161,7 @@ wormlabel(Device *d, Side *v)
|
|||
panic("wrong ordinal in label");
|
||||
}
|
||||
if(chatty)
|
||||
print("label %Z ordinal %d\n", d, v->ord);
|
||||
fprint(2, "label %Z ordinal %d\n", d, v->ord);
|
||||
qunlock(v);
|
||||
/*
|
||||
* wormunit should return without calling us again,
|
||||
|
@ -212,7 +212,7 @@ wormunit(Device *d) /* d is l0 or r2 (e.g.) */
|
|||
delay(100);
|
||||
}
|
||||
if(chatty)
|
||||
print("\tload r%ld drive %Z\n", v-w->side, w->drive[drive]);
|
||||
fprint(2, "\tload r%ld drive %Z\n", v-w->side, w->drive[drive]);
|
||||
if(mmove(w, w->mt0, v->elem, w->dt0+drive, v->rot)) {
|
||||
qunlock(w);
|
||||
goto sbad;
|
||||
|
@ -265,7 +265,7 @@ wormunit(Device *d) /* d is l0 or r2 (e.g.) */
|
|||
v->block = inqsize(dr->wren.sddata);
|
||||
if(v->block <= 0) {
|
||||
if(chatty)
|
||||
print("\twormunit %Z block size %ld, setting to %d\n",
|
||||
fprint(2, "\twormunit %Z block size %ld, setting to %d\n",
|
||||
d, v->block, Sectorsz);
|
||||
v->block = Sectorsz;
|
||||
}
|
||||
|
@ -278,11 +278,11 @@ wormunit(Device *d) /* d is l0 or r2 (e.g.) */
|
|||
v->max = (v->nblock + 1) / v->mult;
|
||||
|
||||
if(chatty){
|
||||
print("\tworm %Z: drive %Z (juke drive %d)\n",
|
||||
fprint(2, "\tworm %Z: drive %Z (juke drive %d)\n",
|
||||
d, w->drive[v->drive], v->drive);
|
||||
print("\t\t%,ld %ld-byte sectors, ", v->nblock, v->block);
|
||||
print("%,ld %d-byte blocks\n", v->max, RBUFSIZE);
|
||||
print("\t\t%ld multiplier\n", v->mult);
|
||||
fprint(2, "\t\t%,ld %ld-byte sectors, ", v->nblock, v->block);
|
||||
fprint(2, "%,ld %d-byte blocks\n", v->max, RBUFSIZE);
|
||||
fprint(2, "\t\t%ld multiplier\n", v->mult);
|
||||
}
|
||||
if(d->type == Devlworm)
|
||||
return wormlabel(d, v);
|
||||
|
@ -325,7 +325,7 @@ waitready(Juke *w, Device *d)
|
|||
rv = 0;
|
||||
for(e=0; e < 100; e++) {
|
||||
if(e == 10 && chatty)
|
||||
print("waitready: waiting for %s to exist\n", datanm);
|
||||
fprint(2, "waitready: waiting for %s to exist\n", datanm);
|
||||
if(access(datanm, AEXIST) >= 0){
|
||||
rv = 1;
|
||||
break;
|
||||
|
@ -398,7 +398,7 @@ loop:
|
|||
goto loop;
|
||||
}
|
||||
if(chatty)
|
||||
print("\tunload r%ld drive %Z\n",
|
||||
fprint(2, "\tunload r%ld drive %Z\n",
|
||||
v-w->side, w->drive[drive]);
|
||||
if(mmove(w, w->mt0, w->dt0+drive, v->elem, v->rot)) {
|
||||
qunlock(v);
|
||||
|
@ -472,7 +472,7 @@ devtojuke(Device *d, Device *top)
|
|||
* but we're not supposed to get here.
|
||||
*/
|
||||
if(chatty)
|
||||
print("devtojuke: (l)worm %Z of %Z encountered\n", d, top);
|
||||
fprint(2, "devtojuke: (l)worm %Z of %Z encountered\n", d, top);
|
||||
/* FALL THROUGH */
|
||||
case Devwren:
|
||||
return nil;
|
||||
|
@ -731,17 +731,17 @@ mmove(Juke *w, int trans, int from, int to, int rot)
|
|||
cmd[10] = 1;
|
||||
s = scsiio(w->juke, SCSInone, cmd, sizeof cmd, buf, 0); /* mmove */
|
||||
if(s) {
|
||||
print("scsio status #%x\n", s);
|
||||
print("move medium t=%d fr=%d to=%d rot=%d\n",
|
||||
fprint(2, "scsio status #%x\n", s);
|
||||
fprint(2, "move medium t=%d fr=%d to=%d rot=%d\n",
|
||||
trans, from, to, rot);
|
||||
// panic("mmove");
|
||||
if(recur == 0) {
|
||||
recur = 1;
|
||||
print("element from=%d\n", from);
|
||||
fprint(2, "element from=%d\n", from);
|
||||
element(w, from);
|
||||
print("element to=%d\n", to);
|
||||
fprint(2, "element to=%d\n", to);
|
||||
element(w, to);
|
||||
print("element trans=%d\n", trans);
|
||||
fprint(2, "element trans=%d\n", trans);
|
||||
element(w, trans);
|
||||
recur = 0;
|
||||
}
|
||||
|
@ -787,12 +787,11 @@ geometry(Juke *w)
|
|||
|
||||
w->rot = buf[4+2] & 1;
|
||||
|
||||
print("\tmt %d %d\n", w->mt0, w->nmt);
|
||||
print("\tse %d %d\n", w->se0, w->nse);
|
||||
print("\tie %d %d\n", w->ie0, w->nie);
|
||||
print("\tdt %d %d\n", w->dt0, w->ndt);
|
||||
print("\trot %d\n", w->rot);
|
||||
prflush();
|
||||
fprint(2, "\tmt %d %d\n", w->mt0, w->nmt);
|
||||
fprint(2, "\tse %d %d\n", w->se0, w->nse);
|
||||
fprint(2, "\tie %d %d\n", w->ie0, w->nie);
|
||||
fprint(2, "\tdt %d %d\n", w->dt0, w->ndt);
|
||||
fprint(2, "\trot %d\n", w->rot);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -862,7 +861,7 @@ element(Juke *w, int e)
|
|||
if(s < 0 || s >= w->nie)
|
||||
goto bad;
|
||||
if(chatty)
|
||||
print("import/export %d #%.2x %d.%d\n", s,
|
||||
fprint(2, "import/export %d #%.2x %d.%d\n", s,
|
||||
buf[8+8+2],
|
||||
(buf[8+8+10]<<8) | buf[8+8+11],
|
||||
(buf[8+8+9]>>6) & 1);
|
||||
|
@ -872,7 +871,7 @@ element(Juke *w, int e)
|
|||
if(s < 0 || s >= w->ndt)
|
||||
goto bad;
|
||||
if(chatty)
|
||||
print("data transfer %d #%.2x %d.%d\n", s,
|
||||
fprint(2, "data transfer %d #%.2x %d.%d\n", s,
|
||||
buf[8+8+2],
|
||||
(buf[8+8+10]<<8) | buf[8+8+11],
|
||||
(buf[8+8+9]>>6) & 1);
|
||||
|
@ -893,7 +892,7 @@ element(Juke *w, int e)
|
|||
goto bad;
|
||||
}
|
||||
if(chatty)
|
||||
print("r%d in drive %d\n", t, s);
|
||||
fprint(2, "r%d in drive %d\n", t, s);
|
||||
if(mmove(w, w->mt0, w->dt0+s, w->se0+t,(buf[8+8+9]>>6) & 1)){
|
||||
fprint(2, "mmove initial unload\n");
|
||||
goto bad;
|
||||
|
@ -1174,7 +1173,7 @@ querychanger(Device *xdev)
|
|||
jukelist = w;
|
||||
|
||||
if(chatty)
|
||||
print("alloc juke %Z\n", xdev);
|
||||
fprint(2, "alloc juke %Z\n", xdev);
|
||||
|
||||
qlock(w);
|
||||
qunlock(w);
|
||||
|
@ -1208,7 +1207,7 @@ querychanger(Device *xdev)
|
|||
w->ndrive = w->ndt;
|
||||
if(w->ndrive > MAXDRIVE) {
|
||||
if(chatty)
|
||||
print("ndrives truncated to %d\n", MAXDRIVE);
|
||||
fprint(2, "ndrives truncated to %d\n", MAXDRIVE);
|
||||
w->ndrive = MAXDRIVE;
|
||||
}
|
||||
|
||||
|
@ -1320,7 +1319,7 @@ wormprobe(void)
|
|||
if(v->status == Sstart && t > v->time) {
|
||||
drive = v->drive;
|
||||
if(chatty)
|
||||
print("\ttime r%ld drive %Z\n",
|
||||
fprint(2, "\ttime r%ld drive %Z\n",
|
||||
v-w->side, w->drive[drive]);
|
||||
mmove(w, w->mt0, w->dt0+drive, v->elem, v->rot);
|
||||
v->status = Sunload;
|
||||
|
|
|
@ -15,38 +15,6 @@ machinit(void)
|
|||
active.exiting = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Put a string on the console.
|
||||
*/
|
||||
void
|
||||
puts(char *s, int n)
|
||||
{
|
||||
print("%.*s", n, s);
|
||||
}
|
||||
|
||||
void
|
||||
prflush(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a string on the console.
|
||||
*/
|
||||
void
|
||||
putstrn(char *str, int n)
|
||||
{
|
||||
puts(str, n);
|
||||
}
|
||||
|
||||
/*
|
||||
* get a character from the console
|
||||
*/
|
||||
int
|
||||
getc(void)
|
||||
{
|
||||
return Bgetrune(&bin);
|
||||
}
|
||||
|
||||
void
|
||||
panic(char *fmt, ...)
|
||||
{
|
||||
|
@ -191,7 +159,7 @@ postservice(void)
|
|||
if(pipe(p) < 0)
|
||||
panic("can't make a pipe");
|
||||
snprint(buf, sizeof(buf), "#s/%s.cmd", service);
|
||||
srvfd(buf, 0220, p[0]);
|
||||
srvfd(buf, 0660, p[0]);
|
||||
close(p[0]);
|
||||
|
||||
/* use it as stdin */
|
||||
|
@ -508,7 +476,7 @@ serve(void *)
|
|||
break;
|
||||
}
|
||||
if(cp->protocol == nil && (chatty > 1)){
|
||||
print("no protocol for message\n");
|
||||
fprint(2, "no protocol for message\n");
|
||||
hexdump(mb->data, 12);
|
||||
}
|
||||
} else
|
||||
|
@ -528,7 +496,7 @@ exit(void)
|
|||
active.exiting = 1;
|
||||
unlock(&active);
|
||||
|
||||
print("halted at %T.\n", time(nil));
|
||||
fprint(2, "halted at %T.\n", time(nil));
|
||||
postnote(PNGROUP, getpid(), "die");
|
||||
exits(nil);
|
||||
}
|
||||
|
@ -548,7 +516,7 @@ nextdump(Timet t)
|
|||
Timet nddate = nextime(t+MINUTE(100), DUMPTIME, WEEKMASK);
|
||||
|
||||
if(!conf.nodump && chatty)
|
||||
print("next dump at %T\n", nddate);
|
||||
fprint(2, "next dump at %T\n", nddate);
|
||||
return nddate;
|
||||
}
|
||||
|
||||
|
@ -583,7 +551,7 @@ wormcopy(void *)
|
|||
ntoytime = time(nil) + HOUR(1);
|
||||
else if(t > nddate) {
|
||||
if(!conf.nodump) {
|
||||
print("automatic dump %T\n", t);
|
||||
fprint(2, "automatic dump %T\n", t);
|
||||
for(fs=filsys; fs->name; fs++)
|
||||
if(fs->dev->type == Devcw)
|
||||
cfsdump(fs);
|
||||
|
|
|
@ -57,7 +57,7 @@ mcatread(Device *d, Off b, void *c)
|
|||
return devread(x, b-l, c);
|
||||
l += m;
|
||||
}
|
||||
print("mcatread past end: %Z block %lld, %lld beyond end\n",
|
||||
fprint(2, "mcatread past end: %Z block %lld, %lld beyond end\n",
|
||||
d, (Wideoff)b, (Wideoff)l);
|
||||
return 1;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ mcatwrite(Device *d, Off b, void *c)
|
|||
return devwrite(x, b-l, c);
|
||||
l += m;
|
||||
}
|
||||
print("mcatwrite past end: %Z block %lld, %lld beyond end\n",
|
||||
fprint(2, "mcatwrite past end: %Z block %lld, %lld beyond end\n",
|
||||
d, (Wideoff)b, (Wideoff)l);
|
||||
return 1;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ partread(Device *d, Off b, void *c)
|
|||
size = l*100;
|
||||
if(b < size)
|
||||
return devread(d->part.d, base+b, c);
|
||||
print("partread past end: %Z blk %lld size %lld\n",
|
||||
fprint(2, "partread past end: %Z blk %lld size %lld\n",
|
||||
d, (Wideoff)b, (Wideoff)size);
|
||||
return 1;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ partwrite(Device *d, Off b, void *c)
|
|||
size = l*100;
|
||||
if(b < size)
|
||||
return devwrite(d->part.d, base+b, c);
|
||||
print("partwrite past end: %Z blk %lld size %lld\n",
|
||||
fprint(2, "partwrite past end: %Z blk %lld size %lld\n",
|
||||
d, (Wideoff)b, (Wideoff)size);
|
||||
return 1;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ mirrread(Device *d, Off b, void *c)
|
|||
Device *x;
|
||||
|
||||
if (d->cat.first == nil) {
|
||||
print("mirrread: empty mirror %Z\n", d);
|
||||
fprint(2, "mirrread: empty mirror %Z\n", d);
|
||||
return 1;
|
||||
}
|
||||
for(x=d->cat.first; x; x=x->link) {
|
||||
|
@ -249,7 +249,7 @@ mirrread(Device *d, Off b, void *c)
|
|||
return 0;
|
||||
}
|
||||
// DANGER WILL ROBINSON
|
||||
print("mirrread: all mirrors of %Z block %lld are bad\n",
|
||||
fprint(2, "mirrread: all mirrors of %Z block %lld are bad\n",
|
||||
d, (Wideoff)b);
|
||||
return 1;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ ewrite(Device *x, Off b, void *c)
|
|||
if(x->size == 0)
|
||||
x->size = devsize(x);
|
||||
if (devwrite(x, b, c) != 0) {
|
||||
print("mirrwrite: error at %Z block %lld\n", x, (Wideoff)b);
|
||||
fprint(2, "mirrwrite: error at %Z block %lld\n", x, (Wideoff)b);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -289,7 +289,7 @@ int
|
|||
mirrwrite(Device *d, Off b, void *c)
|
||||
{
|
||||
if (d->cat.first == nil) {
|
||||
print("mirrwrite: empty mirror %Z\n", d);
|
||||
fprint(2, "mirrwrite: empty mirror %Z\n", d);
|
||||
return 1;
|
||||
}
|
||||
return wrmirrs1st(d->cat.first, b, c);
|
||||
|
|
|
@ -54,8 +54,6 @@ neti(void *v)
|
|||
Network *net;
|
||||
|
||||
net = v;
|
||||
if(chatty)
|
||||
print("net%di\n", net->ctlrno);
|
||||
for(;;) {
|
||||
if((lisfd = listen(net->anndir, net->lisdir)) < 0){
|
||||
fprint(2, "listen %s failed: %r\n", net->anndir);
|
||||
|
|
|
@ -90,7 +90,6 @@ int fwormread(Device*, Off, void*);
|
|||
int fwormwrite(Device*, Off, void*);
|
||||
Iobuf* getbuf(Device*, Off, int);
|
||||
char* getwrd(char*, char*);
|
||||
int getc(void);
|
||||
Dentry* getdir(Iobuf*, int);
|
||||
Chan* getlcp(uchar*, long);
|
||||
Off getraddr(Device*);
|
||||
|
@ -163,13 +162,11 @@ Devsize partsize(Device*);
|
|||
int partwrite(Device*, Off, void*);
|
||||
void prdate(void);
|
||||
void preread(Device*, Off);
|
||||
void prflush(void);
|
||||
int prime(vlong);
|
||||
void printinit(void);
|
||||
void procinit(void);
|
||||
void procsetname(char *fmt, ...);
|
||||
void putbuf(Iobuf*);
|
||||
void putstrn(char *str, int n);
|
||||
Off qidpathgen(Device*);
|
||||
void qlock(QLock*);
|
||||
void* querychanger(Device *);
|
||||
|
@ -196,7 +193,6 @@ int serve9p1(Msgbuf*);
|
|||
int serve9p2(Msgbuf*);
|
||||
void settag(Iobuf*, int, long);
|
||||
void settime(Timet);
|
||||
void startprint(void);
|
||||
int strtouid(char*);
|
||||
Off superaddr(Device*);
|
||||
void superream(Device*, Off);
|
||||
|
|
|
@ -279,14 +279,14 @@ scsireqsense(Target* tp, char lun, int* nbytes, int quiet)
|
|||
buggery:
|
||||
if(quiet == 0){
|
||||
s = key[sense[2]&0x0F];
|
||||
print("%s: reqsense: '%s' code #%2.2ux #%2.2ux\n",
|
||||
fprint(2, "%s: reqsense: '%s' code #%2.2ux #%2.2ux\n",
|
||||
tp->id, s, sense[12], sense[13]);
|
||||
print("%s: byte 2: #%2.2ux, bytes 15-17: #%2.2ux #%2.2ux #%2.2ux\n",
|
||||
fprint(2, "%s: byte 2: #%2.2ux, bytes 15-17: #%2.2ux #%2.2ux #%2.2ux\n",
|
||||
tp->id, sense[2], sense[15], sense[16], sense[17]);
|
||||
print("lastcmd (%d): ", lastcmdsz);
|
||||
fprint(2, "lastcmd (%d): ", lastcmdsz);
|
||||
for(n = 0; n < lastcmdsz; n++)
|
||||
print(" #%2.2ux", lastcmd[n]);
|
||||
print("\n");
|
||||
fprint(2, " #%2.2ux", lastcmd[n]);
|
||||
fprint(2, "\n");
|
||||
}
|
||||
|
||||
return STcheck;
|
||||
|
@ -321,7 +321,7 @@ scsiprobe(Device* d)
|
|||
again:
|
||||
s = scsitest(tp, d->wren.lun);
|
||||
if(s < STok){
|
||||
print("%s: test, status %d\n", tp->id, s);
|
||||
fprint(2, "%s: test, status %d\n", tp->id, s);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ again:
|
|||
if(sense[12] == 0x3A)
|
||||
break;
|
||||
if(sense[12] == 0x04 && sense[13] == 0x02){
|
||||
print("%s: starting...\n", tp->id);
|
||||
fprint(2, "%s: starting...\n", tp->id);
|
||||
if(scsistart(tp, d->wren.lun, 1) == STok)
|
||||
break;
|
||||
s = scsireqsense(tp, d->wren.lun, &nbytes, 0);
|
||||
|
@ -358,7 +358,7 @@ again:
|
|||
}
|
||||
/*FALLTHROUGH*/
|
||||
default:
|
||||
print("%s: unavailable, status %d\n", tp->id, s);
|
||||
fprint(2, "%s: unavailable, status %d\n", tp->id, s);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -368,10 +368,10 @@ again:
|
|||
*/
|
||||
s = scsiinquiry(tp, d->wren.lun, &nbytes);
|
||||
if(s != STok) {
|
||||
print("%s: inquiry failed, status %d\n", tp->id, s);
|
||||
fprint(2, "%s: inquiry failed, status %d\n", tp->id, s);
|
||||
return;
|
||||
}
|
||||
print("%s: %s\n", tp->id, (char*)tp->inquiry+8);
|
||||
fprint(2, "%s: %s\n", tp->id, (char*)tp->inquiry+8);
|
||||
tp->ok = 1;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ scsiio(Device* d, int rw, uchar* cmd, int cbytes, void* data, int dbytes)
|
|||
break;
|
||||
}
|
||||
if(e)
|
||||
print("%s: retry %d cmd #%x\n", tp->id, e, cmd[0]);
|
||||
fprint(2, "%s: retry %d cmd #%x\n", tp->id, e, cmd[0]);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ chanhangup(Chan *chan, char *msg)
|
|||
if(chan == cons.chan || srv == nil || srv->chan != chan)
|
||||
return;
|
||||
if(msg[0] && chatty)
|
||||
print("hangup %s: %s\n", chan->whochan, msg);
|
||||
fprint(2, "hangup %s: %s\n", chan->whochan, msg);
|
||||
if(fd2path(srv->fd, buf, sizeof(buf)) == 0){
|
||||
if(p = strrchr(buf, '/')){
|
||||
strecpy(p, buf+sizeof(buf), "/ctl");
|
||||
|
@ -61,7 +61,7 @@ srvput(Srv *srv)
|
|||
chan = srv->chan;
|
||||
fileinit(chan);
|
||||
if(chatty)
|
||||
print("%s closed\n", chan->whochan);
|
||||
fprint(2, "%s closed\n", chan->whochan);
|
||||
lock(&freechans);
|
||||
srv->chan = freechans.hd;
|
||||
freechans.hd = chan;
|
||||
|
|
|
@ -836,7 +836,7 @@ mbfree(Msgbuf *mb)
|
|||
if (mb->magic != Mbmagic)
|
||||
panic("mbfree: bad magic 0x%lux", mb->magic);
|
||||
if(mb->flags & BTRACE)
|
||||
print("mbfree: BTRACE cat=%d flags=%ux, caller %#p\n",
|
||||
fprint(2, "mbfree: BTRACE cat=%d flags=%ux, caller %#p\n",
|
||||
mb->category, mb->flags, getcallerpc(&mb));
|
||||
|
||||
if(mb->flags & FREE)
|
||||
|
@ -909,12 +909,12 @@ hexdump(void *a, int n)
|
|||
sprint(s2, " %.2ux", p[i]);
|
||||
strcat(s1, s2);
|
||||
if((i&7) == 7) {
|
||||
print("%s\n", s1);
|
||||
fprint(2, "%s\n", s1);
|
||||
s1[0] = 0;
|
||||
}
|
||||
}
|
||||
if(s1[0])
|
||||
print("%s\n", s1);
|
||||
fprint(2, "%s\n", s1);
|
||||
}
|
||||
|
||||
void*
|
||||
|
|
Loading…
Reference in a new issue