Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/riastradh-drm2]: src/sys/external/bsd/drm2/include/linux Implement Linux...
details: https://anonhg.NetBSD.org/src/rev/36319f3cefcd
branches: riastradh-drm2
changeset: 788038:36319f3cefcd
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jul 24 01:57:20 2013 +0000
description:
Implement Linux's struct mutex less sleazily.
Can't recall why I did it sleazily in the first place.
diffstat:
sys/external/bsd/drm2/include/linux/mutex.h | 41 +++++++++++++++++++++++-----
1 files changed, 33 insertions(+), 8 deletions(-)
diffs (55 lines):
diff -r 337a1f5570be -r 36319f3cefcd sys/external/bsd/drm2/include/linux/mutex.h
--- a/sys/external/bsd/drm2/include/linux/mutex.h Wed Jul 24 01:57:06 2013 +0000
+++ b/sys/external/bsd/drm2/include/linux/mutex.h Wed Jul 24 01:57:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mutex.h,v 1.1.2.2 2013/07/24 01:51:21 riastradh Exp $ */
+/* $NetBSD: mutex.h,v 1.1.2.3 2013/07/24 01:57:20 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,13 +34,38 @@
#include <sys/mutex.h>
-/* XXX Kludge: Replace `struct mutex' by `struct kmutex'. */
-#define mutex kmutex
+struct mutex {
+ kmutex_t mtx_lock;
+};
+
+static inline void
+mutex_lock(struct mutex *mutex)
+{
+ mutex_enter(&mutex->mtx_lock);
+}
+
+static inline void
+mutex_lock_interruptible(struct mutex *mutex)
+{
+ mutex_enter(&mutex->mtx_lock); /* XXX */
+}
-#define mutex_lock mutex_enter
-#define mutex_lock_interruptible mutex_enter /* XXX */
-#define mutex_trylock mutex_tryenter
-#define mutex_unlock mutex_exit
-#define mutex_is_locked mutex_owned
+static inline int
+mutex_trylock(struct mutex *mutex)
+{
+ return mutex_tryenter(&mutex->mtx_lock);
+}
+
+static inline void
+mutex_unlock(struct mutex *mutex)
+{
+ mutex_exit(&mutex->mtx_lock);
+}
+
+static inline bool
+mutex_is_locked(struct mutex *mutex)
+{
+ return mutex_owned(&mutex->mtx_lock);
+}
#endif /* _LINUX_MUTEX_H_ */
Home |
Main Index |
Thread Index |
Old Index