]> git.proxmox.com Git - mirror_spl-debian.git/blob - include/linux/sysctl_compat.h
93210e82952a6ad2f1c7cf4bab3d69ceeffb66a1
[mirror_spl-debian.git] / include / linux / sysctl_compat.h
1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
6 * UCRL-CODE-235197
7 *
8 * This file is part of the SPL, Solaris Porting Layer.
9 * For details, see <http://github.com/behlendorf/spl/>.
10 *
11 * The SPL is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * The SPL is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
23 \*****************************************************************************/
24
25 #ifndef _SPL_SYSCTL_COMPAT_H
26 #define _SPL_SYSCTL_COMPAT_H
27
28 #include <linux/sysctl.h>
29
30 /* proc_handler() / proc_do* API changes
31 * 2.6.x - 2.6.31: 6 args, prototype includes 'struct file *'
32 * 2.6.32 - 2.6.y: 5 args, removed unused 'struct file *' from prototype
33 *
34 * Generic SPL_PROC_HANDLER() macro should be used for correct prototypes.
35 * It will define the following function arguments which can and should be
36 * used with the spl_proc_* helper macros.
37 *
38 * struct ctl_table *table,
39 * int write,
40 * struct file *filp [2.6.31 and earlier kernels],
41 * void __user *buffer,
42 * size_t *lenp,
43 * loff_t *ppos,
44 */
45 #ifdef HAVE_5ARGS_PROC_HANDLER
46
47 #define SPL_PROC_HANDLER(proc_handler) \
48 static int \
49 proc_handler(struct ctl_table *table, int write, \
50 void __user *buffer, size_t *lenp, loff_t *ppos)
51
52 #define spl_proc_dostring(table, write, filp, buffer, lenp, ppos) \
53 proc_dostring(table, write, buffer, lenp, ppos)
54 #define spl_proc_dointvec(table, write, filp, buffer, lenp, ppos) \
55 proc_dointvec(table, write, buffer, lenp, ppos)
56 #define spl_proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos) \
57 proc_dointvec_minmax(table, write, buffer, lenp, ppos)
58 #define spl_proc_dointvec_jiffies(table, write, filp, buffer, lenp, ppos) \
59 proc_dointvec_jiffies(table, write, buffer, lenp, ppos)
60 #define spl_proc_dointvec_userhz_jiffies(table,write,filp,buffer,lenp,ppos) \
61 proc_dointvec_userhz_jiffies(table, write, buffer, lenp, ppos)
62 #define spl_proc_dointvec_ms_jiffies(table,write,filp,buffer,lenp,ppos) \
63 proc_dointvec_ms_jiffies(table, write, buffer, lenp, ppos)
64 #define spl_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos) \
65 proc_doulongvec_minmax(table, write, buffer, lenp, ppos)
66 #define spl_proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos)\
67 proc_doulongvec_ms_jiffies_minmax(table, write, buffer, lenp, ppos)
68
69 #else /* HAVE_5ARGS_PROC_HANDLER */
70
71 #define SPL_PROC_HANDLER(proc_handler) \
72 static int \
73 proc_handler(struct ctl_table *table, int write, struct file *filp, \
74 void __user *buffer, size_t *lenp, loff_t *ppos)
75
76 #define spl_proc_dostring(table, write, filp, buffer, lenp, ppos) \
77 proc_dostring(table, write, filp, buffer, lenp, ppos)
78 #define spl_proc_dointvec(table, write, filp, buffer, lenp, ppos) \
79 proc_dointvec(table, write, filp, buffer, lenp, ppos)
80 #define spl_proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos) \
81 proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos)
82 #define spl_proc_dointvec_jiffies(table, write, filp, buffer, lenp, ppos) \
83 proc_dointvec_jiffies(table, write, filp, buffer, lenp, ppos)
84 #define spl_proc_dointvec_userhz_jiffies(table,write,filp,buffer,lenp,ppos) \
85 proc_dointvec_userhz_jiffies(table, write, filp, buffer, lenp, ppos)
86 #define spl_proc_dointvec_ms_jiffies(table, write, filp, buffer, lenp, ppos) \
87 proc_dointvec_ms_jiffies(table, write, filp, buffer, lenp, ppos)
88 #define spl_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos) \
89 proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos)
90 #define spl_proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos) \
91 proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos)
92
93
94 #endif /* HAVE_5ARGS_PROC_HANDLER */
95
96 #endif /* _SPL_SYSCTL_COMPAT_H */