@@ 44,7 44,7 @@ void mntgate(Mnt*);
void mntpntfree(Mnt*);
void mntqrm(Mnt*, Mntrpc*);
Mntrpc* mntralloc(Chan*);
-long mntrdwr(int , Chan*, void*,long , ulong);
+long mntrdwr(int , Chan*, void*,long , ulong, int);
void mntrpcread(Mnt*, Mntrpc*);
void mountio(Mnt*, Mntrpc*);
void mountmux(Mnt*, Mntrpc*);
@@ 168,6 168,7 @@ mntattach(char *muxattach)
mattach(m, c, bogus.spec);
poperror();
+#ifdef STUPIDHACK
/* Work out how deep we are nested and reduce the blocksize
* accordingly
*/
@@ 182,6 183,7 @@ mntattach(char *muxattach)
mc = mc->mntptr->c;
}
m->blocksize -= nest * 32;
+#endif STUPIDHACK
/*
* Detect a recursive mount for a mount point served by exportfs.
@@ 513,7 515,7 @@ mntread(Chan *c, void *buf, long n, ulong offset)
}
}
- n = mntrdwr(Tread, c, buf, n, offset);
+ n = mntrdwr(Tread, c, buf, n, offset, 0);
if(c->qid.path & CHDIR) {
for(p = (uchar*)buf, e = &p[n]; p < e; p += DIRLEN)
mntdirfix(p, c);
@@ 527,13 529,19 @@ mntread(Chan *c, void *buf, long n, ulong offset)
}
long
+mntwrite9p(Chan *c, void *buf, long n, ulong offset)
+{
+ return mntrdwr(Twrite, c, buf, n, offset, 1);
+}
+
+long
mntwrite(Chan *c, void *buf, long n, ulong offset)
{
- return mntrdwr(Twrite, c, buf, n, offset);
+ return mntrdwr(Twrite, c, buf, n, offset, 0);
}
long
-mntrdwr(int type, Chan *c, void *buf, long n, ulong offset)
+mntrdwr(int type, Chan *c, void *buf, long n, ulong offset, int p9msg)
{
Mnt *m;
Mntrpc *r;
@@ 555,7 563,10 @@ mntrdwr(int type, Chan *c, void *buf, long n, ulong offset)
r->request.fid = c->fid;
r->request.offset = offset;
r->request.data = uba;
- r->request.count = limit(n, m->blocksize);
+ if(p9msg)
+ r->request.count = limit(n, m->blocksize + MAXMSG - 20);
+ else
+ r->request.count = limit(n, m->blocksize);
mountrpc(m, r);
nr = r->reply.count;
if(nr > r->request.count)
@@ 629,8 640,13 @@ mountio(Mnt *m, Mntrpc *r)
nexterror();
}
else {
- if((*devtab[m->c->type].write)(m->c, r->rpc, n, 0) != n)
- error(Emountrpc);
+ if(devchar[m->c->type] == L'M'){
+ if(mntwrite9p(m->c, r->rpc, n, 0) != n)
+ error(Emountrpc);
+ }else{
+ if((*devtab[m->c->type].write)(m->c, r->rpc, n, 0) != n)
+ error(Emountrpc);
+ }
poperror();
}
if(m->mux) {
@@ 326,6 326,37 @@ sysread(ulong *arg)
}
long
+syswrite9p(ulong *arg)
+{
+ Chan *c;
+ long n;
+
+ validaddr(arg[1], arg[2], 0);
+ c = fdtochan(arg[0], OWRITE, 1, 1);
+ if(waserror()) {
+ close(c);
+ nexterror();
+ }
+
+ if(c->qid.path & CHDIR)
+ error(Eisdir);
+
+ if(devchar[c->type] != L'M')
+ n = (*devtab[c->type].write)(c, (void*)arg[1], arg[2], c->offset);
+ else
+ n = mntwrite9p(c, (void*)arg[1], arg[2], c->offset);
+
+ lock(c);
+ c->offset += n;
+ unlock(c);
+
+ poperror();
+ close(c);
+
+ return n;
+}
+
+long
syswrite(ulong *arg)
{
Chan *c;
@@ 40,6 40,8 @@ Syscall syssegflush;
Syscall sysrendezvous;
Syscall sysunmount;
Syscall syswait;
+Syscall syswrite9p;
+Syscall ;
Syscall ;
Syscall sysdeath;
@@ 81,6 83,8 @@ Syscall *systab[]={
[RENDEZVOUS] sysrendezvous,
[UNMOUNT] sysunmount,
[WAIT] syswait,
+ [WRITE9P] syswrite9p,
+
};
@@ 122,5 126,7 @@ char *sysctab[]={
[RENDEZVOUS] "Rendez",
[UNMOUNT] "Unmount",
[WAIT] "Wait",
+ [WRITE9P] "Write9p",
+
};