drm/amdgpu/vcn: finish delay work before release resources
[linux-2.6-block.git] / fs / ntfs / sysctl.c
CommitLineData
a1d312de 1// SPDX-License-Identifier: GPL-2.0-or-later
1da177e4
LT
2/*
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,
96de0e25 5 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne
1da177e4 6 *
c002f425 7 * Copyright (c) 2002-2005 Anton Altaparmakov
1da177e4
LT
8 */
9
10#ifdef DEBUG
11
12#include <linux/module.h>
13
14#ifdef CONFIG_SYSCTL
15
16#include <linux/proc_fs.h>
17#include <linux/sysctl.h>
18
19#include "sysctl.h"
20#include "debug.h"
21
1da177e4 22/* Definition of the ntfs sysctl. */
5eccdf39 23static struct ctl_table ntfs_sysctls[] = {
4ed075e9 24 {
4ed075e9
EB
25 .procname = "ntfs-debug",
26 .data = &debug_msgs, /* Data pointer and size. */
27 .maxlen = sizeof(debug_msgs),
28 .mode = 0644, /* Mode, proc handler. */
6d456111 29 .proc_handler = proc_dointvec
4ed075e9
EB
30 },
31 {}
1da177e4
LT
32};
33
34/* Define the parent directory /proc/sys/fs. */
5eccdf39 35static struct ctl_table sysctls_root[] = {
4ed075e9 36 {
4ed075e9
EB
37 .procname = "fs",
38 .mode = 0555,
39 .child = ntfs_sysctls
40 },
41 {}
1da177e4
LT
42};
43
44/* Storage for the sysctls header. */
504e0e2f 45static struct ctl_table_header *sysctls_root_table;
1da177e4
LT
46
47/**
48 * ntfs_sysctl - add or remove the debug sysctl
49 * @add: add (1) or remove (0) the sysctl
50 *
51 * Add or remove the debug sysctl. Return 0 on success or -errno on error.
52 */
53int ntfs_sysctl(int add)
54{
55 if (add) {
56 BUG_ON(sysctls_root_table);
0b4d4147 57 sysctls_root_table = register_sysctl_table(sysctls_root);
1da177e4
LT
58 if (!sysctls_root_table)
59 return -ENOMEM;
1da177e4
LT
60 } else {
61 BUG_ON(!sysctls_root_table);
62 unregister_sysctl_table(sysctls_root_table);
63 sysctls_root_table = NULL;
64 }
65 return 0;
66}
67
68#endif /* CONFIG_SYSCTL */
69#endif /* DEBUG */