Skip to content

Commit eb32d3a

Browse files
t-8chJoelgranados
authored andcommitted
sysctl: drop sysctl_is_perm_empty_ctl_table
It is used only twice and those callers are simpler with sysctl_is_perm_empty_ctl_header(). So use this sibling function. This is part of an effort to constify definition of struct ctl_table. For this effort the mutable member 'type' is moved from struct ctl_table to struct ctl_table_header. Unifying the macros sysctl_is_perm_empty_ctl_* makes this easier. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Joel Granados <j.granados@samsung.com>
1 parent 795f90c commit eb32d3a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/proc/proc_sysctl.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ struct ctl_table_header *register_sysctl_mount_point(const char *path)
4848
}
4949
EXPORT_SYMBOL(register_sysctl_mount_point);
5050

51-
#define sysctl_is_perm_empty_ctl_table(tptr) \
52-
(tptr[0].type == SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY)
5351
#define sysctl_is_perm_empty_ctl_header(hptr) \
54-
(sysctl_is_perm_empty_ctl_table(hptr->ctl_table))
52+
(hptr->ctl_table[0].type == SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY)
5553
#define sysctl_set_perm_empty_ctl_header(hptr) \
5654
(hptr->ctl_table[0].type = SYSCTL_TABLE_TYPE_PERMANENTLY_EMPTY)
5755
#define sysctl_clear_perm_empty_ctl_header(hptr) \
@@ -233,7 +231,7 @@ static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header)
233231

234232
/* Am I creating a permanently empty directory? */
235233
if (header->ctl_table_size > 0 &&
236-
sysctl_is_perm_empty_ctl_table(header->ctl_table)) {
234+
sysctl_is_perm_empty_ctl_header(header)) {
237235
if (!RB_EMPTY_ROOT(&dir->root))
238236
return -EINVAL;
239237
sysctl_set_perm_empty_ctl_header(dir_h);
@@ -1204,7 +1202,7 @@ static bool get_links(struct ctl_dir *dir,
12041202
struct ctl_table *entry, *link;
12051203

12061204
if (header->ctl_table_size == 0 ||
1207-
sysctl_is_perm_empty_ctl_table(header->ctl_table))
1205+
sysctl_is_perm_empty_ctl_header(header))
12081206
return true;
12091207

12101208
/* Are there links available for every entry in table? */

0 commit comments

Comments
 (0)