summaryrefslogtreecommitdiff
path: root/ftpfs
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2012-09-04 00:33:09 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2012-11-27 22:58:15 +0100
commit1de0643c9218db536f5b2e294bbfa653c77438e4 (patch)
treef944e1b023cf0353ca559d22e1f7b701bac04c97 /ftpfs
parent7648503cd894549874ff13f7ed94a4708cf50f0d (diff)
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.
Diffstat (limited to 'ftpfs')
-rw-r--r--ftpfs/Makefile3
-rw-r--r--ftpfs/ccache.c24
-rw-r--r--ftpfs/ccache.h4
-rw-r--r--ftpfs/conn.c12
-rw-r--r--ftpfs/dir.c38
-rw-r--r--ftpfs/fs.c6
-rw-r--r--ftpfs/ftpfs.c18
-rw-r--r--ftpfs/ftpfs.h8
-rw-r--r--ftpfs/ncache.c4
-rw-r--r--ftpfs/netfs.c4
-rw-r--r--ftpfs/node.c12
11 files changed, 67 insertions, 66 deletions
diff --git a/ftpfs/Makefile b/ftpfs/Makefile
index 581c5da6..70398908 100644
--- a/ftpfs/Makefile
+++ b/ftpfs/Makefile
@@ -24,6 +24,7 @@ target = ftpfs
SRCS = ftpfs.c fs.c host.c netfs.c dir.c conn.c ccache.c node.c ncache.c
OBJS = $(SRCS:.c=.o)
-HURDLIBS = netfs fshelp iohelp threads ports ihash ftpconn shouldbeinlibc
+HURDLIBS = netfs fshelp iohelp ports ihash ftpconn shouldbeinlibc
+OTHERLIBS = -lpthread
include ../Makeconf
diff --git a/ftpfs/ccache.c b/ftpfs/ccache.c
index 56f3bf1e..fa63c687 100644
--- a/ftpfs/ccache.c
+++ b/ftpfs/ccache.c
@@ -37,7 +37,7 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data)
error_t err = 0;
size_t max = offs + len;
- mutex_lock (&cc->lock);
+ pthread_mutex_lock (&cc->lock);
if (max > cc->size)
max = cc->size;
@@ -48,7 +48,7 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data)
/* Some thread is fetching data, so just let it do its thing, but get
a wakeup call when it's done. */
{
- if (hurd_condition_wait (&cc->wakeup, &cc->lock))
+ if (pthread_hurd_cond_wait_np (&cc->wakeup, &cc->lock))
err = EINTR;
}
else
@@ -60,7 +60,7 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data)
while (cc->max < max && !err)
{
- mutex_unlock (&cc->lock);
+ pthread_mutex_unlock (&cc->lock);
if (! cc->conn)
/* We need to setup a connection to fetch data over. */
@@ -179,12 +179,12 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data)
err = EINTR;
}
- mutex_lock (&cc->lock);
+ pthread_mutex_lock (&cc->lock);
if (cc->max < max && !err)
/* If anyone's waiting for data, let them look (if we're done
fetching, this gets delayed until below). */
- condition_broadcast (&cc->wakeup);
+ pthread_cond_broadcast (&cc->wakeup);
}
if (!err && cc->conn && cc->max == cc->size)
@@ -200,14 +200,14 @@ ccache_read (struct ccache *cc, off_t offs, size_t len, void *data)
cc->fetching_active = 0;
/* Let others know something's going on. */
- condition_broadcast (&cc->wakeup);
+ pthread_cond_broadcast (&cc->wakeup);
}
}
if (! err)
bcopy (cc->image + offs, data, max - offs);
- mutex_unlock (&cc->lock);
+ pthread_mutex_unlock (&cc->lock);
return err;
}
@@ -218,13 +218,13 @@ ccache_invalidate (struct ccache *cc)
{
error_t err = 0;
- mutex_lock (&cc->lock);
+ pthread_mutex_lock (&cc->lock);
while (cc->fetching_active && !err)
/* Some thread is fetching data, so just let it do its thing, but get
a wakeup call when it's done. */
{
- if (hurd_condition_wait (&cc->wakeup, &cc->lock))
+ if (pthread_hurd_cond_wait_np (&cc->wakeup, &cc->lock))
err = EINTR;
}
@@ -246,7 +246,7 @@ ccache_invalidate (struct ccache *cc)
}
}
- mutex_unlock (&cc->lock);
+ pthread_mutex_unlock (&cc->lock);
return err;
}
@@ -265,8 +265,8 @@ ccache_create (struct node *node, struct ccache **cc)
new->size = node->nn_stat.st_size;
new->max = 0;
new->alloced = 0;
- mutex_init (&new->lock);
- condition_init (&new->wakeup);
+ pthread_mutex_init (&new->lock, NULL);
+ pthread_cond_init (&new->wakeup, NULL);
new->fetching_active = 0;
new->conn = 0;
new->data_conn = -1;
diff --git a/ftpfs/ccache.h b/ftpfs/ccache.h
index 410720c3..78f90bd2 100644
--- a/ftpfs/ccache.h
+++ b/ftpfs/ccache.h
@@ -40,10 +40,10 @@ struct ccache
/* Amount of IMAGE that has been allocated. */
size_t alloced;
- struct mutex lock;
+ pthread_mutex_t lock;
/* People can wait for a reading thread on this condition. */
- struct condition wakeup;
+ pthread_cond_t wakeup;
/* True if some thread is now fetching data. Only that thread should
modify the DATA_CONN, DATA_CONN_POS, and MAX fields. */
diff --git a/ftpfs/conn.c b/ftpfs/conn.c
index 9be7dd28..0f1b0973 100644
--- a/ftpfs/conn.c
+++ b/ftpfs/conn.c
@@ -39,11 +39,11 @@ ftpfs_get_ftp_conn (struct ftpfs *fs, struct ftp_conn **conn)
{
struct ftpfs_conn *fsc;
- spin_lock (&fs->conn_lock);
+ pthread_spin_lock (&fs->conn_lock);
fsc = fs->free_conns;
if (fsc)
fs->free_conns = fsc->next;
- spin_unlock (&fs->conn_lock);
+ pthread_spin_unlock (&fs->conn_lock);
if (! fsc)
{
@@ -73,10 +73,10 @@ ftpfs_get_ftp_conn (struct ftpfs *fs, struct ftp_conn **conn)
fsc->conn->hook = (void *)(uintptr_t)conn_id++;
}
- spin_lock (&fs->conn_lock);
+ pthread_spin_lock (&fs->conn_lock);
fsc->next = fs->conns;
fs->conns = fsc;
- spin_unlock (&fs->conn_lock);
+ pthread_spin_unlock (&fs->conn_lock);
*conn = fsc->conn;
@@ -89,7 +89,7 @@ ftpfs_release_ftp_conn (struct ftpfs *fs, struct ftp_conn *conn)
{
struct ftpfs_conn *fsc, *pfsc;
- spin_lock (&fs->conn_lock);
+ pthread_spin_lock (&fs->conn_lock);
for (pfsc = 0, fsc = fs->conns; fsc; pfsc = fsc, fsc = fsc->next)
if (fsc->conn == conn)
{
@@ -102,5 +102,5 @@ ftpfs_release_ftp_conn (struct ftpfs *fs, struct ftp_conn *conn)
break;
}
assert (fsc);
- spin_unlock (&fs->conn_lock);
+ pthread_spin_unlock (&fs->conn_lock);
}
diff --git a/ftpfs/dir.c b/ftpfs/dir.c
index 8ef719d8..da5ddbe5 100644
--- a/ftpfs/dir.c
+++ b/ftpfs/dir.c
@@ -460,7 +460,7 @@ ftpfs_refresh_node (struct node *node)
time_t timestamp = NOW;
struct ftpfs_dir *dir = entry->dir;
- mutex_lock (&dir->node->lock);
+ pthread_mutex_lock (&dir->node->lock);
if (! entry->self_p)
/* This is a deleted entry, just awaiting disposal; do so. */
@@ -545,7 +545,7 @@ ftpfs_refresh_node (struct node *node)
if (!nn->dir && S_ISDIR (entry->stat.st_mode))
ftpfs_dir_create (nn->fs, node, nn->rmt_path, &nn->dir);
- mutex_unlock (&dir->node->lock);
+ pthread_mutex_unlock (&dir->node->lock);
ftpfs_cache_node (node);
@@ -566,7 +566,7 @@ ftpfs_detach_node (struct node *node)
{
struct ftpfs_dir *dir = entry->dir;
- mutex_lock (&dir->node->lock);
+ pthread_mutex_lock (&dir->node->lock);
if (entry->self_p)
/* Just detach NODE from the still active entry. */
@@ -581,7 +581,7 @@ ftpfs_detach_node (struct node *node)
if (--dir->num_live_entries == 0)
netfs_nput (dir->node);
else
- mutex_unlock (&dir->node->lock);
+ pthread_mutex_unlock (&dir->node->lock);
}
return 0;
@@ -642,7 +642,7 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
if (dir->node->nn->dir_entry)
{
*node = dir->node->nn->dir_entry->dir->node;
- mutex_lock (&(*node)->lock);
+ pthread_mutex_lock (&(*node)->lock);
netfs_nref (*node);
}
else
@@ -651,7 +651,7 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
*node = 0;
}
- mutex_unlock (&dir->node->lock);
+ pthread_mutex_unlock (&dir->node->lock);
return err;
}
@@ -711,10 +711,10 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
{
/* If there's already a node, add a ref so that it doesn't go
away. */
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
if (e->node)
e->node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
if (! e->node)
/* No node; make one and install it into E. */
@@ -740,9 +740,9 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
/* Keep a reference to dir's node corresponding to
children. */
{
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
dir->node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
}
}
}
@@ -754,8 +754,8 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
because the locking order is always child-parent. We know
the child node won't go away because we already hold the
additional reference to it. */
- mutex_unlock (&dir->node->lock);
- mutex_lock (&e->node->lock);
+ pthread_mutex_unlock (&dir->node->lock);
+ pthread_mutex_lock (&e->node->lock);
}
}
else
@@ -765,7 +765,7 @@ ftpfs_dir_lookup (struct ftpfs_dir *dir, const char *name,
if (err)
{
*node = 0;
- mutex_unlock (&dir->node->lock);
+ pthread_mutex_unlock (&dir->node->lock);
}
if (rmt_path)
@@ -794,10 +794,10 @@ ftpfs_dir_null_lookup (struct ftpfs_dir *dir, struct node **node)
/* We've got a dir entry, get a node for it. */
{
/* If there's already a node, add a ref so that it doesn't go away. */
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
if (e->node)
e->node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
if (! e->node)
/* No node; make one and install it into E. */
@@ -807,9 +807,9 @@ ftpfs_dir_null_lookup (struct ftpfs_dir *dir, struct node **node)
if (!err && dir->num_live_entries++ == 0)
/* Keep a reference to dir's node corresponding to children. */
{
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
dir->node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
}
}
@@ -846,9 +846,9 @@ ftpfs_dir_create (struct ftpfs *fs, struct node *node, const char *rmt_path,
}
/* Hold a reference to the new dir's node. */
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
new->num_entries = 0;
new->num_live_entries = 0;
diff --git a/ftpfs/fs.c b/ftpfs/fs.c
index e4db3031..d3a93070 100644
--- a/ftpfs/fs.c
+++ b/ftpfs/fs.c
@@ -48,10 +48,10 @@ ftpfs_create (char *rmt_path, int fsid,
new->free_conns = 0;
new->conns = 0;
- spin_lock_init (&new->conn_lock);
+ pthread_spin_init (&new->conn_lock, PTHREAD_PROCESS_PRIVATE);
new->node_cache_mru = new->node_cache_lru = 0;
new->node_cache_len = 0;
- mutex_init (&new->node_cache_lock);
+ pthread_mutex_init (&new->node_cache_lock, NULL);
new->fsid = fsid;
new->next_inode = 2;
@@ -62,7 +62,7 @@ ftpfs_create (char *rmt_path, int fsid,
hurd_ihash_init (&new->inode_mappings,
offsetof (struct ftpfs_dir_entry, inode_locp));
- spin_lock_init (&new->inode_mappings_lock);
+ pthread_spin_init (&new->inode_mappings_lock, PTHREAD_PROCESS_PRIVATE);
super_root = netfs_make_node (0);
if (! super_root)
diff --git a/ftpfs/ftpfs.c b/ftpfs/ftpfs.c
index 393cc5ba..794439b4 100644
--- a/ftpfs/ftpfs.c
+++ b/ftpfs/ftpfs.c
@@ -72,7 +72,7 @@ extern error_t lookup_server (const char *server,
static FILE *debug_stream = 0;
static char *debug_stream_name = 0;
-static struct mutex debug_lock = MUTEX_INITIALIZER;
+static pthread_mutex_t debug_lock = PTHREAD_MUTEX_INITIALIZER;
/* Prints ftp connection log to DEBUG_STREAM. */
static void
@@ -87,14 +87,14 @@ cntl_debug (struct ftp_conn *conn, int type, const char *txt)
default: type_str = "?"; break;
}
- mutex_lock (&debug_lock);
+ pthread_mutex_lock (&debug_lock);
if (debug_stream)
{
fprintf (debug_stream, "%u.%s%s\n",
(unsigned)(uintptr_t)conn->hook, type_str, txt);
fflush (debug_stream);
}
- mutex_unlock (&debug_lock);
+ pthread_mutex_unlock (&debug_lock);
}
/* Various default parameters. */
@@ -154,7 +154,7 @@ parse_common_opt (int key, char *arg, struct argp_state *state)
switch (key)
{
case 'D':
- mutex_lock (&debug_lock);
+ pthread_mutex_lock (&debug_lock);
if (debug_stream && debug_stream != stderr)
fclose (debug_stream);
@@ -189,16 +189,16 @@ parse_common_opt (int key, char *arg, struct argp_state *state)
if (! err)
ftpfs_ftp_hooks.cntl_debug = cntl_debug;
- mutex_unlock (&debug_lock);
+ pthread_mutex_unlock (&debug_lock);
return err;
case OPT_NO_DEBUG:
- mutex_lock (&debug_lock);
+ pthread_mutex_lock (&debug_lock);
if (debug_stream && debug_stream != stderr)
fclose (debug_stream);
ftpfs_ftp_hooks.cntl_debug = 0;
- mutex_unlock (&debug_lock);
+ pthread_mutex_unlock (&debug_lock);
break;
case OPT_NODE_CACHE_MAX:
@@ -338,7 +338,7 @@ netfs_append_args (char **argz, size_t *argz_len)
} \
} while (0)
- mutex_lock (&debug_lock);
+ pthread_mutex_lock (&debug_lock);
if (ftpfs_ftp_hooks.cntl_debug && debug_stream)
{
if (debug_stream != stderr)
@@ -351,7 +351,7 @@ netfs_append_args (char **argz, size_t *argz_len)
else
err = argz_add (argz, argz_len, "--debug");
}
- mutex_unlock (&debug_lock);
+ pthread_mutex_unlock (&debug_lock);
if (ftpfs->params.name_timeout != DEFAULT_NAME_TIMEOUT)
FOPT ("--name-timeout=%ld", ftpfs->params.name_timeout);
diff --git a/ftpfs/ftpfs.h b/ftpfs/ftpfs.h
index 0eef5bde..206726f1 100644
--- a/ftpfs/ftpfs.h
+++ b/ftpfs/ftpfs.h
@@ -22,7 +22,7 @@
#define __FTPFS_H__
#include <stdlib.h>
-#include <cthreads.h>
+#include <pthread.h>
#include <ftpconn.h>
#include <maptime.h>
#include <hurd/ihash.h>
@@ -163,7 +163,7 @@ struct ftpfs
/* A pool of ftp connections for server threads to use. */
struct ftpfs_conn *free_conns;
struct ftpfs_conn *conns;
- spin_lock_t conn_lock;
+ pthread_spinlock_t conn_lock;
/* Parameters for making new ftp connections. */
struct ftp_conn_params *ftp_params;
@@ -175,14 +175,14 @@ struct ftpfs
/* A hash table mapping inode numbers to directory entries. */
struct hurd_ihash inode_mappings;
- spin_lock_t inode_mappings_lock;
+ pthread_spinlock_t inode_mappings_lock;
struct ftpfs_params params;
/* A cache that holds a reference to recently used nodes. */
struct node *node_cache_mru, *node_cache_lru;
size_t node_cache_len; /* Number of entries in it. */
- struct mutex node_cache_lock;
+ pthread_mutex_t node_cache_lock;
};
extern volatile struct mapped_time_value *ftpfs_maptime;
diff --git a/ftpfs/ncache.c b/ftpfs/ncache.c
index 27b868a7..612dc081 100644
--- a/ftpfs/ncache.c
+++ b/ftpfs/ncache.c
@@ -51,7 +51,7 @@ ftpfs_cache_node (struct node *node)
struct netnode *nn = node->nn;
struct ftpfs *fs = nn->fs;
- mutex_lock (&fs->node_cache_lock);
+ pthread_mutex_lock (&fs->node_cache_lock);
if (fs->params.node_cache_max > 0 || fs->node_cache_len > 0)
{
@@ -83,5 +83,5 @@ ftpfs_cache_node (struct node *node)
}
}
- mutex_unlock (&fs->node_cache_lock);
+ pthread_mutex_unlock (&fs->node_cache_lock);
}
diff --git a/ftpfs/netfs.c b/ftpfs/netfs.c
index 8922f3ab..5359acb9 100644
--- a/ftpfs/netfs.c
+++ b/ftpfs/netfs.c
@@ -41,7 +41,7 @@ netfs_attempt_create_file (struct iouser *user, struct node *dir,
char *name, mode_t mode, struct node **node)
{
*node = 0;
- mutex_unlock (&dir->lock);
+ pthread_mutex_unlock (&dir->lock);
return EOPNOTSUPP;
}
@@ -413,7 +413,7 @@ error_t netfs_attempt_mkfile (struct iouser *user, struct node *dir,
mode_t mode, struct node **node)
{
*node = 0;
- mutex_unlock (&dir->lock);
+ pthread_mutex_unlock (&dir->lock);
return EROFS;
}
diff --git a/ftpfs/node.c b/ftpfs/node.c
index d949016c..74cd402e 100644
--- a/ftpfs/node.c
+++ b/ftpfs/node.c
@@ -61,9 +61,9 @@ ftpfs_create_node (struct ftpfs_dir_entry *e, const char *rmt_path,
fshelp_touch (&new->nn_stat, TOUCH_ATIME|TOUCH_MTIME|TOUCH_CTIME,
ftpfs_maptime);
- spin_lock (&nn->fs->inode_mappings_lock);
+ pthread_spin_lock (&nn->fs->inode_mappings_lock);
err = hurd_ihash_add (&nn->fs->inode_mappings, e->stat.st_ino, e);
- spin_unlock (&nn->fs->inode_mappings_lock);
+ pthread_spin_unlock (&nn->fs->inode_mappings_lock);
if (err)
{
@@ -87,7 +87,7 @@ netfs_node_norefs (struct node *node)
/* Ftpfs_detach_node does ref count frobbing (of other nodes), so we have
to unlock NETFS_NODE_REFCNT_LOCK during it. */
node->references++;
- spin_unlock (&netfs_node_refcnt_lock);
+ pthread_spin_unlock (&netfs_node_refcnt_lock);
/* Remove NODE from any entry it is attached to. */
ftpfs_detach_node (node);
@@ -99,9 +99,9 @@ netfs_node_norefs (struct node *node)
}
/* Remove this entry from the set of known inodes. */
- spin_lock (&nn->fs->inode_mappings_lock);
+ pthread_spin_lock (&nn->fs->inode_mappings_lock);
hurd_ihash_locp_remove (&nn->fs->inode_mappings, nn->dir_entry->inode_locp);
- spin_unlock (&nn->fs->inode_mappings_lock);
+ pthread_spin_unlock (&nn->fs->inode_mappings_lock);
if (nn->contents)
ccache_free (nn->contents);
@@ -110,5 +110,5 @@ netfs_node_norefs (struct node *node)
free (node);
/* Caller expects us to leave this locked... */
- spin_lock (&netfs_node_refcnt_lock);
+ pthread_spin_lock (&netfs_node_refcnt_lock);
}