diff options
author | rsc <devnull@localhost> | 2004-03-21 04:33:13 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-03-21 04:33:13 +0000 |
commit | 2277c5d7bbe1f9595fad512d8f790708473a9bf1 (patch) | |
tree | 4d653e13906f1971d3170dba6dbe0fbf92eb48d6 /src/libfs | |
parent | a770daa795754cb600ad3fab2fdd2961147006c4 (diff) | |
download | plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.tar.gz plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.tar.bz2 plan9port-2277c5d7bbe1f9595fad512d8f790708473a9bf1.zip |
Small tweaks
Lots of new code imported.
Diffstat (limited to 'src/libfs')
-rw-r--r-- | src/libfs/fs.c | 2 | ||||
-rw-r--r-- | src/libfs/read.c | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/libfs/fs.c b/src/libfs/fs.c index d912391f..31515250 100644 --- a/src/libfs/fs.c +++ b/src/libfs/fs.c @@ -259,7 +259,7 @@ _fssend(Mux *mux, void *pkt) Fsys *fs; fs = mux->aux; - return write(fs->fd, pkt, GBIT32((uchar*)pkt)); + return threadwrite(fs->fd, pkt, GBIT32((uchar*)pkt)); } static void* diff --git a/src/libfs/read.c b/src/libfs/read.c index c05d40d1..f868e123 100644 --- a/src/libfs/read.c +++ b/src/libfs/read.c @@ -52,3 +52,21 @@ fsread(Fid *fid, void *buf, long n) { return fspread(fid, buf, n, -1); } + +long +fsreadn(Fid *fid, void *buf, long n) +{ + long tot, nn; + + for(tot=0; tot<n; tot+=nn){ + nn = fsread(fid, (char*)buf+tot, n-tot); + if(nn <= 0){ + if(tot == 0) + return nn; + break; + } + } + return tot; +} + + |