sysctl.c 1.31 KB
Newer Older
1
// SPDX-License-Identifier: GPL-2.0
Linus Torvalds's avatar
Linus Torvalds committed
2 3 4 5 6 7 8 9 10 11 12
/*
 * Sysctl operations for Coda filesystem
 * Original version: (C) 1996 P. Braam and M. Callahan
 * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
 * 
 * Carnegie Mellon encourages users to contribute improvements to
 * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
 */

#include <linux/sysctl.h>

13
#include "coda_int.h"
Linus Torvalds's avatar
Linus Torvalds committed
14

15
#ifdef CONFIG_SYSCTL
Linus Torvalds's avatar
Linus Torvalds committed
16 17
static struct ctl_table_header *fs_table_header;

18
static struct ctl_table coda_table[] = {
19 20 21 22 23
	{
		.procname	= "timeout",
		.data		= &coda_timeout,
		.maxlen		= sizeof(int),
		.mode		= 0644,
24
		.proc_handler	= proc_dointvec
25 26 27 28 29 30
	},
	{
		.procname	= "hard",
		.data		= &coda_hard,
		.maxlen		= sizeof(int),
		.mode		= 0644,
31
		.proc_handler	= proc_dointvec
32 33 34 35 36 37
	},
	{
		.procname	= "fake_statfs",
		.data		= &coda_fake_statfs,
		.maxlen		= sizeof(int),
		.mode		= 0600,
38
		.proc_handler	= proc_dointvec
39 40
	},
	{}
Linus Torvalds's avatar
Linus Torvalds committed
41 42
};

43
static struct ctl_table fs_table[] = {
44 45 46 47 48 49
	{
		.procname	= "coda",
		.mode		= 0555,
		.child		= coda_table
	},
	{}
Linus Torvalds's avatar
Linus Torvalds committed
50 51 52 53 54
};

void coda_sysctl_init(void)
{
	if ( !fs_table_header )
55
		fs_table_header = register_sysctl_table(fs_table);
Linus Torvalds's avatar
Linus Torvalds committed
56 57
}

58
void coda_sysctl_clean(void)
Linus Torvalds's avatar
Linus Torvalds committed
59 60 61 62 63 64
{
	if ( fs_table_header ) {
		unregister_sysctl_table(fs_table_header);
		fs_table_header = NULL;
	}
}
65 66 67 68 69 70 71 72 73

#else
void coda_sysctl_init(void)
{
}

void coda_sysctl_clean(void)
{
}
74
#endif