Commit 0199849a authored by Luis Chamberlain's avatar Luis Chamberlain

sysctl: remove register_sysctl_paths()

The deprecation for register_sysctl_paths() is over. We can rejoice as
we nuke register_sysctl_paths(). The routine register_sysctl_table()
was the only user left of register_sysctl_paths(), so we can now just
open code and move the implementation over to what used to be
to __register_sysctl_paths().

The old dynamic struct ctl_table_set *set is now the point to
sysctl_table_root.default_set.

The old dynamic const struct ctl_path *path was being used in the
routine register_sysctl_paths() with a static:

static const struct ctl_path null_path[] = { {} };

Since this is a null path we can now just simplfy the old routine
and remove its use as its always empty.

This saves us a total of 230 bytes.

$ ./scripts/bloat-o-meter vmlinux.old vmlinux
add/remove: 2/7 grow/shrink: 1/1 up/down: 1015/-1245 (-230)
Function                                     old     new   delta
register_leaf_sysctl_tables.constprop          -     524    +524
register_sysctl_table                         22     497    +475
__pfx_register_leaf_sysctl_tables.constprop       -      16     +16
null_path                                      8       -      -8
__pfx_register_sysctl_paths                   16       -     -16
__pfx_register_leaf_sysctl_tables             16       -     -16
__pfx___register_sysctl_paths                 16       -     -16
__register_sysctl_base                        29      12     -17
register_sysctl_paths                         18       -     -18
register_leaf_sysctl_tables                  534       -    -534
__register_sysctl_paths                      620       -    -620
Total: Before=21259666, After=21259436, chg -0.00%
Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
parent 9e7c73c0
...@@ -1575,25 +1575,18 @@ static int register_leaf_sysctl_tables(const char *path, char *pos, ...@@ -1575,25 +1575,18 @@ static int register_leaf_sysctl_tables(const char *path, char *pos,
} }
/** /**
* __register_sysctl_paths - register a sysctl table hierarchy * register_sysctl_table - register a sysctl table hierarchy
* @set: Sysctl tree to register on
* @path: The path to the directory the sysctl table is in.
* @table: the top-level table structure * @table: the top-level table structure
* *
* Register a sysctl table hierarchy. @table should be a filled in ctl_table * Register a sysctl table hierarchy. @table should be a filled in ctl_table
* array. A completely 0 filled entry terminates the table. * array. A completely 0 filled entry terminates the table.
* We are slowly deprecating this call so avoid its use. * We are slowly deprecating this call so avoid its use.
*
* See __register_sysctl_table for more details.
*/ */
struct ctl_table_header *__register_sysctl_paths( struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
struct ctl_table_set *set,
const struct ctl_path *path, struct ctl_table *table)
{ {
struct ctl_table *ctl_table_arg = table; struct ctl_table *ctl_table_arg = table;
int nr_subheaders = count_subheaders(table); int nr_subheaders = count_subheaders(table);
struct ctl_table_header *header = NULL, **subheaders, **subheader; struct ctl_table_header *header = NULL, **subheaders, **subheader;
const struct ctl_path *component;
char *new_path, *pos; char *new_path, *pos;
pos = new_path = kmalloc(PATH_MAX, GFP_KERNEL); pos = new_path = kmalloc(PATH_MAX, GFP_KERNEL);
...@@ -1601,11 +1594,6 @@ struct ctl_table_header *__register_sysctl_paths( ...@@ -1601,11 +1594,6 @@ struct ctl_table_header *__register_sysctl_paths(
return NULL; return NULL;
pos[0] = '\0'; pos[0] = '\0';
for (component = path; component->procname; component++) {
pos = append_path(new_path, pos, component->procname);
if (!pos)
goto out;
}
while (table->procname && table->child && !table[1].procname) { while (table->procname && table->child && !table[1].procname) {
pos = append_path(new_path, pos, table->procname); pos = append_path(new_path, pos, table->procname);
if (!pos) if (!pos)
...@@ -1613,7 +1601,7 @@ struct ctl_table_header *__register_sysctl_paths( ...@@ -1613,7 +1601,7 @@ struct ctl_table_header *__register_sysctl_paths(
table = table->child; table = table->child;
} }
if (nr_subheaders == 1) { if (nr_subheaders == 1) {
header = __register_sysctl_table(set, new_path, table); header = __register_sysctl_table(&sysctl_table_root.default_set, new_path, table);
if (header) if (header)
header->ctl_table_arg = ctl_table_arg; header->ctl_table_arg = ctl_table_arg;
} else { } else {
...@@ -1627,7 +1615,7 @@ struct ctl_table_header *__register_sysctl_paths( ...@@ -1627,7 +1615,7 @@ struct ctl_table_header *__register_sysctl_paths(
header->ctl_table_arg = ctl_table_arg; header->ctl_table_arg = ctl_table_arg;
if (register_leaf_sysctl_tables(new_path, pos, &subheader, if (register_leaf_sysctl_tables(new_path, pos, &subheader,
set, table)) &sysctl_table_root.default_set, table))
goto err_register_leaves; goto err_register_leaves;
} }
...@@ -1646,41 +1634,6 @@ struct ctl_table_header *__register_sysctl_paths( ...@@ -1646,41 +1634,6 @@ struct ctl_table_header *__register_sysctl_paths(
header = NULL; header = NULL;
goto out; goto out;
} }
/**
* register_sysctl_paths - register a sysctl table hierarchy
* @path: The path to the directory the sysctl table is in.
* @table: the top-level table structure
*
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
* array. A completely 0 filled entry terminates the table.
* We are slowly deprecating this caller so avoid future uses of it.
*
* See __register_sysctl_paths for more details.
*/
struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
struct ctl_table *table)
{
return __register_sysctl_paths(&sysctl_table_root.default_set,
path, table);
}
EXPORT_SYMBOL(register_sysctl_paths);
/**
* register_sysctl_table - register a sysctl table hierarchy
* @table: the top-level table structure
*
* Register a sysctl table hierarchy. @table should be a filled in ctl_table
* array. A completely 0 filled entry terminates the table.
*
* See register_sysctl_paths for more details.
*/
struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
{
static const struct ctl_path null_path[] = { {} };
return register_sysctl_paths(null_path, table);
}
EXPORT_SYMBOL(register_sysctl_table); EXPORT_SYMBOL(register_sysctl_table);
int __register_sysctl_base(struct ctl_table *base_table) int __register_sysctl_base(struct ctl_table *base_table)
......
...@@ -221,14 +221,8 @@ extern void retire_sysctl_set(struct ctl_table_set *set); ...@@ -221,14 +221,8 @@ extern void retire_sysctl_set(struct ctl_table_set *set);
struct ctl_table_header *__register_sysctl_table( struct ctl_table_header *__register_sysctl_table(
struct ctl_table_set *set, struct ctl_table_set *set,
const char *path, struct ctl_table *table); const char *path, struct ctl_table *table);
struct ctl_table_header *__register_sysctl_paths(
struct ctl_table_set *set,
const struct ctl_path *path, struct ctl_table *table);
struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table); struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table);
struct ctl_table_header *register_sysctl_table(struct ctl_table * table); struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
struct ctl_table *table);
void unregister_sysctl_table(struct ctl_table_header * table); void unregister_sysctl_table(struct ctl_table_header * table);
extern int sysctl_init_bases(void); extern int sysctl_init_bases(void);
...@@ -277,12 +271,6 @@ static inline struct ctl_table_header *register_sysctl_mount_point(const char *p ...@@ -277,12 +271,6 @@ static inline struct ctl_table_header *register_sysctl_mount_point(const char *p
return NULL; return NULL;
} }
static inline struct ctl_table_header *register_sysctl_paths(
const struct ctl_path *path, struct ctl_table *table)
{
return NULL;
}
static inline struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table) static inline struct ctl_table_header *register_sysctl(const char *path, struct ctl_table *table)
{ {
return NULL; return NULL;
......
...@@ -156,22 +156,6 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ { ...@@ -156,22 +156,6 @@ curtable && /\.procname[\t ]*=[\t ]*".+"/ {
} }
} }
/register_sysctl_paths\(.*\)/ {
match($0, /register_sysctl_paths\(([^)]+), ([^)]+)\)/, tables)
if (debug) print "Attaching table " tables[2] " to path " tables[1]
if (paths[tables[1]] == table) {
for (entry in entries[tables[2]]) {
printentry(entry)
}
}
split(paths[tables[1]], components, "/")
if (length(components) > 1 && components[1] == table) {
# Count the first subdirectory as seen
seen[components[2]]++
}
}
END { END {
for (entry in documented) { for (entry in documented) {
if (!seen[entry]) { if (!seen[entry]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment