blob: 4b33a8ad544e923d7e2ef7767f4ad3433d920825 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef __LINUX_MUTEX_H
13#define __LINUX_MUTEX_H
Ben Cheng4b29af02012-03-07 16:14:53 -080014
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015#include <linux/list.h>
16#include <linux/spinlock_types.h>
17#include <linux/linkage.h>
18#include <linux/lockdep.h>
Ben Cheng4b29af02012-03-07 16:14:53 -080019
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080020#include <asm/atomic.h>
Ben Cheng4b29af02012-03-07 16:14:53 -080021
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080022struct mutex {
Ben Cheng4b29af02012-03-07 16:14:53 -080023
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080024 atomic_t count;
25 spinlock_t wait_lock;
26 struct list_head wait_list;
27};
Ben Cheng4b29af02012-03-07 16:14:53 -080028
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080029struct mutex_waiter {
30 struct list_head list;
31 struct task_struct *task;
32};
Ben Cheng4b29af02012-03-07 16:14:53 -080033
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034#define __DEBUG_MUTEX_INITIALIZER(lockname)
35#define mutex_init(mutex) do { static struct lock_class_key __key; __mutex_init((mutex), #mutex, &__key); } while (0)
36#define mutex_destroy(mutex) do { } while (0)
Ben Cheng4b29af02012-03-07 16:14:53 -080037
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080038#define __DEP_MAP_MUTEX_INITIALIZER(lockname)
Ben Cheng4b29af02012-03-07 16:14:53 -080039
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080040#define __MUTEX_INITIALIZER(lockname) { .count = ATOMIC_INIT(1) , .wait_lock = SPIN_LOCK_UNLOCKED , .wait_list = LIST_HEAD_INIT(lockname.wait_list) __DEBUG_MUTEX_INITIALIZER(lockname) __DEP_MAP_MUTEX_INITIALIZER(lockname) }
Ben Cheng4b29af02012-03-07 16:14:53 -080041
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080042#define DEFINE_MUTEX(mutexname) struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
Ben Cheng4b29af02012-03-07 16:14:53 -080043
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080044#define mutex_lock_nested(lock, subclass) mutex_lock(lock)
Ben Cheng4b29af02012-03-07 16:14:53 -080045
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080046#endif