summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>2000-07-18 21:33:33 +0000
committerThomas Bushnell <thomas@gnu.org>2000-07-18 21:33:33 +0000
commit8866749204162b2192bdf76d19cd6bc3ced21854 (patch)
tree9596184bc1f3b39944c8c9f2c61ef68ce0dde205 /libdiskfs
parentf99c9356da75637b8b7a366f251b1d8535dfbb9b (diff)
2000-07-18 Thomas Bushnell, BSG <tb@mit.edu>
* io-seek.c (diskfs_S_io_seek): Don't use CHANGE_NODE_FIELD anymore; it was causing problems and was a gross hack anyway.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/ChangeLog5
-rw-r--r--libdiskfs/io-seek.c58
2 files changed, 35 insertions, 28 deletions
diff --git a/libdiskfs/ChangeLog b/libdiskfs/ChangeLog
index 1fba6652..2ea6d4dd 100644
--- a/libdiskfs/ChangeLog
+++ b/libdiskfs/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-18 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * io-seek.c (diskfs_S_io_seek): Don't use CHANGE_NODE_FIELD
+ anymore; it was causing problems and was a gross hack anyway.
+
2000-05-14 Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>
* priv.h (DEFAULT_SYNC_INTERVAL): New macro.
diff --git a/libdiskfs/io-seek.c b/libdiskfs/io-seek.c
index 33aa77d4..6bdd4195 100644
--- a/libdiskfs/io-seek.c
+++ b/libdiskfs/io-seek.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
+ Copyright (C) 1994, 1995, 1996, 2000 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -19,9 +19,6 @@
#include "io_S.h"
#include <unistd.h>
-#define diskfs_readonly 0
-#define diskfs_synchronous 0
-
/* Implement io_seek as described in <hurd/io.defs>. */
kern_return_t
diskfs_S_io_seek (struct protid *cred,
@@ -29,29 +26,34 @@ diskfs_S_io_seek (struct protid *cred,
int whence,
off_t *newoffset)
{
+ error_t err = 0;
+ struct node *np;
+
+ if (!cred)
+ return EOPNOTSUPP;
+
+ np = cred->po->np;
- CHANGE_NODE_FIELD (cred,
- ({
- iohelp_get_conch (&np->conch);
- switch (whence)
- {
- case SEEK_SET:
- err = 0;
- cred->po->filepointer = offset;
- break;
- case SEEK_CUR:
- err = 0;
- cred->po->filepointer += offset;
- break;
- case SEEK_END:
- err = 0;
- cred->po->filepointer = (np->dn_stat.st_size
- + offset);
- break;
- default:
- err = EINVAL;
- break;
- }
- *newoffset = cred->po->filepointer;
- }));
+ mutex_lock (&np->lock);
+
+ iohelp_get_conch (&np->conch);
+ switch (whence)
+ {
+ case SEEK_SET:
+ cred->po->filepointer = offset;
+ break;
+ case SEEK_CUR:
+ cred->po->filepointer += offset;
+ break;
+ case SEEK_END:
+ cred->po->filepointer = (np->dn_stat.st_size + offset);
+ break;
+ default:
+ err = EINVAL;
+ break;
+ }
+ *newoffset = cred->po->filepointer;
+
+ mutex_unlock (&np->lock);
+ return err;
}