Re: [PATCH 22/50] pid: Split out pid_types.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 15, 2023 at 10:29:28PM -0500, Kent Overstreet wrote:
> Trimming down sched.h dependencies: we dont't want to include more than
> the base types.
> 
> Cc: Kees Cook <keescook@xxxxxxxxxxxx>
> Cc: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
> Cc: Will Drewry <wad@xxxxxxxxxxxx>
> Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> ---

Hm, ideally the struct upid and struct pid definitions could also be
moved and then included in pid.h?

>  drivers/target/target_core_xcopy.c |  1 +
>  include/linux/pid.h                | 15 ++-------------
>  include/linux/pid_types.h          | 16 ++++++++++++++++
>  include/linux/sched.h              |  2 +-
>  include/linux/seccomp.h            |  2 ++
>  5 files changed, 22 insertions(+), 14 deletions(-)
>  create mode 100644 include/linux/pid_types.h
> 
> diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
> index 91ed015b588c..4128631c9dfd 100644
> --- a/drivers/target/target_core_xcopy.c
> +++ b/drivers/target/target_core_xcopy.c
> @@ -15,6 +15,7 @@
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
>  #include <linux/list.h>
> +#include <linux/rculist.h>
>  #include <linux/configfs.h>
>  #include <linux/ratelimit.h>
>  #include <scsi/scsi_proto.h>
> diff --git a/include/linux/pid.h b/include/linux/pid.h
> index 653a527574c4..f254c3a45b9b 100644
> --- a/include/linux/pid.h
> +++ b/include/linux/pid.h
> @@ -2,18 +2,10 @@
>  #ifndef _LINUX_PID_H
>  #define _LINUX_PID_H
>  
> +#include <linux/pid_types.h>
>  #include <linux/rculist.h>
> -#include <linux/wait.h>
>  #include <linux/refcount.h>
> -
> -enum pid_type
> -{
> -	PIDTYPE_PID,
> -	PIDTYPE_TGID,
> -	PIDTYPE_PGID,
> -	PIDTYPE_SID,
> -	PIDTYPE_MAX,
> -};
> +#include <linux/wait.h>
>  
>  /*
>   * What is struct pid?
> @@ -110,9 +102,6 @@ extern void exchange_tids(struct task_struct *task, struct task_struct *old);
>  extern void transfer_pid(struct task_struct *old, struct task_struct *new,
>  			 enum pid_type);
>  
> -struct pid_namespace;
> -extern struct pid_namespace init_pid_ns;
> -
>  extern int pid_max;
>  extern int pid_max_min, pid_max_max;
>  
> diff --git a/include/linux/pid_types.h b/include/linux/pid_types.h
> new file mode 100644
> index 000000000000..c2aee1d91dcf
> --- /dev/null
> +++ b/include/linux/pid_types.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_PID_TYPES_H
> +#define _LINUX_PID_TYPES_H
> +
> +enum pid_type {
> +	PIDTYPE_PID,
> +	PIDTYPE_TGID,
> +	PIDTYPE_PGID,
> +	PIDTYPE_SID,
> +	PIDTYPE_MAX,
> +};
> +
> +struct pid_namespace;
> +extern struct pid_namespace init_pid_ns;
> +
> +#endif /* _LINUX_PID_TYPES_H */
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 436f7ce1450a..37cc9d257073 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -11,7 +11,7 @@
>  
>  #include <asm/current.h>
>  
> -#include <linux/pid.h>
> +#include <linux/pid_types.h>
>  #include <linux/sem.h>
>  #include <linux/shm.h>
>  #include <linux/kmsan_types.h>
> diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
> index 175079552f68..1ec0d8dc4b69 100644
> --- a/include/linux/seccomp.h
> +++ b/include/linux/seccomp.h
> @@ -126,6 +126,8 @@ static inline long seccomp_get_metadata(struct task_struct *task,
>  
>  #ifdef CONFIG_SECCOMP_CACHE_DEBUG
>  struct seq_file;
> +struct pid_namespace;
> +struct pid;
>  
>  int proc_pid_seccomp_cache(struct seq_file *m, struct pid_namespace *ns,
>  			   struct pid *pid, struct task_struct *task);
> -- 
> 2.43.0
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux