Blame view

fs/ntfs/sysctl.c 1.51 KB
a1d312de7   Thomas Gleixner   treewide: Replace...
1
  // SPDX-License-Identifier: GPL-2.0-or-later
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
  /*
   * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of
   *	      the Linux-NTFS project. Adapted from the old NTFS driver,
96de0e252   Jan Engelhardt   Convert files to ...
5
   *	      Copyright (C) 1997 Martin von Löwis, Régis Duchesne
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
   *
c002f4254   Anton Altaparmakov   NTFS: - Add disab...
7
   * Copyright (c) 2002-2005 Anton Altaparmakov
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
11
12
13
14
15
16
17
18
19
20
   */
  
  #ifdef DEBUG
  
  #include <linux/module.h>
  
  #ifdef CONFIG_SYSCTL
  
  #include <linux/proc_fs.h>
  #include <linux/sysctl.h>
  
  #include "sysctl.h"
  #include "debug.h"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
  /* Definition of the ntfs sysctl. */
5eccdf395   Joe Perches   ntfs: convert use...
22
  static struct ctl_table ntfs_sysctls[] = {
4ed075e93   Eric W. Biederman   [PATCH] sysctl: C...
23
  	{
4ed075e93   Eric W. Biederman   [PATCH] sysctl: C...
24
25
26
27
  		.procname	= "ntfs-debug",
  		.data		= &debug_msgs,		/* Data pointer and size. */
  		.maxlen		= sizeof(debug_msgs),
  		.mode		= 0644,			/* Mode, proc handler. */
6d4561110   Eric W. Biederman   sysctl: Drop & in...
28
  		.proc_handler	= proc_dointvec
4ed075e93   Eric W. Biederman   [PATCH] sysctl: C...
29
30
  	},
  	{}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
32
33
  };
  
  /* Define the parent directory /proc/sys/fs. */
5eccdf395   Joe Perches   ntfs: convert use...
34
  static struct ctl_table sysctls_root[] = {
4ed075e93   Eric W. Biederman   [PATCH] sysctl: C...
35
  	{
4ed075e93   Eric W. Biederman   [PATCH] sysctl: C...
36
37
38
39
40
  		.procname	= "fs",
  		.mode		= 0555,
  		.child		= ntfs_sysctls
  	},
  	{}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
  };
  
  /* Storage for the sysctls header. */
504e0e2f3   Fabian Frederick   ntfs: remove NULL...
44
  static struct ctl_table_header *sysctls_root_table;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45
46
47
48
49
50
51
52
53
54
55
  
  /**
   * 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);
0b4d41471   Eric W. Biederman   [PATCH] sysctl: r...
56
  		sysctls_root_table = register_sysctl_table(sysctls_root);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57
58
  		if (!sysctls_root_table)
  			return -ENOMEM;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
59
60
61
62
63
64
65
66
67
68
  	} else {
  		BUG_ON(!sysctls_root_table);
  		unregister_sysctl_table(sysctls_root_table);
  		sysctls_root_table = NULL;
  	}
  	return 0;
  }
  
  #endif /* CONFIG_SYSCTL */
  #endif /* DEBUG */