This commit is contained in:
rsc 2005-07-13 10:52:39 +00:00
parent d7b202dfbd
commit 7643b2635c
6 changed files with 32 additions and 33 deletions

View file

@ -429,7 +429,6 @@ vtcacheglobal(VtCache *c, uchar score[VtScoreSize], int type)
vtzeroextend(type, b->data, n, c->blocksize); vtzeroextend(type, b->data, n, c->blocksize);
b->iostate = BioVenti; b->iostate = BioVenti;
b->nlock = 1; b->nlock = 1;
b->decrypted = 0;
return b; return b;
} }

View file

@ -22,16 +22,16 @@ vtfcallrpc(VtConn *z, VtFcall *ou, VtFcall *in)
} }
if(chattyventi) if(chattyventi)
fprint(2, "%s <- %F\n", argv0, in); fprint(2, "%s <- %F\n", argv0, in);
if(in->type == VtRerror){ if(in->msgtype == VtRerror){
werrstr(in->error); werrstr(in->error);
vtfcallclear(in); vtfcallclear(in);
packetfree(p); packetfree(p);
return -1; return -1;
} }
if(in->type != ou->type+1){ if(in->msgtype != ou->msgtype+1){
werrstr("type mismatch: sent %c%d got %c%d", werrstr("type mismatch: sent %c%d got %c%d",
"TR"[ou->type&1], ou->type>>1, "TR"[ou->msgtype&1], ou->msgtype>>1,
"TR"[in->type&1], in->type>>1); "TR"[in->msgtype&1], in->msgtype>>1);
vtfcallclear(in); vtfcallclear(in);
packetfree(p); packetfree(p);
return -1; return -1;
@ -46,7 +46,7 @@ vthello(VtConn *z)
VtFcall tx, rx; VtFcall tx, rx;
memset(&tx, 0, sizeof tx); memset(&tx, 0, sizeof tx);
tx.type = VtThello; tx.msgtype = VtThello;
tx.version = z->version; tx.version = z->version;
tx.uid = z->uid; tx.uid = z->uid;
if(tx.uid == nil) if(tx.uid == nil)
@ -68,8 +68,8 @@ vtreadpacket(VtConn *z, uchar score[VtScoreSize], uint type, int n)
return packetalloc(); return packetalloc();
memset(&tx, 0, sizeof tx); memset(&tx, 0, sizeof tx);
tx.type = VtTread; tx.msgtype = VtTread;
tx.dtype = type; tx.blocktype = type;
tx.count = n; tx.count = n;
memmove(tx.score, score, VtScoreSize); memmove(tx.score, score, VtScoreSize);
if(vtfcallrpc(z, &tx, &rx) < 0) if(vtfcallrpc(z, &tx, &rx) < 0)
@ -114,8 +114,8 @@ vtwritepacket(VtConn *z, uchar score[VtScoreSize], uint type, Packet *p)
memmove(score, vtzeroscore, VtScoreSize); memmove(score, vtzeroscore, VtScoreSize);
return 0; return 0;
} }
tx.type = VtTwrite; tx.msgtype = VtTwrite;
tx.dtype = type; tx.blocktype = type;
tx.data = p; tx.data = p;
if(ventidoublechecksha1) if(ventidoublechecksha1)
packetsha1(p, score); packetsha1(p, score);
@ -148,7 +148,7 @@ vtsync(VtConn *z)
{ {
VtFcall tx, rx; VtFcall tx, rx;
tx.type = VtTsync; tx.msgtype = VtTsync;
return vtfcallrpc(z, &tx, &rx); return vtfcallrpc(z, &tx, &rx);
} }
@ -157,7 +157,7 @@ vtping(VtConn *z)
{ {
VtFcall tx, rx; VtFcall tx, rx;
tx.type = VtTping; tx.msgtype = VtTping;
return vtfcallrpc(z, &tx, &rx); return vtfcallrpc(z, &tx, &rx);
} }

View file

