Skip to content

Commit 049a18f

Browse files
committed
Merge tag 'sysctl-6.4-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux
Pull more sysctl updates from Luis Chamberlain: "As mentioned on my first pull request for sysctl-next, for v6.4-rc1 we're very close to being able to deprecating register_sysctl_paths(). I was going to assess the situation after the first week of the merge window. That time is now and things are looking good. We only have one which had already an ACK for so I'm picking this up here now and the last patch is the one that uses an axe. I have boot tested the last patch and 0-day build completed successfully" * tag 'sysctl-6.4-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux: sysctl: remove register_sysctl_paths() kernel: pid_namespace: simplify sysctls with register_sysctl()
2 parents 342528f + 0199849 commit 049a18f

5 files changed

Lines changed: 6 additions & 83 deletions

File tree

fs/proc/proc_sysctl.c

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,45 +1575,33 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
15751575
}
15761576

15771577
/**
1578-
* __register_sysctl_paths - register a sysctl table hierarchy
1579-
* @set: Sysctl tree to register on
1580-
* @path: The path to the directory the sysctl table is in.
1578+
* register_sysctl_table - register a sysctl table hierarchy
15811579
* @table: the top-level table structure
15821580
*
15831581
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
15841582
* array. A completely 0 filled entry terminates the table.
15851583
* We are slowly deprecating this call so avoid its use.
1586-
*
1587-
* See __register_sysctl_table for more details.
15881584
*/
1589-
struct ctl_table_header *__register_sysctl_paths(
1590-
struct ctl_table_set *set,
1591-
const struct ctl_path *path, struct ctl_table *table)
1585+
struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
15921586
{
15931587
struct ctl_table *ctl_table_arg = table;
15941588
int nr_subheaders = count_subheaders(table);
15951589
struct ctl_table_header *header = NULL, **subheaders, **subheader;
1596-
const struct ctl_path *component;
15971590
char *new_path, *pos;
15981591

15991592
pos = new_path = kmalloc(PATH_MAX, GFP_KERNEL);
16001593
if (!new_path)
16011594
return NULL;
16021595

16031596
pos[0] = '\0';
1604-
for (component = path; component->procname; component++) {
1605-
pos = append_path(new_path, pos, component->procname);
1606-
if (!pos)
1607-
goto out;
1608-
}
16091597
while (table->procname && table->child && !table[1].procname) {
16101598
pos = append_path(new_path, pos, table->procname);
16111599
if (!pos)
16121600
goto out;
16131601
table = table->child;
16141602
}
16151603
if (nr_subheaders == 1) {
1616-
header = __register_sysctl_table(set, new_path, table);
1604+
header = __register_sysctl_table(&sysctl_table_root.default_set, new_path, table);
16171605
if (header)
16181606
header->ctl_table_arg = ctl_table_arg;
16191607
} else {
@@ -1627,7 +1615,7 @@ struct ctl_table_header *__register_sysctl_paths(
16271615
header->ctl_table_arg = ctl_table_arg;
16281616

16291617
if (register_leaf_sysctl_tables(new_path, pos, &subheader,
1630-
set, table))
1618+
&sysctl_table_root.default_set, table))
16311619
goto err_register_leaves;
16321620
}
16331621

@@ -1646,41 +1634,6 @@ struct ctl_table_header *__register_sysctl_paths(
16461634
header = NULL;
16471635
goto out;
16481636
}
1649-
1650-
/**
1651-
* register_sysctl_paths - register a sysctl table hierarchy
1652-
* @path: The path to the directory the sysctl table is in.
1653-
* @table: the top-level table structure
1654-
*
1655-
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
1656-
* array. A completely 0 filled entry terminates the table.
1657-
* We are slowly deprecating this caller so avoid future uses of it.
1658-
*
1659-
* See __register_sysctl_paths for more details.
1660-
*/
1661-
struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1662-
struct ctl_table *table)
1663-
{
1664-
return __register_sysctl_paths(&sysctl_table_root.default_set,
1665-
path, table);
1666-
}
1667-
EXPORT_SYMBOL(register_sysctl_paths);
1668-
1669-
/**
1670-
* register_sysctl_table - register a sysctl table hierarchy
1671-
* @table: the top-level table structure
1672-
*
1673-
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
1674-
* array. A completely 0 filled entry terminates the table.
1675-
*
1676-
* See register_sysctl_paths for more details.
1677-
*/
1678-
struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
1679-
{
1680-
static const struct ctl_path null_path[] = { {} };
1681-
1682-
return register_sysctl_paths(null_path, table);
1683-
}
16841637
EXPORT_SYMBOL(register_sysctl_table);
16851638

