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