Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\refcount.c Create Date:2022-07-28 06:25:20
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:_dec_not_one - decrement a refcount if it is not 1*@r: the refcount* No atomic_t counterpart, it decrements unless the value is 1, in which case* it will return false

Proto:bool refcount_dec_not_one(refcount_t *r)

Type:bool

Parameter:

TypeParameterName
refcount_t *r
76  val = atomic_read( & refs)
78  Do
79  If Value for the false possibility is greater at compile time(val == REFCOUNT_SATURATED) Then Return true
82  If val == 1 Then Return false
85  new = val - 1
86  If new > val Then
87  WARN_ONCE(new > val, "refcount_t: underflow; use-after-free.\n")
88  Return true
91  When Not atomic_try_cmpxchg_release( & refs, & val, new) cycle
93  Return true
Caller
NameDescribe
refcount_dec_and_mutex_lock_dec_and_mutex_lock - return holding mutex if able to decrement* refcount to 0*@r: the refcount*@lock: the mutex to be locked* Similar to atomic_dec_and_mutex_lock(), it will WARN on underflow and fail* to decrement when saturated at REFCOUNT_SATURATED
refcount_dec_and_lock_dec_and_lock - return holding spinlock if able to decrement* refcount to 0*@r: the refcount*@lock: the spinlock to be locked* Similar to atomic_dec_and_lock(), it will WARN on underflow and fail to* decrement when saturated at REFCOUNT_SATURATED
refcount_dec_and_lock_irqsave_dec_and_lock_irqsave - return holding spinlock with disabled* interrupts if able to decrement refcount to 0*@r: the refcount*@lock: the spinlock to be locked*@flags: saved IRQ-flags if the is acquired* Same as refcount_dec_and_lock() above except that