1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * linux/fs/fuse/fuse_sysctl.c
4 *
5 * Sysctl interface to fuse parameters
6 */
7 #include <linux/sysctl.h>
8
9 #include "fuse_i.h"
10
11 static struct ctl_table_header *fuse_table_header;
12
13 /* Bound by fuse_init_out max_pages, which is a u16 */
14 static unsigned int sysctl_fuse_max_pages_limit = 65535;
15
16 static const struct ctl_table fuse_sysctl_table[] = {
17 {
18 .procname = "max_pages_limit",
19 .data = &fuse_max_pages_limit,
20 .maxlen = sizeof(fuse_max_pages_limit),
21 .mode = 0644,
22 .proc_handler = proc_douintvec_minmax,
23 .extra1 = SYSCTL_ONE,
24 .extra2 = &sysctl_fuse_max_pages_limit,
25 },
26 };
27
fuse_sysctl_register(void)28 int fuse_sysctl_register(void)
29 {
30 fuse_table_header = register_sysctl("fs/fuse", fuse_sysctl_table);
31 if (!fuse_table_header)
32 return -ENOMEM;
33 return 0;
34 }
35
fuse_sysctl_unregister(void)36 void fuse_sysctl_unregister(void)
37 {
38 unregister_sysctl_table(fuse_table_header);
39 fuse_table_header = NULL;
40 }
41