nfsserver: claim more free space [rsc] --rw-rw-r-- M 940585 glenda sys 15772 Apr 16 08:59 sys/src/cmd/9nfs/nfsserver.c /n/sourcesdump/2006/0416/plan9/sys/src/cmd/9nfs/nfsserver.c:629,634 - /n/sourcesdump/2006/0417/plan9/sys/src/cmd/9nfs/nfsserver.c:629,639 nfsstatfs(int n, Rpccall *cmd, Rpccall *reply) { uchar *dataptr = reply->results; + enum { + Xfersize = 2048, + Maxlong = (long)((1ULL<<31) - 1), + Maxfreeblks = Maxlong / Xfersize, + }; chat("statfs..."); showauth(&cmd->cred); /n/sourcesdump/2006/0416/plan9/sys/src/cmd/9nfs/nfsserver.c:635,645 - /n/sourcesdump/2006/0417/plan9/sys/src/cmd/9nfs/nfsserver.c:640,650 if(n != FHSIZE) return garbage(reply, "bad count"); PLONG(NFS_OK); - PLONG(4096); /* tsize */ - PLONG(2048); /* bsize */ - PLONG(100000); /* blocks */ - PLONG(50000); /* bfree */ - PLONG(40000); /* bavail */ + PLONG(4096); /* tsize (fs block size) */ + PLONG(Xfersize); /* bsize (optimal transfer size) */ + PLONG(Maxfreeblks); /* blocks in fs */ + PLONG(Maxfreeblks); /* bfree to root*/ + PLONG(Maxfreeblks); /* bavail (free to mortals) */ chat("OK\n"); /*conftime = 0; readunixidmaps(config);*/ win: handle malformed runes better [rsc] --rw-rw-r-- M 940585 glenda sys 2743 Apr 16 09:04 acme/bin/source/win/fs.c /n/sourcesdump/2006/0416/plan9/acme/bin/source/win/fs.c:46,52 - /n/sourcesdump/2006/0417/plan9/acme/bin/source/win/fs.c:46,52 { static Event *e[4]; Event *ep; - int i, j, nb, wid, pid; + int i, j, ei, nb, wid, pid; Rune rune; char *s; char tmp[UTFmax], *t; /n/sourcesdump/2006/0416/plan9/acme/bin/source/win/fs.c:97,104 - /n/sourcesdump/2006/0417/plan9/acme/bin/source/win/fs.c:97,105 nb = j; t[j] = '\0'; } + ei = nb>8192? 8192 : nb; /* process bytes into runes, transferring terminal partial runes into next buffer */ - for(i=j=0; ib+i, nb-i); i+=wid,j++) + for(i=j=0; ib+i, ei-i); i+=wid,j++) wid = chartorune(&rune, ep->b+i); memmove(tmp, ep->b+i, nb-i); partial = nb-i; [rsc] --rw-rw-r-- M 940585 glenda sys 12432 Apr 16 09:04 acme/bin/source/win/main.c /n/sourcesdump/2006/0416/plan9/acme/bin/source/win/main.c:436,442 - /n/sourcesdump/2006/0417/plan9/acme/bin/source/win/main.c:436,442 sprint(tmp, "#%lud", hostpt); winsetaddr(w, tmp, 0); write(w->data, e->b, e->nb); - pendingS += utfnlen(e->b, e->nb); + pendingS += e->nr; break; case 'E': /* write to tag or body; body happens due to sendit */