1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of
4 * the Linux-NTFS project. Adapted from the old NTFS driver,
5 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne
7 * Copyright (c) 2002-2005 Anton Altaparmakov
12 #include <linux/module.h>
16 #include <linux/proc_fs.h>
17 #include <linux/sysctl.h>
22 /* Definition of the ntfs sysctl. */
23 static struct ctl_table ntfs_sysctls
[] = {
25 .procname
= "ntfs-debug",
26 .data
= &debug_msgs
, /* Data pointer and size. */
27 .maxlen
= sizeof(debug_msgs
),
28 .mode
= 0644, /* Mode, proc handler. */
29 .proc_handler
= proc_dointvec
34 /* Define the parent directory /proc/sys/fs. */
35 static struct ctl_table sysctls_root
[] = {
44 /* Storage for the sysctls header. */
45 static struct ctl_table_header
*sysctls_root_table
;
48 * ntfs_sysctl - add or remove the debug sysctl
49 * @add: add (1) or remove (0) the sysctl
51 * Add or remove the debug sysctl. Return 0 on success or -errno on error.
53 int ntfs_sysctl(int add
)
56 BUG_ON(sysctls_root_table
);
57 sysctls_root_table
= register_sysctl_table(sysctls_root
);
58 if (!sysctls_root_table
)
61 BUG_ON(!sysctls_root_table
);
62 unregister_sysctl_table(sysctls_root_table
);
63 sysctls_root_table
= NULL
;
68 #endif /* CONFIG_SYSCTL */