| Date: Mon, 27 Dec 2004 00:12:54 +0000
change to use new thread library
Diffstat:
M src/libfs/fs.c | 12 ++++++++----
M src/libfs/fsimpl.h | 4 ++++
2 files changed, 12 insertions(+), 4 deletions(-)
--- |
| t@@ -39,6 +39,8 @@ fsinit(int fd)
fs->mux.recv = _fsrecv;
fs->mux.gettag = _fsgettag;
fs->mux.settag = _fssettag;
+ fs->iorecv = ioproc();
+ fs->iosend = ioproc();
muxinit(&fs->mux);
return fs;
}
t@@ -105,6 +107,8 @@ _fsdecref(Fsys *fs)
next = f->next;
free(f);
}
+ closeioproc(fs->iorecv);
+ closeioproc(fs->iosend);
free(fs);
return;
}
t@@ -267,7 +271,7 @@ _fssend(Mux *mux, void *pkt)
Fsys *fs;
fs = mux->aux;
- return threadwrite(fs->fd, pkt, GBIT32((uchar*)pkt));
+ return iowrite(fs->iosend, fs->fd, pkt, GBIT32((uchar*)pkt));
}
static void*
t@@ -279,7 +283,7 @@ _fsrecv(Mux *mux)
Fsys *fs;
fs = mux->aux;
- n = threadreadn(fs->fd, buf, 4);
+ n = ioreadn(fs->iorecv, fs->fd, buf, 4);
if(n != 4)
return nil;
n = GBIT32(buf);
t@@ -289,12 +293,12 @@ _fsrecv(Mux *mux)
return nil;
}
PBIT32(pkt, n);
- if(threadreadn(fs->fd, pkt+4, n-4) != n-4){
+ if(ioreadn(fs->iorecv, fs->fd, pkt+4, n-4) != n-4){
free(pkt);
return nil;
}
if(pkt[4] == Ropenfd){
- if((nfd=threadrecvfd(fs->fd)) < 0){
+ if((nfd=iorecvfd(fs->iorecv, fs->fd)) < 0){
fprint(2, "recv fd error: %r\n");
free(pkt);
return nil; |
| t@@ -1,6 +1,8 @@
/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */
/* See COPYRIGHT */
+#include
+
typedef struct Queue Queue;
Queue *_fsqalloc(void);
int _fsqsend(Queue*, void*);
t@@ -22,6 +24,8 @@ struct Fsys
Queue *rxq;
Fid *freefid;
int nextfid;
+ Ioproc *iorecv;
+ Ioproc *iosend;
};
struct Fid |