From 1de0643c9218db536f5b2e294bbfa653c77438e4 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Tue, 4 Sep 2012 00:33:09 +0200 Subject: Switch from cthreads to pthreads Makefiles, headers, types, macros and function calls are renamed where appropriate. Most of this work was done by Barry deFreese and Thomas DiModica. * auth/Makefile: Switch from cthreads to pthreads. * auth/auth.c: Likewise. * boot/Makefile: Likewise. * boot/boot.c: Likewise. * boot/ux.c: Likewise. * console-client/Makefile: Likewise. * console-client/console.c: Likewise. * console-client/driver.c: Likewise. * console-client/driver.h: Likewise. * console-client/generic-speaker.c: Likewise. * console-client/kbd-repeat.c: Likewise. * console-client/ncursesw.c: Likewise. * console-client/pc-kbd.c: Likewise. * console-client/pc-mouse.c: Likewise. * console-client/timer.c: Likewise. * console-client/trans.c: Likewise. * console-client/vga.c: Likewise. * console/Makefile: Likewise. * console/console.c: Likewise. * console/display.c: Likewise. * console/input.c: Likewise. * console/pager.c: Likewise. * defpager/backing.c: Likewise. * exec/Makefile: Likewise. * exec/exec.c: Likewise. * exec/hashexec.c: Likewise. * exec/priv.h: Likewise. * ext2fs/Makefile: Likewise. * ext2fs/balloc.c: Likewise. * ext2fs/dir.c: Likewise. * ext2fs/ext2fs.c: Likewise. * ext2fs/ext2fs.h: Likewise. * ext2fs/ialloc.c: Likewise. * ext2fs/inode.c: Likewise. * ext2fs/msg.c: Likewise. * ext2fs/pager.c: Likewise. * ext2fs/pokel.c: Likewise. * ext2fs/storeinfo.c: Likewise. * ext2fs/truncate.c: Likewise. * fatfs/Makefile: Likewise. * fatfs/dir.c: Likewise. * fatfs/fat.c: Likewise. * fatfs/fatfs.h: Likewise. * fatfs/inode.c: Likewise. * fatfs/main.c: Likewise. * fatfs/pager.c: Likewise. * fatfs/virt-inode.c: Likewise. * ftpfs/Makefile: Likewise. * ftpfs/ccache.c: Likewise. * ftpfs/ccache.h: Likewise. * ftpfs/conn.c: Likewise. * ftpfs/dir.c: Likewise. * ftpfs/fs.c: Likewise. * ftpfs/ftpfs.c: Likewise. * ftpfs/ftpfs.h: Likewise. * ftpfs/ncache.c: Likewise. * ftpfs/netfs.c: Likewise. * ftpfs/node.c: Likewise. * hostmux/Makefile: Likewise. * hostmux/hostmux.h: Likewise. * hostmux/mux.c: Likewise. * hostmux/node.c: Likewise. * hostmux/stubs.c: Likewise. * hurd/shared.h: Likewise. * isofs/Makefile: Likewise. * isofs/inode.c: Likewise. * isofs/lookup.c: Likewise. * isofs/main.c: Likewise. * isofs/pager.c: Likewise. * libcons/Makefile: Likewise. * libcons/cons-switch.c: Likewise. * libcons/cons.h: Likewise. * libcons/dir-changed.c: Likewise. * libcons/file-changed.c: Likewise. * libcons/init-init.c: Likewise. * libcons/vcons-close.c: Likewise. * libcons/vcons-input.c: Likewise. * libcons/vcons-move-mouse.c: Likewise. * libcons/vcons-open.c: Likewise. * libcons/vcons-scrollback.c: Likewise. * libdiskfs/Makefile: Likewise. * libdiskfs/boot-start.c: Likewise. * libdiskfs/dead-name.c: Likewise. * libdiskfs/dir-chg.c: Likewise. * libdiskfs/dir-link.c: Likewise. * libdiskfs/dir-lookup.c: Likewise. * libdiskfs/dir-mkdir.c: Likewise. * libdiskfs/dir-mkfile.c: Likewise. * libdiskfs/dir-readdir.c: Likewise. * libdiskfs/dir-rename.c: Likewise. * libdiskfs/dir-renamed.c: Likewise. * libdiskfs/dir-rmdir.c: Likewise. * libdiskfs/dir-unlink.c: Likewise. * libdiskfs/disk-pager.c: Likewise. * libdiskfs/diskfs-pager.h: Likewise. * libdiskfs/diskfs.h: Likewise. * libdiskfs/file-access.c: Likewise. * libdiskfs/file-chg.c: Likewise. * libdiskfs/file-exec.c: Likewise. * libdiskfs/file-get-fs-opts.c: Likewise. * libdiskfs/file-get-trans.c: Likewise. * libdiskfs/file-get-transcntl.c: Likewise. * libdiskfs/file-getcontrol.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-lock-stat.c: Likewise. * libdiskfs/file-lock.c: Likewise. * libdiskfs/file-reparent.c: Likewise. * libdiskfs/file-set-trans.c: Likewise. * libdiskfs/file-sync.c: Likewise. * libdiskfs/file-syncfs.c: Likewise. * libdiskfs/fsys-getroot.c: Likewise. * libdiskfs/fsys-options.c: Likewise. * libdiskfs/fsys-syncfs.c: Likewise. * libdiskfs/ifsock.c: Likewise. * libdiskfs/init-first.c: Likewise. * libdiskfs/init-init.c: Likewise. * libdiskfs/init-startup.c: Likewise. * libdiskfs/io-duplicate.c: Likewise. * libdiskfs/io-get-conch.c: Likewise. * libdiskfs/io-identity.c: Likewise. * libdiskfs/io-map-cntl.c: Likewise. * libdiskfs/io-map.c: Likewise. * libdiskfs/io-modes-get.c: Likewise. * libdiskfs/io-modes-off.c: Likewise. * libdiskfs/io-modes-on.c: Likewise. * libdiskfs/io-modes-set.c: Likewise. * libdiskfs/io-owner-get.c: Likewise. * libdiskfs/io-owner-mod.c: Likewise. * libdiskfs/io-prenotify.c: Likewise. * libdiskfs/io-read.c: Likewise. * libdiskfs/io-readable.c: Likewise. * libdiskfs/io-reauthenticate.c: Likewise. * libdiskfs/io-rel-conch.c: Likewise. * libdiskfs/io-restrict-auth.c: Likewise. * libdiskfs/io-revoke.c: Likewise. * libdiskfs/io-seek.c: Likewise. * libdiskfs/io-sigio.c: Likewise. * libdiskfs/io-stat.c: Likewise. * libdiskfs/io-write.c: Likewise. * libdiskfs/lookup.c: Likewise. * libdiskfs/name-cache.c: Likewise. * libdiskfs/node-drop.c: Likewise. * libdiskfs/node-make.c: Likewise. * libdiskfs/node-nput.c: Likewise. * libdiskfs/node-nputl.c: Likewise. * libdiskfs/node-nref.c: Likewise. * libdiskfs/node-nrefl.c: Likewise. * libdiskfs/node-nrele.c: Likewise. * libdiskfs/node-nrelel.c: Likewise. * libdiskfs/peropen-rele.c: Likewise. * libdiskfs/priv.h: Likewise. * libdiskfs/shutdown.c: Likewise. * libdiskfs/sync-interval.c: Likewise. * libfshelp/Makefile: Likewise. * libfshelp/fetch-root.c: Likewise. * libfshelp/fshelp.h: Likewise. * libfshelp/get-identity.c: Likewise. * libfshelp/lock-acquire.c: Likewise. * libfshelp/lock-init.c: Likewise. * libfshelp/locks.h: Likewise. * libfshelp/set-active.c: Likewise. * libfshelp/trans.h: Likewise. * libfshelp/transbox-init.c: Likewise. * libiohelp/Makefile: Likewise. * libiohelp/get_conch.c: Likewise. * libiohelp/handle_io_release_conch.c: Likewise. * libiohelp/initialize_conch.c: Likewise. * libiohelp/iohelp.h: Likewise. * libiohelp/verify_user_conch.c: Likewise. * libnetfs/Makefile: Likewise. * libnetfs/dir-lookup.c: Likewise. * libnetfs/dir-mkdir.c: Likewise. * libnetfs/dir-mkfile.c: Likewise. * libnetfs/dir-readdir.c: Likewise. * libnetfs/dir-rmdir.c: Likewise. * libnetfs/dir-unlink.c: Likewise. * libnetfs/drop-node.c: Likewise. * libnetfs/file-chauthor.c: Likewise. * libnetfs/file-check-access.c: Likewise. * libnetfs/file-chflags.c: Likewise. * libnetfs/file-chmod.c: Likewise. * libnetfs/file-chown.c: Likewise. * libnetfs/file-exec.c: Likewise. * libnetfs/file-get-storage-info.c: Likewise. * libnetfs/file-get-translator.c: Likewise. * libnetfs/file-lock-stat.c: Likewise. * libnetfs/file-lock.c: Likewise. * libnetfs/file-reparent.c: Likewise. * libnetfs/file-set-size.c: Likewise. * libnetfs/file-set-translator.c: Likewise. * libnetfs/file-statfs.c: Likewise. * libnetfs/file-sync.c: Likewise. * libnetfs/file-syncfs.c: Likewise. * libnetfs/file-utimes.c: Likewise. * libnetfs/fsys-getroot.c: Likewise. * libnetfs/fsys-set-options.c: Likewise. * libnetfs/init-init.c: Likewise. * libnetfs/io-clear-some-openmodes.c: Likewise. * libnetfs/io-duplicate.c: Likewise. * libnetfs/io-get-openmodes.c: Likewise. * libnetfs/io-get-owner.c: Likewise. * libnetfs/io-identity.c: Likewise. * libnetfs/io-mod-owner.c: Likewise. * libnetfs/io-read.c: Likewise. * libnetfs/io-readable.c: Likewise. * libnetfs/io-reauthenticate.c: Likewise. * libnetfs/io-restrict-auth.c: Likewise. * libnetfs/io-revoke.c: Likewise. * libnetfs/io-seek.c: Likewise. * libnetfs/io-set-all-openmodes.c: Likewise. * libnetfs/io-set-some-openmodes.c: Likewise. * libnetfs/io-stat.c: Likewise. * libnetfs/io-write.c: Likewise. * libnetfs/make-node.c: Likewise. * libnetfs/netfs.h: Likewise. * libnetfs/nput.c: Likewise. * libnetfs/nref.c: Likewise. * libnetfs/nrele.c: Likewise. * libnetfs/release-peropen.c: Likewise. * libnetfs/shutdown.c: Likewise. * libpager/Makefile: Likewise. * libpager/chg-compl.c: Likewise. * libpager/clean.c: Likewise. * libpager/data-request.c: Likewise. * libpager/data-return.c: Likewise. * libpager/data-unlock.c: Likewise. * libpager/inhibit-term.c: Likewise. * libpager/lock-completed.c: Likewise. * libpager/lock-object.c: Likewise. * libpager/mark-error.c: Likewise. * libpager/no-senders.c: Likewise. * libpager/object-init.c: Likewise. * libpager/object-terminate.c: Likewise. * libpager/offer-page.c: Likewise. * libpager/pager-attr.c: Likewise. * libpager/pager-create.c: Likewise. * libpager/pager-shutdown.c: Likewise. * libpager/priv.h: Likewise. * libpager/seqnos.c: Likewise. * libpipe/Makefile: Likewise. * libpipe/pipe.c: Likewise. * libpipe/pipe.h: Likewise. * libports/Makefile: Likewise. * libports/begin-rpc.c: Likewise. * libports/bucket-iterate.c: Likewise. * libports/claim-right.c: Likewise. * libports/class-iterate.c: Likewise. * libports/complete-deallocate.c: Likewise. * libports/count-bucket.c: Likewise. * libports/count-class.c: Likewise. * libports/create-bucket.c: Likewise. * libports/create-internal.c: Likewise. * libports/destroy-right.c: Likewise. * libports/enable-bucket.c: Likewise. * libports/enable-class.c: Likewise. * libports/end-rpc.c: Likewise. * libports/get-right.c: Likewise. * libports/import-port.c: Likewise. * libports/inhibit-all-rpcs.c: Likewise. * libports/inhibit-bucket-rpcs.c: Likewise. * libports/inhibit-class-rpcs.c: Likewise. * libports/inhibit-port-rpcs.c: Likewise. * libports/init.c: Likewise. * libports/interrupt-notified-rpcs.c: Likewise. * libports/interrupt-on-notify.c: Likewise. * libports/interrupt-operation.c: Likewise. * libports/interrupt-rpcs.c: Likewise. * libports/interrupted.c: Likewise. * libports/lookup-port.c: Likewise. * libports/manage-multithread.c: Likewise. * libports/no-senders.c: Likewise. * libports/port-deref-weak.c: Likewise. * libports/port-deref.c: Likewise. * libports/port-ref-weak.c: Likewise. * libports/port-ref.c: Likewise. * libports/ports.h: Likewise. * libports/reallocate-from-external.c: Likewise. * libports/reallocate-port.c: Likewise. * libports/resume-all-rpcs.c: Likewise. * libports/resume-bucket-rpcs.c: Likewise. * libports/resume-class-rpcs.c: Likewise. * libports/resume-port-rpcs.c: Likewise. * libports/stubs.c: Likewise. * libports/transfer-right.c: Likewise. * libstore/Makefile: Likewise. * libstore/gunzip.c: Likewise. * libstore/part.c: Likewise. * libstore/unzipstore.c: Likewise. * libthreads/Makefile: Likewise. * libtreefs/dir-lookup.c: Likewise. * libtreefs/fsys-getroot.c: Likewise. * libtreefs/fsys-hooks.c: Likewise. * libtreefs/fsys.c: Likewise. * libtreefs/trans-help.c: Likewise. * libtreefs/trans-start.c: Likewise. * libtreefs/treefs.h: Likewise. * libtrivfs/cntl-create.c: Likewise. * libtrivfs/dyn-classes.c: Likewise. * libtrivfs/io-reauthenticate.c: Likewise. * libtrivfs/io-restrict-auth.c: Likewise. * libtrivfs/protid-clean.c: Likewise. * libtrivfs/protid-dup.c: Likewise. * libtrivfs/trivfs.h: Likewise. * mach-defpager/Makefile: Likewise. * mach-defpager/default_pager.c: Likewise. * mach-defpager/kalloc.c: Likewise. * mach-defpager/main.c: Likewise. * nfs/Makefile: Likewise. * nfs/cache.c: Likewise. * nfs/main.c: Likewise. * nfs/mount.c: Likewise. * nfs/name-cache.c: Likewise. * nfs/nfs.h: Likewise. * nfs/ops.c: Likewise. * nfs/rpc.c: Likewise. * nfsd/Makefile: Likewise. * nfsd/cache.c: Likewise. * nfsd/loop.c: Likewise. * nfsd/main.c: Likewise. * nfsd/nfsd.h: Likewise. * pfinet/Makefile: Likewise. * pfinet/ethernet.c: Likewise. * pfinet/glue-include/asm/spinlock.h: Likewise. * pfinet/glue-include/linux/interrupt.h: Likewise. * pfinet/glue-include/linux/sched.h: Likewise. * pfinet/glue-include/linux/timer.h: Likewise. * pfinet/glue-include/linux/wait.h: Likewise. * pfinet/iioctl-ops.c: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/kmem_cache.c: Likewise. * pfinet/main.c: Likewise. * pfinet/options.c: Likewise. * pfinet/pfinet-ops.c: Likewise. * pfinet/pfinet.h: Likewise. * pfinet/sched.c: Likewise. * pfinet/socket-ops.c: Likewise. * pfinet/socket.c: Likewise. * pfinet/timer-emul.c: Likewise. * pfinet/tunnel.c: Likewise. * pflocal/Makefile: Likewise. * pflocal/connq.c: Likewise. * pflocal/io.c: Likewise. * pflocal/sock.c: Likewise. * pflocal/sock.h: Likewise. * pflocal/socket.c: Likewise. * pflocal/sserver.c: Likewise. * proc/Makefile: Likewise. * proc/info.c: Likewise. * proc/main.c: Likewise. * proc/mgt.c: Likewise. * proc/msg.c: Likewise. * proc/proc.h: Likewise. * proc/stubs.c: Likewise. * proc/wait.c: Likewise. * storeio/Makefile: Likewise. * storeio/dev.c: Likewise. * storeio/dev.h: Likewise. * storeio/open.c: Likewise. * storeio/open.h: Likewise. * storeio/pager.c: Likewise. * storeio/storeio.c: Likewise. * term/Makefile: Likewise. * term/devio.c: Likewise. * term/hurdio.c: Likewise. * term/main.c: Likewise. * term/munge.c: Likewise. * term/ptyio.c: Likewise. * term/term.h: Likewise. * term/users.c: Likewise. * tmpfs/Makefile: Likewise. * tmpfs/dir.c: Likewise. * tmpfs/node.c: Likewise. * tmpfs/tmpfs.c: Likewise. * tmpfs/tmpfs.h: Likewise. * trans/Makefile: Likewise. * trans/fakeroot.c: Likewise. * trans/fifo.c: Likewise. * trans/hello-mt.c: Likewise. * trans/new-fifo.c: Likewise. * trans/streamio.c: Likewise. * ufs/Makefile: Likewise. * ufs/alloc.c: Likewise. * ufs/dir.c: Likewise. * ufs/hyper.c: Likewise. * ufs/inode.c: Likewise. * ufs/main.c: Likewise. * ufs/pager.c: Likewise. * ufs/pokeloc.c: Likewise. * ufs/sizes.c: Likewise. * ufs/ufs.h: Likewise. * usermux/Makefile: Likewise. * usermux/mux.c: Likewise. * usermux/node.c: Likewise. * usermux/usermux.h: Likewise. * utils/Makefile: Likewise. * utils/fakeauth.c: Likewise. * utils/rpctrace.c: Likewise. --- libnetfs/Makefile | 3 ++- libnetfs/dir-lookup.c | 14 +++++++------- libnetfs/dir-mkdir.c | 4 ++-- libnetfs/dir-mkfile.c | 2 +- libnetfs/dir-readdir.c | 4 ++-- libnetfs/dir-rmdir.c | 4 ++-- libnetfs/dir-unlink.c | 4 ++-- libnetfs/drop-node.c | 2 +- libnetfs/file-chauthor.c | 4 ++-- libnetfs/file-check-access.c | 4 ++-- libnetfs/file-chflags.c | 4 ++-- libnetfs/file-chmod.c | 4 ++-- libnetfs/file-chown.c | 4 ++-- libnetfs/file-exec.c | 4 ++-- libnetfs/file-get-storage-info.c | 4 ++-- libnetfs/file-get-translator.c | 6 +++--- libnetfs/file-lock-stat.c | 4 ++-- libnetfs/file-lock.c | 4 ++-- libnetfs/file-reparent.c | 6 +++--- libnetfs/file-set-size.c | 4 ++-- libnetfs/file-set-translator.c | 14 +++++++------- libnetfs/file-statfs.c | 4 ++-- libnetfs/file-sync.c | 4 ++-- libnetfs/file-syncfs.c | 4 ++-- libnetfs/file-utimes.c | 4 ++-- libnetfs/fsys-getroot.c | 8 ++++---- libnetfs/fsys-set-options.c | 4 ++-- libnetfs/init-init.c | 2 +- libnetfs/io-clear-some-openmodes.c | 4 ++-- libnetfs/io-duplicate.c | 4 ++-- libnetfs/io-get-openmodes.c | 4 ++-- libnetfs/io-get-owner.c | 4 ++-- libnetfs/io-identity.c | 8 ++++---- libnetfs/io-mod-owner.c | 4 ++-- libnetfs/io-read.c | 6 +++--- libnetfs/io-readable.c | 4 ++-- libnetfs/io-reauthenticate.c | 4 ++-- libnetfs/io-restrict-auth.c | 6 +++--- libnetfs/io-revoke.c | 4 ++-- libnetfs/io-seek.c | 4 ++-- libnetfs/io-set-all-openmodes.c | 4 ++-- libnetfs/io-set-some-openmodes.c | 4 ++-- libnetfs/io-stat.c | 4 ++-- libnetfs/io-write.c | 6 +++--- libnetfs/make-node.c | 2 +- libnetfs/netfs.h | 5 +++-- libnetfs/nput.c | 6 +++--- libnetfs/nref.c | 4 ++-- libnetfs/nrele.c | 6 +++--- libnetfs/release-peropen.c | 6 +++--- libnetfs/shutdown.c | 6 +++--- 51 files changed, 122 insertions(+), 120 deletions(-) (limited to 'libnetfs') 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 #include #include +#include /* 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 #include #include -#include +#include /* 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; -- cgit v1.2.3