16861639
int __register_sysctl_base(struct ctl_table *base_table)

include/linux/sysctl.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,8 @@ extern void retire_sysctl_set(struct ctl_table_set *set);
221221
struct ctl_table_header *__register_sysctl_table(
222222
struct ctl_table_set *set,
223223
const char *path, struct ctl_table *table);
224-
struct ctl_table_header *__register_sysctl_paths(
225-
struct ctl_table_set *set,
226-
const struct ctl_path *path, struct ctl_table *table);
227224
struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
228225
struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
229-
struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
230-
struct ctl_table *table);
231-
232226
void unregister_sysctl_table(struct ctl_table_header * table);
233227

234228
extern int sysctl_init_bases(void);
@@ -277,12 +271,6 @@ static inline struct ctl_table_header *register_sysctl_mount_point(const char *p
277271
return NULL;
278272
}
279273

280-
static inline struct ctl_table_header *register_sysctl_paths(
281-
const struct ctl_path *path, struct ctl_table *table)
282-
{
283-
return NULL;
284-
}
285-
286274
static inline struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table)
287275
{
288276
return NULL;

kernel/pid_namespace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ static struct ctl_table pid_ns_ctl_table[] = {
314314
},
315315
{ }
316316
};
317-
static struct ctl_path kern_path[] = { { .procname = "kernel", }, { } };
318317
#endif /* CONFIG_CHECKPOINT_RESTORE */
319318

320319
int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
@@ -473,7 +472,7 @@ static __init int pid_namespaces_init(void)
473472
pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC | SLAB_ACCOUNT);
474473

475474
#ifdef CONFIG_CHECKPOINT_RESTORE
476-
register_sysctl_paths(kern_path, pid_ns_ctl_table);
475+
register_sysctl_init("kernel", pid_ns_ctl_table);
477476
#endif
478477

479478
register_pid_ns_sysctl_table_vm();

kernel/pid_sysctl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ static struct ctl_table pid_ns_ctl_table_vm[] = {
4646
},
4747
{ }
4848
};
49-
static struct ctl_path vm_path[] = { { .procname = "vm", }, { } };
5049
static inline void register_pid_ns_sysctl_table_vm(void)
5150
{
52-
register_sysctl_paths(vm_path, pid_ns_ctl_table_vm);
51+
register_sysctl("vm", pid_ns_ctl_table_vm);
5352
}
5453
#else
5554
static inline void initialize_memfd_noexec_scope(struct pid_namespace *ns) {}

scripts/check-sysctl-docs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -156,22 +156,6 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ {
156156
}
157157
}
158158

159-
/register_sysctl_paths\(.*\)/ {
160-
match($0, /register_sysctl_paths\(([^)]+), ([^)]+)\)/, tables)
161-
if (debug) print "Attaching table " tables[2] " to path " tables[1]
162-
if (paths[tables[1]] == table) {
163-
for (entry in entries[tables[2]]) {
164-
printentry(entry)
165-
}
166-
}
167-
split(paths[tables[1]], components, "/")
168-
if (length(components) > 1 && components[1] == table) {
169-
# Count the first subdirectory as seen
170-
seen[components[2]]++
171-
}
172-
}
173-
174-
175159
END {
176160
for (entry in documented) {
177161
if (!seen[entry]) {

0 commit comments

Comments
 (0)