Whamcloud - gitweb
LU-3963 libcfs: remove proc handler wrappers 63/11963/3
authorJames Simmons <uja.ornl@gmail.com>
Wed, 17 Sep 2014 21:50:16 +0000 (17:50 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 25 Sep 2014 02:45:24 +0000 (02:45 +0000)
Libcfs has wrappers to handle other platforms proc
handling  which is no longer needed. This patch unwinds
those wrappers.

Change-Id: I529a5c3ac0fe6eed9e967782d9d24e40215d3840
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-on: http://review.whamcloud.com/11963
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
14 files changed:
libcfs/include/libcfs/linux/Makefile.am
libcfs/include/libcfs/linux/kp30.h
libcfs/include/libcfs/linux/libcfs.h
libcfs/include/libcfs/linux/linux-prim.h
libcfs/include/libcfs/linux/linux-tcpip.h
libcfs/include/libcfs/linux/linux-time.h
libcfs/include/libcfs/linux/portals_compat25.h [deleted file]
libcfs/libcfs/linux/linux-debug.c
libcfs/libcfs/linux/linux-proc.c
lnet/klnds/gnilnd/gnilnd_sysctl.c
lnet/klnds/socklnd/socklnd_lib-linux.h
lnet/lnet/router_proc.c
lustre/include/linux/lustre_compat25.h
lustre/obdclass/linux/linux-sysctl.c

index 409ac3c..acfb486 100644 (file)
@@ -1,3 +1,3 @@
 EXTRA_DIST = kp30.h libcfs.h linux-fs.h linux-lock.h linux-mem.h       \
        linux-prim.h linux-time.h linux-tcpip.h linux-cpu.h             \
-       portals_compat25.h linux-crypto.h
+       linux-crypto.h
index 8204dba..339e0ec 100644 (file)
@@ -71,8 +71,6 @@
 #include <linux/moduleparam.h>
 #include <linux/scatterlist.h>
 
-#include <libcfs/linux/portals_compat25.h>
-
 /******************************************************************************/
 /* Module parameter support */
 #define CFS_MODULE_PARM(name, t, type, perm, desc) \
index 8c6864f..7f3ba3e 100644 (file)
@@ -111,6 +111,11 @@ do {                                                                    \
  */
 #define CFS_CURPROC_COMM_MAX (sizeof ((struct task_struct *)0)->comm)
 
+/* helper for sysctl handlers */
+int lprocfs_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));
+
 #include <linux/capability.h>
 
 /*
index 9622b63..cb679ca 100644 (file)
@@ -67,7 +67,6 @@
 #endif
 #include <linux/user_namespace.h>
 #include <linux/miscdevice.h>
-#include <libcfs/linux/portals_compat25.h>
 #include <asm/div64.h>
 
 #include <libcfs/linux/linux-time.h>
 #define NR_CPUS                                1
 #endif
 
-#define DECLARE_PROC_HANDLER(name)                      \
-static int                                              \
-LL_PROC_PROTO(name)                                     \
-{                                                       \
-        return proc_call_handler(table->data, write,    \
-                                 ppos, buffer, lenp,    \
-                                 __##name);             \
-}
-
 /*
  * Wait Queue
  */
index 2e04b1f..bec571a 100644 (file)
@@ -50,7 +50,6 @@
 #endif
 
 #include <net/sock.h>
-#include <libcfs/linux/portals_compat25.h>
 
 #ifndef HIPQUAD
 // XXX Should just kill all users
index f85ca34..987dfc1 100644 (file)
 #include <linux/time.h>
 #include <asm/div64.h>
 
-#include <libcfs/linux/portals_compat25.h>
-
 /*
  * post 2.5 kernels.
  */
diff --git a/libcfs/include/libcfs/linux/portals_compat25.h b/libcfs/include/libcfs/linux/portals_compat25.h
deleted file mode 100644 (file)
index c946564..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2013, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#ifndef __LIBCFS_LINUX_PORTALS_COMPAT_H__
-#define __LIBCFS_LINUX_PORTALS_COMPAT_H__
-
-#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,
-                      loff_t *ppos, void *buffer, size_t *lenp,
-                      int (*handler)(void *data, int write,
-                                     loff_t pos, void *buffer, int len));
-
-#ifdef HAVE_INIT_NET
-# define DEFAULT_NET   (&init_net)
-#else
-/* some broken backports */
-# define DEFAULT_NET   (NULL)
-#endif
-
-#endif /* _PORTALS_COMPAT_H */
index 3fb9797..a140d61 100644 (file)
@@ -63,7 +63,6 @@
 # define DEBUG_SUBSYSTEM S_LNET
 
 #include <libcfs/libcfs.h>
