Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102994472
D24847.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
662 B
Referenced Files
None
Subscribers
None
D24847.diff
View Options
Index: head/sys/compat/linuxkpi/common/include/linux/mutex.h
===================================================================
--- head/sys/compat/linuxkpi/common/include/linux/mutex.h
+++ head/sys/compat/linuxkpi/common/include/linux/mutex.h
@@ -37,6 +37,7 @@
#include <sys/sx.h>
#include <linux/spinlock.h>
+#include <asm/atomic.h>
typedef struct mutex {
struct sx sx;
@@ -123,6 +124,16 @@
mutex_is_owned(mutex_t *m)
{
return (sx_xlocked(&m->sx));
+}
+
+static inline int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *m)
+{
+ if (atomic_dec_and_test(cnt)) {
+ mutex_lock(m);
+ return (1);
+ }
+
+ return (0);
}
#ifdef WITNESS_ALL
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 2:45 PM (22 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14740750
Default Alt Text
D24847.diff (662 B)
Attached To
Mode
D24847: linuxkpi: Add atomic_dec_and_mutex_lock
Attached
Detach File
Event Timeline
Log In to Comment