From: James Simmons Date: Tue, 17 Sep 2013 17:48:24 +0000 (-0400) Subject: LU-2800 autoconf: remove LN_5ARGS_SYSCTL_PROC_HANDLER test X-Git-Tag: 2.5.51~71 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=44f30fd7b54bbb7fa218214f18e5c3dc3e4b1171 LU-2800 autoconf: remove LN_5ARGS_SYSCTL_PROC_HANDLER test ctl_table.proc_handler has taken 5 arguments since v2.6.32. We remove the test and dead code. Also eliminate the ll_* prefixed compatibility shims and empty macros. I've left the LL_PROC_PROTO macro because it definitely simplifies the appearance of the handler definitions. Signed-off-by: Jeff Mahoney Signed-off-by: James Simmons Change-Id: I8c5fc509e1c8bc52705090f5eedf8fb10d549cf5 Reviewed-on: http://review.whamcloud.com/5411 Tested-by: Hudson Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Minh Diep Reviewed-by: Oleg Drokin --- diff --git a/libcfs/include/libcfs/linux/linux-prim.h b/libcfs/include/libcfs/linux/linux-prim.h index b59865b..e525279 100644 --- a/libcfs/include/libcfs/linux/linux-prim.h +++ b/libcfs/include/libcfs/linux/linux-prim.h @@ -87,8 +87,6 @@ static int \ LL_PROC_PROTO(name) \ { \ - DECLARE_LL_PROC_PPOS_DECL; \ - \ return proc_call_handler(table->data, write, \ ppos, buffer, lenp, \ __##name); \ diff --git a/libcfs/include/libcfs/linux/portals_compat25.h b/libcfs/include/libcfs/linux/portals_compat25.h index 741f3e6..52b6244 100644 --- a/libcfs/include/libcfs/linux/portals_compat25.h +++ b/libcfs/include/libcfs/linux/portals_compat25.h @@ -41,30 +41,9 @@ #define __user #endif -#ifdef HAVE_5ARGS_SYSCTL_PROC_HANDLER -#define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos) \ - proc_dointvec(table, write, buffer, lenp, ppos); - -#define ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos) \ - proc_doulongvec_minmax(table, write, buffer, lenp, ppos); -#define ll_proc_dostring(table, write, filp, buffer, lenp, ppos) \ - proc_dostring(table, write, buffer, lenp, ppos); -#define LL_PROC_PROTO(name) \ - name(struct ctl_table *table, int write, \ - void __user *buffer, size_t *lenp, loff_t *ppos) -#else -#define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos) \ - proc_dointvec(table, write, filp, buffer, lenp, ppos); - -#define ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos) \ - proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos); -#define ll_proc_dostring(table, write, filp, buffer, lenp, ppos) \ - proc_dostring(table, write, filp, buffer, lenp, ppos); -#define LL_PROC_PROTO(name) \ - name(struct ctl_table *table, int write, struct file *filp, \ - void __user *buffer, size_t *lenp, loff_t *ppos) -#endif -#define DECLARE_LL_PROC_PPOS_DECL +#define LL_PROC_PROTO(name) \ + name(struct ctl_table *table, int write, \ + void __user *buffer, size_t *lenp, loff_t *ppos) /* helper for sysctl handlers */ int proc_call_handler(void *data, int write, diff --git a/libcfs/include/libcfs/winnt/portals_compat25.h b/libcfs/include/libcfs/winnt/portals_compat25.h index 6f6ea7e..c563e33 100644 --- a/libcfs/include/libcfs/winnt/portals_compat25.h +++ b/libcfs/include/libcfs/winnt/portals_compat25.h @@ -46,13 +46,8 @@ #define clear_tsk_thread_flag(current, TIF_SIGPENDING) do {} while(0) #endif -#define ll_proc_dointvec(table, write, filp, buffer, lenp, ppos) \ - proc_dointvec(table, write, filp, buffer, lenp) -#define ll_proc_dostring(table, write, filp, buffer, lenp, ppos) \ - proc_dostring(table, write, filp, buffer, lenp) #define LL_PROC_PROTO(name) \ name(struct ctl_table *table, int write, struct file *filp, \ void __user *buffer, size_t *lenp) -#define DECLARE_LL_PROC_PPOS_DECL loff_t *ppos = &filp->f_pos #endif /* _PORTALS_COMPAT_H */ diff --git a/libcfs/libcfs/linux/linux-proc.c b/libcfs/libcfs/linux/linux-proc.c index bbc363a..dc11f1e 100644 --- a/libcfs/libcfs/linux/linux-proc.c +++ b/libcfs/libcfs/linux/linux-proc.c @@ -255,13 +255,13 @@ int LL_PROC_PROTO(proc_console_max_delay_cs) if (!write) { /* read */ max_delay_cs = cfs_duration_sec(libcfs_console_max_delay * 100); - rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); return rc; } /* write */ max_delay_cs = 0; - rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); if (rc < 0) return rc; if (max_delay_cs <= 0) @@ -286,13 +286,13 @@ int LL_PROC_PROTO(proc_console_min_delay_cs) if (!write) { /* read */ min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100); - rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); return rc; } /* write */ min_delay_cs = 0; - rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); if (rc < 0) return rc; if (min_delay_cs <= 0) @@ -316,13 +316,13 @@ int LL_PROC_PROTO(proc_console_backoff) if (!write) { /* read */ backoff= libcfs_console_backoff; - rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); return rc; } /* write */ backoff = 0; - rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(&dummy, write, buffer, lenp, ppos); if (rc < 0) return rc; if (backoff <= 0) @@ -345,7 +345,7 @@ int LL_PROC_PROTO(proc_fail_loc) int rc; long old_fail_loc = cfs_fail_loc; - rc = ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos); + rc = proc_doulongvec_minmax(table, write, buffer, lenp, ppos); if (old_fail_loc != cfs_fail_loc) wake_up(&cfs_race_waitq); return rc; diff --git a/libcfs/libcfs/winnt/winnt-proc.c b/libcfs/libcfs/winnt/winnt-proc.c index 33ec3aa..94378fe 100644 --- a/libcfs/libcfs/winnt/winnt-proc.c +++ b/libcfs/libcfs/winnt/winnt-proc.c @@ -1055,7 +1055,7 @@ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) #define OP_MIN 4 -static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp, +static int do_proc_dointvec(struct ctl_table *table, int write, void *buffer, size_t *lenp, int conv, int op) { int *i, vleft, first=1, neg, val; @@ -1162,8 +1162,6 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil if (write && first) return -EINVAL; *lenp -= left; - memset(&(filp->f_pos) , 0, sizeof(loff_t)); - filp->f_pos += (loff_t)(*lenp); return 0; } @@ -1171,7 +1169,6 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil * proc_dointvec - read a vector of integers * @table: the sysctl table * @write: %TRUE if this is a write to the sysctl file - * @filp: the file structure * @buffer: the user buffer * @lenp: the size of the user buffer * @@ -1180,10 +1177,10 @@ static int do_proc_dointvec(struct ctl_table *table, int write, struct file *fil * * Returns 0 on success. */ -int proc_dointvec(struct ctl_table *table, int write, struct file *filp, +int proc_dointvec(struct ctl_table *table, int write, void *buffer, size_t *lenp) { - return do_proc_dointvec(table,write,filp,buffer,lenp,1,OP_SET); + return do_proc_dointvec(table,write,buffer,lenp,1,OP_SET); } @@ -1191,7 +1188,6 @@ int proc_dointvec(struct ctl_table *table, int write, struct file *filp, * proc_dostring - read a string sysctl * @table: the sysctl table * @write: %TRUE if this is a write to the sysctl file - * @filp: the file structure * @buffer: the user buffer * @lenp: the size of the user buffer * @@ -1204,14 +1200,14 @@ int proc_dointvec(struct ctl_table *table, int write, struct file *filp, * * Returns 0 on success. */ -int proc_dostring(struct ctl_table *table, int write, struct file *filp, +int proc_dostring(struct ctl_table *table, int write, void *buffer, size_t *lenp) { size_t len; char *p, c; if (!table->data || !table->maxlen || !*lenp || - (filp->f_pos && !write)) { + (!write)) { *lenp = 0; return 0; } @@ -1231,7 +1227,6 @@ int proc_dostring(struct ctl_table *table, int write, struct file *filp, if (copy_from_user(table->data, buffer, len)) return -EFAULT; ((char *) table->data)[len] = 0; - filp->f_pos += *lenp; } else { len = (size_t)strlen(table->data); if (len > (size_t)table->maxlen) @@ -1247,7 +1242,6 @@ int proc_dostring(struct ctl_table *table, int write, struct file *filp, len++; } *lenp = len; - filp->f_pos += len; } return 0; } diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index d38581c..6597dc3 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -624,30 +624,6 @@ AC_DEFUN([LN_CONFIG_USERSPACE], [ ]) -# See if sysctl proc_handler wants only 5 arguments (since 2.6.32) -AC_DEFUN([LN_5ARGS_SYSCTL_PROC_HANDLER], -[AC_MSG_CHECKING([if sysctl proc_handler wants 5 args]) -LB_LINUX_TRY_COMPILE([ - #include -],[ - struct ctl_table *table = NULL; - int write = 1; - void __user *buffer = NULL; - size_t *lenp = NULL; - loff_t *ppos = NULL; - - proc_handler *proc_handler = NULL; - proc_handler(table, write, buffer, lenp, ppos); - -],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_5ARGS_SYSCTL_PROC_HANDLER, 1, - [sysctl proc_handler wants 5 args]) -],[ - AC_MSG_RESULT(no) -]) -]) - # # 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'. # @@ -686,8 +662,6 @@ LN_CONFIG_RALND LN_CONFIG_GNILND LN_CONFIG_PTLLND LN_CONFIG_MX -# 2.6.32 -LN_5ARGS_SYSCTL_PROC_HANDLER # 2.6.36 LN_CONFIG_TCP_SENDPAGE ]) diff --git a/lnet/lnet/router_proc.c b/lnet/lnet/router_proc.c index 588c295..cb19004 100644 --- a/lnet/lnet/router_proc.c +++ b/lnet/lnet/router_proc.c @@ -162,8 +162,6 @@ int LL_PROC_PROTO(proc_lnet_routes) int ver; int off; - DECLARE_LL_PROC_PPOS_DECL; - CLASSERT(sizeof(loff_t) >= 4); off = LNET_PROC_HOFF_GET(*ppos); @@ -289,8 +287,6 @@ int LL_PROC_PROTO(proc_lnet_routers) int ver; int off; - DECLARE_LL_PROC_PPOS_DECL; - off = LNET_PROC_HOFF_GET(*ppos); ver = LNET_PROC_VER_GET(*ppos); @@ -649,8 +645,6 @@ int LL_PROC_PROTO(proc_lnet_nis) char *s; int len; - DECLARE_LL_PROC_PPOS_DECL; - LASSERT (!write); if (*lenp == 0) diff --git a/lustre/obdclass/linux/linux-sysctl.c b/lustre/obdclass/linux/linux-sysctl.c index 25c7179..099cd04 100644 --- a/lustre/obdclass/linux/linux-sysctl.c +++ b/lustre/obdclass/linux/linux-sysctl.c @@ -111,7 +111,7 @@ int LL_PROC_PROTO(proc_set_timeout) { int rc; - rc = ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + rc = proc_dointvec(table, write, buffer, lenp, ppos); if (ldlm_timeout >= obd_timeout) ldlm_timeout = max(obd_timeout / 3, 1U); return rc; @@ -121,7 +121,6 @@ int LL_PROC_PROTO(proc_memory_alloc) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -145,7 +144,6 @@ int LL_PROC_PROTO(proc_pages_alloc) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -169,7 +167,6 @@ int LL_PROC_PROTO(proc_mem_max) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -193,7 +190,6 @@ int LL_PROC_PROTO(proc_pages_max) { char buf[22]; int len; - DECLARE_LL_PROC_PPOS_DECL; if (!*lenp || (*ppos && !write)) { *lenp = 0; @@ -216,7 +212,6 @@ int LL_PROC_PROTO(proc_pages_max) int LL_PROC_PROTO(proc_max_dirty_pages_in_mb) { int rc = 0; - DECLARE_LL_PROC_PPOS_DECL; if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; @@ -256,10 +251,10 @@ int LL_PROC_PROTO(proc_max_dirty_pages_in_mb) } #ifdef RANDOM_FAIL_ALLOC -int LL_PROC_PROTO(proc_alloc_fail_rate) +int proc_alloc_fail_rate(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { int rc = 0; - DECLARE_LL_PROC_PPOS_DECL; if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) { *lenp = 0; @@ -290,23 +285,23 @@ int LL_PROC_PROTO(proc_alloc_fail_rate) int LL_PROC_PROTO(proc_at_min) { - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + return proc_dointvec(table, write, buffer, lenp, ppos); } int LL_PROC_PROTO(proc_at_max) { - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + return proc_dointvec(table, write, buffer, lenp, ppos); } int LL_PROC_PROTO(proc_at_extra) { - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + return proc_dointvec(table, write, buffer, lenp, ppos); } int LL_PROC_PROTO(proc_at_early_margin) { - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + return proc_dointvec(table, write, buffer, lenp, ppos); } int LL_PROC_PROTO(proc_at_history) { - return ll_proc_dointvec(table, write, filp, buffer, lenp, ppos); + return proc_dointvec(table, write, buffer, lenp, ppos); } #ifdef CONFIG_SYSCTL