Home | History | Annotate | Download | only in linux
      1 /****************************************************************************
      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
     14 
     15 #include <linux/list.h>
     16 #include <linux/spinlock_types.h>
     17 #include <linux/linkage.h>
     18 #include <linux/lockdep.h>
     19 
     20 #include <asm/atomic.h>
     21 
     22 struct mutex {
     23 
     24  atomic_t count;
     25  spinlock_t wait_lock;
     26  struct list_head wait_list;
     27 };
     28 
     29 struct mutex_waiter {
     30  struct list_head list;
     31  struct task_struct *task;
     32 };
     33 
     34 #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)
     37 
     38 #define __DEP_MAP_MUTEX_INITIALIZER(lockname)
     39 
     40 #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) }
     41 
     42 #define DEFINE_MUTEX(mutexname)   struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
     43 
     44 #define mutex_lock_nested(lock, subclass) mutex_lock(lock)
     45 
     46 #endif
     47