summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-11-13 21:33:15 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-11-13 21:33:15 +0000
commit0ec8fe4fe8c967c934566a4bf916744320a192aa (patch)
tree0be603473887be6752392cc1d74ae1781e678676 /libnetfs
parent3fd0286bd2761864cf3ee39da705fdb50f06dedf (diff)
entered into RCS
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/io-write.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libnetfs/io-write.c b/libnetfs/io-write.c
index 1341c47a..7e452ede 100644
--- a/libnetfs/io-write.c
+++ b/libnetfs/io-write.c
@@ -19,17 +19,30 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "netfs.h"
+#include "io_S.h"
error_t
netfs_S_io_write (struct protid *user,
char *data,
- mach_msg_number_t datalen,
+ mach_msg_type_number_t datalen,
off_t offset,
- mach_msg_number_t *amount)
+ mach_msg_type_number_t *amount)
{
+ error_t err;
+
if (!user)
return EOPNOTSUPP;
- return netfs_attempt_write (user->credential, user->po->np,
- offset, amount, data);
+ mutex_lock (&user->po->np->lock);
+ *amount = datalen;
+ err = netfs_attempt_write (user->credential, user->po->np,
+ offset == -1 ? user->po->filepointer : offset,
+ amount, data);
+ if (offset == -1 && !err)
+ user->po->filepointer += *amount;
+ mutex_unlock (&user->po->np->lock);
+
+ return err;
}
+
+