Skip to content

Commit e61bb8b

Browse files
legionusebiederm
authored andcommitted
proc: use named enums for better readability
Signed-off-by: Alexey Gladkov <[email protected]> Reviewed-by: Alexey Dobriyan <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
1 parent 1c6c4d1 commit e61bb8b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

fs/proc/base.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ int proc_setattr(struct dentry *dentry, struct iattr *attr)
699699
*/
700700
static bool has_pid_permissions(struct proc_fs_info *fs_info,
701701
struct task_struct *task,
702-
int hide_pid_min)
702+
enum proc_hidepid hide_pid_min)
703703
{
704704
/*
705705
* If 'hidpid' mount option is set force a ptrace check,

fs/proc/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void proc_invalidate_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock
166166
deactivate_super(old_sb);
167167
}
168168

169-
static inline const char *hidepid2str(int v)
169+
static inline const char *hidepid2str(enum proc_hidepid v)
170170
{
171171
switch (v) {
172172
case HIDEPID_OFF: return "off";

fs/proc/root.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
struct proc_fs_context {
3333
struct pid_namespace *pid_ns;
3434
unsigned int mask;
35-
int hidepid;
35+
enum proc_hidepid hidepid;
3636
int gid;
37-
int pidonly;
37+
enum proc_pidonly pidonly;
3838
};
3939

4040
enum proc_param {

include/linux/proc_fs.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ struct proc_ops {
4343
} __randomize_layout;
4444

4545
/* definitions for hide_pid field */
46-
enum {
46+
enum proc_hidepid {
4747
HIDEPID_OFF = 0,
4848
HIDEPID_NO_ACCESS = 1,
4949
HIDEPID_INVISIBLE = 2,
5050
HIDEPID_NOT_PTRACEABLE = 4, /* Limit pids to only ptraceable pids */
5151
};
5252

5353
/* definitions for proc mount option pidonly */
54-
enum {
54+
enum proc_pidonly {
5555
PROC_PIDONLY_OFF = 0,
5656
PROC_PIDONLY_ON = 1,
5757
};
@@ -61,8 +61,8 @@ struct proc_fs_info {
6161
struct dentry *proc_self; /* For /proc/self */
6262
struct dentry *proc_thread_self; /* For /proc/thread-self */
6363
kgid_t pid_gid;
64-
int hide_pid;
65-
int pidonly;
64+
enum proc_hidepid hide_pid;
65+
enum proc_pidonly pidonly;
6666
};
6767

6868
static inline struct proc_fs_info *proc_sb_info(struct super_block *sb)

0 commit comments

Comments
 (0)