summaryrefslogtreecommitdiffstats
path: root/sys/gnu/fs/xfs/FreeBSD/support/mutex.h
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2005-12-12 01:04:32 +0000
committerrodrigc <rodrigc@FreeBSD.org>2005-12-12 01:04:32 +0000
commit410e08d350a2cfcb50386dc6b5a24a5d82825067 (patch)
tree8ac52e2fe37d3790aa9ac8fc061d5c395bc1b946 /sys/gnu/fs/xfs/FreeBSD/support/mutex.h
parentff6c302a67bb107dfea59fdc76583af9913df36e (diff)
downloadFreeBSD-src-410e08d350a2cfcb50386dc6b5a24a5d82825067.zip
FreeBSD-src-410e08d350a2cfcb50386dc6b5a24a5d82825067.tar.gz
Initial import of read-only support for SGI's XFS filesystem.
Contributed by: XFS for FreeBSD project
Diffstat (limited to 'sys/gnu/fs/xfs/FreeBSD/support/mutex.h')
-rw-r--r--sys/gnu/fs/xfs/FreeBSD/support/mutex.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/gnu/fs/xfs/FreeBSD/support/mutex.h b/sys/gnu/fs/xfs/FreeBSD/support/mutex.h
new file mode 100644
index 0000000..d9b89b3
--- /dev/null
+++ b/sys/gnu/fs/xfs/FreeBSD/support/mutex.h
@@ -0,0 +1,29 @@
+#ifndef __XFS_SUPPORT_MUTEX_H__
+#define __XFS_SUPPORT_MUTEX_H__
+
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sx.h>
+
+/*
+ * Map the mutex'es from IRIX to FreeBSD. Irix holds mutexes across
+ * sleeps, so on FreeBSD we have a choice of sema, sx or lockmgr
+ * to use as a underlining implemenation. Go with sx always locked
+ * in exclusive mode for now as it gets all the benefits of witness
+ * checking.
+ */
+typedef struct sx mutex_t;
+
+#define mutex_init(lock, type, name) sx_init(lock, name)
+#define mutex_lock(lock, num) sx_xlock(lock)
+#define mutex_trylock(lock) sx_try_xlock(lock)
+#define mutex_unlock(lock) sx_xunlock(lock)
+#define mutex_destroy(lock) sx_destroy(lock)
+
+/*
+ * Type for mutex_init()
+ */
+#define MUTEX_DEFAULT 0
+
+#endif /* __XFS_SUPPORT_MUTEX_H__ */
OpenPOWER on IntegriCloud