SPL_AC_CRED_STRUCT
SPL_AC_GROUPS_SEARCH
SPL_AC_PUT_TASK_STRUCT
+ SPL_AC_5ARGS_PROC_HANDLER
])
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
[__put_task_struct() is available])],
[])
])
+
+dnl #
+dnl # 2.6.32 API change,
+dnl # Unused 'struct file *' removed from prototype.
+dnl #
+AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
+ AC_MSG_CHECKING([whether proc_handler() wants 5 args])
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/sysctl.h>
+ ],[
+ proc_dostring(NULL, 0, NULL, NULL, NULL);
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
+ [proc_handler() wants 5 args])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
fi
+
+ echo "$as_me:$LINENO: checking whether proc_handler() wants 5 args" >&5
+echo $ECHO_N "checking whether proc_handler() wants 5 args... $ECHO_C" >&6
+
+
+cat >conftest.c <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/sysctl.h>
+
+int
+main (void)
+{
+
+ proc_dostring(NULL, 0, NULL, NULL, NULL);
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_5ARGS_PROC_HANDLER 1
+_ACEOF
+
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+
+
+fi
+
+ rm -Rf build
+
+
+
;;
user) ;;
all)
+ echo "$as_me:$LINENO: checking whether proc_handler() wants 5 args" >&5
+echo $ECHO_N "checking whether proc_handler() wants 5 args... $ECHO_C" >&6
+
+
+cat >conftest.c <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+
+ #include <linux/sysctl.h>
+
+int
+main (void)
+{
+
+ proc_dostring(NULL, 0, NULL, NULL, NULL);
+
+ ;
+ return 0;
+}
+
+_ACEOF
+
+
+ rm -Rf build && mkdir -p build
+ echo "obj-m := conftest.o" >build/Makefile
+ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_5ARGS_PROC_HANDLER 1
+_ACEOF
+
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+
+
+fi
+
+ rm -Rf build
+
+
+
+
;;
srpm) ;;
*)
--- /dev/null
+#ifndef _SPL_SYSCTL_COMPAT_H
+#define _SPL_SYSCTL_COMPAT_H
+
+#include <linux/sysctl.h>
+
+/* proc_handler() / proc_do* API changes
+ * 2.6.x - 2.6.31: 6 args, prototype includes 'struct file *'
+ * 2.6.32 - 2.6.y: 5 args, removed unused 'struct file *' from prototype
+ *
+ * Generic SPL_PROC_HANDLER() macro should be used for correct prototypes.
+ * It will define the following function arguments which can and should be
+ * used with the spl_proc_* helper macros.
+ *
+ * struct ctl_table *table,
+ * int write,
+ * struct file *filp [2.6.31 and earlier kernels],
+ * void __user *buffer,
+ * size_t *lenp,
+ * loff_t *ppos,
+ */
+#ifdef HAVE_5ARGS_PROC_HANDLER
+
+#define SPL_PROC_HANDLER(proc_handler) \
+static int \
+proc_handler(struct ctl_table *table, int write, \
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+
+#define spl_proc_dostring(table, write, filp, buffer, lenp, ppos) \
+ proc_dostring(table, write, buffer, lenp, ppos)
+#define spl_proc_dointvec(table, write, filp, buffer, lenp, ppos) \
+ proc_dointvec(table, write, buffer, lenp, ppos)
+#define spl_proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos) \
+ proc_dointvec_minmax(table, write, buffer, lenp, ppos)
+#define spl_proc_dointvec_jiffies(table, write, filp, buffer, lenp, ppos) \
+ proc_dointvec_jiffies(table, write, buffer, lenp, ppos)
+#define spl_proc_dointvec_userhz_jiffies(table,write,filp,buffer,lenp,ppos) \
+ proc_dointvec_userhz_jiffies(table, write, buffer, lenp, ppos)
+#define spl_proc_dointvec_ms_jiffies(table,write,filp,buffer,lenp,ppos) \
+ proc_dointvec_ms_jiffies(table, write, buffer, lenp, ppos)
+#define spl_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos) \
+ proc_doulongvec_minmax(table, write, buffer, lenp, ppos)
+#define spl_proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos) \
+ proc_doulongvec_ms_jiffies_minmax(table, write, buffer, lenp, ppos)
+
+#else /* HAVE_5ARGS_PROC_HANDLER */
+
+#define SPL_PROC_HANDLER(proc_handler) \
+static int \
+proc_handler(struct ctl_table *table, int write, struct file *filp, \
+ void __user *buffer, size_t *lenp, loff_t *ppos)
+
+#define spl_proc_dostring(table, write, filp, buffer, lenp, ppos) \
+ proc_dostring(table, write, filp, buffer, lenp, ppos)
+#define spl_proc_dointvec(table, write, filp, buffer, lenp, ppos) \
+ proc_dointvec(table, write, filp, buffer, lenp, ppos)
+#define spl_proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos) \
+ proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos)
+#define spl_proc_dointvec_jiffies(table, write, filp, buffer, lenp, ppos) \
+ proc_dointvec_jiffies(table, write, filp, buffer, lenp, ppos)
+#define spl_proc_dointvec_userhz_jiffies(table,write,filp,buffer,lenp,ppos) \
+ proc_dointvec_userhz_jiffies(table, write, filp, buffer, lenp, ppos)
+#define spl_proc_dointvec_ms_jiffies(table, write, filp, buffer, lenp, ppos) \
+ proc_dointvec_ms_jiffies(table, write, filp, buffer, lenp, ppos)
+#define spl_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos) \
+ proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos)
+#define spl_proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos) \
+ proc_doulongvec_ms_jiffies_minmax(table,write,filp,buffer,lenp,ppos)
+
+
+#endif /* HAVE_5ARGS_PROC_HANDLER */
+
+#endif /* _SPL_SYSCTL_COMPAT_H */
#include <linux/kallsyms_compat.h>
#include <linux/mutex_compat.h>
#include <linux/module_compat.h>
+#include <linux/sysctl_compat.h>
#ifndef HAVE_UINTPTR_T
typedef unsigned long uintptr_t;
return size;
}
-static int
-proc_dobitmasks(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dobitmasks)
{
unsigned long *mask = table->data;
int is_subsys = (mask == &spl_debug_subsys) ? 1 : 0;
RETURN(rc);
}
-static int
-proc_debug_mb(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_debug_mb)
{
char str[32];
int rc, len;
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
RETURN(rc);
}
-static int
-proc_dump_kernel(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dump_kernel)
{
ENTRY;
RETURN(0);
}
-static int
-proc_force_bug(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_force_bug)
{
ENTRY;
RETURN(0);
}
-static int
-proc_console_max_delay_cs(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_console_max_delay_cs)
{
int rc, max_delay_cs;
struct ctl_table dummy = *table;
if (write) {
max_delay_cs = 0;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
if (rc < 0)
RETURN(rc);
spl_console_max_delay = d;
} else {
max_delay_cs = (spl_console_max_delay * 100) / HZ;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
}
RETURN(rc);
}
-static int
-proc_console_min_delay_cs(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_console_min_delay_cs)
{
int rc, min_delay_cs;
struct ctl_table dummy = *table;
if (write) {
min_delay_cs = 0;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
if (rc < 0)
RETURN(rc);
spl_console_min_delay = d;
} else {
min_delay_cs = (spl_console_min_delay * 100) / HZ;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
}
RETURN(rc);
}
-static int
-proc_console_backoff(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_console_backoff)
{
int rc, backoff;
struct ctl_table dummy = *table;
if (write) {
backoff = 0;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
if (rc < 0)
RETURN(rc);
spl_console_backoff = backoff;
} else {
backoff = spl_console_backoff;
- rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+ rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
}
RETURN(rc);
}
#ifdef DEBUG_KMEM
-static int
-proc_domemused(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_domemused)
{
int rc = 0;
unsigned long min = 0, max = ~0, val;
# else
val = atomic_read((atomic_t *)table->data);
# endif /* HAVE_ATOMIC64_T */
- rc = proc_doulongvec_minmax(&dummy, write, filp,
- buffer, lenp, ppos);
+ rc = spl_proc_doulongvec_minmax(&dummy, write, filp,
+ buffer, lenp, ppos);
}
RETURN(rc);
}
#endif /* DEBUG_KMEM */
-static int
-proc_dohostid(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dohostid)
{
int len, rc = 0;
int32_t val;
ENTRY;
if (write) {
- /* We can't use proc_doulongvec_minmax() in the write
+ /* We can't use spl_proc_doulongvec_minmax() in the write
* case hear because hostid while a hex value has no
* leading 0x which confuses the helper function. */
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
}
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
-static int
-proc_dokallsyms_lookup_name(struct ctl_table *table, int write,
- struct file *filp, void __user *buffer,
- size_t *lenp, loff_t *ppos) {
+SPL_PROC_HANDLER(proc_dokallsyms_lookup_name)
+{
int len, rc = 0;
char *end, str[32];
ENTRY;
if (spl_kallsyms_lookup_name_fn != SYMBOL_POISON)
RETURN(-EEXIST);
- /* We can't use proc_doulongvec_minmax() in the write
+ /* We can't use spl_proc_doulongvec_minmax() in the write
* case hear because the address while a hex value has no
* leading 0x which confuses the helper function. */
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
}
#endif /* HAVE_KALLSYMS_LOOKUP_NAME */
-static int
-proc_doavailrmem(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_doavailrmem)
{
int len, rc = 0;
char str[32];
if (write) {
*ppos += *lenp;
} else {
- len = snprintf(str, sizeof(str), "%lu", (unsigned long)availrmem);
+ len = snprintf(str, sizeof(str), "%lu",
+ (unsigned long)availrmem);
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
RETURN(rc);
}
-static int
-proc_dofreemem(struct ctl_table *table, int write, struct file *filp,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+SPL_PROC_HANDLER(proc_dofreemem)
{
int len, rc = 0;
char str[32];
if (*ppos >= len)
rc = 0;
else
- rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
+ rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
if (rc >= 0) {
*lenp = rc;
++*pos;
RETURN((skc->skc_list.next == &spl_kmem_cache_list) ?
- NULL : list_entry(skc->skc_list.next, spl_kmem_cache_t, skc_list));
+ NULL : list_entry(skc->skc_list.next,spl_kmem_cache_t,skc_list));
}
static void
/* device_create wants 5 args */
#undef HAVE_5ARGS_DEVICE_CREATE
+/* proc_handler() wants 5 args */
+#undef HAVE_5ARGS_PROC_HANDLER
+
/* kernel defines atomic64_cmpxchg */
#undef HAVE_ATOMIC64_CMPXCHG