-#include <libcfs/linux/portals_compat25.h>
 
 #include "tracefile.h"
 
index 113dc18..d5a979b 100644 (file)
@@ -76,11 +76,9 @@ extern char lnet_upcall[1024];
  */
 extern char lnet_debug_log_upcall[1024];
 
-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 lprocfs_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);
 
@@ -95,7 +93,7 @@ proc_call_handler(void *data, int write,
         }
         return 0;
 }
-EXPORT_SYMBOL(proc_call_handler);
+EXPORT_SYMBOL(lprocfs_call_handler);
 
 static int __proc_dobitmasks(void *data, int write,
                              loff_t pos, void *buffer, int nob)
@@ -138,7 +136,13 @@ 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 lprocfs_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 */
@@ -152,7 +156,13 @@ 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 lprocfs_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)
@@ -170,7 +180,13 @@ 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 lprocfs_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)
@@ -190,9 +206,17 @@ 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 lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                   __proc_debug_mb);
+}
 
-int LL_PROC_PROTO(proc_console_max_delay_cs)
+static int
+proc_console_max_delay_cs(struct ctl_table *table, int write,
+                         void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int rc, max_delay_cs;
        struct ctl_table dummy = *table;
@@ -223,7 +247,9 @@ int LL_PROC_PROTO(proc_console_max_delay_cs)
         return rc;
 }
 
-int LL_PROC_PROTO(proc_console_min_delay_cs)
+static int
+proc_console_min_delay_cs(struct ctl_table *table, int write,
+                         void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int rc, min_delay_cs;
        struct ctl_table dummy = *table;
@@ -254,7 +280,9 @@ int LL_PROC_PROTO(proc_console_min_delay_cs)
        return rc;
 }
 
-int LL_PROC_PROTO(proc_console_backoff)
+static int
+proc_console_backoff(struct ctl_table *table, int write, void __user *buffer,
+                    size_t *lenp, loff_t *ppos)
 {
        int rc, backoff;
        struct ctl_table dummy = *table;
@@ -281,14 +309,18 @@ int LL_PROC_PROTO(proc_console_backoff)
        return rc;
 }
 
-int LL_PROC_PROTO(libcfs_force_lbug)
+static int
+libcfs_force_lbug(struct ctl_table *table, int write, void __user *buffer,
+                 size_t *lenp, loff_t *ppos)
 {
         if (write)
                 LBUG();
         return 0;
 }
 
