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 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19#ifndef __LINUX_SPINLOCK_H 20#define __LINUX_SPINLOCK_H 21#include <linux/preempt.h> 22#include <linux/linkage.h> 23/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24#include <linux/compiler.h> 25#include <linux/thread_info.h> 26#include <linux/kernel.h> 27#include <linux/stringify.h> 28/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29#include <asm/system.h> 30#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME 31#define LOCK_SECTION_START(extra) ".subsection 1\n\t" extra ".ifndef " LOCK_SECTION_NAME "\n\t" LOCK_SECTION_NAME ":\n\t" ".endif\n" 32#define LOCK_SECTION_END ".previous\n\t" 33/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34#define __lockfunc fastcall __attribute__((section(".spinlock.text"))) 35#include <linux/spinlock_types.h> 36#include <linux/spinlock_up.h> 37#define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0) 38/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39#define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0) 40#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) 41#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock) 42#include <linux/spinlock_api_up.h> 43/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44#define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock) 45#define _raw_spin_lock_flags(lock, flags) __raw_spin_lock_flags(&(lock)->raw_lock, *(flags)) 46#define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock) 47#define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock) 48/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49#define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock) 50#define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock) 51#define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock) 52#define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock) 53/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54#define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock) 55#define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock) 56#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock) 57#define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock) 58/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59#define spin_trylock(lock) __cond_lock(_spin_trylock(lock)) 60#define read_trylock(lock) __cond_lock(_read_trylock(lock)) 61#define write_trylock(lock) __cond_lock(_write_trylock(lock)) 62#define spin_lock(lock) _spin_lock(lock) 63/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64#define spin_lock_nested(lock, subclass) _spin_lock(lock) 65#define write_lock(lock) _write_lock(lock) 66#define read_lock(lock) _read_lock(lock) 67#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) 68/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) 70#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) 71#define spin_lock_irq(lock) _spin_lock_irq(lock) 72#define spin_lock_bh(lock) _spin_lock_bh(lock) 73/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74#define read_lock_irq(lock) _read_lock_irq(lock) 75#define read_lock_bh(lock) _read_lock_bh(lock) 76#define write_lock_irq(lock) _write_lock_irq(lock) 77#define write_lock_bh(lock) _write_lock_bh(lock) 78/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79#define spin_unlock(lock) _spin_unlock(lock) 80#define read_unlock(lock) _read_unlock(lock) 81#define write_unlock(lock) _write_unlock(lock) 82#define spin_unlock_irq(lock) _spin_unlock_irq(lock) 83/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84#define read_unlock_irq(lock) _read_unlock_irq(lock) 85#define write_unlock_irq(lock) _write_unlock_irq(lock) 86#define spin_unlock_irqrestore(lock, flags) _spin_unlock_irqrestore(lock, flags) 87#define spin_unlock_bh(lock) _spin_unlock_bh(lock) 88/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89#define read_unlock_irqrestore(lock, flags) _read_unlock_irqrestore(lock, flags) 90#define read_unlock_bh(lock) _read_unlock_bh(lock) 91#define write_unlock_irqrestore(lock, flags) _write_unlock_irqrestore(lock, flags) 92#define write_unlock_bh(lock) _write_unlock_bh(lock) 93/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock)) 95#define spin_trylock_irq(lock) ({ local_irq_disable(); _spin_trylock(lock) ? 1 : ({ local_irq_enable(); 0; }); }) 96#define spin_trylock_irqsave(lock, flags) ({ local_irq_save(flags); _spin_trylock(lock) ? 1 : ({ local_irq_restore(flags); 0; }); }) 97#include <asm/atomic.h> 98/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99#define atomic_dec_and_lock(atomic, lock) __cond_lock(_atomic_dec_and_lock(atomic, lock)) 100#define spin_can_lock(lock) (!spin_is_locked(lock)) 101#endif 102