Skip to content

Commit a6e1420

Browse files
author
Kent Overstreet
committed
seccomp: Split out seccomp_types.h
More pruning of sched.h dependencies. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent f9d6966 commit a6e1420

File tree

3 files changed

+37
-22
lines changed

3 files changed

+37
-22
lines changed

include/linux/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <linux/mutex_types.h>
2020
#include <linux/plist_types.h>
2121
#include <linux/hrtimer_types.h>
22-
#include <linux/seccomp.h>
22+
#include <linux/seccomp_types.h>
2323
#include <linux/nodemask_types.h>
2424
#include <linux/rcupdate.h>
2525
#include <linux/refcount_types.h>

include/linux/seccomp.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define _LINUX_SECCOMP_H
44

55
#include <uapi/linux/seccomp.h>
6+
#include <linux/seccomp_types.h>
67

78
#define SECCOMP_FILTER_FLAG_MASK (SECCOMP_FILTER_FLAG_TSYNC | \
89
SECCOMP_FILTER_FLAG_LOG | \
@@ -21,25 +22,6 @@
2122
#include <linux/atomic.h>
2223
#include <asm/seccomp.h>
2324

24-
struct seccomp_filter;
25-
/**
26-
* struct seccomp - the state of a seccomp'ed process
27-
*
28-
* @mode: indicates one of the valid values above for controlled
29-
* system calls available to a process.
30-
* @filter_count: number of seccomp filters
31-
* @filter: must always point to a valid seccomp-filter or NULL as it is
32-
* accessed without locking during system call entry.
33-
*
34-
* @filter must only be accessed from the context of current as there
35-
* is no read locking.
36-
*/
37-
struct seccomp {
38-
int mode;
39-
atomic_t filter_count;
40-
struct seccomp_filter *filter;
41-
};
42-
4325
#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER
4426
extern int __secure_computing(const struct seccomp_data *sd);
4527
static inline int secure_computing(void)
@@ -64,8 +46,6 @@ static inline int seccomp_mode(struct seccomp *s)
6446

6547
#include <linux/errno.h>
6648

67-
struct seccomp { };
68-
struct seccomp_filter { };
6949
struct seccomp_data;
7050

7151
#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER

include/linux/seccomp_types.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _LINUX_SECCOMP_TYPES_H
3+
#define _LINUX_SECCOMP_TYPES_H
4+
5+
#include <linux/types.h>
6+
7+
#ifdef CONFIG_SECCOMP
8+
9+
struct seccomp_filter;
10+
/**
11+
* struct seccomp - the state of a seccomp'ed process
12+
*
13+
* @mode: indicates one of the valid values above for controlled
14+
* system calls available to a process.
15+
* @filter_count: number of seccomp filters
16+
* @filter: must always point to a valid seccomp-filter or NULL as it is
17+
* accessed without locking during system call entry.
18+
*
19+
* @filter must only be accessed from the context of current as there
20+
* is no read locking.
21+
*/
22+
struct seccomp {
23+
int mode;
24+
atomic_t filter_count;
25+
struct seccomp_filter *filter;
26+
};
27+
28+
#else
29+
30+
struct seccomp { };
31+
struct seccomp_filter { };
32+
33+
#endif
34+
35+
#endif /* _LINUX_SECCOMP_TYPES_H */

0 commit comments

Comments
 (0)