staging: lustre: clean up some proc file declarations
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Jul 2014 01:11:25 +0000 (18:11 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Jul 2014 01:11:25 +0000 (18:11 -0700)
This removes the DECLARE_PROC_HANDLER macro, and makes proc_call_handler
a static function (horrible name to be in a module).  This makes the
linux-prim.h file empty now, so it can be removed soon.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/linux/linux-prim.h
drivers/staging/lustre/include/linux/libcfs/linux/portals_compat25.h
drivers/staging/lustre/lnet/lnet/router_proc.c
drivers/staging/lustre/lustre/libcfs/linux/linux-proc.c

index 43ce3a05f59bb4b03044bdb7a9cb69eeaff08650..8ea857684d65f509bc9bb93c85e01e82827f282a 100644 (file)
 
 #include "linux-time.h"
 
-/*
- * Sysctl register
- */
-#define DECLARE_PROC_HANDLER(name)                                     \
-static int name(struct ctl_table *table, int write,                    \
-               void __user *buffer, size_t *lenp, loff_t *ppos)        \
-{                                                                      \
-       return proc_call_handler(table->data, write,                    \
-                                ppos, buffer, lenp,                    \
-                                __##name);                             \
-}
-
 #endif
index 4fe072056da2eefdd7e944d6f80f7b90ffda698a..0728f20b499f17fd9a1194747f12c8c05b55875b 100644 (file)
 #define ll_proc_dolongvec(table, write, filp, buffer, lenp, ppos)      \
        proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 
-/* helper for sysctl handlers */
-int proc_call_handler(void *data, int write,
-                     loff_t *ppos, void *buffer, size_t *lenp,
-                     int (*handler)(void *data, int write,
-                                    loff_t pos, void *buffer, int len));
-
 #endif /* _PORTALS_COMPAT_H */
index 60b2e844a33d631f71a6e695789f322d5156dbab..122ebf430d2a4f5f6819f15470b3db3fc82faaf2 100644 (file)
@@ -90,6 +90,24 @@ enum {
 
 #define LNET_PROC_VERSION(v)   ((unsigned int)((v) & LNET_PROC_VER_MASK))
 
+static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer,
+                            size_t *lenp, int (*handler)(void *data, int write,
+                            loff_t pos, void *buffer, int len))
+{
+       int rc = handler(data, write, *ppos, buffer, *lenp);
+
+       if (rc < 0)
+               return rc;
+
+       if (write) {
+               *ppos += *lenp;
+       } else {
+               *lenp = rc;
+               *ppos += rc;
+       }
+       return 0;
+}
+
 static int __proc_lnet_stats(void *data, int write,
                             loff_t pos, void *buffer, int nob)
 {
@@ -139,7 +157,12 @@ static int __proc_lnet_stats(void *data, int write,
        return rc;
 }
 
-DECLARE_PROC_HANDLER(proc_lnet_stats);
+static int proc_lnet_stats(struct ctl_table *table, int write,
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_lnet_stats);
+}
 
 int proc_lnet_routes(struct ctl_table *table, int write, void __user *buffer,
                     size_t *lenp, loff_t *ppos)
@@ -627,7 +650,12 @@ static int __proc_lnet_buffers(void *data, int write,
        return rc;
 }
 
-DECLARE_PROC_HANDLER(proc_lnet_buffers);
+static int proc_lnet_buffers(struct ctl_table *table, int write,
+                            void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_lnet_buffers);
+}
 
 int proc_lnet_nis(struct ctl_table *table, int write, void __user *buffer,
                  size_t *lenp, loff_t *ppos)
@@ -847,7 +875,14 @@ out:
        LIBCFS_FREE(buf, buf_len);
        return rc;
 }
-DECLARE_PROC_HANDLER(proc_lnet_portal_rotor);
+
+static int proc_lnet_portal_rotor(struct ctl_table *table, int write,
+                                 void __user *buffer, size_t *lenp,
+                                 loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_lnet_portal_rotor);
+}
 
 static struct ctl_table lnet_table[] = {
        /*
index 68e41f780e7446f129f032cc44fd7acaf4db17d6..0732ff4ca72fe4b781a0fc53ef18f3f4e5000e83 100644 (file)
@@ -98,11 +98,9 @@ enum {
        PSDEV_LNET_FAIL_VAL,      /* userdata for fail loc */
 };
 
-int
-proc_call_handler(void *data, int write,
-                 loff_t *ppos, void *buffer, size_t *lenp,
-                 int (*handler)(void *data, int write,
-                                loff_t pos, void *buffer, int len))
+static int proc_call_handler(void *data, int write, loff_t *ppos, void *buffer,
+                            size_t *lenp, int (*handler)(void *data, int write,
+                            loff_t pos, void *buffer, int len))
 {
        int rc = handler(data, write, *ppos, buffer, *lenp);
 
@@ -117,7 +115,6 @@ proc_call_handler(void *data, int write,
        }
        return 0;
 }
-EXPORT_SYMBOL(proc_call_handler);
 
 static int __proc_dobitmasks(void *data, int write,
                             loff_t pos, void *buffer, int nob)
@@ -160,7 +157,12 @@ static int __proc_dobitmasks(void *data, int write,
        return rc;
 }
 
-DECLARE_PROC_HANDLER(proc_dobitmasks)
+static int proc_dobitmasks(struct ctl_table *table, int write,
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_dobitmasks);
+}
 
 static int min_watchdog_ratelimit = 0;   /* disable ratelimiting */
 static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */
@@ -174,7 +176,12 @@ static int __proc_dump_kernel(void *data, int write,
        return cfs_trace_dump_debug_buffer_usrstr(buffer, nob);
 }
 
-DECLARE_PROC_HANDLER(proc_dump_kernel)
+static int proc_dump_kernel(struct ctl_table *table, int write,
+                           void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_dump_kernel);
+}
 
 static int __proc_daemon_file(void *data, int write,
                              loff_t pos, void *buffer, int nob)
@@ -192,7 +199,12 @@ static int __proc_daemon_file(void *data, int write,
        return cfs_trace_daemon_command_usrstr(buffer, nob);
 }
 
-DECLARE_PROC_HANDLER(proc_daemon_file)
+static int proc_daemon_file(struct ctl_table *table, int write,
+                           void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_daemon_file);
+}
 
 static int __proc_debug_mb(void *data, int write,
                           loff_t pos, void *buffer, int nob)
@@ -212,7 +224,12 @@ static int __proc_debug_mb(void *data, int write,
        return cfs_trace_set_debug_mb_usrstr(buffer, nob);
 }
 
-DECLARE_PROC_HANDLER(proc_debug_mb)
+static int proc_debug_mb(struct ctl_table *table, int write,
+                        void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_debug_mb);
+}
 
 int proc_console_max_delay_cs(struct ctl_table *table, int write,
                              void __user *buffer, size_t *lenp, loff_t *ppos)
@@ -366,7 +383,13 @@ static int __proc_cpt_table(void *data, int write,
                LIBCFS_FREE(buf, len);
        return rc;
 }
-DECLARE_PROC_HANDLER(proc_cpt_table)
+
+static int proc_cpt_table(struct ctl_table *table, int write,
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+       return proc_call_handler(table->data, write, ppos, buffer, lenp,
+                                __proc_cpt_table);
+}
 
 static struct ctl_table lnet_table[] = {
        /*