mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 13:52:50 +01:00
sysctl: add helper to register a sysctl mount point
The way to create a subdirectory on top of sysctl_mount_point is a bit obscure, and *why* we do that even so more. Provide a helper which makes it clear why we do this. [[email protected]: export register_sysctl_mount_point() to modules] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Luis Chamberlain <[email protected]> Suggested-by: "Eric W. Biederman" <[email protected]> Cc: Al Viro <[email protected]> Cc: Amir Goldstein <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Antti Palosaari <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Benjamin LaHaise <[email protected]> Cc: Clemens Ladisch <[email protected]> Cc: David Airlie <[email protected]> Cc: Douglas Gilbert <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Iurii Zaikin <[email protected]> Cc: James E.J. Bottomley <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Jan Kara <[email protected]> Cc: Joel Becker <[email protected]> Cc: John Ogness <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Joseph Qi <[email protected]> Cc: Julia Lawall <[email protected]> Cc: Kees Cook <[email protected]> Cc: Lukas Middendorf <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Martin K. Petersen <[email protected]> Cc: Paul Turner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Phillip Potter <[email protected]> Cc: Qing Wang <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Sebastian Reichel <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Stephen Kitt <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Cc: Xiaoming Ni <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
1 parent
5475e8f03c
commit
ee9efac48a
2 files changed
+21
No files matched your search
@@ -35,6 +35,20 @@ struct ctl_table sysctl_mount_point[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
/**
|
||||
* register_sysctl_mount_point() - registers a sysctl mount point
|
||||
* @path: path for the mount point
|
||||
*
|
||||
* Used to create a permanently empty directory to serve as mount point.
|
||||
* There are some subtle but important permission checks this allows in the
|
||||
* case of unprivileged mounts.
|
||||
*/
|
||||
struct ctl_table_header *register_sysctl_mount_point(const char *path)
|
||||
{
|
||||
return register_sysctl(path, sysctl_mount_point);
|
||||
}
|
||||
EXPORT_SYMBOL(register_sysctl_mount_point);
|
||||
|
||||
static bool is_empty_dir(struct ctl_table_header *head)
|
||||
{
|
||||
return head->ctl_table[0].child == sysctl_mount_point;
|
||||
|
||||
@@ -209,6 +209,8 @@ extern int sysctl_init(void);
|
||||
extern void __register_sysctl_init(const char *path, struct ctl_table *table,
|
||||
const char *table_name);
|
||||
#define register_sysctl_init(path, table) __register_sysctl_init(path, table, #table)
|
||||
extern struct ctl_table_header *register_sysctl_mount_point(const char *path);
|
||||
|
||||
void do_sysctl_args(void);
|
||||
|
||||
extern int pwrsw_enabled;
|
||||
@@ -224,6 +226,11 @@ static inline struct ctl_table_header *register_sysctl_table(struct ctl_table *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct sysctl_header *register_sysctl_mount_point(const char *path)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct ctl_table_header *register_sysctl_paths(
|
||||
const struct ctl_path *path, struct ctl_table *table)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user