diff options
| author | rsc <devnull@localhost> | 2005-01-02 19:46:12 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2005-01-02 19:46:12 +0000 |
| commit | 2600337aa704efbeba8201e88147a764b4fd2b90 (patch) | |
| tree | 48d526d00a515aabde861659380cf0f393e16401 /src/libfs/read.c | |
| parent | acc021b8f8c727c0f04f33615354170fd7bccd0c (diff) | |
| download | plan9port-2600337aa704efbeba8201e88147a764b4fd2b90.tar.gz plan9port-2600337aa704efbeba8201e88147a764b4fd2b90.zip | |
remove libfs. now lib9pclient
Diffstat (limited to 'src/libfs/read.c')
| -rw-r--r-- | src/libfs/read.c | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/src/libfs/read.c b/src/libfs/read.c deleted file mode 100644 index f868e123..00000000 --- a/src/libfs/read.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (C) 2003 Russ Cox, Massachusetts Institute of Technology */ -/* See COPYRIGHT */ - -#include <u.h> -#include <libc.h> -#include <fcall.h> -#include <fs.h> -#include "fsimpl.h" - -long -fspread(Fid *fid, void *buf, long n, vlong offset) -{ - Fcall tx, rx; - void *freep; - uint msize; - - msize = fid->fs->msize - IOHDRSZ; - if(n > msize) - n = msize; - tx.type = Tread; - tx.fid = fid->fid; - if(offset == -1){ - qlock(&fid->lk); - tx.offset = fid->offset; - qunlock(&fid->lk); - }else - tx.offset = offset; - tx.count = n; - - if(fsrpc(fid->fs, &tx, &rx, &freep) < 0) - return -1; - if(rx.type == Rerror){ - werrstr("%s", rx.ename); - free(freep); - return -1; - } - if(rx.count){ - memmove(buf, rx.data, rx.count); - if(offset == -1){ - qlock(&fid->lk); - fid->offset += rx.count; - qunlock(&fid->lk); - } - } - free(freep); - - return rx.count; -} - -long -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; -} - - |
