summaryrefslogtreecommitdiff
path: root/fs/fuse/sysctl.c
blob: b272bb333005a8ca4e5f10b2e1a659f3f38b660a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-License-Identifier: GPL-2.0
/*
 * linux/fs/fuse/fuse_sysctl.c
 *
 * Sysctl interface to fuse parameters
 */
#include <linux/sysctl.h>

#include "fuse_i.h"

static struct ctl_table_header *fuse_table_header;

/* Bound by fuse_init_out max_pages, which is a u16 */
static unsigned int sysctl_fuse_max_pages_limit = 65535;

static struct ctl_table fuse_sysctl_table[] = {
	{
		.procname	= "max_pages_limit",
		.data		= &fuse_max_pages_limit,
		.maxlen		= sizeof(fuse_max_pages_limit),
		.mode		= 0644,
		.proc_handler	= proc_douintvec_minmax,
		.extra1		= SYSCTL_ONE,
		.extra2		= &sysctl_fuse_max_pages_limit,
	},
};

int fuse_sysctl_register(void)
{
	fuse_table_header = register_sysctl("fs/fuse", fuse_sysctl_table);
	if (!fuse_table_header)
		return -ENOMEM;
	return 0;
}

void fuse_sysctl_unregister(void)
{
	unregister_sysctl_table(fuse_table_header);
	fuse_table_header = NULL;
}