lib9pclient: add support for 9P2000.u
diff --git a/src/lib9pclient/dirread.c b/src/lib9pclient/dirread.c
index 2d11191..c2b1388 100644
--- a/src/lib9pclient/dirread.c
+++ b/src/lib9pclient/dirread.c
@@ -4,9 +4,10 @@
#include <libc.h>
#include <fcall.h>
#include <9pclient.h>
+#include "fsimpl.h"
static long
-dirpackage(uchar *buf, long ts, Dir **d)
+dirpackage(uchar *buf, long ts, Dir **d, int dotu)
{
char *s;
long ss, i, n, nn, m;
@@ -22,7 +23,7 @@
n = 0;
for(i = 0; i < ts; i += m){
m = BIT16SZ + GBIT16(&buf[i]);
- if(statcheck(&buf[i], m) < 0)
+ if(statchecku(&buf[i], m, dotu) < 0)
break;
ss += m;
n++;
@@ -42,7 +43,7 @@
nn = 0;
for(i = 0; i < ts; i += m){
m = BIT16SZ + GBIT16((uchar*)&buf[i]);
- if(nn >= n || convM2D(&buf[i], m, *d + nn, s) != m){
+ if(nn >= n || convM2Du(&buf[i], m, *d + nn, s, dotu) != m){
free(*d);
*d = nil;
return -1;
@@ -65,7 +66,7 @@
return -1;
ts = fsread(fid, buf, DIRMAX);
if(ts >= 0)
- ts = dirpackage(buf, ts, d);
+ ts = dirpackage(buf, ts, d, fid->fs->dotu);
free(buf);
return ts;
}
@@ -91,9 +92,9 @@
ts += n;
}
if(ts >= 0){
- ts = dirpackage(buf, ts, d);
+ ts = dirpackage(buf, ts, d, fid->fs->dotu);
if(ts < 0)
- werrstr("malformed directory contents");
+ werrstr("malformed directory contents [dotu=%d]", fid->fs->dotu);
}
free(buf);
if(ts == 0 && n < 0)