summaryrefslogtreecommitdiff
path: root/ext2fs
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 /ext2fs
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 'ext2fs')
-rw-r--r--ext2fs/Makefile3
-rw-r--r--ext2fs/balloc.c32
-rw-r--r--ext2fs/dir.c8
-rw-r--r--ext2fs/ext2fs.c4
-rw-r--r--ext2fs/ext2fs.h18
-rw-r--r--ext2fs/ialloc.c24
-rw-r--r--ext2fs/inode.c34
-rw-r--r--ext2fs/msg.c19
-rw-r--r--ext2fs/pager.c66
-rw-r--r--ext2fs/pokel.c22
-rw-r--r--ext2fs/storeinfo.c4
-rw-r--r--ext2fs/truncate.c12
12 files changed, 125 insertions, 121 deletions
diff --git a/ext2fs/Makefile b/ext2fs/Makefile
index 8e16ebe6..983dbee3 100644
--- a/ext2fs/Makefile
+++ b/ext2fs/Makefile
@@ -23,7 +23,8 @@ target = ext2fs
SRCS = balloc.c dir.c ext2fs.c getblk.c hyper.c ialloc.c \
inode.c pager.c pokel.c truncate.c storeinfo.c msg.c xinl.c
OBJS = $(SRCS:.c=.o)
-HURDLIBS = diskfs pager iohelp fshelp store threads ports ihash shouldbeinlibc
+HURDLIBS = diskfs pager iohelp fshelp store ports ihash shouldbeinlibc
+OTHERLIBS = -lpthread
include ../Makeconf
diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c
index 7fe82ba0..b2d2eab9 100644
--- a/ext2fs/balloc.c
+++ b/ext2fs/balloc.c
@@ -63,14 +63,14 @@ ext2_free_blocks (block_t block, unsigned long count)
unsigned long i;
struct ext2_group_desc *gdp;
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
if (block < sblock->s_first_data_block ||
(block + count) > sblock->s_blocks_count)
{
ext2_error ("freeing blocks not in datazone - "
"block = %u, count = %lu", block, count);
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return;
}
@@ -122,7 +122,7 @@ ext2_free_blocks (block_t block, unsigned long count)
sblock_dirty = 1;
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
alloc_sync (0);
}
@@ -149,7 +149,7 @@ ext2_new_block (block_t goal,
static int goal_hits = 0, goal_attempts = 0;
#endif
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
#ifdef XXX /* Auth check to use reserved blocks */
if (sblock->s_free_blocks_count <= sblock->s_r_blocks_count &&
@@ -157,7 +157,7 @@ ext2_new_block (block_t goal,
(sb->u.ext2_sb.s_resgid == 0 ||
!in_group_p (sb->u.ext2_sb.s_resgid))))
{
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return 0;
}
#endif
@@ -264,7 +264,7 @@ repeat:
}
if (k >= groups_count)
{
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return 0;
}
bh = bptr (gdp->bg_block_bitmap);
@@ -278,7 +278,7 @@ repeat:
if (j >= sblock->s_blocks_per_group)
{
ext2_error ("free blocks count corrupted for block group %d", i);
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return 0;
}
@@ -312,9 +312,9 @@ got_block:
block is being allocated to a file (see pager.c). */
if (modified_global_blocks)
{
- spin_lock (&modified_global_blocks_lock);
+ pthread_spin_lock (&modified_global_blocks_lock);
clear_bit (tmp, modified_global_blocks);
- spin_unlock (&modified_global_blocks_lock);
+ pthread_spin_unlock (&modified_global_blocks_lock);
}
ext2_debug ("found bit %d", j);
@@ -337,9 +337,9 @@ got_block:
/* (See comment before the clear_bit above) */
if (modified_global_blocks)
{
- spin_lock (&modified_global_blocks_lock);
+ pthread_spin_lock (&modified_global_blocks_lock);
clear_bit (tmp + k, modified_global_blocks);
- spin_unlock (&modified_global_blocks_lock);
+ pthread_spin_unlock (&modified_global_blocks_lock);
}
}
gdp->bg_free_blocks_count -= *prealloc_count;
@@ -369,7 +369,7 @@ got_block:
sblock_dirty = 1;
sync_out:
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
alloc_sync (0);
return j;
@@ -383,7 +383,7 @@ ext2_count_free_blocks ()
struct ext2_group_desc *gdp;
int i;
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
desc_count = 0;
bitmap_count = 0;
@@ -399,7 +399,7 @@ ext2_count_free_blocks ()
}
printf ("ext2_count_free_blocks: stored = %u, computed = %lu, %lu",
sblock->s_free_blocks_count, desc_count, bitmap_count);
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return bitmap_count;
#else
return sblock->s_free_blocks_count;
@@ -422,7 +422,7 @@ ext2_check_blocks_bitmap ()
struct ext2_group_desc *gdp;
int i, j;
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
desc_count = 0;
bitmap_count = 0;
@@ -489,5 +489,5 @@ ext2_check_blocks_bitmap ()
ext2_error ("wrong free blocks count in super block,"
" stored = %lu, counted = %lu",
(unsigned long) sblock->s_free_blocks_count, bitmap_count);
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
}
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 714c1b7c..3a3e648d 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -278,9 +278,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 (inum, &np);
- mutex_lock (&dp->lock);
+ pthread_mutex_lock (&dp->lock);
if (err)
goto out;
retry_dotdot = inum;
@@ -293,9 +293,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 (inum, &np);
- mutex_lock (&dp->lock);
+ pthread_mutex_lock (&dp->lock);
if (err)
goto out;
retry_dotdot = inum;
diff --git a/ext2fs/ext2fs.c b/ext2fs/ext2fs.c
index 0857a749..993f1997 100644
--- a/ext2fs/ext2fs.c
+++ b/ext2fs/ext2fs.c
@@ -193,7 +193,7 @@ main (int argc, char **argv)
ext2_panic ("can't get root: %s", strerror (err));
else if ((diskfs_root_node->dn_stat.st_mode & S_IFMT) == 0)
ext2_panic ("no root node!");
- mutex_unlock (&diskfs_root_node->lock);
+ pthread_mutex_unlock (&diskfs_root_node->lock);
/* Now that we are all set up to handle requests, and diskfs_root_node is
set properly, it is safe to export our fsys control port to the
@@ -201,7 +201,7 @@ main (int argc, char **argv)
diskfs_startup_diskfs (bootstrap, 0);
/* and so we die, leaving others to do the real work. */
- cthread_exit (0);
+ pthread_exit (NULL);
/* NOTREACHED */
return 0;
}
diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h
index 2ad4a9df..52bf2b19 100644
--- a/ext2fs/ext2fs.h
+++ b/ext2fs/ext2fs.h
@@ -25,7 +25,7 @@
#include <hurd/iohelp.h>
#include <hurd/diskfs.h>
#include <assert.h>
-#include <rwlock.h>
+#include <pthread.h>
#include <sys/mman.h>
#define __hurd__ /* Enable some hurd-specific fields. */
@@ -80,7 +80,7 @@ struct poke
struct pokel
{
struct poke *pokes, *free_pokes;
- spin_lock_t lock;
+ pthread_spinlock_t lock;
struct pager *pager;
void *image;
};
@@ -161,7 +161,7 @@ struct disknode
struct node *hnext, **hprevp;
/* Lock to lock while fiddling with this inode's block allocation info. */
- struct rwlock alloc_lock;
+ pthread_rwlock_t alloc_lock;
/* Where changes to our indirect blocks are added. */
struct pokel indir_pokel;
@@ -268,9 +268,9 @@ unsigned long groups_count; /* Number of groups in the fs */
/* ---------------------------------------------------------------- */
-spin_lock_t node_to_page_lock;
+pthread_spinlock_t node_to_page_lock;
-spin_lock_t generation_lock;
+pthread_spinlock_t generation_lock;
unsigned long next_generation;
/* ---------------------------------------------------------------- */
@@ -335,7 +335,7 @@ void inode_init (void);
/* What to lock if changing global data data (e.g., the superblock or block
group descriptors or bitmaps). */
-spin_lock_t global_lock;
+pthread_spinlock_t global_lock;
/* Where to record such changes. */
struct pokel global_pokel;
@@ -344,7 +344,7 @@ struct pokel global_pokel;
record which disk blocks are actually modified, so we don't stomp on parts
of the disk which are backed by file pagers. */
char *modified_global_blocks;
-spin_lock_t modified_global_blocks_lock;
+pthread_spinlock_t modified_global_blocks_lock;
extern int global_block_modified (block_t block);
extern void record_global_poke (void *ptr);
@@ -364,9 +364,9 @@ global_block_modified (block_t block)
if (modified_global_blocks)
{
int was_clean;
- spin_lock (&modified_global_blocks_lock);
+ pthread_spin_lock (&modified_global_blocks_lock);
was_clean = !set_bit(block, modified_global_blocks);
- spin_unlock (&modified_global_blocks_lock);
+ pthread_spin_unlock (&modified_global_blocks_lock);
return was_clean;
}
else
diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c
index 15c17a4e..aa018d94 100644
--- a/ext2fs/ialloc.c
+++ b/ext2fs/ialloc.c
@@ -62,12 +62,12 @@ diskfs_free_node (struct node *np, mode_t old_mode)
ext2_debug ("freeing inode %u", inum);
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
if (inum < EXT2_FIRST_INO (sblock) || inum > sblock->s_inodes_count)
{
ext2_error ("reserved inode or nonexistent inode: %Ld", inum);
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return;
}
@@ -92,7 +92,7 @@ diskfs_free_node (struct node *np, mode_t old_mode)
}
sblock_dirty = 1;
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
alloc_sync(0);
}
@@ -116,7 +116,7 @@ ext2_alloc_inode (ino_t dir_inum, mode_t mode)
struct ext2_group_desc *gdp;
struct ext2_group_desc *tmp;
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
repeat:
gdp = NULL;
@@ -209,7 +209,7 @@ repeat:
if (!gdp)
{
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return 0;
}
@@ -254,7 +254,7 @@ repeat:
sblock_dirty = 1;
sync_out:
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
alloc_sync (0);
return inum;
@@ -323,12 +323,12 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node)
/*
* Set up a new generation number for this inode.
*/
- spin_lock (&generation_lock);
+ pthread_spin_lock (&generation_lock);
sex = diskfs_mtime->seconds;
if (++next_generation < (u_long)sex)
next_generation = sex;
st->st_gen = next_generation;
- spin_unlock (&generation_lock);
+ pthread_spin_unlock (&generation_lock);
alloc_sync (np);
@@ -346,7 +346,7 @@ ext2_count_free_inodes ()
struct ext2_group_desc *gdp;
int i;
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
desc_count = 0;
bitmap_count = 0;
@@ -363,7 +363,7 @@ ext2_count_free_inodes ()
}
ext2_debug ("stored = %u, computed = %lu, %lu",
sblock->s_free_inodes_count, desc_count, bitmap_count);
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
return desc_count;
#else
return sblock->s_free_inodes_count;
@@ -379,7 +379,7 @@ ext2_check_inodes_bitmap ()
struct ext2_group_desc *gdp;
unsigned long desc_count, bitmap_count, x;
- spin_lock (&global_lock);
+ pthread_spin_lock (&global_lock);
desc_count = 0;
bitmap_count = 0;
@@ -401,5 +401,5 @@ ext2_check_inodes_bitmap ()
"stored = %lu, counted = %lu",
(unsigned long) sblock->s_free_inodes_count, bitmap_count);
- spin_unlock (&global_lock);
+ pthread_spin_unlock (&global_lock);
}
diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 2da8a95e..2c442795 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -50,7 +50,7 @@ static struct node *nodehash[INOHSZ];
static error_t read_node (struct node *np);
-spin_lock_t generation_lock = SPIN_LOCK_INITIALIZER;
+pthread_spinlock_t generation_lock = PTHREAD_SPINLOCK_INITIALIZER;
/* Initialize the inode hash table. */
void
@@ -70,13 +70,13 @@ diskfs_cached_lookup (ino_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;
}
@@ -85,20 +85,20 @@ diskfs_cached_lookup (ino_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->dirents = 0;
dn->dir_idx = 0;
dn->pager = 0;
- rwlock_init (&dn->alloc_lock);
+ pthread_rwlock_init (&dn->alloc_lock, NULL);
pokel_init (&dn->indir_pokel, diskfs_disk_pager, disk_image);
/* Create the new node. */
np = diskfs_make_node (dn);
np->cache_id = inum;
- mutex_lock (&np->lock);
+ pthread_mutex_lock (&np->lock);
/* Put NP in NODEHASH. */
dn->hnext = nodehash[INOHASH(inum)];
@@ -107,18 +107,18 @@ diskfs_cached_lookup (ino_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);
if (!diskfs_check_readonly () && !np->dn_stat.st_gen)
{
- spin_lock (&generation_lock);
+ pthread_spin_lock (&generation_lock);
if (++next_generation < diskfs_mtime->seconds)
next_generation = diskfs_mtime->seconds;
np->dn_stat.st_gen = next_generation;
- spin_unlock (&generation_lock);
+ pthread_spin_unlock (&generation_lock);
np->dn_set_ctime = 1;
}
@@ -138,14 +138,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);
@@ -540,7 +540,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
@@ -557,7 +557,7 @@ diskfs_node_iterate (error_t (*fun)(struct node *))
node_list = malloc (num_nodes * sizeof (struct node *));
if (node_list == NULL)
{
- spin_unlock (&diskfs_node_refcnt_lock);
+ pthread_spin_unlock (&diskfs_node_refcnt_lock);
ext2_debug ("unable to allocate temporary node table");
return ENOMEM;
}
@@ -570,7 +570,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)
@@ -578,9 +578,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);
}
diff --git a/ext2fs/msg.c b/ext2fs/msg.c
index 727d926d..83939b06 100644
--- a/ext2fs/msg.c
+++ b/ext2fs/msg.c
@@ -23,16 +23,17 @@
#include "ext2fs.h"
-struct mutex printf_lock = MUTEX_INITIALIZER; /* XXX */
+pthread_mutex_t printf_lock = PTHREAD_MUTEX_INITIALIZER; /* XXX */
+
int printf (const char *fmt, ...)
{
va_list arg;
int done;
va_start (arg, fmt);
- mutex_lock (&printf_lock);
+ pthread_mutex_lock (&printf_lock);
done = vprintf (fmt, arg);
- mutex_unlock (&printf_lock);
+ pthread_mutex_unlock (&printf_lock);
va_end (arg);
return done;
}
@@ -43,7 +44,7 @@ void _ext2_error (const char * function, const char * fmt, ...)
{
va_list args;
- mutex_lock(&printf_lock);
+ pthread_mutex_lock (&printf_lock);
va_start (args, fmt);
vsprintf (error_buf, fmt, args);
@@ -51,14 +52,14 @@ void _ext2_error (const char * function, const char * fmt, ...)
fprintf (stderr, "ext2fs: %s: %s: %s\n", diskfs_disk_name, function, error_buf);
- mutex_unlock(&printf_lock);
+ pthread_mutex_unlock (&printf_lock);
}
void _ext2_panic (const char * function, const char * fmt, ...)
{
va_list args;
- mutex_lock(&printf_lock);
+ pthread_mutex_lock (&printf_lock);
va_start (args, fmt);
vsprintf (error_buf, fmt, args);
@@ -67,7 +68,7 @@ void _ext2_panic (const char * function, const char * fmt, ...)
fprintf(stderr, "ext2fs: %s: panic: %s: %s\n",
diskfs_disk_name, function, error_buf);
- mutex_unlock(&printf_lock);
+ pthread_mutex_unlock (&printf_lock);
exit (1);
}
@@ -76,7 +77,7 @@ void ext2_warning (const char * fmt, ...)
{
va_list args;
- mutex_lock(&printf_lock);
+ pthread_mutex_lock (&printf_lock);
va_start (args, fmt);
vsprintf (error_buf, fmt, args);
@@ -84,5 +85,5 @@ void ext2_warning (const char * fmt, ...)
fprintf (stderr, "ext2fs: %s: warning: %s\n", diskfs_disk_name, error_buf);
- mutex_unlock(&printf_lock);
+ pthread_mutex_unlock (&printf_lock);
}
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index 0136f9b1..f740434a 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -29,7 +29,8 @@ struct port_bucket *pager_bucket;
/* Mapped image of the disk. */
void *disk_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
@@ -42,7 +43,7 @@ spin_lock_t node_to_page_lock = SPIN_LOCK_INITIALIZER;
#ifdef STATS
struct ext2fs_pager_stats
{
- spin_lock_t lock;
+ pthread_spinlock_t lock;
unsigned long disk_pageins;
unsigned long disk_pageouts;
@@ -58,12 +59,13 @@ struct ext2fs_pager_stats
unsigned long file_grows;
};
-static struct ext2fs_pager_stats ext2s_pager_stats;
+static struct ext2fs_pager_stats ext2s_pager_stats =
+ { .lock = PTHREAD_SPINLOCK_INITIALIZER };
#define STAT_INC(field) \
-do { spin_lock (&ext2s_pager_stats.lock); \
+do { pthread_spin_lock (&ext2s_pager_stats.lock); \
ext2s_pager_stats.field++; \
- spin_unlock (&ext2s_pager_stats.lock); } while (0)
+ pthread_spin_unlock (&ext2s_pager_stats.lock); } while (0)
#else /* !STATS */
#define STAT_INC(field) /* nop */0
@@ -75,12 +77,12 @@ do { spin_lock (&ext2s_pager_stats.lock); \
static void *
get_page_buf ()
{
- static struct mutex free_page_bufs_lock = MUTEX_INITIALIZER;
+ static pthread_mutex_t free_page_bufs_lock = PTHREAD_MUTEX_INITIALIZER;
static void *free_page_bufs;
static int num_free_page_bufs;
void *buf;
- mutex_lock (&free_page_bufs_lock);
+ pthread_mutex_lock (&free_page_bufs_lock);
if (num_free_page_bufs > 0)
{
buf = free_page_bufs;
@@ -106,7 +108,7 @@ get_page_buf ()
}
}
- mutex_unlock (&free_page_bufs_lock);
+ pthread_mutex_unlock (&free_page_bufs_lock);
return buf;
}
@@ -124,14 +126,14 @@ free_page_buf (void *buf)
on success otherwise an error code. */
static error_t
find_block (struct node *node, vm_offset_t offset,
- block_t *block, struct rwlock **lock)
+ block_t *block, pthread_rwlock_t **lock)
{
error_t err;
if (!*lock)
{
*lock = &node->dn->alloc_lock;
- rwlock_reader_lock (*lock);
+ pthread_rwlock_rdlock (*lock);
}
if (offset + block_size > node->allocsize)
@@ -158,7 +160,7 @@ file_pager_read_page (struct node *node, vm_offset_t page,
error_t err;
int offs = 0;
int partial = 0; /* A page truncated by the EOF. */
- struct rwlock *lock = NULL;
+ pthread_rwlock_t *lock = NULL;
int left = vm_page_size;
block_t pending_blocks = 0;
int num_pending_blocks = 0;
@@ -271,7 +273,7 @@ file_pager_read_page (struct node *node, vm_offset_t page,
node->dn->last_page_partially_writable = 1;
if (lock)
- rwlock_reader_unlock (lock);
+ pthread_rwlock_unlock (lock);
return err;
}
@@ -365,7 +367,7 @@ file_pager_write_page (struct node *node, vm_offset_t offset, void *buf)
{
error_t err = 0;
struct pending_blocks pb;
- struct rwlock *lock = &node->dn->alloc_lock;
+ pthread_rwlock_t *lock = &node->dn->alloc_lock;
block_t block;
int left = vm_page_size;
@@ -374,7 +376,7 @@ file_pager_write_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;
@@ -399,7 +401,7 @@ file_pager_write_page (struct node *node, vm_offset_t offset, void *buf)
if (!err)
pending_blocks_write (&pb);
- rwlock_reader_unlock (&node->dn->alloc_lock);
+ pthread_rwlock_unlock (&node->dn->alloc_lock);
return err;
}
@@ -525,7 +527,7 @@ pager_unlock_page (struct user_pager_info *pager, vm_offset_t page)
struct node *node = pager->node;
struct disknode *dn = node->dn;
- rwlock_writer_lock (&dn->alloc_lock);
+ pthread_rwlock_wrlock (&dn->alloc_lock);
partial_page = (page + vm_page_size > node->allocsize);
@@ -567,7 +569,7 @@ pager_unlock_page (struct user_pager_info *pager, vm_offset_t page)
STAT_INC (file_page_unlocks);
- rwlock_writer_unlock (&dn->alloc_lock);
+ pthread_rwlock_unlock (&dn->alloc_lock);
if (err == ENOSPC)
ext2_warning ("This filesystem is out of space, and will now crash. Bye!");
@@ -598,7 +600,7 @@ diskfs_grow (struct node *node, off_t size, struct protid *cred)
block_t new_end_block;
struct disknode *dn = node->dn;
- rwlock_writer_lock (&dn->alloc_lock);
+ pthread_rwlock_wrlock (&dn->alloc_lock);
old_size = node->allocsize;
new_size = round_block (size);
@@ -665,7 +667,7 @@ diskfs_grow (struct node *node, off_t size, struct protid *cred)
node->allocsize = new_size;
- rwlock_writer_unlock (&dn->alloc_lock);
+ pthread_rwlock_unlock (&dn->alloc_lock);
return err;
}
@@ -680,11 +682,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)
{
@@ -704,11 +706,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)
{
@@ -745,11 +747,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);
}
@@ -789,7 +791,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;
@@ -820,7 +822,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;
}
@@ -829,7 +831,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);
@@ -844,11 +846,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)
{
@@ -866,11 +868,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/ext2fs/pokel.c b/ext2fs/pokel.c
index 85b4d2d1..a8b16c97 100644
--- a/ext2fs/pokel.c
+++ b/ext2fs/pokel.c
@@ -25,7 +25,7 @@
void
pokel_init (struct pokel *pokel, struct pager *pager, void *image)
{
- pokel->lock = SPIN_LOCK_INITIALIZER;
+ pokel->lock = PTHREAD_SPINLOCK_INITIALIZER;
pokel->pokes = NULL;
pokel->free_pokes = NULL;
pokel->pager = pager;
@@ -59,7 +59,7 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
ext2_debug ("adding %p[%ul] (range 0x%x to 0x%x)", loc, length, offset, end);
- spin_lock (&pokel->lock);
+ pthread_spin_lock (&pokel->lock);
pl = pokel->pokes;
while (pl != NULL)
@@ -97,7 +97,7 @@ pokel_add (struct pokel *pokel, void *loc, vm_size_t length)
pokel->pokes = pl;
}
- spin_unlock (&pokel->lock);
+ pthread_spin_unlock (&pokel->lock);
}
/* Move all pending pokes from POKEL into its free list. If SYNC is true,
@@ -107,10 +107,10 @@ _pokel_exec (struct pokel *pokel, int sync, int wait)
{
struct poke *pl, *pokes, *last = NULL;
- spin_lock (&pokel->lock);
+ pthread_spin_lock (&pokel->lock);
pokes = pokel->pokes;
pokel->pokes = NULL;
- spin_unlock (&pokel->lock);
+ pthread_spin_unlock (&pokel->lock);
for (pl = pokes; pl; last = pl, pl = pl->next)
if (sync)
@@ -121,10 +121,10 @@ _pokel_exec (struct pokel *pokel, int sync, int wait)
if (last)
{
- spin_lock (&pokel->lock);
+ pthread_spin_lock (&pokel->lock);
last->next = pokel->free_pokes;
pokel->free_pokes = pokes;
- spin_unlock (&pokel->lock);
+ pthread_spin_unlock (&pokel->lock);
}
}
@@ -152,13 +152,13 @@ pokel_inherit (struct pokel *pokel, struct pokel *from)
assert (pokel->image == from->image);
/* Take all pokes from FROM... */
- spin_lock (&from->lock);
+ pthread_spin_lock (&from->lock);
pokes = from->pokes;
from->pokes = NULL;
- spin_unlock (&from->lock);
+ pthread_spin_unlock (&from->lock);
/* And put them in POKEL. */
- spin_lock (&pokel->lock);
+ pthread_spin_lock (&pokel->lock);
last = pokel->pokes;
if (last)
{
@@ -168,5 +168,5 @@ pokel_inherit (struct pokel *pokel, struct pokel *from)
}
else
pokel->pokes = pokes;
- spin_unlock (&pokel->lock);
+ pthread_spin_unlock (&pokel->lock);
}
diff --git a/ext2fs/storeinfo.c b/ext2fs/storeinfo.c
index 395ab5ca..5d21b05e 100644
--- a/ext2fs/storeinfo.c
+++ b/ext2fs/storeinfo.c
@@ -45,7 +45,7 @@ diskfs_S_file_get_storage_info (struct protid *cred,
if (! runs)
return ENOMEM;
- mutex_lock (&node->lock);
+ pthread_mutex_lock (&node->lock);
/* NUM_FS_BLOCKS counts down the blocks in the file that we've not
enumerated yet; when it hits zero, we can stop. */
@@ -100,7 +100,7 @@ diskfs_S_file_get_storage_info (struct protid *cred,
run->length += 1 << log2_dev_blocks_per_fs_block;
}
- mutex_unlock (&node->lock);
+ pthread_mutex_unlock (&node->lock);
if (! err)
err = store_clone (store, &file_store);
diff --git a/ext2fs/truncate.c b/ext2fs/truncate.c
index 2058a1c1..37e360bb 100644
--- a/ext2fs/truncate.c
+++ b/ext2fs/truncate.c
@@ -224,11 +224,11 @@ force_delayed_copies (struct node *node, off_t length)
{
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)
{
@@ -254,11 +254,11 @@ enable_delayed_copies (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 (pager)
{
@@ -317,7 +317,7 @@ diskfs_truncate (struct node *node, off_t length)
force_delayed_copies (node, length);
- rwlock_writer_lock (&node->dn->alloc_lock);
+ pthread_rwlock_wrlock (&node->dn->alloc_lock);
/* Update the size on disk; fsck will finish freeing blocks if necessary
should we crash. */
@@ -363,7 +363,7 @@ diskfs_truncate (struct node *node, off_t length)
/* Now we can permit delayed copies again. */
enable_delayed_copies (node);
- rwlock_writer_unlock (&node->dn->alloc_lock);
+ pthread_rwlock_unlock (&node->dn->alloc_lock);
return err;
}