@ -10,13 +10,13 @@ vtfcallpack(VtFcall *f)
p = packetalloc(); p = packetalloc();
buf[0] = f->type; buf[0] = f->msgtype;
buf[1] = f->tag; buf[1] = f->tag;
packetappend(p, buf, 2); packetappend(p, buf, 2);
switch(f->type){ switch(f->msgtype){
default: default:
werrstr("vtfcallpack: unknown packet type %d", f->type); werrstr("vtfcallpack: unknown packet type %d", f->msgtype);
goto Err; goto Err;
case VtRerror: case VtRerror:
@ -56,7 +56,7 @@ vtfcallpack(VtFcall *f)
case VtTread: case VtTread:
packetappend(p, f->score, VtScoreSize); packetappend(p, f->score, VtScoreSize);
buf[0] = vttodisktype(f->dtype); buf[0] = vttodisktype(f->blocktype);
if(~buf[0] == 0) if(~buf[0] == 0)
goto Err; goto Err;
buf[1] = 0; buf[1] = 0;
@ -70,7 +70,7 @@ vtfcallpack(VtFcall *f)
break; break;
case VtTwrite: case VtTwrite:
buf[0] = vttodisktype(f->dtype); buf[0] = vttodisktype(f->blocktype);
if(~buf[0] == 0) if(~buf[0] == 0)
goto Err; goto Err;
buf[1] = 0; buf[1] = 0;
@ -108,12 +108,12 @@ vtfcallunpack(VtFcall *f, Packet *p)
if(packetconsume(p, buf, 2) < 0) if(packetconsume(p, buf, 2) < 0)
return -1; return -1;
f->type = buf[0]; f->msgtype = buf[0];
f->tag = buf[1]; f->tag = buf[1];
switch(f->type){ switch(f->msgtype){
default: default:
werrstr("vtfcallunpack: unknown bad packet type %d", f->type); werrstr("vtfcallunpack: unknown bad packet type %d", f->msgtype);
vtfcallclear(f); vtfcallclear(f);
return -1; return -1;
@ -165,8 +165,8 @@ vtfcallunpack(VtFcall *f, Packet *p)
if(packetconsume(p, f->score, VtScoreSize) < 0 if(packetconsume(p, f->score, VtScoreSize) < 0
|| packetconsume(p, buf, 4) < 0) || packetconsume(p, buf, 4) < 0)
goto Err; goto Err;
f->dtype = vtfromdisktype(buf[0]); f->blocktype = vtfromdisktype(buf[0]);
if(~f->dtype == 0) if(~f->blocktype == 0)
goto Err; goto Err;
f->count = (buf[2] << 8) | buf[3]; f->count = (buf[2] << 8) | buf[3];
break; break;
@ -179,8 +179,8 @@ vtfcallunpack(VtFcall *f, Packet *p)
case VtTwrite: case VtTwrite:
if(packetconsume(p, buf, 4) < 0) if(packetconsume(p, buf, 4) < 0)
goto Err; goto Err;
f->dtype = vtfromdisktype(buf[0]); f->blocktype = vtfromdisktype(buf[0]);
if(~f->dtype == 0) if(~f->blocktype == 0)
goto Err; goto Err;
f->data = packetalloc(); f->data = packetalloc();
packetconcat(f->data, p); packetconcat(f->data, p);

View file

@ -12,9 +12,9 @@ vtfcallfmt(Fmt *f)
fmtprint(f, "<nil fcall>"); fmtprint(f, "<nil fcall>");
return 0; return 0;
} }
switch(t->type){ switch(t->msgtype){
default: default:
return fmtprint(f, "%c%d tag %ud", "TR"[t->type&1], t->type>>1, t->tag); return fmtprint(f, "%c%d tag %ud", "TR"[t->msgtype&1], t->msgtype>>1, t->tag);
case VtRerror: case VtRerror:
return fmtprint(f, "Rerror tag %ud error %s", t->tag, t->error); return fmtprint(f, "Rerror tag %ud error %s", t->tag, t->error);
case VtTping: case VtTping:
@ -40,11 +40,11 @@ vtfcallfmt(Fmt *f)
case VtRauth1: case VtRauth1:
return fmtprint(f, "Rauth1 tag %ud auth %.*H", t->tag, t->nauth, t->auth); return fmtprint(f, "Rauth1 tag %ud auth %.*H", t->tag, t->nauth, t->auth);
case VtTread: case VtTread:
return fmtprint(f, "Tread tag %ud score %V dtype %d count %d", t->tag, t->score, t->dtype, t->count); return fmtprint(f, "Tread tag %ud score %V blocktype %d count %d", t->tag, t->score, t->blocktype, t->count);
case VtRread: case VtRread:
return fmtprint(f, "Rread tag %ud count %d", t->tag, packetsize(t->data)); return fmtprint(f, "Rread tag %ud count %d", t->tag, packetsize(t->data));
case VtTwrite: case VtTwrite:
return fmtprint(f, "Twrite tag %ud dtype %d count %d", t->tag, t->dtype, packetsize(t->data)); return fmtprint(f, "Twrite tag %ud blocktype %d count %d", t->tag, t->blocktype, packetsize(t->data));
case VtRwrite: case VtRwrite:
return fmtprint(f, "Rwrite tag %ud score %V", t->tag, t->score); return fmtprint(f, "Rwrite tag %ud score %V", t->tag, t->score);
case VtTsync: case VtTsync:

View file

@ -151,7 +151,7 @@ if(first && chattyventi){
if(chattyventi) if(chattyventi)
fprint(2, "%s <- %F\n", argv0, &r->tx); fprint(2, "%s <- %F\n", argv0, &r->tx);
packetfree(p); packetfree(p);
if(r->tx.type == VtTgoodbye) if(r->tx.msgtype == VtTgoodbye)
break; break;
r->rx.tag = r->tx.tag; r->rx.tag = r->tx.tag;
r->sc = sc; r->sc = sc;
@ -195,7 +195,7 @@ vtrespond(VtReq *r)
sc = r->sc; sc = r->sc;
if(r->rx.tag != r->tx.tag) if(r->rx.tag != r->tx.tag)
abort(); abort();
if(r->rx.type != r->tx.type+1 && r->rx.type != VtRerror) if(r->rx.msgtype != r->tx.msgtype+1 && r->rx.msgtype != VtRerror)
abort(); abort();
if(chattyventi) if(chattyventi)
fprint(2, "%s -> %F\n", argv0, &r->rx); fprint(2, "%s -> %F\n", argv0, &r->rx);

View file

@ -17,9 +17,9 @@ vtsrvhello(VtConn *z)
} }
packetfree(p); packetfree(p);
if(tx.type != VtThello){ if(tx.msgtype != VtThello){
vtfcallclear(&tx); vtfcallclear(&tx);
werrstr("bad packet type %d; want Thello %d", tx.type, VtThello); werrstr("bad packet type %d; want Thello %d", tx.msgtype, VtThello);
return -1; return -1;
} }
if(tx.tag != 0){ if(tx.tag != 0){
@ -38,7 +38,7 @@ vtsrvhello(VtConn *z)
vtfcallclear(&tx); vtfcallclear(&tx);
memset(&rx, 0, sizeof rx); memset(&rx, 0, sizeof rx);
rx.type = VtRhello; rx.msgtype = VtRhello;
rx.tag = tx.tag; rx.tag = tx.tag;
rx.sid = "anonymous"; rx.sid = "anonymous";
if((p = vtfcallpack(&rx)) == nil) if((p = vtfcallpack(&rx)) == nil)