mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Linux 2.6.32 compat, proc_handler() API change
As of linux-2.6.32 the 'struct file *filp' argument was dropped from the proc_handle() prototype. It was apparently unused _almost_ everywhere in the kernel and this was simply cleanup. I've added a new SPL_AC_5ARGS_PROC_HANDLER autoconf check for this and the proper compat macros to correctly define the prototypes and some helper functions. It's not pretty but API compat changes rarely are.
This commit is contained in:
parent
694921bc49
commit
3977f8370f
@ -72,6 +72,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
|
|||||||
SPL_AC_CRED_STRUCT
|
SPL_AC_CRED_STRUCT
|
||||||
SPL_AC_GROUPS_SEARCH
|
SPL_AC_GROUPS_SEARCH
|
||||||
SPL_AC_PUT_TASK_STRUCT
|
SPL_AC_PUT_TASK_STRUCT
|
||||||
|
SPL_AC_5ARGS_PROC_HANDLER
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
|
AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
|
||||||
@ -1371,3 +1372,22 @@ AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
|
|||||||
[__put_task_struct() is available])],
|
[__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)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
130
configure
vendored
130
configure
vendored
@ -22231,6 +22231,71 @@ _ACEOF
|
|||||||
fi
|
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) ;;
|
user) ;;
|
||||||
all)
|
all)
|
||||||
@ -25513,6 +25578,71 @@ _ACEOF
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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) ;;
|
srpm) ;;
|
||||||
*)
|
*)
|
||||||
|
72
include/linux/sysctl_compat.h
Normal file
72
include/linux/sysctl_compat.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#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 */
|
@ -19,6 +19,7 @@ extern "C" {
|
|||||||
#include <linux/kallsyms_compat.h>
|
#include <linux/kallsyms_compat.h>
|
||||||
#include <linux/mutex_compat.h>
|
#include <linux/mutex_compat.h>
|
||||||
#include <linux/module_compat.h>
|
#include <linux/module_compat.h>
|
||||||
|
#include <linux/sysctl_compat.h>
|
||||||
|
|
||||||
#ifndef HAVE_UINTPTR_T
|
#ifndef HAVE_UINTPTR_T
|
||||||
typedef unsigned long uintptr_t;
|
typedef unsigned long uintptr_t;
|
||||||
|
@ -203,9 +203,7 @@ proc_copyout_string(char *ubuffer, int ubuffer_size,
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_dobitmasks)
|
||||||
proc_dobitmasks(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
unsigned long *mask = table->data;
|
unsigned long *mask = table->data;
|
||||||
int is_subsys = (mask == &spl_debug_subsys) ? 1 : 0;
|
int is_subsys = (mask == &spl_debug_subsys) ? 1 : 0;
|
||||||
@ -246,9 +244,7 @@ proc_dobitmasks(struct ctl_table *table, int write, struct file *filp,
|
|||||||
RETURN(rc);
|
RETURN(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_debug_mb)
|
||||||
proc_debug_mb(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
char str[32];
|
char str[32];
|
||||||
int rc, len;
|
int rc, len;
|
||||||
@ -266,7 +262,7 @@ proc_debug_mb(struct ctl_table *table, int write, struct file *filp,
|
|||||||
if (*ppos >= len)
|
if (*ppos >= len)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
else
|
else
|
||||||
rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
|
rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
|
||||||
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
*lenp = rc;
|
*lenp = rc;
|
||||||
@ -277,9 +273,7 @@ proc_debug_mb(struct ctl_table *table, int write, struct file *filp,
|
|||||||
RETURN(rc);
|
RETURN(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_dump_kernel)
|
||||||
proc_dump_kernel(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
@ -293,9 +287,7 @@ proc_dump_kernel(struct ctl_table *table, int write, struct file *filp,
|
|||||||
RETURN(0);
|
RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_force_bug)
|
||||||
proc_force_bug(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
@ -310,9 +302,7 @@ proc_force_bug(struct ctl_table *table, int write, struct file *filp,
|
|||||||
RETURN(0);
|
RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_console_max_delay_cs)
|
||||||
proc_console_max_delay_cs(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int rc, max_delay_cs;
|
int rc, max_delay_cs;
|
||||||
struct ctl_table dummy = *table;
|
struct ctl_table dummy = *table;
|
||||||
@ -324,7 +314,7 @@ proc_console_max_delay_cs(struct ctl_table *table, int write, struct file *filp,
|
|||||||
|
|
||||||
if (write) {
|
if (write) {
|
||||||
max_delay_cs = 0;
|
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)
|
if (rc < 0)
|
||||||
RETURN(rc);
|
RETURN(rc);
|
||||||
|
|
||||||
@ -338,15 +328,13 @@ proc_console_max_delay_cs(struct ctl_table *table, int write, struct file *filp,
|
|||||||
spl_console_max_delay = d;
|
spl_console_max_delay = d;
|
||||||
} else {
|
} else {
|
||||||
max_delay_cs = (spl_console_max_delay * 100) / HZ;
|
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);
|
RETURN(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_console_min_delay_cs)
|
||||||
proc_console_min_delay_cs(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int rc, min_delay_cs;
|
int rc, min_delay_cs;
|
||||||
struct ctl_table dummy = *table;
|
struct ctl_table dummy = *table;
|
||||||
@ -358,7 +346,7 @@ proc_console_min_delay_cs(struct ctl_table *table, int write, struct file *filp,
|
|||||||
|
|
||||||
if (write) {
|
if (write) {
|
||||||
min_delay_cs = 0;
|
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)
|
if (rc < 0)
|
||||||
RETURN(rc);
|
RETURN(rc);
|
||||||
|
|
||||||
@ -372,15 +360,13 @@ proc_console_min_delay_cs(struct ctl_table *table, int write, struct file *filp,
|
|||||||
spl_console_min_delay = d;
|
spl_console_min_delay = d;
|
||||||
} else {
|
} else {
|
||||||
min_delay_cs = (spl_console_min_delay * 100) / HZ;
|
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);
|
RETURN(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_console_backoff)
|
||||||
proc_console_backoff(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int rc, backoff;
|
int rc, backoff;
|
||||||
struct ctl_table dummy = *table;
|
struct ctl_table dummy = *table;
|
||||||
@ -391,7 +377,7 @@ proc_console_backoff(struct ctl_table *table, int write, struct file *filp,
|
|||||||
|
|
||||||
if (write) {
|
if (write) {
|
||||||
backoff = 0;
|
backoff = 0;
|
||||||
rc = proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
|
rc = spl_proc_dointvec(&dummy,write,filp,buffer,lenp,ppos);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
RETURN(rc);
|
RETURN(rc);
|
||||||
|
|
||||||
@ -401,16 +387,14 @@ proc_console_backoff(struct ctl_table *table, int write, struct file *filp,
|
|||||||
spl_console_backoff = backoff;
|
spl_console_backoff = backoff;
|
||||||
} else {
|
} else {
|
||||||
backoff = spl_console_backoff;
|
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);
|
RETURN(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_KMEM
|
#ifdef DEBUG_KMEM
|
||||||
static int
|
SPL_PROC_HANDLER(proc_domemused)
|
||||||
proc_domemused(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
unsigned long min = 0, max = ~0, val;
|
unsigned long min = 0, max = ~0, val;
|
||||||
@ -430,7 +414,7 @@ proc_domemused(struct ctl_table *table, int write, struct file *filp,
|
|||||||
# else
|
# else
|
||||||
val = atomic_read((atomic_t *)table->data);
|
val = atomic_read((atomic_t *)table->data);
|
||||||
# endif /* HAVE_ATOMIC64_T */
|
# endif /* HAVE_ATOMIC64_T */
|
||||||
rc = proc_doulongvec_minmax(&dummy, write, filp,
|
rc = spl_proc_doulongvec_minmax(&dummy, write, filp,
|
||||||
buffer, lenp, ppos);
|
buffer, lenp, ppos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,9 +422,7 @@ proc_domemused(struct ctl_table *table, int write, struct file *filp,
|
|||||||
}
|
}
|
||||||
#endif /* DEBUG_KMEM */
|
#endif /* DEBUG_KMEM */
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_dohostid)
|
||||||
proc_dohostid(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int len, rc = 0;
|
int len, rc = 0;
|
||||||
int32_t val;
|
int32_t val;
|
||||||
@ -448,7 +430,7 @@ proc_dohostid(struct ctl_table *table, int write, struct file *filp,
|
|||||||
ENTRY;
|
ENTRY;
|
||||||
|
|
||||||
if (write) {
|
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
|
* case hear because hostid while a hex value has no
|
||||||
* leading 0x which confuses the helper function. */
|
* leading 0x which confuses the helper function. */
|
||||||
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
|
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
|
||||||
@ -469,7 +451,7 @@ proc_dohostid(struct ctl_table *table, int write, struct file *filp,
|
|||||||
if (*ppos >= len)
|
if (*ppos >= len)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
else
|
else
|
||||||
rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
|
rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
|
||||||
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
*lenp = rc;
|
*lenp = rc;
|
||||||
@ -481,10 +463,8 @@ proc_dohostid(struct ctl_table *table, int write, struct file *filp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
|
#ifndef HAVE_KALLSYMS_LOOKUP_NAME
|
||||||
static int
|
SPL_PROC_HANDLER(proc_dokallsyms_lookup_name)
|
||||||
proc_dokallsyms_lookup_name(struct ctl_table *table, int write,
|
{
|
||||||
struct file *filp, void __user *buffer,
|
|
||||||
size_t *lenp, loff_t *ppos) {
|
|
||||||
int len, rc = 0;
|
int len, rc = 0;
|
||||||
char *end, str[32];
|
char *end, str[32];
|
||||||
ENTRY;
|
ENTRY;
|
||||||
@ -494,7 +474,7 @@ proc_dokallsyms_lookup_name(struct ctl_table *table, int write,
|
|||||||
if (spl_kallsyms_lookup_name_fn != SYMBOL_POISON)
|
if (spl_kallsyms_lookup_name_fn != SYMBOL_POISON)
|
||||||
RETURN(-EEXIST);
|
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
|
* case hear because the address while a hex value has no
|
||||||
* leading 0x which confuses the helper function. */
|
* leading 0x which confuses the helper function. */
|
||||||
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
|
rc = proc_copyin_string(str, sizeof(str), buffer, *lenp);
|
||||||
@ -525,9 +505,7 @@ proc_dokallsyms_lookup_name(struct ctl_table *table, int write,
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_KALLSYMS_LOOKUP_NAME */
|
#endif /* HAVE_KALLSYMS_LOOKUP_NAME */
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_doavailrmem)
|
||||||
proc_doavailrmem(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int len, rc = 0;
|
int len, rc = 0;
|
||||||
char str[32];
|
char str[32];
|
||||||
@ -536,11 +514,12 @@ proc_doavailrmem(struct ctl_table *table, int write, struct file *filp,
|
|||||||
if (write) {
|
if (write) {
|
||||||
*ppos += *lenp;
|
*ppos += *lenp;
|
||||||
} else {
|
} else {
|
||||||
len = snprintf(str, sizeof(str), "%lu", (unsigned long)availrmem);
|
len = snprintf(str, sizeof(str), "%lu",
|
||||||
|
(unsigned long)availrmem);
|
||||||
if (*ppos >= len)
|
if (*ppos >= len)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
else
|
else
|
||||||
rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
|
rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
|
||||||
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
*lenp = rc;
|
*lenp = rc;
|
||||||
@ -551,9 +530,7 @@ proc_doavailrmem(struct ctl_table *table, int write, struct file *filp,
|
|||||||
RETURN(rc);
|
RETURN(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
SPL_PROC_HANDLER(proc_dofreemem)
|
||||||
proc_dofreemem(struct ctl_table *table, int write, struct file *filp,
|
|
||||||
void __user *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int len, rc = 0;
|
int len, rc = 0;
|
||||||
char str[32];
|
char str[32];
|
||||||
@ -566,7 +543,7 @@ proc_dofreemem(struct ctl_table *table, int write, struct file *filp,
|
|||||||
if (*ppos >= len)
|
if (*ppos >= len)
|
||||||
rc = 0;
|
rc = 0;
|
||||||
else
|
else
|
||||||
rc = proc_copyout_string(buffer, *lenp, str + *ppos, "\n");
|
rc = proc_copyout_string(buffer,*lenp,str+*ppos,"\n");
|
||||||
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
*lenp = rc;
|
*lenp = rc;
|
||||||
@ -648,7 +625,7 @@ slab_seq_next(struct seq_file *f, void *p, loff_t *pos)
|
|||||||
|
|
||||||
++*pos;
|
++*pos;
|
||||||
RETURN((skc->skc_list.next == &spl_kmem_cache_list) ?
|
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
|
static void
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
/* device_create wants 5 args */
|
/* device_create wants 5 args */
|
||||||
#undef HAVE_5ARGS_DEVICE_CREATE
|
#undef HAVE_5ARGS_DEVICE_CREATE
|
||||||
|
|
||||||
|
/* proc_handler() wants 5 args */
|
||||||
|
#undef HAVE_5ARGS_PROC_HANDLER
|
||||||
|
|
||||||
/* kernel defines atomic64_cmpxchg */
|
/* kernel defines atomic64_cmpxchg */
|
||||||
#undef HAVE_ATOMIC64_CMPXCHG
|
#undef HAVE_ATOMIC64_CMPXCHG
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user