summaryrefslogtreecommitdiff
path: root/libnetfs
diff options
context:
space:
mode:
Diffstat (limited to 'libnetfs')
-rw-r--r--libnetfs/Makefile3
-rw-r--r--libnetfs/dir-lookup.c14
-rw-r--r--libnetfs/dir-mkdir.c4
-rw-r--r--libnetfs/dir-mkfile.c2
-rw-r--r--libnetfs/dir-readdir.c4
-rw-r--r--libnetfs/dir-rmdir.c4
-rw-r--r--libnetfs/dir-unlink.c4
-rw-r--r--libnetfs/drop-node.c2
-rw-r--r--libnetfs/file-chauthor.c4
-rw-r--r--libnetfs/file-check-access.c4
-rw-r--r--libnetfs/file-chflags.c4
-rw-r--r--libnetfs/file-chmod.c4
-rw-r--r--libnetfs/file-chown.c4
-rw-r--r--libnetfs/file-exec.c4
-rw-r--r--libnetfs/file-get-storage-info.c4
-rw-r--r--libnetfs/file-get-translator.c6
-rw-r--r--libnetfs/file-lock-stat.c4
-rw-r--r--libnetfs/file-lock.c4
-rw-r--r--libnetfs/file-reparent.c6
-rw-r--r--libnetfs/file-set-size.c4
-rw-r--r--libnetfs/file-set-translator.c14
-rw-r--r--libnetfs/file-statfs.c4
-rw-r--r--libnetfs/file-sync.c4
-rw-r--r--libnetfs/file-syncfs.c4
-rw-r--r--libnetfs/file-utimes.c4
-rw-r--r--libnetfs/fsys-getroot.c8
-rw-r--r--libnetfs/fsys-set-options.c4
-rw-r--r--libnetfs/init-init.c2
-rw-r--r--libnetfs/io-clear-some-openmodes.c4
-rw-r--r--libnetfs/io-duplicate.c4
-rw-r--r--libnetfs/io-get-openmodes.c4
-rw-r--r--libnetfs/io-get-owner.c4
-rw-r--r--libnetfs/io-identity.c8
-rw-r--r--libnetfs/io-mod-owner.c4
-rw-r--r--libnetfs/io-read.c6
-rw-r--r--libnetfs/io-readable.c4
-rw-r--r--libnetfs/io-reauthenticate.c4
-rw-r--r--libnetfs/io-restrict-auth.c6
-rw-r--r--libnetfs/io-revoke.c4
-rw-r--r--libnetfs/io-seek.c4
-rw-r--r--libnetfs/io-set-all-openmodes.c4
-rw-r--r--libnetfs/io-set-some-openmodes.c4
-rw-r--r--libnetfs/io-stat.c4
-rw-r--r--libnetfs/io-write.c6
-rw-r--r--libnetfs/make-node.c2
-rw-r--r--libnetfs/netfs.h5
-rw-r--r--libnetfs/nput.c6
-rw-r--r--libnetfs/nref.c4
-rw-r--r--libnetfs/nrele.c6
-rw-r--r--libnetfs/release-peropen.c6
-rw-r--r--libnetfs/shutdown.c6
51 files changed, 122 insertions, 120 deletions
diff --git a/libnetfs/Makefile b/libnetfs/Makefile
index 33ee2fb2..24b5acae 100644
--- a/libnetfs/Makefile
+++ b/libnetfs/Makefile
@@ -23,7 +23,8 @@ dir := libnetfs
makemode := library
libname = libnetfs
-HURDLIBS = fshelp iohelp threads ports shouldbeinlibc
+HURDLIBS = fshelp iohelp ports shouldbeinlibc
+LDLIBS += -lpthread
FSSRCS= dir-link.c dir-lookup.c dir-mkdir.c dir-mkfile.c \
dir-notice-changes.c dir-readdir.c dir-rename.c \
diff --git a/libnetfs/dir-lookup.c b/libnetfs/dir-lookup.c
index 17d9e23e..f1b6438f 100644
--- a/libnetfs/dir-lookup.c
+++ b/libnetfs/dir-lookup.c
@@ -69,13 +69,13 @@ netfs_S_dir_lookup (struct protid *diruser,
/* Set things up in the state expected by the code from gotit: on. */
dnp = 0;
np = diruser->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
netfs_nref (np);
goto gotit;
}
dnp = diruser->po->np;
- mutex_lock (&dnp->lock);
+ pthread_mutex_lock (&dnp->lock);
netfs_nref (dnp); /* acquire a reference for later netfs_nput */
@@ -120,7 +120,7 @@ netfs_S_dir_lookup (struct protid *diruser,
if (! lastcomp)
strcpy (retry_name, nextname);
error = 0;
- mutex_unlock (&dnp->lock);
+ pthread_mutex_unlock (&dnp->lock);
goto out;
}
else if (diruser->po->root_parent != MACH_PORT_NULL)
@@ -134,7 +134,7 @@ netfs_S_dir_lookup (struct protid *diruser,
if (!lastcomp)
strcpy (retry_name, nextname);
error = 0;
- mutex_unlock (&dnp->lock);
+ pthread_mutex_unlock (&dnp->lock);
goto out;
}
else
@@ -159,7 +159,7 @@ netfs_S_dir_lookup (struct protid *diruser,
{
mode &= ~(S_IFMT | S_ISPARE | S_ISVTX);
mode |= S_IFREG;
- mutex_lock (&dnp->lock);
+ pthread_mutex_lock (&dnp->lock);
error = netfs_attempt_create_file (diruser->user, dnp,
filename, mode, &np);
@@ -168,7 +168,7 @@ netfs_S_dir_lookup (struct protid *diruser,
EXCL, that's fine; otherwise, we have to retry the lookup. */
if (error == EEXIST && !excl)
{
- mutex_lock (&dnp->lock);
+ pthread_mutex_lock (&dnp->lock);
goto retry_lookup;
}
@@ -338,7 +338,7 @@ netfs_S_dir_lookup (struct protid *diruser,
create = 0;
}
netfs_nput (np);
- mutex_lock (&dnp->lock);
+ pthread_mutex_lock (&dnp->lock);
np = 0;
}
else
diff --git a/libnetfs/dir-mkdir.c b/libnetfs/dir-mkdir.c
index 33feb25f..c8bebac8 100644
--- a/libnetfs/dir-mkdir.c
+++ b/libnetfs/dir-mkdir.c
@@ -32,8 +32,8 @@ netfs_S_dir_mkdir (struct protid *user, char *name, mode_t mode)
mode &= ~(S_IFMT|S_ISPARE|S_ISVTX);
mode |= S_IFDIR;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_mkdir (user->user, user->po->np, name, mode);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/dir-mkfile.c b/libnetfs/dir-mkfile.c
index 7d388737..9e5847af 100644
--- a/libnetfs/dir-mkfile.c
+++ b/libnetfs/dir-mkfile.c
@@ -31,7 +31,7 @@ netfs_S_dir_mkfile (struct protid *diruser, int flags, mode_t mode,
struct iouser *user;
struct protid *newpi;
- mutex_lock (&diruser->po->np->lock);
+ pthread_mutex_lock (&diruser->po->np->lock);
err = netfs_attempt_mkfile (diruser->user, diruser->po->np, mode, &np);
if (!err)
diff --git a/libnetfs/dir-readdir.c b/libnetfs/dir-readdir.c
index 7f896ac1..4ab03d8a 100644
--- a/libnetfs/dir-readdir.c
+++ b/libnetfs/dir-readdir.c
@@ -40,7 +40,7 @@ netfs_S_dir_readdir (struct protid *user,
return EOPNOTSUPP;
np = user->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
err = 0;
if ((user->po->openstat & O_READ) == 0)
@@ -53,6 +53,6 @@ netfs_S_dir_readdir (struct protid *user,
err = netfs_get_dirents (user->user, np, entry, nentries, data,
datacnt, bufsiz, amt);
*data_dealloc = 1; /* XXX */
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
diff --git a/libnetfs/dir-rmdir.c b/libnetfs/dir-rmdir.c
index 9a5941d3..96196fd4 100644
--- a/libnetfs/dir-rmdir.c
+++ b/libnetfs/dir-rmdir.c
@@ -29,8 +29,8 @@ netfs_S_dir_rmdir (struct protid *diruser, char *name)
if (!diruser)
return EOPNOTSUPP;
- mutex_lock (&diruser->po->np->lock);
+ pthread_mutex_lock (&diruser->po->np->lock);
err = netfs_attempt_rmdir (diruser->user, diruser->po->np, name);
- mutex_unlock (&diruser->po->np->lock);
+ pthread_mutex_unlock (&diruser->po->np->lock);
return err;
}
diff --git a/libnetfs/dir-unlink.c b/libnetfs/dir-unlink.c
index 8077514a..6f1eaca6 100644
--- a/libnetfs/dir-unlink.c
+++ b/libnetfs/dir-unlink.c
@@ -26,8 +26,8 @@ netfs_S_dir_unlink (struct protid *user, char *name)
{
error_t err;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_unlink (user->user, user->po->np, name);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/drop-node.c b/libnetfs/drop-node.c
index b2ec95e3..5460149a 100644
--- a/libnetfs/drop-node.c
+++ b/libnetfs/drop-node.c
@@ -25,7 +25,7 @@ netfs_drop_node (struct node *np)
{
fshelp_drop_transbox (&np->transbox);
netfs_node_norefs (np);
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
}
diff --git a/libnetfs/file-chauthor.c b/libnetfs/file-chauthor.c
index ec7f6177..4f0aad0b 100644
--- a/libnetfs/file-chauthor.c
+++ b/libnetfs/file-chauthor.c
@@ -30,9 +30,9 @@ netfs_S_file_chauthor (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_chauthor (user->user, user->po->np, author);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-check-access.c b/libnetfs/file-check-access.c
index 8e36ede1..d8773ff2 100644
--- a/libnetfs/file-check-access.c
+++ b/libnetfs/file-check-access.c
@@ -30,8 +30,8 @@ netfs_S_file_check_access (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_report_access (user->user, user->po->np, types);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-chflags.c b/libnetfs/file-chflags.c
index 068a1cea..a5c132d4 100644
--- a/libnetfs/file-chflags.c
+++ b/libnetfs/file-chflags.c
@@ -30,8 +30,8 @@ netfs_S_file_chflags (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_chflags (user->user, user->po->np, flags);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-chmod.c b/libnetfs/file-chmod.c
index 0f082f18..413261ca 100644
--- a/libnetfs/file-chmod.c
+++ b/libnetfs/file-chmod.c
@@ -32,8 +32,8 @@ netfs_S_file_chmod (struct protid *user,
mode &= ~(S_IFMT | S_ISPARE | S_ITRANS);
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_chmod (user->user, user->po->np, mode);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-chown.c b/libnetfs/file-chown.c
index 4b724048..d02876c7 100644
--- a/libnetfs/file-chown.c
+++ b/libnetfs/file-chown.c
@@ -31,9 +31,9 @@ netfs_S_file_chown (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_chown (user->user, user->po->np,
owner, group);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-exec.c b/libnetfs/file-exec.c
index 73c125ba..638f0ae8 100644
--- a/libnetfs/file-exec.c
+++ b/libnetfs/file-exec.c
@@ -70,12 +70,12 @@ netfs_S_file_exec (struct protid *cred,
np = cred->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
mode = np->nn_stat.st_mode;
uid = np->nn_stat.st_uid;
gid = np->nn_stat.st_gid;
err = netfs_validate_stat (np, cred->user);
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
if (err)
return err;
diff --git a/libnetfs/file-get-storage-info.c b/libnetfs/file-get-storage-info.c
index ac977be3..d2c9d8fc 100644
--- a/libnetfs/file-get-storage-info.c
+++ b/libnetfs/file-get-storage-info.c
@@ -36,12 +36,12 @@ netfs_S_file_get_storage_info (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_file_get_storage_info (user->user, user->po->np, ports,
ports_type, num_ports, ints,
num_ints, offsets, num_offsets,
data, data_len);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-get-translator.c b/libnetfs/file-get-translator.c
index 7edc8fd0..59e61020 100644
--- a/libnetfs/file-get-translator.c
+++ b/libnetfs/file-get-translator.c
@@ -37,12 +37,12 @@ netfs_S_file_get_translator (struct protid *user,
return EOPNOTSUPP;
np = user->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
err = netfs_validate_stat (np, user->user);
if (err)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
@@ -112,7 +112,7 @@ netfs_S_file_get_translator (struct protid *user,
else
err = EINVAL;
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
diff --git a/libnetfs/file-lock-stat.c b/libnetfs/file-lock-stat.c
index 12f5eccf..49529cf4 100644
--- a/libnetfs/file-lock-stat.c
+++ b/libnetfs/file-lock-stat.c
@@ -29,9 +29,9 @@ netfs_S_file_lock_stat (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
*mystatus = user->po->lock_status;
*otherstatus = user->po->np->userlock.type;
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return 0;
}
diff --git a/libnetfs/file-lock.c b/libnetfs/file-lock.c
index cedc9c1d..0010d4be 100644
--- a/libnetfs/file-lock.c
+++ b/libnetfs/file-lock.c
@@ -28,9 +28,9 @@ netfs_S_file_lock (struct protid *user,
error_t err;
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = fshelp_acquire_lock (&user->po->np->userlock, &user->po->lock_status,
&user->po->np->lock, flags);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-reparent.c b/libnetfs/file-reparent.c
index 396a0a6b..61b7e37f 100644
--- a/libnetfs/file-reparent.c
+++ b/libnetfs/file-reparent.c
@@ -40,19 +40,19 @@ netfs_S_file_reparent (struct protid *cred, mach_port_t parent,
node = cred->po->np;
- mutex_lock (&node->lock);
+ pthread_mutex_lock (&node->lock);
new_cred =
netfs_make_protid (netfs_make_peropen (node, cred->po->openstat, cred->po),
user);
- mutex_unlock (&node->lock);
+ pthread_mutex_unlock (&node->lock);
if (new_cred)
{
/* Remove old shadow root state. */
if (new_cred->po->shadow_root && new_cred->po->shadow_root != node)
{
- mutex_lock (&new_cred->po->shadow_root->lock);
+ pthread_mutex_lock (&new_cred->po->shadow_root->lock);
netfs_nput (new_cred->po->shadow_root);
}
if (new_cred->po->shadow_root_parent)
diff --git a/libnetfs/file-set-size.c b/libnetfs/file-set-size.c
index 7b253e04..72f31db7 100644
--- a/libnetfs/file-set-size.c
+++ b/libnetfs/file-set-size.c
@@ -30,9 +30,9 @@ netfs_S_file_set_size (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_set_size (user->user, user->po->np, size);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-set-translator.c b/libnetfs/file-set-translator.c
index a0a70dba..4c29d952 100644
--- a/libnetfs/file-set-translator.c
+++ b/libnetfs/file-set-translator.c
@@ -43,7 +43,7 @@ netfs_S_file_set_translator (struct protid *user,
return EINVAL;
np = user->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
if (active_flags & FS_TRANS_SET
&& ! (active_flags & FS_TRANS_ORPHAN))
@@ -64,12 +64,12 @@ netfs_S_file_set_translator (struct protid *user,
if (control != MACH_PORT_NULL
&& (active_flags & FS_TRANS_EXCL) == 0)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
err = fsys_goaway (control, killtrans_flags);
if (err && err != MIG_SERVER_DIED && err != MACH_SEND_INVALID_DEST)
return err;
err = 0;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
}
}
@@ -123,7 +123,7 @@ netfs_S_file_set_translator (struct protid *user,
assert (arg <= passive + passivelen);
if (arg == passive + passivelen)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return EINVAL;
}
major = strtol (arg, 0, 0);
@@ -132,7 +132,7 @@ netfs_S_file_set_translator (struct protid *user,
assert (arg < passive + passivelen);
if (arg == passive + passivelen)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return EINVAL;
}
minor = strtol (arg, 0, 0);
@@ -148,7 +148,7 @@ netfs_S_file_set_translator (struct protid *user,
assert (arg <= passive + passivelen);
if (arg == passive + passivelen)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return EINVAL;
}
@@ -176,6 +176,6 @@ netfs_S_file_set_translator (struct protid *user,
}
out:
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
diff --git a/libnetfs/file-statfs.c b/libnetfs/file-statfs.c
index 180d29fc..13ae7d94 100644
--- a/libnetfs/file-statfs.c
+++ b/libnetfs/file-statfs.c
@@ -30,8 +30,8 @@ netfs_S_file_statfs (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_statfs (user->user, user->po->np, st);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-sync.c b/libnetfs/file-sync.c
index 99492ed8..4f6b4db8 100644
--- a/libnetfs/file-sync.c
+++ b/libnetfs/file-sync.c
@@ -31,8 +31,8 @@ netfs_S_file_sync (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_sync (user->user, user->po->np, wait);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-syncfs.c b/libnetfs/file-syncfs.c
index 28e34a3a..2302e926 100644
--- a/libnetfs/file-syncfs.c
+++ b/libnetfs/file-syncfs.c
@@ -33,8 +33,8 @@ netfs_S_file_syncfs (struct protid *user,
/* Translators not yet supported by netfs. XXX */
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_syncfs (user->user, wait);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/file-utimes.c b/libnetfs/file-utimes.c
index 45adf825..19156094 100644
--- a/libnetfs/file-utimes.c
+++ b/libnetfs/file-utimes.c
@@ -44,10 +44,10 @@ netfs_S_file_utimes (struct protid *user,
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_attempt_utimes (user->user, user->po->np,
atimein.microseconds != -1 ? &atime : 0,
mtimein.microseconds != -1 ? &mtime : 0);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/fsys-getroot.c b/libnetfs/fsys-getroot.c
index d3e78332..a1dd5e54 100644
--- a/libnetfs/fsys-getroot.c
+++ b/libnetfs/fsys-getroot.c
@@ -55,7 +55,7 @@ netfs_S_fsys_getroot (mach_port_t cntl,
flags &= O_HURD;
- mutex_lock (&netfs_root_node->lock);
+ pthread_mutex_lock (&netfs_root_node->lock);
err = netfs_validate_stat (netfs_root_node, cred);
if (err)
goto out;
@@ -73,7 +73,7 @@ netfs_S_fsys_getroot (mach_port_t cntl,
do_retry, retry_name, retry_port);
if (err != ENOENT)
{
- mutex_unlock (&netfs_root_node->lock);
+ pthread_mutex_unlock (&netfs_root_node->lock);
iohelp_free_iouser (cred);
if (!err)
*retry_port_type = MACH_MSG_TYPE_MOVE_SEND;
@@ -92,7 +92,7 @@ netfs_S_fsys_getroot (mach_port_t cntl,
if (err)
goto out;
- mutex_unlock (&netfs_root_node->lock);
+ pthread_mutex_unlock (&netfs_root_node->lock);
iohelp_free_iouser (cred);
if (pathbuf[0] == '/')
@@ -141,6 +141,6 @@ netfs_S_fsys_getroot (mach_port_t cntl,
out:
if (err)
iohelp_free_iouser (cred);
- mutex_unlock (&netfs_root_node->lock);
+ pthread_mutex_unlock (&netfs_root_node->lock);
return err;
}
diff --git a/libnetfs/fsys-set-options.c b/libnetfs/fsys-set-options.c
index 38f06c16..9dd8b007 100644
--- a/libnetfs/fsys-set-options.c
+++ b/libnetfs/fsys-set-options.c
@@ -48,7 +48,7 @@ netfs_S_fsys_set_options (fsys_t fsys,
mach_port_t control;
error = fshelp_fetch_control (&np->transbox, &control);
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
if (!error && (control != MACH_PORT_NULL))
{
error = fsys_set_options (control, data, data_len, do_children);
@@ -56,7 +56,7 @@ netfs_S_fsys_set_options (fsys_t fsys,
}
else
error = 0;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
if ((error == MIG_SERVER_DIED) || (error == MACH_SEND_INVALID_DEST))
error = 0;
diff --git a/libnetfs/init-init.c b/libnetfs/init-init.c
index 411430f0..e98b6562 100644
--- a/libnetfs/init-init.c
+++ b/libnetfs/init-init.c
@@ -21,7 +21,7 @@
#include "netfs.h"
-spin_lock_t netfs_node_refcnt_lock = SPIN_LOCK_INITIALIZER;
+pthread_spinlock_t netfs_node_refcnt_lock = PTHREAD_SPINLOCK_INITIALIZER;
struct node *netfs_root_node = 0;
struct port_bucket *netfs_port_bucket = 0;
diff --git a/libnetfs/io-clear-some-openmodes.c b/libnetfs/io-clear-some-openmodes.c
index 27bbfac8..1da5e476 100644
--- a/libnetfs/io-clear-some-openmodes.c
+++ b/libnetfs/io-clear-some-openmodes.c
@@ -28,8 +28,8 @@ netfs_S_io_clear_some_openmodes (struct protid *user, int bits)
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
user->po->openstat &= ~(bits & HONORED_STATE_MODES);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return 0;
}
diff --git a/libnetfs/io-duplicate.c b/libnetfs/io-duplicate.c
index ad374fc9..b2c3a3a1 100644
--- a/libnetfs/io-duplicate.c
+++ b/libnetfs/io-duplicate.c
@@ -34,10 +34,10 @@ netfs_S_io_duplicate (struct protid *user,
if (err)
return err;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
newpi = netfs_make_protid (user->po, clone);
*newport = ports_get_right (newpi);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
*newporttp = MACH_MSG_TYPE_MAKE_SEND;
ports_port_deref (newpi);
return 0;
diff --git a/libnetfs/io-get-openmodes.c b/libnetfs/io-get-openmodes.c
index e197fdc9..698c2937 100644
--- a/libnetfs/io-get-openmodes.c
+++ b/libnetfs/io-get-openmodes.c
@@ -27,8 +27,8 @@ netfs_S_io_get_openmodes (struct protid *user, int *bits)
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
*bits = user->po->openstat;
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return 0;
}
diff --git a/libnetfs/io-get-owner.c b/libnetfs/io-get-owner.c
index c86207f7..9bbf41de 100644
--- a/libnetfs/io-get-owner.c
+++ b/libnetfs/io-get-owner.c
@@ -27,8 +27,8 @@ netfs_S_io_get_owner (struct protid *user, pid_t *owner)
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
*owner = user->po->np->owner;
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return 0;
}
diff --git a/libnetfs/io-identity.c b/libnetfs/io-identity.c
index e62a01e4..0c6a191c 100644
--- a/libnetfs/io-identity.c
+++ b/libnetfs/io-identity.c
@@ -36,19 +36,19 @@ netfs_S_io_identity (struct protid *cred,
return EOPNOTSUPP;
np = cred->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
err = netfs_validate_stat (np, cred->user);
if (err)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
err = fshelp_get_identity (netfs_port_bucket, np->nn_stat.st_ino, id);
if (err)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
*idtype = MACH_MSG_TYPE_MAKE_SEND;
@@ -56,6 +56,6 @@ netfs_S_io_identity (struct protid *cred,
*fsystype = MACH_MSG_TYPE_MAKE_SEND;
*fileno = np->nn_stat.st_ino;
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return 0;
}
diff --git a/libnetfs/io-mod-owner.c b/libnetfs/io-mod-owner.c
index 16c61060..91cbdb03 100644
--- a/libnetfs/io-mod-owner.c
+++ b/libnetfs/io-mod-owner.c
@@ -27,8 +27,8 @@ netfs_S_io_mod_owner (struct protid *user, pid_t owner)
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
user->po->np->owner = owner;
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return 0;
}
diff --git a/libnetfs/io-read.c b/libnetfs/io-read.c
index ff8fbcff..0ce75db1 100644
--- a/libnetfs/io-read.c
+++ b/libnetfs/io-read.c
@@ -39,11 +39,11 @@ netfs_S_io_read (struct protid *user,
return EOPNOTSUPP;
node = user->po->np;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
if ((user->po->openstat & O_READ) == 0)
{
- mutex_unlock (&node->lock);
+ pthread_mutex_unlock (&node->lock);
return EBADF;
}
@@ -96,7 +96,7 @@ netfs_S_io_read (struct protid *user,
if (offset == -1 && !err)
user->po->filepointer += *datalen;
- mutex_unlock (&node->lock);
+ pthread_mutex_unlock (&node->lock);
if (err && alloced)
munmap (*data, amount);
diff --git a/libnetfs/io-readable.c b/libnetfs/io-readable.c
index ad6bf3c1..07becf66 100644
--- a/libnetfs/io-readable.c
+++ b/libnetfs/io-readable.c
@@ -35,7 +35,7 @@ netfs_S_io_readable (struct protid *user,
if (!(user->po->openstat & O_READ))
return EINVAL;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
err = netfs_validate_stat (user->po->np, user->user);
if (!err)
{
@@ -44,6 +44,6 @@ netfs_S_io_readable (struct protid *user,
else
*amount = 0;
}
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/io-reauthenticate.c b/libnetfs/io-reauthenticate.c
index 3140499c..1d2d935a 100644
--- a/libnetfs/io-reauthenticate.c
+++ b/libnetfs/io-reauthenticate.c
@@ -31,7 +31,7 @@ netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port)
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
newpi = netfs_make_protid (user->po, 0);
newright = ports_get_send_right (newpi);
@@ -46,7 +46,7 @@ netfs_S_io_reauthenticate (struct protid *user, mach_port_t rend_port)
mach_port_move_member (mach_task_self (), newpi->pi.port_right,
netfs_port_bucket->portset);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
ports_port_deref (newpi);
return err;
diff --git a/libnetfs/io-restrict-auth.c b/libnetfs/io-restrict-auth.c
index bddc8fea..0c3403d8 100644
--- a/libnetfs/io-restrict-auth.c
+++ b/libnetfs/io-restrict-auth.c
@@ -42,17 +42,17 @@ netfs_S_io_restrict_auth (struct protid *user,
if (err)
return err;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
newpi = netfs_make_protid (user->po, new_user);
if (newpi)
{
*newport = ports_get_right (newpi);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
*newporttype = MACH_MSG_TYPE_MAKE_SEND;
}
else
{
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
iohelp_free_iouser (new_user);
err = ENOMEM;
}
diff --git a/libnetfs/io-revoke.c b/libnetfs/io-revoke.c
index 5b32622a..7877eabe 100644
--- a/libnetfs/io-revoke.c
+++ b/libnetfs/io-revoke.c
@@ -41,13 +41,13 @@ netfs_S_io_revoke (struct protid *cred)
np = cred->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
err = netfs_validate_stat (np, cred->user);
if (!err)
err = fshelp_isowner (&np->nn_stat, cred->user);
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
if (err)
return err;
diff --git a/libnetfs/io-seek.c b/libnetfs/io-seek.c
index 85408a4d..cd2b3e4b 100644
--- a/libnetfs/io-seek.c
+++ b/libnetfs/io-seek.c
@@ -43,13 +43,13 @@ netfs_S_io_seek (struct protid *user,
struct node *np;
np = user->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
err = netfs_validate_stat (np, user->user);
if (!err)
offset += np->nn_stat.st_size;
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
}
case SEEK_SET:
check:
diff --git a/libnetfs/io-set-all-openmodes.c b/libnetfs/io-set-all-openmodes.c
index 4f431459..2424282e 100644
--- a/libnetfs/io-set-all-openmodes.c
+++ b/libnetfs/io-set-all-openmodes.c
@@ -28,9 +28,9 @@ netfs_S_io_set_all_openmodes (struct protid *user, int newbits)
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
user->po->openstat &= ~HONORED_STATE_MODES;
user->po->openstat |= (newbits & HONORED_STATE_MODES);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return 0;
}
diff --git a/libnetfs/io-set-some-openmodes.c b/libnetfs/io-set-some-openmodes.c
index 97bd2b43..48fbeed6 100644
--- a/libnetfs/io-set-some-openmodes.c
+++ b/libnetfs/io-set-some-openmodes.c
@@ -28,8 +28,8 @@ netfs_S_io_set_some_openmodes (struct protid *user, int bits)
if (!user)
return EOPNOTSUPP;
- mutex_lock (&user->po->np->lock);
+ pthread_mutex_lock (&user->po->np->lock);
user->po->openstat |= (bits & HONORED_STATE_MODES);
- mutex_unlock (&user->po->np->lock);
+ pthread_mutex_unlock (&user->po->np->lock);
return 0;
}
diff --git a/libnetfs/io-stat.c b/libnetfs/io-stat.c
index 3826c9d9..cf2c25b3 100644
--- a/libnetfs/io-stat.c
+++ b/libnetfs/io-stat.c
@@ -32,7 +32,7 @@ netfs_S_io_stat (struct protid *user, io_statbuf_t *statbuf)
return EOPNOTSUPP;
node = user->po->np;
- mutex_lock (&node->lock);
+ pthread_mutex_lock (&node->lock);
err = netfs_validate_stat (node, user->user);
if (! err)
@@ -47,7 +47,7 @@ netfs_S_io_stat (struct protid *user, io_statbuf_t *statbuf)
statbuf->st_mode |= S_IROOT; /* Is a root node. */
}
- mutex_unlock (&node->lock);
+ pthread_mutex_unlock (&node->lock);
return err;
}
diff --git a/libnetfs/io-write.c b/libnetfs/io-write.c
index c4423dab..98c2a306 100644
--- a/libnetfs/io-write.c
+++ b/libnetfs/io-write.c
@@ -42,7 +42,7 @@ netfs_S_io_write (struct protid *user,
*amount = datalen;
np = user->po->np;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
if (off == -1)
{
@@ -51,7 +51,7 @@ netfs_S_io_write (struct protid *user,
err = netfs_validate_stat (np, user->user);
if (err)
{
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
user->po->filepointer = np->nn_stat.st_size;
@@ -62,7 +62,7 @@ netfs_S_io_write (struct protid *user,
err = netfs_attempt_write (user->user, np, off, amount, data);
if (offset == -1 && !err)
user->po->filepointer += *amount;
- mutex_unlock (&np->lock);
+ pthread_mutex_unlock (&np->lock);
return err;
}
diff --git a/libnetfs/make-node.c b/libnetfs/make-node.c
index c547bfcb..f20ada18 100644
--- a/libnetfs/make-node.c
+++ b/libnetfs/make-node.c
@@ -30,7 +30,7 @@ netfs_make_node (struct netnode *nn)
np->nn = nn;
- mutex_init (&np->lock);
+ pthread_mutex_init (&np->lock, NULL);
np->references = 1;
np->sockaddr = MACH_PORT_NULL;
np->owner = 0;
diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h
index 1dda718e..d1ebed01 100644
--- a/libnetfs/netfs.h
+++ b/libnetfs/netfs.h
@@ -23,6 +23,7 @@
#include <hurd/fshelp.h>
#include <hurd/iohelp.h>
#include <assert.h>
+#include <pthread.h>
/* This library supports client-side network file system
implementations. It is analogous to the diskfs library provided for
@@ -79,7 +80,7 @@ struct node
are ignored, so you can set this to nn_stat.st_mode if you want that. */
mode_t nn_translated;
- struct mutex lock;
+ pthread_mutex_t lock;
/* The number of references to this node. */
int references;
@@ -359,7 +360,7 @@ struct node *netfs_make_node (struct netnode *);
/* Whenever node->references is to be touched, this lock must be
held. Cf. netfs_nrele, netfs_nput, netfs_nref and netfs_drop_node. */
-extern spin_lock_t netfs_node_refcnt_lock;
+extern pthread_spinlock_t netfs_node_refcnt_lock;
/* Normally called in main. This function sets up some of the netfs
server's internal state. */
diff --git a/libnetfs/nput.c b/libnetfs/nput.c
index c62b7b9f..611b37a0 100644
--- a/libnetfs/nput.c
+++ b/libnetfs/nput.c
@@ -23,7 +23,7 @@
void
netfs_nput (struct node *np)
{
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
assert (np->references);
np->references--;
if (np->references == 0)
@@ -31,8 +31,8 @@ netfs_nput (struct node *np)
/* netfs_drop_node drops netfs_node_refcnt_lock for us. */
else
{
- spin_unlock (&netfs_node_refcnt_lock);
- mutex_unlock (&np->lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
+ pthread_mutex_unlock (&np->lock);
}
}
diff --git a/libnetfs/nref.c b/libnetfs/nref.c
index 4e26910f..86b49927 100644
--- a/libnetfs/nref.c
+++ b/libnetfs/nref.c
@@ -23,7 +23,7 @@
void
netfs_nref (struct node *np)
{
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
np->references++;
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
}
diff --git a/libnetfs/nrele.c b/libnetfs/nrele.c
index dca9599a..6f9a0144 100644
--- a/libnetfs/nrele.c
+++ b/libnetfs/nrele.c
@@ -23,15 +23,15 @@
void
netfs_nrele (struct node *np)
{
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
assert (np->references);
np->references--;
if (np->references == 0)
{
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
netfs_drop_node (np);
/* netfs_drop_node drops netfs_node_refcnt_lock for us. */
}
else
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
}
diff --git a/libnetfs/release-peropen.c b/libnetfs/release-peropen.c
index 9a52184b..3e650999 100644
--- a/libnetfs/release-peropen.c
+++ b/libnetfs/release-peropen.c
@@ -23,9 +23,9 @@
void
netfs_release_peropen (struct peropen *po)
{
- mutex_lock (&po->np->lock);
+ pthread_mutex_lock (&po->np->lock);
if (--po->refcnt)
- mutex_unlock (&po->np->lock);
+ pthread_mutex_unlock (&po->np->lock);
else
{
if (po->root_parent)
@@ -33,7 +33,7 @@ netfs_release_peropen (struct peropen *po)
if (po->shadow_root && po->shadow_root != po->np)
{
- mutex_lock (&po->shadow_root->lock);
+ pthread_mutex_lock (&po->shadow_root->lock);
netfs_nput (po->shadow_root);
}
if (po->shadow_root_parent)
diff --git a/libnetfs/shutdown.c b/libnetfs/shutdown.c
index 9ba137d0..b3463bfc 100644
--- a/libnetfs/shutdown.c
+++ b/libnetfs/shutdown.c
@@ -24,7 +24,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <sys/stat.h>
#include <hurd/fsys.h>
#include <hurd/fshelp.h>
-#include <cthreads.h>
+#include <pthread.h>
/* Shutdown the filesystem; flags are as for fsys_goaway. */
error_t
@@ -39,10 +39,10 @@ netfs_shutdown (int flags)
err = fshelp_fetch_control (&node->transbox, &control);
if (!err && (control != MACH_PORT_NULL))
{
- mutex_unlock (&node->lock);
+ pthread_mutex_unlock (&node->lock);
err = fsys_goaway (control, flags);
mach_port_deallocate (mach_task_self (), control);
- mutex_lock (&node->lock);
+ pthread_mutex_lock (&node->lock);
}
else
err = 0;