From 1b7ed34b975cf5aaacd06fea620d9b7ca268d75d Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 4 Jan 1996 21:18:49 +0000 Subject: (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. --- libdiskfs/node-rdwr.c | 23 +++++++++++------------ 1 file 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; } -- cgit v1.2.3