-int LL_PROC_PROTO(proc_fail_loc)
+static int
+proc_fail_loc(struct ctl_table *table, int write, void __user *buffer,
+             size_t *lenp, loff_t *ppos)
 {
        int rc;
        long old_fail_loc = cfs_fail_loc;
@@ -339,7 +371,14 @@ 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 lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                    __proc_cpt_table);
+}
 
 static struct ctl_table lnet_table[] = {
        /*
index 4a083a9..a6fd107 100644 (file)
@@ -40,7 +40,9 @@ static kgn_sysctl_data_t        kgnilnd_sysctl;
 
 static struct ctl_table_header *kgnilnd_table_header = NULL;
 
-static int LL_PROC_PROTO(proc_toggle_thread_pause)
+static int
+proc_toggle_thread_pause(struct ctl_table *table, int write,
+                        void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int  old_val = kgnilnd_sysctl.ksd_pause_trigger;
        int  rc = 0;
@@ -68,7 +70,9 @@ static int LL_PROC_PROTO(proc_toggle_thread_pause)
        RETURN(rc);
 }
 
-static int LL_PROC_PROTO(proc_hw_quiesce)
+static int
+proc_hw_quiesce(struct ctl_table *table, int write, void __user *buffer,
+               size_t *lenp, loff_t *ppos)
 {
        int              rc = 0;
        kgn_device_t    *dev;
@@ -97,7 +101,9 @@ static int LL_PROC_PROTO(proc_hw_quiesce)
        RETURN(rc);
 }
 
-int LL_PROC_PROTO(proc_trigger_stack_reset)
+static int
+proc_trigger_stack_reset(struct ctl_table *table, int write,
+                        void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int              rc = 0;
        int              i = 1;
@@ -129,7 +135,9 @@ int LL_PROC_PROTO(proc_trigger_stack_reset)
        RETURN(rc);
 }
 
-static int LL_PROC_PROTO(proc_toggle_rdmaq_override)
+static int
+proc_toggle_rdmaq_override(struct ctl_table *table, int write,
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int  old_val = kgnilnd_sysctl.ksd_rdmaq_override;
        int  rc = 0;
@@ -161,7 +169,9 @@ static int LL_PROC_PROTO(proc_toggle_rdmaq_override)
 /* /proc/sys entry point for injecting up/down nid event
  * <up|down> <nid>
  */
-static int LL_PROC_PROTO(proc_peer_state)
+static int
+proc_peer_state(struct ctl_table *table, int write, void __user *buffer,
+               size_t *lenp, loff_t *ppos)
 {
        int             rc;
        int             nid;
index 379892c..6979809 100644 (file)
@@ -67,7 +67,6 @@
 #include <linux/syscalls.h>
 
 #include <libcfs/libcfs.h>
-#include <libcfs/linux/portals_compat25.h>
 
 #include <linux/crc32.h>
 static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
index 1211b35..edbc0ec 100644 (file)
@@ -128,9 +128,17 @@ 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 lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                   __proc_lnet_stats);
+}
 
-int LL_PROC_PROTO(proc_lnet_routes)
+static int
+proc_lnet_routes(struct ctl_table *table, int write, void __user *buffer,
+                size_t *lenp, loff_t *ppos)
 {
        const int       tmpsiz = 256;
        char            *tmpstr;
@@ -255,7 +263,9 @@ int LL_PROC_PROTO(proc_lnet_routes)
         return rc;
 }
 
-int LL_PROC_PROTO(proc_lnet_routers)
+static int
+proc_lnet_routers(struct ctl_table *table, int write, void __user *buffer,
+                 size_t *lenp, loff_t *ppos)
 {
         int        rc = 0;
         char      *tmpstr;
@@ -389,7 +399,9 @@ int LL_PROC_PROTO(proc_lnet_routers)
         return rc;
 }
 
-int LL_PROC_PROTO(proc_lnet_peers)
+static int
+proc_lnet_peers(struct ctl_table *table, int write, void __user *buffer,
+               size_t *lenp, loff_t *ppos)
 {
        const int               tmpsiz  = 256;
        struct lnet_peer_table  *ptable;
@@ -613,9 +625,17 @@ 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 lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                   __proc_lnet_buffers);
+}
 
