ext2 fixes

This commit is contained in:
rsc 2006-05-04 18:03:11 +00:00
parent 886a6f6c53
commit 80b4aedc11
4 changed files with 20 additions and 7 deletions

View file

@ -463,6 +463,7 @@ fsysconfigreaddir(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int count, u64i
ep = data+count; ep = data+count;
while(e && p < ep){ while(e && p < ep){
ne.name = e->name; ne.name = e->name;
ne.namelen = strlen(e->name);
ne.cookie = ++cookie; ne.cookie = ++cookie;
ne.fileid = *(u64int*)e->sha1; ne.fileid = *(u64int*)e->sha1;
if(nfs3entrypack(p, ep, &np, &ne) < 0) if(nfs3entrypack(p, ep, &np, &ne) < 0)

View file

@ -15,7 +15,7 @@ usage(void)
fprint(2, "\tcat file\n"); fprint(2, "\tcat file\n");
fprint(2, "\tls dir\n"); fprint(2, "\tls dir\n");
fprint(2, "\tstat file\n"); fprint(2, "\tstat file\n");
exits("usage"); threadexitsall("usage");
} }
void void
@ -24,10 +24,10 @@ printattr(Nfs3Attr *attr)
Fmt fmt; Fmt fmt;
char buf[256]; char buf[256];
fmtfdinit(&fmt, 1, buf, sizeof buf); fmtfdinit(&fmt, 2, buf, sizeof buf);
nfs3attrprint(&fmt, attr); nfs3attrprint(&fmt, attr);
fmtfdflush(&fmt); fmtfdflush(&fmt);
print("\n"); fprint(2, "\n");
} }
char buf[8192]; char buf[8192];
@ -105,6 +105,7 @@ threadmain(int argc, char **argv)
if(strcmp(argv[1], "cat") == 0){ if(strcmp(argv[1], "cat") == 0){
switch(attr.type){ switch(attr.type){
case Nfs3FileReg: case Nfs3FileReg:
case Nfs3FileDir:
offset = 0; offset = 0;
for(;;){ for(;;){
x(fsysreadfile(fsys, &au, &h, sizeof buf, offset, &data, &n, &eof)); x(fsysreadfile(fsys, &au, &h, sizeof buf, offset, &data, &n, &eof));

View file

@ -39,6 +39,14 @@ threadmain(int argc, char **argv)
addr = "*"; addr = "*";
ARGBEGIN{ ARGBEGIN{
default:
usage();
case 'L':
if(srv->localonly == 0)
srv->localonly = 1;
else
srv->localparanoia = 1;
break;
case 'R': case 'R':
srv->chatty++; srv->chatty++;
break; break;
@ -70,14 +78,15 @@ threadmain(int argc, char **argv)
if(sunsrvudp(srv, addr) < 0) if(sunsrvudp(srv, addr) < 0)
sysfatal("starting server: %r"); sysfatal("starting server: %r");
sunsrvprog(srv, &nfs3prog, nfs3chan);
sunsrvprog(srv, &nfsmount3prog, mountchan);
sunsrvthreadcreate(srv, nfs3proc, nfs3chan); sunsrvthreadcreate(srv, nfs3proc, nfs3chan);
sunsrvthreadcreate(srv, mount3proc, mountchan); sunsrvthreadcreate(srv, mount3proc, mountchan);
sunsrvprog(srv, &nfs3prog, nfs3chan);
sunsrvprog(srv, &nfsmount3prog, mountchan);
fsgetroot(&h); fsgetroot(&h);
print("mountbackups -h %.*H %s /mountpoint\n", h.len, h.h, addr);
print("vmount0 -h %.*H %s /mnt\n", h.len, h.h, addr);
threadexits(nil); threadexits(nil);
} }

View file

@ -116,7 +116,8 @@ threadmain(int argc, char **argv)
tracecalls = 1; tracecalls = 1;
break; break;
case 'V': case 'V':
chattyventi = 1; if(chattyventi++)
vttracelevel++;
break; break;
case 'a': case 'a':
addr = EARGF(usage()); addr = EARGF(usage());
@ -836,6 +837,7 @@ cnodereaddir(Cnode *n, u32int count, u64int cookie, uchar **pdata, u32int *pcoun
continue; continue;
} }
ne.name = n->name; ne.name = n->name;
ne.namelen = strlen(n->name);
ne.cookie = ++cookie; ne.cookie = ++cookie;
ne.fileid = *(u64int*)n->handle; ne.fileid = *(u64int*)n->handle;
if(nfs3entrypack(p, ep, &np, &ne) < 0) if(nfs3entrypack(p, ep, &np, &ne) < 0)