123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #ifndef __LINUX_RT_MUTEX_H
- #define __LINUX_RT_MUTEX_H
- #include <linux/linkage.h>
- #include <linux/rbtree.h>
- #include <linux/spinlock_types.h>
- extern int max_lock_depth;
- struct rt_mutex {
- raw_spinlock_t wait_lock;
- struct rb_root waiters;
- struct rb_node *waiters_leftmost;
- struct task_struct *owner;
- #ifdef CONFIG_DEBUG_RT_MUTEXES
- int save_state;
- const char *name, *file;
- int line;
- void *magic;
- #endif
- };
- struct rt_mutex_waiter;
- struct hrtimer_sleeper;
- #ifdef CONFIG_DEBUG_RT_MUTEXES
- extern int rt_mutex_debug_check_no_locks_freed(const void *from,
- unsigned long len);
- extern void rt_mutex_debug_check_no_locks_held(struct task_struct *task);
- #else
- static inline int rt_mutex_debug_check_no_locks_freed(const void *from,
- unsigned long len)
- {
- return 0;
- }
- # define rt_mutex_debug_check_no_locks_held(task) do { } while (0)
- #endif
- #ifdef CONFIG_DEBUG_RT_MUTEXES
- # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname) \
- , .name = #mutexname, .file = __FILE__, .line = __LINE__
- # define rt_mutex_init(mutex) __rt_mutex_init(mutex, __func__)
- extern void rt_mutex_debug_task_free(struct task_struct *tsk);
- #else
- # define __DEBUG_RT_MUTEX_INITIALIZER(mutexname)
- # define rt_mutex_init(mutex) __rt_mutex_init(mutex, NULL)
- # define rt_mutex_debug_task_free(t) do { } while (0)
- #endif
- #define __RT_MUTEX_INITIALIZER(mutexname) \
- { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
- , .waiters = RB_ROOT \
- , .owner = NULL \
- __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
- #define DEFINE_RT_MUTEX(mutexname) \
- struct rt_mutex mutexname = __RT_MUTEX_INITIALIZER(mutexname)
- static inline int rt_mutex_is_locked(struct rt_mutex *lock)
- {
- return lock->owner != NULL;
- }
- extern void __rt_mutex_init(struct rt_mutex *lock, const char *name);
- extern void rt_mutex_destroy(struct rt_mutex *lock);
- extern void rt_mutex_lock(struct rt_mutex *lock);
- extern int rt_mutex_lock_interruptible(struct rt_mutex *lock);
- extern int rt_mutex_timed_lock(struct rt_mutex *lock,
- struct hrtimer_sleeper *timeout);
- extern int rt_mutex_trylock(struct rt_mutex *lock);
- extern void rt_mutex_unlock(struct rt_mutex *lock);
- #endif
|