aboutsummaryrefslogtreecommitdiff
path: root/src/libfs/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libfs/read.c')
-rw-r--r--src/libfs/read.c18
1 files changed, 18 insertions, 0 deletions
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;
+}
+
+