Lines Matching refs:kref
43 struct kref { struct
48 kref_init(struct kref *kref) in kref_init() argument
51 refcount_init((uint32_t *)&kref->refcount, 1); in kref_init()
55 kref_read(const struct kref *kref) in kref_read() argument
58 return (refcount_load(__DECONST(u_int32_t *, &kref->refcount))); in kref_read()
62 kref_get(struct kref *kref) in kref_get() argument
65 refcount_acquire((uint32_t *)&kref->refcount); in kref_get()
69 kref_put(struct kref *kref, void (*rel)(struct kref *kref)) in kref_put() argument
72 if (refcount_release((uint32_t *)&kref->refcount)) { in kref_put()
73 rel(kref); in kref_put()
80 kref_put_lock(struct kref *kref, void (*rel)(struct kref *kref), in kref_put_lock() argument
84 if (refcount_release((uint32_t *)&kref->refcount)) { in kref_put_lock()
86 rel(kref); in kref_put_lock()
93 kref_sub(struct kref *kref, unsigned int count, in kref_sub() argument
94 void (*rel)(struct kref *kref)) in kref_sub() argument
98 if (refcount_release((uint32_t *)&kref->refcount)) { in kref_sub()
99 rel(kref); in kref_sub()
107 kref_get_unless_zero(struct kref *kref) in kref_get_unless_zero() argument
110 return refcount_acquire_if_not_zero((uint32_t *)&kref->refcount); in kref_get_unless_zero()
113 static inline int kref_put_mutex(struct kref *kref, in kref_put_mutex() argument
114 void (*release)(struct kref *kref), struct mutex *lock) in kref_put_mutex() argument
117 if (unlikely(!refcount_release_if_not_last((uint32_t *)&kref->refcount))) { in kref_put_mutex()
119 if (unlikely(!refcount_release((uint32_t *)&kref->refcount))) { in kref_put_mutex()
123 release(kref); in kref_put_mutex()