summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-04 21:18:49 +0000
committerRoland McGrath <roland@gnu.org>1996-01-04 21:18:49 +0000
commit1b7ed34b975cf5aaacd06fea620d9b7ca268d75d (patch)
tree3c11449268410d8a463852cc7bdcc4b187a2c521
parent443530e027c699ace1aed21fc3347a4ffd35bdfa (diff)
(diskfs_node_rdwr): Pass AMTREAD read/write to _diskfs_rdwr_internal,
instead of assuming it wrote the whole amount. Update the node if anything was transferred, regardless of ERR.
-rw-r--r--libdiskfs/node-rdwr.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/libdiskfs/node-rdwr.c b/libdiskfs/node-rdwr.c
index 438b7426..888f2497 100644
--- a/libdiskfs/node-rdwr.c
+++ b/libdiskfs/node-rdwr.c
@@ -1,5 +1,5 @@
-/*
- Copyright (C) 1994, 1995 Free Software Foundation
+/*
+ Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -27,18 +27,18 @@
extension). For reads, *AMTREAD is filled with the amount actually
read. */
error_t
-diskfs_node_rdwr (struct node *np,
+diskfs_node_rdwr (struct node *np,
char *data,
- off_t off,
- int amt,
+ off_t off,
+ size_t amt,
int dir,
struct protid *cred,
- int *amtread)
+ size_t *amtread)
{
error_t err;
-
+
ioserver_get_conch (&np->conch);
-
+
if (dir)
while (off + amt > np->allocsize)
{
@@ -58,16 +58,15 @@ diskfs_node_rdwr (struct node *np,
amt = np->dn_stat.st_size - off;
}
- err = _diskfs_rdwr_internal (np, data, off, amt, dir, 0);
- if (diskfs_synchronous)
+ *amtread = amt;
+ err = _diskfs_rdwr_internal (np, data, off, amtread, dir, 0);
+ if (*amtread && diskfs_synchronous)
{
if (dir)
diskfs_file_update (np, 1);
else
diskfs_node_update (np, 1);
}
- if (!err && amtread)
- *amtread = amt;
return err;
}