Commit f9d6966b authored by Kent Overstreet's avatar Kent Overstreet
Browse files

refcount: Split out refcount_types.h



More trimming of sched.h dependencies.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 1ef83969
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -96,22 +96,11 @@
#include <linux/bug.h>
#include <linux/compiler.h>
#include <linux/limits.h>
#include <linux/refcount_types.h>
#include <linux/spinlock_types.h>

struct mutex;

/**
 * typedef refcount_t - variant of atomic_t specialized for reference counts
 * @refs: atomic_t counter field
 *
 * The counter saturates at REFCOUNT_SATURATED 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), }
#define REFCOUNT_MAX		INT_MAX
#define REFCOUNT_SATURATED	(INT_MIN / 2)
+19 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_REFCOUNT_TYPES_H
#define _LINUX_REFCOUNT_TYPES_H

#include <linux/types.h>

/**
 * typedef refcount_t - variant of atomic_t specialized for reference counts
 * @refs: atomic_t counter field
 *
 * The counter saturates at REFCOUNT_SATURATED 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;

#endif /* _LINUX_REFCOUNT_TYPES_H */
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#include <linux/seccomp.h>
#include <linux/nodemask_types.h>
#include <linux/rcupdate.h>
#include <linux/refcount.h>
#include <linux/refcount_types.h>
#include <linux/resource.h>
#include <linux/latencytop.h>
#include <linux/sched/prio.h>
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
 * functionality:
 */

#include <linux/refcount.h>
#include <linux/sched.h>
#include <linux/uaccess.h>