mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
9d5b947535
This commit comes at the tail end of a greater effort to remove the empty elements at the end of the ctl_table arrays (sentinels) which will reduce the overall build time size of the kernel and run time memory bloat by ~64 bytes per sentinel (further information Link : https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/) Remove sentinel elements ctl_table struct. Special attention was placed in making sure that an empty directory for fs/verity was created when CONFIG_FS_VERITY_BUILTIN_SIGNATURES is not defined. In this case we use the register sysctl call that expects a size. Signed-off-by: Joel Granados <j.granados@samsung.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of
|
|
* the Linux-NTFS project. Adapted from the old NTFS driver,
|
|
* Copyright (C) 1997 Martin von Löwis, Régis Duchesne
|
|
*
|
|
* Copyright (c) 2002-2005 Anton Altaparmakov
|
|
*/
|
|
|
|
#ifdef DEBUG
|
|
|
|
#include <linux/module.h>
|
|
|
|
#ifdef CONFIG_SYSCTL
|
|
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/sysctl.h>
|
|
|
|
#include "sysctl.h"
|
|
#include "debug.h"
|
|
|
|
/* Definition of the ntfs sysctl. */
|
|
static struct ctl_table ntfs_sysctls[] = {
|
|
{
|
|
.procname = "ntfs-debug",
|
|
.data = &debug_msgs, /* Data pointer and size. */
|
|
.maxlen = sizeof(debug_msgs),
|
|
.mode = 0644, /* Mode, proc handler. */
|
|
.proc_handler = proc_dointvec
|
|
},
|
|
};
|
|
|
|
/* Storage for the sysctls header. */
|
|
static struct ctl_table_header *sysctls_root_table;
|
|
|
|
/**
|
|
* ntfs_sysctl - add or remove the debug sysctl
|
|
* @add: add (1) or remove (0) the sysctl
|
|
*
|
|
* Add or remove the debug sysctl. Return 0 on success or -errno on error.
|
|
*/
|
|
int ntfs_sysctl(int add)
|
|
{
|
|
if (add) {
|
|
BUG_ON(sysctls_root_table);
|
|
sysctls_root_table = register_sysctl("fs", ntfs_sysctls);
|
|
if (!sysctls_root_table)
|
|
return -ENOMEM;
|
|
} else {
|
|
BUG_ON(!sysctls_root_table);
|
|
unregister_sysctl_table(sysctls_root_table);
|
|
sysctls_root_table = NULL;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
#endif /* CONFIG_SYSCTL */
|
|
#endif /* DEBUG */
|