1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_REFCOUNT_TYPES_H 3 #define _LINUX_REFCOUNT_TYPES_H 4 5 #include <linux/types.h> 6 7 /** 8 * typedef refcount_t - variant of atomic_t specialized for reference counts 9 * @refs: atomic_t counter field 10 * 11 * The counter saturates at REFCOUNT_SATURATED and will not move once 12 * there. This avoids wrapping the counter and causing 'spurious' 13 * use-after-free bugs. 14 */ 15 typedef struct refcount_struct { 16 atomic_t refs; 17 } refcount_t; 18 19 #endif /* _LINUX_REFCOUNT_TYPES_H */ 20