summaryrefslogtreecommitdiff
path: root/fatfs
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 /fatfs
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 'fatfs')
-rw-r--r--fatfs/Makefile3
-rw-r--r--fatfs/dir.c8
-rw-r--r--fatfs/fat.c18
-rw-r--r--fatfs/fatfs.h6
-rw-r--r--fatfs/inode.c74
-rw-r--r--fatfs/main.c4
-rw-r--r--fatfs/pager.c78
-rw-r--r--fatfs/virt-inode.c20
8 files changed, 106 insertions, 105 deletions
diff --git a/fatfs/Makefile b/fatfs/Makefile
index 24dcab12..c673b1ba 100644
--- a/fatfs/Makefile
+++ b/fatfs/Makefile
@@ -22,7 +22,8 @@ target = fatfs
SRCS = inode.c main.c dir.c pager.c fat.c virt-inode.c node-create.c
OBJS = $(SRCS:.c=.o)
-HURDLIBS = diskfs iohelp fshelp store pager threads ports ihash shouldbeinlibc
+HURDLIBS = diskfs iohelp fshelp store pager ports ihash shouldbeinlibc
+OTHERLIBS = -lpthread
include ../Makeconf
diff --git a/fatfs/dir.c b/fatfs/dir.c
index 762320f8..b2b7d7e4 100644
--- a/fatfs/dir.c
+++ b/fatfs/dir.c
@@ -314,9 +314,9 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
/* Drop what we *thought* was .. (but isn't any more) and
try *again*. */
diskfs_nput (np);
- mutex_unlock (&dp->lock);
+ pthread_mutex_unlock (&dp->lock);
err = diskfs_cached_lookup_in_dirbuf (inum, &np, buf);
- mutex_lock (&dp->lock);
+ pthread_mutex_lock (&dp->lock);
if (err)
goto out;
retry_dotdot = inum;
@@ -329,9 +329,9 @@ diskfs_lookup_hard (struct node *dp, const char *name, enum lookup_type type,
/* Lock them in the proper order, and then
repeat the directory scan to see if this is still
right. */
- mutex_unlock (&dp->lock);
+ pthread_mutex_unlock (&dp->lock);
err = diskfs_cached_lookup_in_dirbuf (inum, &np, buf);
- mutex_lock (&dp->lock);
+ pthread_mutex_lock (&dp->lock);
if (err)
goto out;
retry_dotdot = inum;
diff --git a/fatfs/fat.c b/fatfs/fat.c
index 1d110c40..14926ff3 100644
--- a/fatfs/fat.c
+++ b/fatfs/fat.c
@@ -51,10 +51,10 @@ size_t first_fat_sector;
cluster_t nr_of_clusters;
/* Hold this lock while converting times using gmtime. */
-spin_lock_t epoch_to_time_lock = SPIN_LOCK_INITIALIZER;
+pthread_spinlock_t epoch_to_time_lock = PTHREAD_SPINLOCK_INITIALIZER;
/* Hold this lock while allocating a new cluster in the FAT. */
-spin_lock_t allocate_free_cluster_lock = SPIN_LOCK_INITIALIZER;
+pthread_spinlock_t allocate_free_cluster_lock = PTHREAD_SPINLOCK_INITIALIZER;
/* Where to look for the next free cluster. This is meant to avoid
searching through a nearly full file system from the beginning at
@@ -323,7 +323,7 @@ fat_allocate_cluster (cluster_t content, cluster_t *cluster)
assert (content != FAT_FREE_CLUSTER);
- spin_lock (&allocate_free_cluster_lock);
+ pthread_spin_lock (&allocate_free_cluster_lock);
old_next_free_cluster = next_free_cluster;
/* Loop over all clusters, starting from next_free_cluster and
@@ -356,7 +356,7 @@ fat_allocate_cluster (cluster_t content, cluster_t *cluster)
else
err = ENOSPC;
- spin_unlock(&allocate_free_cluster_lock);
+ pthread_spin_unlock (&allocate_free_cluster_lock);
return err;
}
@@ -390,14 +390,14 @@ fat_extend_chain (struct node *node, cluster_t new_last_cluster, int create)
return 0;
}
- spin_lock(&dn->chain_extension_lock);
+ pthread_spin_lock (&dn->chain_extension_lock);
/* If we already have what we need, or we have all clusters that are
available without allocating new ones, go out. */
if (new_last_cluster < dn->length_of_chain
|| (!create && dn->chain_complete))
{
- spin_unlock(&dn->chain_extension_lock);
+ pthread_spin_unlock (&dn->chain_extension_lock);
return 0;
}
@@ -460,7 +460,7 @@ fat_extend_chain (struct node *node, cluster_t new_last_cluster, int create)
if (dn->length_of_chain << log2_bytes_per_cluster > node->allocsize)
node->allocsize = dn->length_of_chain << log2_bytes_per_cluster;
- spin_unlock(&dn->chain_extension_lock);
+ pthread_spin_unlock (&dn->chain_extension_lock);
return err;
}
@@ -739,7 +739,7 @@ fat_from_epoch (char *date, char *time, time_t *tp)
{
struct tm *tm;
- spin_lock(&epoch_to_time_lock);
+ pthread_spin_lock (&epoch_to_time_lock);
tm = gmtime (tp);
/* Date format:
@@ -757,5 +757,5 @@ fat_from_epoch (char *date, char *time, time_t *tp)
| ((tm->tm_year - 80) << 9));
write_word(time, (tm->tm_hour << 11) | (tm->tm_min << 5)
| (tm->tm_sec >> 1));
- spin_unlock(&epoch_to_time_lock);
+ pthread_spin_unlock (&epoch_to_time_lock);
}
diff --git a/fatfs/fatfs.h b/fatfs/fatfs.h
index 16b058a8..06955a4a 100644
--- a/fatfs/fatfs.h
+++ b/fatfs/fatfs.h
@@ -45,7 +45,7 @@ struct disknode
/* The directory that hold this file, always hold a reference. */
struct node *dirnode;
- struct rwlock dirent_lock;
+ pthread_rwlock_t dirent_lock;
char *link_target; /* For S_ISLNK. */
@@ -54,11 +54,11 @@ struct disknode
/* Lock to hold while fiddling with this inode's block allocation
info. */
- struct rwlock alloc_lock;
+ pthread_rwlock_t alloc_lock;
/* Lock to hold while extending this inode's block allocation info.
Hold only if you hold readers alloc_lock, then you don't need to
hold it if you hold writers alloc_lock already. */
- spin_lock_t chain_extension_lock;
+ pthread_spinlock_t chain_extension_lock;
struct cluster_chain *first;
struct cluster_chain *last;
cluster_t length_of_chain;
diff --git a/fatfs/inode.c b/fatfs/inode.c
index 2a427933..e3ca09d5 100644
--- a/fatfs/inode.c
+++ b/fatfs/inode.c
@@ -65,13 +65,13 @@ diskfs_cached_lookup (ino64_t inum, struct node **npp)
struct node *np;
struct disknode *dn;
- spin_lock (&diskfs_node_refcnt_lock);
+ pthread_spin_lock (&diskfs_node_refcnt_lock);
for (np = nodehash[INOHASH(inum)]; np; np = np->dn->hnext)
if (np->cache_id == inum)
{
np->references++;
- spin_unlock (&diskfs_node_refcnt_lock);
- mutex_lock (&np->lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_mutex_lock (&np->lock);
*npp = np;
return 0;
}
@@ -80,7 +80,7 @@ diskfs_cached_lookup (ino64_t inum, struct node **npp)
dn = malloc (sizeof (struct disknode));
if (! dn)
{
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
return ENOMEM;
}
dn->pager = 0;
@@ -88,16 +88,16 @@ diskfs_cached_lookup (ino64_t inum, struct node **npp)
dn->last = 0;
dn->length_of_chain = 0;
dn->chain_complete = 0;
- dn->chain_extension_lock = SPIN_LOCK_INITIALIZER;
- rwlock_init (&dn->alloc_lock);
- rwlock_init (&dn->dirent_lock);
+ dn->chain_extension_lock = PTHREAD_SPINLOCK_INITIALIZER;
+ pthread_rwlock_init (&dn->alloc_lock, NULL);
+ pthread_rwlock_init (&dn->dirent_lock, NULL);
/* Create the new node. */
np = diskfs_make_node (dn);
np->cache_id = inum;
np->dn->inode = vi_lookup(inum);
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
/* Put NP in NODEHASH. */
dn->hnext = nodehash[INOHASH(inum)];
@@ -106,7 +106,7 @@ diskfs_cached_lookup (ino64_t inum, struct node **npp)
dn->hprevp = &nodehash[INOHASH(inum)];
nodehash[INOHASH(inum)] = np;
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
/* Get the contents of NP off disk. */
err = read_node (np, 0);
@@ -130,13 +130,13 @@ diskfs_cached_lookup_in_dirbuf (int inum, struct node **npp, vm_address_t buf)
struct node *np;
struct disknode *dn;
- spin_lock (&diskfs_node_refcnt_lock);
+ pthread_spin_lock (&diskfs_node_refcnt_lock);
for (np = nodehash[INOHASH(inum)]; np; np = np->dn->hnext)
if (np->cache_id == inum)
{
np->references++;
- spin_unlock (&diskfs_node_refcnt_lock);
- mutex_lock (&np->lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_mutex_lock (&np->lock);
*npp = np;
return 0;
}
@@ -145,7 +145,7 @@ diskfs_cached_lookup_in_dirbuf (int inum, struct node **npp, vm_address_t buf)
dn = malloc (sizeof (struct disknode));
if (! dn)
{
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
return ENOMEM;
}
dn->pager = 0;
@@ -153,16 +153,16 @@ diskfs_cached_lookup_in_dirbuf (int inum, struct node **npp, vm_address_t buf)
dn->last = 0;
dn->length_of_chain = 0;
dn->chain_complete = 0;
- dn->chain_extension_lock = SPIN_LOCK_INITIALIZER;
- rwlock_init (&dn->alloc_lock);
- rwlock_init (&dn->dirent_lock);
+ dn->chain_extension_lock = PTHREAD_SPINLOCK_INITIALIZER;
+ pthread_rwlock_init (&dn->alloc_lock, NULL);
+ pthread_rwlock_init (&dn->dirent_lock, NULL);
/* Create the new node. */
np = diskfs_make_node (dn);
np->cache_id = inum;
np->dn->inode = vi_lookup(inum);
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
/* Put NP in NODEHASH. */
dn->hnext = nodehash[INOHASH(inum)];
@@ -171,7 +171,7 @@ diskfs_cached_lookup_in_dirbuf (int inum, struct node **npp, vm_address_t buf)
dn->hprevp = &nodehash[INOHASH(inum)];
nodehash[INOHASH(inum)] = np;
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
/* Get the contents of NP off disk. */
err = read_node (np, buf);
@@ -192,14 +192,14 @@ ifind (ino_t inum)
{
struct node *np;
- spin_lock (&diskfs_node_refcnt_lock);
+ pthread_spin_lock (&diskfs_node_refcnt_lock);
for (np = nodehash[INOHASH(inum)]; np; np = np->dn->hnext)
{
if (np->cache_id != inum)
continue;
assert (np->references);
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
return np;
}
assert (0);
@@ -230,9 +230,9 @@ diskfs_node_norefs (struct node *np)
all references to the node have been deleted. */
if (np->dn->dirnode)
{
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
diskfs_nrele (np->dn->dirnode);
- spin_lock (&diskfs_node_refcnt_lock);
+ pthread_spin_lock (&diskfs_node_refcnt_lock);
}
assert (!np->dn->pager);
@@ -336,7 +336,7 @@ read_node (struct node *np, vm_address_t buf)
if (dp)
dp->references++;
- rwlock_reader_lock(&np->dn->dirent_lock);
+ pthread_rwlock_rdlock (&np->dn->dirent_lock);
dn->start_cluster = (read_word (dr->first_cluster_high) << 16)
+ read_word (dr->first_cluster_low);
@@ -355,9 +355,9 @@ read_node (struct node *np, vm_address_t buf)
else
{
np->allocsize = 0;
- rwlock_reader_lock(&dn->alloc_lock);
+ pthread_rwlock_rdlock (&dn->alloc_lock);
err = fat_extend_chain (np, FAT_EOC, 0);
- rwlock_reader_unlock(&dn->alloc_lock);
+ pthread_rwlock_unlock (&dn->alloc_lock);
if (err)
{
if (our_buf && buf)
@@ -391,7 +391,7 @@ read_node (struct node *np, vm_address_t buf)
st->st_blksize = bytes_per_sector;
st->st_blocks = (st->st_size - 1) / bytes_per_sector + 1;
- rwlock_reader_unlock(&np->dn->dirent_lock);
+ pthread_rwlock_unlock (&np->dn->dirent_lock);
if (our_buf && buf)
munmap ((caddr_t) buf, buflen);
@@ -482,14 +482,14 @@ write_node (struct node *np)
dp = np->dn->dirnode;
assert (dp);
- mutex_lock (&dp->lock);
+ pthread_mutex_lock (&dp->lock);
/* Map in the directory contents. */
memobj = diskfs_get_filemap (dp, prot);
if (memobj == MACH_PORT_NULL)
{
- mutex_unlock (&dp->lock);
+ pthread_mutex_unlock (&dp->lock);
/* FIXME: We shouldn't ignore this error. */
return;
}
@@ -501,7 +501,7 @@ write_node (struct node *np)
dr = (struct dirrect *) (buf + vk.dir_offset);
- rwlock_writer_lock(&np->dn->dirent_lock);
+ pthread_rwlock_wrlock (&np->dn->dirent_lock);
write_word (dr->first_cluster_low, np->dn->start_cluster & 0xffff);
write_word (dr->first_cluster_high, np->dn->start_cluster >> 16);
@@ -511,11 +511,11 @@ write_node (struct node *np)
fat_from_epoch ((unsigned char *) &dr->write_date,
(unsigned char *) &dr->write_time, &st->st_mtime);
- rwlock_writer_unlock(&np->dn->dirent_lock);
+ pthread_rwlock_unlock (&np->dn->dirent_lock);
np->dn_stat_dirty = 0;
munmap ((caddr_t) buf, buflen);
- mutex_unlock (&dp->lock);
+ pthread_mutex_unlock (&dp->lock);
}
}
@@ -548,7 +548,7 @@ diskfs_node_iterate (error_t (*fun)(struct node *))
int n, num_nodes = 0;
struct node *node, **node_list, **p;
- spin_lock (&diskfs_node_refcnt_lock);
+ pthread_spin_lock (&diskfs_node_refcnt_lock);
/* We must copy everything from the hash table into another data structure
to avoid running into any problems with the hash-table being modified
@@ -569,7 +569,7 @@ diskfs_node_iterate (error_t (*fun)(struct node *))
node->references++;
}
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
p = node_list;
while (num_nodes-- > 0)
@@ -577,9 +577,9 @@ diskfs_node_iterate (error_t (*fun)(struct node *))
node = *p++;
if (!err)
{
- mutex_lock (&node->lock);
+ pthread_mutex_lock (&node->lock);
err = (*fun)(node);
- mutex_unlock (&node->lock);
+ pthread_mutex_unlock (&node->lock);
}
diskfs_nrele (node);
}
@@ -700,7 +700,7 @@ diskfs_truncate (struct node *node, loff_t length)
diskfs_file_update (node, 1);
}
- rwlock_writer_lock (&node->dn->alloc_lock);
+ pthread_rwlock_wrlock (&node->dn->alloc_lock);
/* Update the size on disk; if we crash, we'll loose. */
node->dn_stat.st_size = length;
@@ -720,7 +720,7 @@ diskfs_truncate (struct node *node, loff_t length)
node->dn_set_ctime = 1;
node->dn_stat_dirty = 1;
- rwlock_writer_unlock (&node->dn->alloc_lock);
+ pthread_rwlock_unlock (&node->dn->alloc_lock);
return err;
}
diff --git a/fatfs/main.c b/fatfs/main.c
index b85d7fe7..b34f8dae 100644
--- a/fatfs/main.c
+++ b/fatfs/main.c
@@ -205,7 +205,7 @@ fetch_root ()
assert_perror (err);
- mutex_unlock (&diskfs_root_node->lock);
+ pthread_mutex_unlock (&diskfs_root_node->lock);
}
@@ -239,7 +239,7 @@ main (int argc, char **argv)
diskfs_startup_diskfs (bootstrap, 0);
- cthread_exit (0);
+ pthread_exit (NULL);
return 0;
}
diff --git a/fatfs/pager.c b/fatfs/pager.c
index e617af03..f892c88f 100644
--- a/fatfs/pager.c
+++ b/fatfs/pager.c
@@ -28,7 +28,7 @@ struct port_bucket *pager_bucket;
/* Mapped image of the FAT. */
void *fat_image;
-spin_lock_t node_to_page_lock = SPIN_LOCK_INITIALIZER;
+pthread_spinlock_t node_to_page_lock = PTHREAD_SPINLOCK_INITIALIZER;
#ifdef DONT_CACHE_MEMORY_OBJECTS
#define MAY_CACHE 0
@@ -40,7 +40,7 @@ spin_lock_t node_to_page_lock = SPIN_LOCK_INITIALIZER;
#define MAX_FREE_PAGE_BUFS 32
-static spin_lock_t free_page_bufs_lock = SPIN_LOCK_INITIALIZER;
+static pthread_spinlock_t free_page_bufs_lock = PTHREAD_SPINLOCK_INITIALIZER;
static void *free_page_bufs = 0;
static int num_free_page_bufs = 0;
@@ -50,12 +50,12 @@ get_page_buf ()
{
void *buf;
- spin_lock (&free_page_bufs_lock);
+ pthread_spin_lock (&free_page_bufs_lock);
buf = free_page_bufs;
if (buf == 0)
{
- spin_unlock (&free_page_bufs_lock);
+ pthread_spin_unlock (&free_page_bufs_lock);
buf = mmap (0, vm_page_size, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
if (buf == (void *) -1)
buf = 0;
@@ -64,7 +64,7 @@ get_page_buf ()
{
free_page_bufs = *(void **)buf;
num_free_page_bufs--;
- spin_unlock (&free_page_bufs_lock);
+ pthread_spin_unlock (&free_page_bufs_lock);
}
return buf;
@@ -74,17 +74,17 @@ get_page_buf ()
static void
free_page_buf (void *buf)
{
- spin_lock (&free_page_bufs_lock);
+ pthread_spin_lock (&free_page_bufs_lock);
if (num_free_page_bufs < MAX_FREE_PAGE_BUFS)
{
*(void **)buf = free_page_bufs;
free_page_bufs = buf;
num_free_page_bufs++;
- spin_unlock (&free_page_bufs_lock);
+ pthread_spin_unlock (&free_page_bufs_lock);
}
else
{
- spin_unlock (&free_page_bufs_lock);
+ pthread_spin_unlock (&free_page_bufs_lock);
munmap (buf, vm_page_size);
}
}
@@ -96,14 +96,14 @@ free_page_buf (void *buf)
error code otherwise is returned. */
static error_t
find_cluster (struct node *node, vm_offset_t offset,
- cluster_t *cluster, struct rwlock **lock)
+ cluster_t *cluster, pthread_rwlock_t **lock)
{
error_t err;
if (!*lock)
{
*lock = &node->dn->alloc_lock;
- rwlock_reader_lock (*lock);
+ pthread_rwlock_rdlock (*lock);
}
if (round_cluster (offset) > node->allocsize)
@@ -134,7 +134,7 @@ root_dir_pager_read_page (vm_offset_t page, void **buf, int *writelock)
return EIO;
}
- rwlock_reader_lock(&diskfs_root_node->dn->alloc_lock);
+ pthread_rwlock_rdlock (&diskfs_root_node->dn->alloc_lock);
addr = first_root_dir_byte + page;
if (page + vm_page_size > diskfs_root_node->allocsize)
@@ -145,7 +145,7 @@ root_dir_pager_read_page (vm_offset_t page, void **buf, int *writelock)
if (!err && read != vm_page_size)
err = EIO;
- rwlock_reader_unlock (&diskfs_root_node->dn->alloc_lock);
+ pthread_rwlock_unlock (&diskfs_root_node->dn->alloc_lock);
if (overrun)
bzero ((void *) *buf + vm_page_size - overrun, overrun);
@@ -162,7 +162,7 @@ file_pager_read_small_page (struct node *node, vm_offset_t page,
void **buf, int *writelock)
{
error_t err;
- struct rwlock *lock = NULL;
+ pthread_rwlock_t *lock = NULL;
cluster_t cluster;
size_t read = 0;
@@ -188,7 +188,7 @@ file_pager_read_small_page (struct node *node, vm_offset_t page,
}
if (lock)
- rwlock_reader_unlock (lock);
+ pthread_rwlock_unlock (lock);
return err;
}
@@ -204,7 +204,7 @@ file_pager_read_huge_page (struct node *node, vm_offset_t page,
{
error_t err;
int offs = 0;
- struct rwlock *lock = NULL;
+ pthread_rwlock_t *lock = NULL;
int left = vm_page_size;
cluster_t pending_clusters = 0;
int num_pending_clusters = 0;
@@ -295,7 +295,7 @@ file_pager_read_huge_page (struct node *node, vm_offset_t page,
err = do_pending_reads();
if (lock)
- rwlock_reader_unlock (lock);
+ pthread_rwlock_unlock (lock);
return err;
}
@@ -380,7 +380,7 @@ file_pager_write_huge_page (struct node *node, vm_offset_t offset, void *buf)
{
error_t err = 0;
struct pending_clusters pc;
- struct rwlock *lock = &node->dn->alloc_lock;
+ pthread_rwlock_t *lock = &node->dn->alloc_lock;
cluster_t cluster;
int left = vm_page_size;
@@ -389,7 +389,7 @@ file_pager_write_huge_page (struct node *node, vm_offset_t offset, void *buf)
/* Holding NODE->dn->alloc_lock effectively locks NODE->allocsize,
at least for the cases we care about: pager_unlock_page,
diskfs_grow and diskfs_truncate. */
- rwlock_reader_lock (&node->dn->alloc_lock);
+ pthread_rwlock_rdlock (&node->dn->alloc_lock);
if (offset >= node->allocsize)
left = 0;
@@ -411,7 +411,7 @@ file_pager_write_huge_page (struct node *node, vm_offset_t offset, void *buf)
if (!err)
pending_clusters_write (&pc);
- rwlock_reader_unlock (&node->dn->alloc_lock);
+ pthread_rwlock_unlock (&node->dn->alloc_lock);
return err;
}
@@ -436,7 +436,7 @@ root_dir_pager_write_page (vm_offset_t offset, void *buf)
/* Holding NODE->dn->alloc_lock effectively locks NODE->allocsize,
at least for the cases we care about: pager_unlock_page,
diskfs_grow and diskfs_truncate. */
- rwlock_reader_lock (&diskfs_root_node->dn->alloc_lock);
+ pthread_rwlock_rdlock (&diskfs_root_node->dn->alloc_lock);
addr = first_root_dir_byte + offset;
@@ -450,7 +450,7 @@ root_dir_pager_write_page (vm_offset_t offset, void *buf)
if (!err && write != length)
err = EIO;
- rwlock_reader_unlock (&diskfs_root_node->dn->alloc_lock);
+ pthread_rwlock_unlock (&diskfs_root_node->dn->alloc_lock);
return err;
}
@@ -464,7 +464,7 @@ static error_t
file_pager_write_small_page (struct node *node, vm_offset_t offset, void *buf)
{
error_t err;
- struct rwlock *lock = NULL;
+ pthread_rwlock_t *lock = NULL;
cluster_t cluster;
size_t write = 0;
@@ -474,7 +474,7 @@ file_pager_write_small_page (struct node *node, vm_offset_t offset, void *buf)
/* Holding NODE->dn->alloc_lock effectively locks NODE->allocsize,
at least for the cases we care about: pager_unlock_page,
diskfs_grow and diskfs_truncate. */
- rwlock_reader_lock (&node->dn->alloc_lock);
+ pthread_rwlock_rdlock (&node->dn->alloc_lock);
err = find_cluster (node, offset, &cluster, &lock);
@@ -489,7 +489,7 @@ file_pager_write_small_page (struct node *node, vm_offset_t offset, void *buf)
}
if (lock)
- rwlock_reader_unlock (lock);
+ pthread_rwlock_unlock (lock);
return err;
}
@@ -617,7 +617,7 @@ diskfs_grow (struct node *node, loff_t size, struct protid *cred)
cluster_t new_end_cluster;
struct disknode *dn = node->dn;
- rwlock_writer_lock (&dn->alloc_lock);
+ pthread_rwlock_wrlock (&dn->alloc_lock);
old_size = node->allocsize;
new_size = ((size + bytes_per_cluster - 1) >> log2_bytes_per_cluster)
@@ -647,7 +647,7 @@ diskfs_grow (struct node *node, loff_t size, struct protid *cred)
node->allocsize = new_size;
- rwlock_writer_unlock (&dn->alloc_lock);
+ pthread_rwlock_unlock (&dn->alloc_lock);
return err;
}
@@ -662,11 +662,11 @@ diskfs_file_update (struct node *node, int wait)
{
struct pager *pager;
- spin_lock (&node_to_page_lock);
+ pthread_spin_lock (&node_to_page_lock);
pager = node->dn->pager;
if (pager)
ports_port_ref (pager);
- spin_unlock (&node_to_page_lock);
+ pthread_spin_unlock (&node_to_page_lock);
if (pager)
{
@@ -684,11 +684,11 @@ flush_node_pager (struct node *node)
struct pager *pager;
struct disknode *dn = node->dn;
- spin_lock (&node_to_page_lock);
+ pthread_spin_lock (&node_to_page_lock);
pager = dn->pager;
if (pager)
ports_port_ref (pager);
- spin_unlock (&node_to_page_lock);
+ pthread_spin_unlock (&node_to_page_lock);
if (pager)
{
@@ -724,11 +724,11 @@ pager_clear_user_data (struct user_pager_info *upi)
{
struct pager *pager;
- spin_lock (&node_to_page_lock);
+ pthread_spin_lock (&node_to_page_lock);
pager = upi->node->dn->pager;
if (pager && pager_get_upi (pager) == upi)
upi->node->dn->pager = 0;
- spin_unlock (&node_to_page_lock);
+ pthread_spin_unlock (&node_to_page_lock);
diskfs_nrele_light (upi->node);
}
@@ -768,7 +768,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
|| S_ISREG (node->dn_stat.st_mode)
|| (S_ISLNK (node->dn_stat.st_mode)));
- spin_lock (&node_to_page_lock);
+ pthread_spin_lock (&node_to_page_lock);
do
{
struct pager *pager = node->dn->pager;
@@ -799,7 +799,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
{
diskfs_nrele_light (node);
free (upi);
- spin_unlock (&node_to_page_lock);
+ pthread_spin_unlock (&node_to_page_lock);
return MACH_PORT_NULL;
}
@@ -808,7 +808,7 @@ diskfs_get_filemap (struct node *node, vm_prot_t prot)
}
}
while (right == MACH_PORT_NULL);
- spin_unlock (&node_to_page_lock);
+ pthread_spin_unlock (&node_to_page_lock);
mach_port_insert_right (mach_task_self (), right, right,
MACH_MSG_TYPE_MAKE_SEND);
@@ -823,11 +823,11 @@ drop_pager_softrefs (struct node *node)
{
struct pager *pager;
- spin_lock (&node_to_page_lock);
+ pthread_spin_lock (&node_to_page_lock);
pager = node->dn->pager;
if (pager)
ports_port_ref (pager);
- spin_unlock (&node_to_page_lock);
+ pthread_spin_unlock (&node_to_page_lock);
if (MAY_CACHE && pager)
pager_change_attributes (pager, 0, MEMORY_OBJECT_COPY_DELAY, 0);
@@ -842,11 +842,11 @@ allow_pager_softrefs (struct node *node)
{
struct pager *pager;
- spin_lock (&node_to_page_lock);
+ pthread_spin_lock (&node_to_page_lock);
pager = node->dn->pager;
if (pager)
ports_port_ref (pager);
- spin_unlock (&node_to_page_lock);
+ pthread_spin_unlock (&node_to_page_lock);
if (MAY_CACHE && pager)
pager_change_attributes (pager, 1, MEMORY_OBJECT_COPY_DELAY, 0);
diff --git a/fatfs/virt-inode.c b/fatfs/virt-inode.c
index d7c990d6..5d134b00 100644
--- a/fatfs/virt-inode.c
+++ b/fatfs/virt-inode.c
@@ -27,7 +27,7 @@
#include <stdlib.h>
#include <assert.h>
#include <string.h>
-#include <spin-lock.h>
+#include <pthread.h>
#include "virt-inode.h"
/* Each virtual inode contains the UNIQUE key it belongs to,
@@ -56,7 +56,7 @@ struct table_page
struct table_page *inode_table;
-spin_lock_t inode_table_lock = SPIN_LOCK_INITIALIZER;
+pthread_spinlock_t inode_table_lock = PTHREAD_SPINLOCK_INITIALIZER;
/* See vi_new and vi_rlookup. */
error_t
@@ -119,9 +119,9 @@ vi_new(vi_key_t key, ino_t *inode, inode_t *v_inode)
assert (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
- spin_lock (&inode_table_lock);
+ pthread_spin_lock (&inode_table_lock);
err = _vi_new(key, inode, v_inode);
- spin_unlock (&inode_table_lock);
+ pthread_spin_unlock (&inode_table_lock);
return err;
}
@@ -144,7 +144,7 @@ vi_lookup(ino_t inode)
int offset = (inode - 1) & (TABLE_PAGE_SIZE - 1);
inode_t v_inode = 0;
- spin_lock (&inode_table_lock);
+ pthread_spin_lock (&inode_table_lock);
while (table && page > 0)
{
@@ -155,7 +155,7 @@ vi_lookup(ino_t inode)
if (table)
v_inode = &table->vi[offset];
- spin_unlock (&inode_table_lock);
+ pthread_spin_unlock (&inode_table_lock);
return v_inode;
}
@@ -173,7 +173,7 @@ vi_rlookup(vi_key_t key, ino_t *inode, inode_t *v_inode, int create)
assert (memcmp(&vi_zero_key, &key, sizeof (vi_key_t)));
- spin_lock (&inode_table_lock);
+ pthread_spin_lock (&inode_table_lock);
while (table && memcmp(&table->vi[offset].key, &key, sizeof (vi_key_t)))
{
@@ -200,7 +200,7 @@ vi_rlookup(vi_key_t key, ino_t *inode, inode_t *v_inode, int create)
err = EINVAL;
}
- spin_unlock (&inode_table_lock);
+ pthread_spin_unlock (&inode_table_lock);
return err;
}
@@ -221,10 +221,10 @@ vi_key_t vi_change(inode_t v_inode, vi_key_t key)
vi_key_t vi_free(inode_t v_inode)
{
vi_key_t key;
- spin_lock (&inode_table_lock);
+ pthread_spin_lock (&inode_table_lock);
key = v_inode->key;
v_inode->key = vi_zero_key;
- spin_unlock (&inode_table_lock);
+ pthread_spin_unlock (&inode_table_lock);
return key;
}