-int LL_PROC_PROTO(proc_lnet_nis)
+static int
+proc_lnet_nis(struct ctl_table *table, int write, void __user *buffer,
+             size_t *lenp, loff_t *ppos)
 {
        int     tmpsiz = 128 * LNET_CPT_NUMBER;
         int        rc = 0;
@@ -832,7 +852,15 @@ 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 lprocfs_call_handler(table->data, write, ppos, buffer, lenp,
+                                   __proc_lnet_portal_rotor);
+}
+
 
 static struct ctl_table lnet_table[] = {
        /*
index 15fb569..79c6db0 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <linux/fs_struct.h>
 #include <linux/namei.h>
-#include <libcfs/linux/portals_compat25.h>
 
 #include <linux/lustre_patchless_compat.h>
 
index 326218f..dd94b46 100644 (file)
@@ -57,7 +57,9 @@
 struct ctl_table_header *obd_table_header = NULL;
 #endif
 
-int LL_PROC_PROTO(proc_set_timeout)
+static int
+proc_set_timeout(struct ctl_table *table, int write, void __user *buffer,
+                size_t *lenp, loff_t *ppos)
 {
         int rc;
 
@@ -67,7 +69,9 @@ int LL_PROC_PROTO(proc_set_timeout)
         return rc;
 }
 
-int LL_PROC_PROTO(proc_memory_alloc)
+static int
+proc_memory_alloc(struct ctl_table *table, int write, void __user *buffer,
+                 size_t *lenp, loff_t *ppos)
 {
         char buf[22];
         int len;
@@ -90,7 +94,9 @@ int LL_PROC_PROTO(proc_memory_alloc)
         return 0;
 }
 
-int LL_PROC_PROTO(proc_pages_alloc)
+static int
+proc_pages_alloc(struct ctl_table *table, int write, void __user *buffer,
+                size_t *lenp, loff_t *ppos)
 {
         char buf[22];
         int len;
@@ -113,7 +119,9 @@ int LL_PROC_PROTO(proc_pages_alloc)
         return 0;
 }
 
-int LL_PROC_PROTO(proc_mem_max)
+static int
+proc_mem_max(struct ctl_table *table, int write, void __user *buffer,
+            size_t *lenp, loff_t *ppos)
 {
         char buf[22];
         int len;
@@ -136,7 +144,9 @@ int LL_PROC_PROTO(proc_mem_max)
         return 0;
 }
 
-int LL_PROC_PROTO(proc_pages_max)
+static int
+proc_pages_max(struct ctl_table *table, int write, void __user *buffer,
+              size_t *lenp, loff_t *ppos)
 {
         char buf[22];
         int len;
@@ -159,7 +169,9 @@ int LL_PROC_PROTO(proc_pages_max)
         return 0;
 }
 
-int LL_PROC_PROTO(proc_max_dirty_pages_in_mb)
+static int
+proc_max_dirty_pages_in_mb(struct ctl_table *table, int write,
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int rc = 0;
 
@@ -233,31 +245,6 @@ int proc_alloc_fail_rate(struct ctl_table *table, int write,
 }
 #endif
 
-int LL_PROC_PROTO(proc_bulk_timeout)
-{
-       return proc_dointvec(table, write, buffer, lenp, ppos);
-}
-int LL_PROC_PROTO(proc_at_min)
-{
-       return proc_dointvec(table, write, buffer, lenp, ppos);
-}
-int LL_PROC_PROTO(proc_at_max)
-{
-       return proc_dointvec(table, write, buffer, lenp, ppos);
-}
-int LL_PROC_PROTO(proc_at_extra)
-{
-       return proc_dointvec(table, write, buffer, lenp, ppos);
-}
-int LL_PROC_PROTO(proc_at_early_margin)
-{
-       return proc_dointvec(table, write, buffer, lenp, ppos);
-}
-int LL_PROC_PROTO(proc_at_history)
-{
-       return proc_dointvec(table, write, buffer, lenp, ppos);
-}
-
 #ifdef CONFIG_SYSCTL
 static struct ctl_table obd_table[] = {
        {
@@ -356,7 +343,7 @@ static struct ctl_table obd_table[] = {
                .data           = &bulk_timeout,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_bulk_timeout
+               .proc_handler   = &proc_dointvec
        },
        {
                INIT_CTL_NAME
@@ -364,7 +351,7 @@ static struct ctl_table obd_table[] = {
                .data           = &at_min,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_at_min
+               .proc_handler   = &proc_dointvec
        },
        {
                INIT_CTL_NAME
@@ -372,7 +359,7 @@ static struct ctl_table obd_table[] = {
                .data           = &at_max,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_at_max
+               .proc_handler   = &proc_dointvec
        },
        {
                INIT_CTL_NAME
@@ -380,7 +367,7 @@ static struct ctl_table obd_table[] = {
                .data           = &at_extra,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_at_extra
+               .proc_handler   = &proc_dointvec
        },
        {
                INIT_CTL_NAME
@@ -388,7 +375,7 @@ static struct ctl_table obd_table[] = {
                .data           = &at_early_margin,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_at_early_margin
+               .proc_handler   = &proc_dointvec
        },
        {
                INIT_CTL_NAME
@@ -396,7 +383,7 @@ static struct ctl_table obd_table[] = {
                .data           = &at_history,
                .maxlen         = sizeof(int),
                .mode           = 0644,
-               .proc_handler   = &proc_at_history
+               .proc_handler   = &proc_dointvec
        },
        { 0 }
 };