Whamcloud - gitweb
LU-2800 autoconf: remove LN_5ARGS_SYSCTL_PROC_HANDLER test 11/5411/9
authorJames Simmons <uja.ornl@gmail.com>
Tue, 17 Sep 2013 17:48:24 +0000 (13:48 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 25 Oct 2013 01:40:43 +0000 (01:40 +0000)
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 <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I8c5fc509e1c8bc52705090f5eedf8fb10d549cf5
Reviewed-on: http://review.whamcloud.com/5411
Tested-by: Hudson
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/include/libcfs/linux/linux-prim.h
libcfs/include/libcfs/linux/portals_compat25.h
libcfs/include/libcfs/winnt/portals_compat25.h
libcfs/libcfs/linux/linux-proc.c
libcfs/libcfs/winnt/winnt-proc.c
lnet/autoconf/lustre-lnet.m4
lnet/lnet/router_proc.c
lustre/obdclass/linux/linux-sysctl.c

index b59865b..e525279 100644 (file)
@@ -87,8 +87,6 @@
 static int                                              \
 LL_PROC_PROTO(name)                                     \
 {                                                       \
 static int                                              \
 LL_PROC_PROTO(name)                                     \
 {                                                       \
-        DECLARE_LL_PROC_PPOS_DECL;                      \
-                                                        \
         return proc_call_handler(table->data, write,    \
                                  ppos, buffer, lenp,    \
                                  __##name);             \
         return proc_call_handler(table->data, write,    \
                                  ppos, buffer, lenp,    \
                                  __##name);             \
index 741f3e6..52b6244 100644 (file)
 #define __user
 #endif
 
 #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,
 
 /* helper for sysctl handlers */
 int proc_call_handler(void *data, int write,
index 6f6ea7e..c563e33 100644 (file)
 #define clear_tsk_thread_flag(current, TIF_SIGPENDING) do {} while(0)
 #endif
 
 #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 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 */
 
 #endif /* _PORTALS_COMPAT_H */
index bbc363a..dc11f1e 100644 (file)
@@ -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);
 
         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;
                 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)
         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);
 
        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;
                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)
        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;
 
        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;
                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)
        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;
 
        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;
        if (old_fail_loc != cfs_fail_loc)
                wake_up(&cfs_race_waitq);
        return rc;
index 33ec3aa..94378fe 100644 (file)
@@ -1055,7 +1055,7 @@ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
 #define OP_MIN  4
 
 
 #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;
           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;
     if (write && first)
         return -EINVAL;
     *lenp -= left;
-    memset(&(filp->f_pos) , 0, sizeof(loff_t));
-    filp->f_pos += (loff_t)(*lenp);
     return 0;
 }
 
     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
  * 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
  *
  * @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.
  */
  *
  * 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)
 {
              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
  * 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
  *
  * @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.
  */
  *
  * 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 ||
           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;
     }
         *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;
        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)
     } 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;
             len++;
         }
         *lenp = len;
-        filp->f_pos += len;
     }
     return 0;
 }
     }
     return 0;
 }
index d38581c..6597dc3 100644 (file)
@@ -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 <linux/sysctl.h>
-],[
-        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'.
 #
 #
 # 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
 LN_CONFIG_GNILND
 LN_CONFIG_PTLLND
 LN_CONFIG_MX
-# 2.6.32
-LN_5ARGS_SYSCTL_PROC_HANDLER
 # 2.6.36
 LN_CONFIG_TCP_SENDPAGE
 ])
 # 2.6.36
 LN_CONFIG_TCP_SENDPAGE
 ])
index 588c295..cb19004 100644 (file)
@@ -162,8 +162,6 @@ int LL_PROC_PROTO(proc_lnet_routes)
        int             ver;
        int             off;
 
        int             ver;
        int             off;
 
-       DECLARE_LL_PROC_PPOS_DECL;
-
        CLASSERT(sizeof(loff_t) >= 4);
 
        off = LNET_PROC_HOFF_GET(*ppos);
        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;
 
         int        ver;
        int        off;
 
-       DECLARE_LL_PROC_PPOS_DECL;
-
        off = LNET_PROC_HOFF_GET(*ppos);
        ver = LNET_PROC_VER_GET(*ppos);
 
        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;
 
         char      *s;
         int        len;
 
-        DECLARE_LL_PROC_PPOS_DECL;
-
         LASSERT (!write);
 
         if (*lenp == 0)
         LASSERT (!write);
 
         if (*lenp == 0)
index 25c7179..099cd04 100644 (file)
@@ -111,7 +111,7 @@ int LL_PROC_PROTO(proc_set_timeout)
 {
         int rc;
 
 {
         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;
         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;
 {
         char buf[22];
         int len;
-        DECLARE_LL_PROC_PPOS_DECL;
 
         if (!*lenp || (*ppos && !write)) {
                 *lenp = 0;
 
         if (!*lenp || (*ppos && !write)) {
                 *lenp = 0;
@@ -145,7 +144,6 @@ int LL_PROC_PROTO(proc_pages_alloc)
 {
         char buf[22];
         int len;
 {
         char buf[22];
         int len;
-        DECLARE_LL_PROC_PPOS_DECL;
 
         if (!*lenp || (*ppos && !write)) {
                 *lenp = 0;
 
         if (!*lenp || (*ppos && !write)) {
                 *lenp = 0;
@@ -169,7 +167,6 @@ int LL_PROC_PROTO(proc_mem_max)
 {
         char buf[22];
         int len;
 {
         char buf[22];
         int len;
-        DECLARE_LL_PROC_PPOS_DECL;
 
         if (!*lenp || (*ppos && !write)) {
                 *lenp = 0;
 
         if (!*lenp || (*ppos && !write)) {
                 *lenp = 0;
@@ -193,7 +190,6 @@ int LL_PROC_PROTO(proc_pages_max)
 {
         char buf[22];
         int len;
 {
         char buf[22];
         int len;
-        DECLARE_LL_PROC_PPOS_DECL;
 
         if (!*lenp || (*ppos && !write)) {
                 *lenp = 0;
 
         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;
 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;
 
        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
 }
 
 #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;
 {
         int rc          = 0;
-        DECLARE_LL_PROC_PPOS_DECL;
 
         if (!table->data || !table->maxlen || !*lenp || (*ppos && !write)) {
                 *lenp = 0;
 
         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)
 {
 
 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)
 {
 }
 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)
 {
 }
 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)
 {
 }
 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)
 {
 }
 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
 }
 
 #ifdef CONFIG_SYSCTL