#ifndef _LINUX_REFCOUNT_H #define _LINUX_REFCOUNT_H #include <linux/atomic.h> #include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/kernel.h> /** * refcount_t - variant of atomic_t specialized for reference counts * @refs: atomic_t counter field * * The counter saturates at UINT_MAX and will not move once * there. This avoids wrapping the counter and causing 'spurious' * use-after-free bugs. */ typedef struct refcount_struct { atomic_t refs; } refcount_t; #define REFCOUNT_INIT(n) { .refs = ATOMIC_INIT(n), } /** * refcount_set - set a refcount's value * @r: the refcount * @n: value to which the refcount will be set */
static inline void refcount_set(refcount_t *r, unsigned int n) { atomic_set(&r->refs, n); }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Peter Zijlstra | 25 | 100.00% | 1 | 100.00% |
Total | 25 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Peter Zijlstra | 22 | 100.00% | 1 | 100.00% |
Total | 22 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Peter Zijlstra | 223 | 97.38% | 2 | 50.00% |
Elena Reshetova | 3 | 1.31% | 1 | 25.00% |
David Windsor | 3 | 1.31% | 1 | 25.00% |
Total | 229 | 100.00% | 4 | 100.00% |