mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
lib9: dotu fixes in convS2M, convM2S
http://codereview.appspot.com/109049
This commit is contained in:
parent
e7c5e5ed94
commit
8ff457f56d
3 changed files with 36 additions and 6 deletions
|
@ -44,6 +44,7 @@ struct Fcall
|
|||
|
||||
/* 9P2000.u extensions */
|
||||
int errornum; /* Rerror */
|
||||
int uidnum; /* Tattach, Tauth */
|
||||
char *extension; /* Tcreate */
|
||||
} Fcall;
|
||||
|
||||
|
@ -73,6 +74,7 @@ struct Fcall
|
|||
|
||||
#define NOTAG (ushort)~0U /* Dummy tag */
|
||||
#define NOFID (u32int)~0U /* Dummy fid */
|
||||
#define NOUID (-1) /* Dummy uid */
|
||||
#define IOHDRSZ 24 /* ample room for Twrite/Rread header (iounit) */
|
||||
|
||||
enum
|
||||
|
|
|
@ -100,6 +100,13 @@ convM2Su(uchar *ap, uint nap, Fcall *f, int dotu)
|
|||
p = gstring(p, ep, &f->aname);
|
||||
if(p == nil)
|
||||
break;
|
||||
f->uidnum = NOUID;
|
||||
if(dotu){
|
||||
if(p+BIT32SZ > ep)
|
||||
return 0;
|
||||
f->uidnum = GBIT32(p);
|
||||
p += BIT32SZ;
|
||||
}
|
||||
break;
|
||||
|
||||
case Tattach:
|
||||
|
@ -117,6 +124,13 @@ convM2Su(uchar *ap, uint nap, Fcall *f, int dotu)
|
|||
p = gstring(p, ep, &f->aname);
|
||||
if(p == nil)
|
||||
break;
|
||||
f->uidnum = NOUID;
|
||||
if(dotu){
|
||||
if(p+BIT32SZ > ep)
|
||||
return 0;
|
||||
f->uidnum = GBIT32(p);
|
||||
p += BIT32SZ;
|
||||
}
|
||||
break;
|
||||
|
||||
case Twalk:
|
||||
|
@ -233,10 +247,10 @@ convM2Su(uchar *ap, uint nap, Fcall *f, int dotu)
|
|||
p = gstring(p, ep, &f->ename);
|
||||
f->errornum = 0;
|
||||
if(dotu){
|
||||
if(p+BIT16SZ > ep)
|
||||
if(p+BIT32SZ > ep)
|
||||
return 0;
|
||||
f->errornum = GBIT16(p);
|
||||
p += BIT16SZ;
|
||||
f->errornum = GBIT32(p);
|
||||
p += BIT32SZ;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -74,6 +74,8 @@ sizeS2Mu(Fcall *f, int dotu)
|
|||
n += BIT32SZ;
|
||||
n += stringsz(f->uname);
|
||||
n += stringsz(f->aname);
|
||||
if(dotu)
|
||||
n += BIT32SZ;
|
||||
break;
|
||||
|
||||
case Tattach:
|
||||
|
@ -81,6 +83,8 @@ sizeS2Mu(Fcall *f, int dotu)
|
|||
n += BIT32SZ;
|
||||
n += stringsz(f->uname);
|
||||
n += stringsz(f->aname);
|
||||
if(dotu)
|
||||
n += BIT32SZ;
|
||||
break;
|
||||
|
||||
case Twalk:
|
||||
|
@ -144,7 +148,7 @@ sizeS2Mu(Fcall *f, int dotu)
|
|||
case Rerror:
|
||||
n += stringsz(f->ename);
|
||||
if(dotu)
|
||||
n += BIT16SZ;
|
||||
n += BIT32SZ;
|
||||
break;
|
||||
|
||||
case Rflush:
|
||||
|
@ -249,6 +253,11 @@ convS2Mu(Fcall *f, uchar *ap, uint nap, int dotu)
|
|||
p += BIT32SZ;
|
||||
p = pstring(p, f->uname);
|
||||
p = pstring(p, f->aname);
|
||||
if(dotu){
|
||||
f->uidnum = NOUID;
|
||||
PBIT32(p, f->uidnum);
|
||||
p += BIT32SZ;
|
||||
}
|
||||
break;
|
||||
|
||||
case Tattach:
|
||||
|
@ -258,6 +267,11 @@ convS2Mu(Fcall *f, uchar *ap, uint nap, int dotu)
|
|||
p += BIT32SZ;
|
||||
p = pstring(p, f->uname);
|
||||
p = pstring(p, f->aname);
|
||||
if(dotu){
|
||||
f->uidnum = NOUID;
|
||||
PBIT32(p, f->uidnum);
|
||||
p += BIT32SZ;
|
||||
}
|
||||
break;
|
||||
|
||||
case Twalk:
|
||||
|
@ -344,8 +358,8 @@ convS2Mu(Fcall *f, uchar *ap, uint nap, int dotu)
|
|||
case Rerror:
|
||||
p = pstring(p, f->ename);
|
||||
if(dotu){
|
||||
PBIT16(p, f->errornum);
|
||||
p += BIT16SZ;
|
||||
PBIT32(p, f->errornum);
|
||||
p += BIT32SZ;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue