usr
/
src
/
kernels
/
3.10.0-1160.139.1.el7.tuxcare.els4.x86_64
/
include
/
linux
➕ New
📤 Upload
✎ Editing:
lockref.h
← Back
#ifndef __LINUX_LOCKREF_H #define __LINUX_LOCKREF_H #include <linux/rh_kabi.h> /* * Locked reference counts. * * These are different from just plain atomic refcounts in that they * are atomic with respect to the spinlock that goes with them. In * particular, there can be implementations that don't actually get * the spinlock for the common decrement/increment operations, but they * still have to check that the operation is done semantically as if * the spinlock had been taken (using a cmpxchg operation that covers * both the lock and the count word, or using memory transactions, for * example). */ #include <linux/spinlock.h> struct lockref { union { #if defined(CONFIG_PPC64) || defined(CONFIG_S390) #ifdef CONFIG_CMPXCHG_LOCKREF RH_KABI_EXTEND(aligned_u64 lock_count) #endif #else /* CONFIG_PPC64 || CONFIG_S390 */ #ifdef CONFIG_CMPXCHG_LOCKREF aligned_u64 lock_count; #endif #endif /* CONFIG_PPC64 */ struct { spinlock_t lock; unsigned int count; }; }; }; extern void lockref_get(struct lockref *); extern int lockref_get_not_zero(struct lockref *); extern int lockref_get_or_lock(struct lockref *); extern int lockref_put_or_lock(struct lockref *); extern void lockref_mark_dead(struct lockref *); extern int lockref_get_not_dead(struct lockref *); /* Must be called under spinlock for reliable results */ static inline int __lockref_is_dead(const struct lockref *l) { return ((int)l->count < 0); } #endif /* __LINUX_LOCKREF_H */
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel