Whamcloud - gitweb
LU-1346 libcfs: cleanup libcfs primitive (linux-prim.h) 54/6954/8
authorPeng Tao <tao.peng@emc.com>
Wed, 11 Sep 2013 16:46:17 +0000 (00:46 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 13 Sep 2013 03:40:21 +0000 (03:40 +0000)
Affected primitives:

CFS_KERN_XXX, CFS_L1_CACHE_ALIGN, CFS_NR_IRQS, CFS_EXPORT_SYMBOL,
cfs_psdev_t, cfs_psdev_register/deregister, cfs_sysctl_table_t,
cfs_sysctl_table_header_t, cfs_unregister_sysctl_table,
PORTAL_SYMBOL_PUT/GET, PORTAL_MODULE_USE/UNUSE, cfs_(try_)module_get,
__cfs_module_get, cfs_module_refcount, cfs_module_t,
cfs_request_module

Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: Ie1ab42d60b2cba052bb21f4ec5b02a7f7a555515
Reviewed-on: http://review.whamcloud.com/6954
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
85 files changed:
contrib/scripts/libcfs_cleanup.sed
libcfs/include/libcfs/darwin/darwin-prim.h
libcfs/include/libcfs/darwin/kp30.h
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/libcfs_prim.h
libcfs/include/libcfs/linux/kp30.h
libcfs/include/libcfs/linux/linux-prim.h
libcfs/include/libcfs/linux/portals_compat25.h
libcfs/include/libcfs/params_tree.h
libcfs/include/libcfs/posix/libcfs.h
libcfs/include/libcfs/posix/posix-wordsize.h
libcfs/include/libcfs/user-prim.h
libcfs/include/libcfs/winnt/kp30.h
libcfs/include/libcfs/winnt/portals_compat25.h
libcfs/include/libcfs/winnt/winnt-fs.h
libcfs/include/libcfs/winnt/winnt-prim.h
libcfs/libcfs/darwin/darwin-module.c
libcfs/libcfs/darwin/darwin-prim.c
libcfs/libcfs/darwin/darwin-proc.c
libcfs/libcfs/debug.c
libcfs/libcfs/fail.c
libcfs/libcfs/hash.c
libcfs/libcfs/kernel_user_comm.c
libcfs/libcfs/libcfs_lock.c
libcfs/libcfs/libcfs_mem.c
libcfs/libcfs/linux/linux-crypto.c
libcfs/libcfs/linux/linux-module.c
libcfs/libcfs/linux/linux-proc.c
libcfs/libcfs/module.c
libcfs/libcfs/prng.c
libcfs/libcfs/tracefile.c
libcfs/libcfs/tracefile.h
libcfs/libcfs/winnt/winnt-module.c
libcfs/libcfs/winnt/winnt-proc.c
libcfs/libcfs/winnt/winnt-tracefile.c
lnet/klnds/mxlnd/mxlnd.c
lnet/klnds/mxlnd/mxlnd_modparams.c
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/o2iblnd/o2iblnd.h
lnet/klnds/o2iblnd/o2iblnd_modparams.c
lnet/klnds/ptllnd/ptllnd.c
lnet/klnds/ptllnd/ptllnd.h
lnet/klnds/ptllnd/ptllnd_modparams.c
lnet/klnds/qswlnd/qswlnd.c
lnet/klnds/qswlnd/qswlnd.h
lnet/klnds/qswlnd/qswlnd_modparams.c
lnet/klnds/ralnd/ralnd.c
lnet/klnds/ralnd/ralnd.h
lnet/klnds/ralnd/ralnd_modparams.c
lnet/klnds/socklnd/socklnd.c
lnet/klnds/socklnd/socklnd.h
lnet/klnds/socklnd/socklnd_lib-darwin.c
lnet/klnds/socklnd/socklnd_lib-linux.c
lnet/klnds/socklnd/socklnd_lib-winnt.c
lnet/lnet/api-ni.c
lnet/lnet/router_proc.c
lnet/selftest/winnt/selftest-winnt.c
lustre/include/liblustre.h
lustre/include/linux/lustre_fsfilt.h
lustre/include/lprocfs_status.h
lustre/include/lu_object.h
lustre/include/lustre_net.h
lustre/include/lustre_sec.h
lustre/include/obd.h
lustre/llite/llite_lib.c
lustre/llite/lloop.c
lustre/lvfs/fsfilt.c
lustre/mdc/mdc_request.c
lustre/obdclass/class_obd.c
lustre/obdclass/darwin/darwin-module.c
lustre/obdclass/darwin/darwin-sysctl.c
lustre/obdclass/genops.c
lustre/obdclass/linux/linux-module.c
lustre/obdclass/linux/linux-sysctl.c
lustre/obdclass/lu_object.c
lustre/osc/osc_request.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_iam.c
lustre/osd-ldiskfs/osd_iam_lfix.c
lustre/osd-ldiskfs/osd_iam_lvar.c
lustre/osp/osp_dev.c
lustre/ptlrpc/gss/gss_api.h
lustre/ptlrpc/gss/gss_mech_switch.c
lustre/ptlrpc/nrs.c
lustre/ptlrpc/sec.c

index 8b81fec..12d5389 100644 (file)
@@ -435,3 +435,64 @@ s/\bcfs_curproc_is_in_groups\b/in_group_p/g
 s/\bcfs_curproc_umask\b/current_umask/g
 s/\bcfs_curproc_comm\b/current_comm/g
 s/\bcfs_curproc_is_32bit\b/current_is_32bit/g
+
+################################################################################
+# linux primitives (linux-prim.h)
+# debug level
+s/\bCFS_KERN_EMERG\b/KERN_EMERG/g
+/#[ \t]*define[ \t]*\bKERN_EMERG\b[ \t]*\bKERN_EMERG\b/d
+s/\bCFS_KERN_ALERT\b/KERN_ALERT/g
+/#[ \t]*define[ \t]*\bKERN_ALERT\b[ \t]*\bKERN_ALERT\b/d
+s/\bCFS_KERN_CRIT\b/KERN_CRIT/g
+/#[ \t]*define[ \t]*\bKERN_CRIT\b[ \t]*\bKERN_CRIT\b/d
+s/\bCFS_KERN_ERR\b/KERN_ERR/g
+/#[ \t]*define[ \t]*\bKERN_ERR\b[ \t]*\bKERN_ERR\b/d
+s/\bCFS_KERN_WARNING\b/KERN_WARNING/g
+/#[ \t]*define[ \t]*\bKERN_WARNING\b[ \t]*\bKERN_WARNING\b/d
+s/\bCFS_KERN_NOTICE\b/KERN_NOTICE/g
+/#[ \t]*define[ \t]*\bKERN_NOTICE\b[ \t]*\bKERN_NOTICE\b/d
+s/\bCFS_KERN_INFO\b/KERN_INFO/g
+/#[ \t]*define[ \t]*\bKERN_INFO\b[ \t]*\bKERN_INFO\b/d
+s/\bCFS_KERN_DEBUG\b/KERN_DEBUG/g
+/#[ \t]*define[ \t]*\bKERN_DEBUG\b[ \t]*\bKERN_DEBUG\b/d
+# cache
+s/\bCFS_L1_CACHE_ALIGN\b/L1_CACHE_ALIGN/g
+/#[ \t]*define[ \t]*\bL1_CACHE_ALIGN\b *( *\w* *)[ \t]*\bL1_CACHE_ALIGN\b *( *\w* *)/d
+# IRQs
+s/\bCFS_NR_IRQS\b/NR_IRQS/g
+/#[ \t]*define[ \t]*\bNR_IRQS\b[ \t]*\bNR_IRQS\b/d
+s/\bCFS_EXPORT_SYMBOL\b/EXPORT_SYMBOL/g
+/#[ \t]*define[ \t]*\bEXPORT_SYMBOL\b *( *\w* *)[ \t]*\bEXPORT_SYMBOL\b *( *\w* *)/d
+# Pseudo device register
+s/\bcfs_psdev_t\b/struct miscdevice/g
+s/\bcfs_psdev_register\b/misc_register/g
+/#[ \t]*define[ \t]*\bmisc_register\b *( *\w* *)[ \t]*\bmisc_register\b *( *\w* *)/d
+s/\bcfs_psdev_deregister\b/misc_deregister/g
+/#[ \t]*define[ \t]*\bmisc_deregister\b *( *\w* *)[ \t]*\bmisc_deregister\b *( *\w* *)/d
+# Sysctl register
+s/\bcfs_sysctl_table_t\b/struct ctl_table/g
+s/\bcfs_sysctl_table_header_t\b/struct ctl_table_header/g
+# Symbol register
+s/\bcfs_register_sysctl_table\b/register_sysctl_table/g
+s/\bcfs_unregister_sysctl_table\b/unregister_sysctl_table/g
+/#[ \t]*define[ \t]*\bunregister_sysctl_table\b *( *\w* *)[ \t]*\bunregister_sysctl_table\b *( *\w* *)/d
+s/\bPORTAL_SYMBOL_PUT\b/symbol_put/g
+/#[ \t]*define[ \t]*\bsymbol_put\b *( *\w* *)[ \t]*\bsymbol_put\b *( *\w* *)/d
+s/\bPORTAL_SYMBOL_GET\b/symbol_get/g
+/#[ \t]*define[ \t]*\bsymbol_get\b *( *\w* *)[ \t]*\bsymbol_get\b *( *\w* *)/d
+# Module interfaces
+s/\bPORTAL_MODULE_USE\b/cfs_module_get()/g
+s/\bcfs_module_get()/try_module_get(THIS_MODULE)/g
+s/\bcfs_try_module_get\b/try_module_get/g
+/#[ \t]*define[ \t]*\btry_module_get\b.*\btry_module_get\b/d
+s/\bPORTAL_MODULE_UNUSE\b/cfs_module_put(THIS_MODULE)/g
+s/\bcfs_module_put\b/module_put/g
+/#[ \t]*define[ \t]*\bmodule_put\b *( *\w* *)[ \t]*\bmodule_put\b *( *\w* *)/d
+s/\b__cfs_module_get\b/__module_get/g
+/#[ \t]*define[ \t]*\b__module_get\b *( *\w* *)[ \t]*\b__module_get\b *( *\w* *)/d
+s/\bcfs_module_refcount\b/module_refcount/g
+/#[ \t]*define[ \t]*\bmodule_refcount\b *( *\w* *)[ \t]*\bmodule_refcount\b *( *\w* *)/d
+s/\bcfs_module_t\b/struct module/g
+# s/\bcfs_module\b/declare_module/g
+s/\bcfs_request_module\b/request_module/g
+/#[ \t]*define[ \t]*\brequest_module\b[ \t]*\brequest_module\b/d
index 1df7092..d2118e7 100644 (file)
 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
 #endif
 
+#ifndef EXPORT_SYMBOL
+# define EXPORT_SYMBOL(s)
+#endif
+
 #ifdef __KERNEL__
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -103,10 +107,9 @@ extern kern_return_t            cfs_symbol_put(const char *);
  */
 #define        CONFIG_SYSCTL   1
 
-typedef struct sysctl_oid *     cfs_sysctl_table_t;
-typedef cfs_sysctl_table_t      cfs_sysctl_table_header_t;
-cfs_sysctl_table_header_t      *cfs_register_sysctl_table (cfs_sysctl_table_t *table, int arg);
-void cfs_unregister_sysctl_table (cfs_sysctl_table_header_t *table);
+#define ctl_table sysctl_oid
+struct ctl_table *register_sysctl_table(struct ctl_table *table);
+void unregister_sysctl_table(struct ctl_table *table);
 
 /*
  * Proc file system APIs, no /proc fs support in OSX
@@ -128,20 +131,20 @@ typedef int (cfs_write_proc_t)(struct file *file, const char *buffer,
 /*
  * cfs pseudo device
  *
- * cfs_psdev_t
- * cfs_psdev_register:
- * cfs_psdev_deregister:
+ * struct miscdevice
+ * misc_register:
+ * misc_deregister:
  */
-typedef struct {
+struct miscdevice{
        int             index;
        void            *handle;
        const char      *name;
        struct cdevsw   *devsw;
        void            *private;
-} cfs_psdev_t;
+};
 
-extern kern_return_t            cfs_psdev_register(cfs_psdev_t *);
-extern kern_return_t            cfs_psdev_deregister(cfs_psdev_t *);
+extern kern_return_t            misc_register(struct miscdevice *);
+extern kern_return_t            misc_deregister(struct miscdevice *);
 
 /*
  * Task struct and ...
@@ -479,7 +482,6 @@ static inline int request_module(const char *name, ...)
 #define __init
 #endif
 
-#define EXPORT_SYMBOL(s)
 #define MODULE_AUTHOR(s)
 #define MODULE_DESCRIPTION(s)
 #define MODULE_LICENSE(s)
index 27db508..85eec6b 100644 (file)
 #error libcfs_unregister_panic_notifier() missing
 
 /* --------------------------------------------------------------------- */
-
-#define PORTAL_SYMBOL_GET(x)                    ((typeof(&x))cfs_symbol_get(#x))
-#define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
-
-#define PORTAL_MODULE_USE                       do{int i = 0; i++;}while(0)
-#define PORTAL_MODULE_UNUSE                     do{int i = 0; i--;}while(0)
-
 #define num_online_cpus()                       cfs_online_cpus()
 
 /******************************************************************************/
index 76abc5a..9bce8c8 100644 (file)
@@ -161,9 +161,9 @@ void lc_watchdog_dumplog(pid_t pid, void *data);
 /*
  * libcfs pseudo device operations
  *
- * struct cfs_psdev_t and
- * cfs_psdev_register() and
- * cfs_psdev_deregister() are declared in
+ * struct struct miscdevice and
+ * misc_register() and
+ * misc_deregister() are declared in
  * libcfs/<os>/<os>-prim.h
  *
  * It's just draft now.
index 1f066e9..497b98a 100644 (file)
 #ifndef __LIBCFS_PRIM_H__
 #define __LIBCFS_PRIM_H__
 
-#ifndef CFS_EXPORT_SYMBOL
-# define CFS_EXPORT_SYMBOL(s)
-#endif
-
 /*
  * Schedule
  */
index 2c4ecb5..274c599 100644 (file)
 
 #include <libcfs/linux/portals_compat25.h>
 
-/* ------------------------------------------------------------------- */
-
-#define PORTAL_SYMBOL_GET(x) symbol_get(x)
-#define PORTAL_SYMBOL_PUT(x) symbol_put(x)
-
-#define PORTAL_MODULE_USE       try_module_get(THIS_MODULE)
-#define PORTAL_MODULE_UNUSE     module_put(THIS_MODULE)
-
-
 /******************************************************************************/
 /* Module parameter support */
 #define CFS_MODULE_PARM(name, t, type, perm, desc) \
index 5980889..75c064f 100644 (file)
 
 #include <libcfs/linux/linux-time.h>
 
-#define CFS_KERN_EMERG   KERN_EMERG
-#define CFS_KERN_ALERT   KERN_ALERT
-#define CFS_KERN_CRIT    KERN_CRIT
-#define CFS_KERN_ERR     KERN_ERR
-#define CFS_KERN_WARNING KERN_WARNING
-#define CFS_KERN_NOTICE  KERN_NOTICE
-#define CFS_KERN_INFO    KERN_INFO
-#define CFS_KERN_DEBUG   KERN_DEBUG
 
 /*
  * CPU
 #define NR_CPUS                                1
 #endif
 
-/*
- * cache
- */
-#define CFS_L1_CACHE_ALIGN(x)           L1_CACHE_ALIGN(x)
-
-/*
- * IRQs
- */
-#define CFS_NR_IRQS                     NR_IRQS
-
-#define CFS_EXPORT_SYMBOL(s)            EXPORT_SYMBOL(s)
-
-/*
- * Pseudo device register
- */
-typedef struct miscdevice              cfs_psdev_t;
-#define cfs_psdev_register(dev)                misc_register(dev)
-#define cfs_psdev_deregister(dev)      misc_deregister(dev)
-
-/*
- * Sysctl register
- */
-typedef struct ctl_table               cfs_sysctl_table_t;
-typedef struct ctl_table_header                cfs_sysctl_table_header_t;
-
-#define cfs_register_sysctl_table(t, a) register_sysctl_table(t)
-#define cfs_unregister_sysctl_table(t) unregister_sysctl_table(t)
-
 #define DECLARE_PROC_HANDLER(name)                      \
 static int                                              \
 LL_PROC_PROTO(name)                                     \
@@ -131,21 +95,6 @@ LL_PROC_PROTO(name)                                     \
 }
 
 /*
- * Symbol register
- */
-#define cfs_symbol_register(s, p)       do {} while(0)
-#define cfs_symbol_unregister(s)        do {} while(0)
-#define cfs_symbol_get(s)               symbol_get(s)
-#define cfs_symbol_put(s)               symbol_put(s)
-#define cfs_module_get()                try_module_get(THIS_MODULE)
-#define cfs_try_module_get(m)           try_module_get(m)
-#define __cfs_module_get(m)             __module_get(m)
-#define cfs_module_put(m)               module_put(m)
-#define cfs_module_refcount(m)          module_refcount(m)
-
-typedef struct module cfs_module_t;
-
-/*
  * Proc file system APIs
  */
 typedef read_proc_t                     cfs_read_proc_t;
@@ -191,7 +140,6 @@ typedef struct task_struct              cfs_task_t;
 #define cfs_module(name, version, init, fini) \
         module_init(init);                    \
         module_exit(fini)
-#define cfs_request_module              request_module
 
 /*
  * Signal
index 4e19a1c..741f3e6 100644 (file)
@@ -49,9 +49,9 @@
         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(cfs_sysctl_table_t *table, int write,                      \
-             void __user *buffer, size_t *lenp, loff_t *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);
@@ -60,9 +60,9 @@
         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(cfs_sysctl_table_t *table, int write, struct file *filp,   \
-             void __user *buffer, size_t *lenp, loff_t *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
 
index 41413eb..3e94d7d 100644 (file)
@@ -54,7 +54,6 @@ typedef struct proc_inode                       cfs_proc_inode_t;
 typedef struct seq_file                         cfs_seq_file_t;
 typedef struct seq_operations                   cfs_seq_ops_t;
 typedef struct file_operations                  cfs_param_file_ops_t;
-typedef cfs_module_t                           *cfs_param_module_t;
 typedef struct proc_dir_entry                   cfs_param_dentry_t;
 typedef struct poll_table_struct                cfs_poll_table_t;
 #define CFS_PARAM_MODULE                        THIS_MODULE
@@ -151,11 +150,10 @@ typedef struct cfs_seq_operations {
         int   (*show) (cfs_seq_file_t *m, void *v);
 } cfs_seq_ops_t;
 
-typedef void *cfs_param_module_t;
 typedef void *cfs_poll_table_t;
 
-typedef struct cfs_param_file_ops {
-       cfs_param_module_t owner;
+typedef struct cfs_param_file_ops{
+       struct module   *owner;
        int (*open) (cfs_inode_t *, struct file *);
        loff_t (*llseek)(struct file *, loff_t, int);
        int (*release) (cfs_inode_t *, cfs_param_file_t *);
index d03f4d4..e6d91bc 100644 (file)
@@ -226,10 +226,10 @@ typedef __u32 kernel_cap_t;
 /**
  * Module support (probably shouldn't be used in generic code?)
  */
-typedef struct cfs_module {
+struct module {
         int count;
         char *name;
-} cfs_module_t;
+};
 
 static inline void MODULE_AUTHOR(char *name)
 {
@@ -242,30 +242,28 @@ static inline void MODULE_AUTHOR(char *name)
 #define __init
 #define __exit
 
-#define EXPORT_SYMBOL(symbol)
-
-static inline int cfs_request_module(const char *name, ...)
+static inline int request_module(const char *name, ...)
 {
-        return (-EINVAL);
+       return (-EINVAL);
 }
 
-static inline void __cfs_module_get(cfs_module_t *module)
+static inline void __module_get(struct module *module)
 {
 }
 
-static inline int cfs_try_module_get(cfs_module_t *module)
+static inline int try_module_get(struct module *module)
 {
-        return 1;
+       return 1;
 }
 
-static inline void cfs_module_put(cfs_module_t *module)
+static inline void module_put(struct module *module)
 {
 }
 
 
-static inline int cfs_module_refcount(cfs_module_t *m)
+static inline int module_refcount(struct module *m)
 {
-        return 1;
+       return 1;
 }
 
 /***************************************************************************
index 72e8b3b..ad33017 100644 (file)
@@ -56,8 +56,8 @@
 #endif
 
 # define CFS_MODULE_PARM(name, t, type, perm, desc)
-#define PORTAL_SYMBOL_GET(x) inter_module_get(#x)
-#define PORTAL_SYMBOL_PUT(x) inter_module_put(#x)
+#define symbol_get(x) inter_module_get(#x)
+#define symbol_put(x) inter_module_put(#x)
 
 
 #ifdef __CYGWIN__
index 8c0b400..5885728 100644 (file)
  * liblustre is single-threaded, so most "synchronization" APIs are trivial.
  */
 
+#ifndef EXPORT_SYMBOL
+# define EXPORT_SYMBOL(s)
+#endif
+
 #ifndef __KERNEL__
 
 typedef struct proc_dir_entry           cfs_proc_dir_entry_t;
@@ -123,16 +127,17 @@ typedef struct {
 
 #define cfs_in_interrupt()    (0)
 
-typedef void cfs_psdev_t;
+struct miscdevice{
+};
 
-static inline int cfs_psdev_register(cfs_psdev_t *foo)
+static inline int misc_register(struct miscdevice *foo)
 {
-        return 0;
+       return 0;
 }
 
-static inline int cfs_psdev_deregister(cfs_psdev_t *foo)
+static inline int misc_deregister(struct miscdevice *foo)
 {
-        return 0;
+       return 0;
 }
 
 #define cfs_sigfillset(l)               do {} while (0)
@@ -142,7 +147,7 @@ static inline int cfs_psdev_deregister(cfs_psdev_t *foo)
 
 #define CFS_DAEMON_FLAGS                0
 
-#define CFS_L1_CACHE_ALIGN(x)          (x)
+#define L1_CACHE_ALIGN(x)              (x)
 
 #ifdef HAVE_LIBPTHREAD
 typedef int (*cfs_thread_t)(void *);
index 0ef2911..a515b63 100644 (file)
@@ -59,11 +59,11 @@ void libcfs_unregister_panic_notifier();
 #define PORTAL_SYMBOL_REGISTER(x)               cfs_symbol_register(#x, &x)
 #define PORTAL_SYMBOL_UNREGISTER(x)             cfs_symbol_unregister(#x)
 
-#define PORTAL_SYMBOL_GET(x)                    (cfs_symbol_get(#x))
-#define PORTAL_SYMBOL_PUT(x)                    cfs_symbol_put(#x)
+#define symbol_get(x)                    (cfs_symbol_get(#x))
+#define symbol_put(x)                    cfs_symbol_put(#x)
 
-#define PORTAL_MODULE_USE                       do{}while(0)
-#define PORTAL_MODULE_UNUSE                     do{}while(0)
+#define try_module_get(THIS_MODULE)                       do{}while(0)
+#define module_put(THIS_MODULE)                     do{}while(0)
 
 #define printk                                  DbgPrint
 #define ptintf                                  DbgPrint
index 5e46cc3..6f6ea7e 100644 (file)
@@ -50,9 +50,9 @@
         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(cfs_sysctl_table_t *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 */
index 587c308..36809aa 100644 (file)
@@ -91,7 +91,7 @@
 
 struct file_operations
 {
-    cfs_module_t *owner;
+    struct module *owner;
     loff_t (*llseek)(struct file * file, loff_t offset, int origin);
     ssize_t (*read) (struct file * file, char * buf, size_t nbytes, loff_t *ppos);
     ssize_t (*write)(struct file * file, const char * buffer,
index 58603ef..c1b487d 100644 (file)
 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
 #endif
 
+#ifndef EXPORT_SYMBOL
+# define EXPORT_SYMBOL(s)
+#endif
+
 /*
  * libcfs proc device object
  */
@@ -114,15 +118,14 @@ typedef struct file_operations cfs_file_operations_t;
  * Pseudo device register
  */
 
-typedef struct
-{
+typedef struct miscdevice{
     int                     minor;
     const char *            name;
     cfs_file_operations_t * fops;
-} cfs_psdev_t;
+};
 
-int cfs_psdev_register(cfs_psdev_t * psdev);
-int cfs_psdev_deregister(cfs_psdev_t * psdev);
+int misc_register(struct miscdevice *psdev);
+int misc_deregister(struct miscdevice *psdev);
 
 
 /*
@@ -187,31 +190,24 @@ struct proc_dir_entry *PDE(const struct inode *inode);
 /*
  * Sysctl register
  */
+typedef int ctl_handler(struct ctl_table *table,
+                       int *name,  int nlen,
+                       void *oldval, size_t *oldlenp,
+                       void *newval, size_t newlen,
+                       void **context);
 
-typedef struct ctl_table                cfs_sysctl_table_t;
-typedef struct ctl_table_header         cfs_sysctl_table_header_t;
+typedef int proc_handler (struct ctl_table *ctl,
+                         int write, struct file *filp,
+                         void *buffer, size_t *lenp);
 
 
-typedef int ctl_handler (
-            cfs_sysctl_table_t *table,
-            int *name,  int nlen,
-            void *oldval, size_t *oldlenp,
-            void *newval, size_t newlen, 
-            void **context );
-
-typedef int proc_handler (
-            cfs_sysctl_table_t *ctl,
-            int write, struct file * filp,
-            void *buffer, size_t *lenp );
-
-
-int proc_dointvec(cfs_sysctl_table_t *table, int write, struct file *filp,
+int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
                     void *buffer, size_t *lenp);
 
-int proc_dostring(cfs_sysctl_table_t *table, int write, struct file *filp,
+int proc_dostring(struct ctl_table *table, int write, struct file *filp,
                  void *buffer, size_t *lenp);
 
-int sysctl_string(cfs_sysctl_table_t *table, int *name, int nlen,
+int sysctl_string(struct ctl_table *table, int *name, int nlen,
                  void *oldval, size_t *oldlenp,
                  void *newval, size_t newlen, void **context);
 
@@ -246,7 +242,7 @@ struct ctl_table
        void *data;
        int maxlen;
        mode_t mode;
-       cfs_sysctl_table_t *child;
+       struct ctl_table *child;
        proc_handler *proc_handler;     /* text formatting callback */
        ctl_handler *strategy;          /* read / write callback functions */
        cfs_proc_entry_t *de;   /* proc entry block */
@@ -258,7 +254,7 @@ struct ctl_table
 /* the mantaner of the cfs_sysctl_table trees */
 struct ctl_table_header
 {
-       cfs_sysctl_table_t *    ctl_table;
+       struct ctl_table *    ctl_table;
        cfs_list_t              ctl_entry;
 };
 
@@ -285,12 +281,8 @@ cfs_proc_entry_t *proc_mkdir(const char *name,
 #define cfs_free_proc_entry   proc_free_entry
 #define cfs_remove_proc_entry remove_proc_entry
 
-struct ctl_table_header *register_sysctl_table(cfs_sysctl_table_t * table,
-                                               int insert_at_head);
-void unregister_sysctl_table(struct ctl_table_header * header);
-
-#define cfs_register_sysctl_table(t, a)   register_sysctl_table(t, a)
-#define cfs_unregister_sysctl_table(t)    unregister_sysctl_table(t)
+struct ctl_table_header *register_sysctl_table(struct ctl_table *table);
+void unregister_sysctl_table(struct ctl_table_header *header);
 
 /*
  * seq device (linux/seq_file.h)
@@ -721,15 +713,14 @@ void sleep_on(cfs_waitq_t *waitq);
 #define __init
 #endif
 
-typedef struct cfs_module {
+struct module{
     const char *name;
-} cfs_module_t;
+};
 
-extern cfs_module_t libcfs_global_module;
+extern struct module libcfs_global_module;
 #define THIS_MODULE  &libcfs_global_module
 
-#define cfs_request_module(x, y) (0)
-#define EXPORT_SYMBOL(s)
+#define request_module(x, y) (0)
 #define MODULE_AUTHOR(s)
 #define MODULE_DESCRIPTION(s)
 #define MODULE_LICENSE(s)
@@ -753,7 +744,7 @@ extern cfs_module_t libcfs_global_module;
 #define cfs_module(name, version, init, fini) \
         module_init(init);                    \
         module_exit(fini)
-#define cfs_module_refcount(x) (1)
+#define module_refcount(x) (1)
 
 /*
  * typecheck
@@ -827,7 +818,7 @@ libcfs_arch_cleanup(void);
  *  cache alignment size
  */
 
-#define CFS_L1_CACHE_ALIGN(x) (x)
+#define L1_CACHE_ALIGN(x) (x)
 
 #define __cacheline_aligned
 
@@ -849,21 +840,21 @@ libcfs_arch_cleanup(void);
  *  Irp related
  */
 
-#define CFS_NR_IRQS                 512
+#define NR_IRQS                 512
 #define cfs_in_interrupt()          (0)
 
 /*
  *  printk flags
  */
 
-#define CFS_KERN_EMERG      "<0>"   /* system is unusable                   */
-#define CFS_KERN_ALERT      "<1>"   /* action must be taken immediately     */
-#define CFS_KERN_CRIT       "<2>"   /* critical conditions                  */
-#define CFS_KERN_ERR        "<3>"   /* error conditions                     */
-#define CFS_KERN_WARNING    "<4>"   /* warning conditions                   */
-#define CFS_KERN_NOTICE     "<5>"   /* normal but significant condition     */
-#define CFS_KERN_INFO       "<6>"   /* informational                        */
-#define CFS_KERN_DEBUG      "<7>"   /* debug-level messages                 */
+#define KERN_EMERG      "<0>"   /* system is unusable                   */
+#define KERN_ALERT      "<1>"   /* action must be taken immediately     */
+#define KERN_CRIT       "<2>"   /* critical conditions                  */
+#define KERN_ERR        "<3>"   /* error conditions                     */
+#define KERN_WARNING    "<4>"   /* warning conditions                   */
+#define KERN_NOTICE     "<5>"   /* normal but significant condition     */
+#define KERN_INFO       "<6>"   /* informational                        */
+#define KERN_DEBUG      "<7>"   /* debug-level messages                 */
 
 /*
  * Misc
@@ -1083,16 +1074,16 @@ void globfree(glob_t *__pglog);
  *  module routines
  */
 
-static inline void __cfs_module_get(cfs_module_t *module)
+static inline void __module_get(struct module *module)
 {
 }
 
-static inline int cfs_try_module_get(cfs_module_t *module)
+static inline int try_module_get(struct module *module)
 {
-    return 1;
+       return 1;
 }
 
-static inline void cfs_module_put(cfs_module_t *module)
+static inline void module_put(struct module *module)
 {
 }
 
index 8c9f1b4..deea373 100644 (file)
@@ -177,7 +177,7 @@ static struct cdevsw libcfs_devsw =
        .d_type     = 0
 };
 
-cfs_psdev_t libcfs_dev = {
+struct miscdevice libcfs_dev = {
        -1,
        NULL,
        "lnet",
index 12fb9eb..e91dfab 100644 (file)
@@ -60,7 +60,7 @@
  */
 #define KLNET_MAJOR  -1
 
-kern_return_t  cfs_psdev_register(cfs_psdev_t *dev) {
+kern_return_t  misc_register(struct miscdevice *dev) {
        dev->index = cdevsw_add(KLNET_MAJOR, dev->devsw);
        if (dev->index < 0) {
                printf("libcfs_init: failed to allocate a major number!\n");
@@ -72,7 +72,7 @@ kern_return_t  cfs_psdev_register(cfs_psdev_t *dev) {
        return KERN_SUCCESS;
 }
 
-kern_return_t  cfs_psdev_deregister(cfs_psdev_t *dev) {
+kern_return_t  misc_deregister(struct miscdevice *dev) {
        devfs_remove(dev->handle);
        cdevsw_remove(dev->index, dev->devsw);
        return KERN_SUCCESS;
index b1e2e84..1780f5b 100644 (file)
@@ -54,7 +54,7 @@ static struct libcfs_sysctl_sprite {
         struct sysctl_oid_list  *ss_link;
 } libcfs_sysctl_sprite = { 0, NULL };
 
-static cfs_sysctl_table_header_t *libcfs_table_header = NULL;
+static struct ctl_table_header *libcfs_table_header = NULL;
 extern unsigned int libcfs_debug;
 extern unsigned int libcfs_subsystem_debug;
 extern unsigned int libcfs_printk;
@@ -204,7 +204,7 @@ SYSCTL_PROC(_lnet,                      OID_AUTO,       fail_loc,
              CTLTYPE_INT | CTLFLAG_RW ,                 &cfs_fail_loc,
              0,         &proc_fail_loc,                 "I",    "cfs_fail_loc");
 
-static cfs_sysctl_table_t      top_table[] = {
+static struct ctl_table        top_table[] = {
        &sysctl__lnet,
        &sysctl__lnet_debug,
        &sysctl__lnet_subsystem_debug,
@@ -223,28 +223,28 @@ static cfs_sysctl_table_t top_table[] = {
 /*
  * Register sysctl table
  */
-cfs_sysctl_table_header_t *
-cfs_register_sysctl_table (cfs_sysctl_table_t *table, int arg)
+struct ctl_table_header *
+register_sysctl_table(struct ctl_table *table, int arg)
 {
-        cfs_sysctl_table_t      item;
-        int i = 0;
+       struct ctl_table      item;
+       int i = 0;
 
-        while ((item = table[i++]) != NULL) 
-                sysctl_register_oid(item);
-        return table;
+       while ((item = table[i++]) != NULL)
+               sysctl_register_oid(item);
+       return table;
 }
 
 /*
  * Unregister sysctl table
  */
-void
-cfs_unregister_sysctl_table (cfs_sysctl_table_header_t *table) {
-        int i = 0;
-        cfs_sysctl_table_t      item;
+void unregister_sysctl_table(struct ctl_table_header *table)
+{
+       int i = 0;
+       struct ctl_table      item;
 
-        while ((item = table[i++]) != NULL) 
-                sysctl_unregister_oid(item);
-        return;
+       while ((item = table[i++]) != NULL)
+               sysctl_unregister_oid(item);
+       return;
 }
 
 /*
@@ -413,8 +413,8 @@ int
 insert_proc(void)
 {
 #if 1
-        if (!libcfs_table_header) 
-                libcfs_table_header = cfs_register_sysctl_table(top_table, 0);
+       if (!libcfs_table_header)
+               libcfs_table_header = register_sysctl_table(top_table);
 #endif
        return 0;
 }
@@ -423,9 +423,9 @@ void
 remove_proc(void)
 {
 #if 1
-        if (libcfs_table_header != NULL) 
-                cfs_unregister_sysctl_table(libcfs_table_header); 
-        libcfs_table_header = NULL;
+       if (libcfs_table_header != NULL)
+               unregister_sysctl_table(libcfs_table_header);
+       libcfs_table_header = NULL;
 #endif
        return;
 }
index 5a0c270..6818a20 100644 (file)
@@ -229,20 +229,20 @@ libcfs_debug_str2mask(int *mask, const char *str, int is_subsys)
  */
 void libcfs_debug_dumplog_internal(void *arg)
 {
-        CFS_DECL_JOURNAL_DATA;
-
-        CFS_PUSH_JOURNAL;
-
-        if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0) {
-                snprintf(debug_file_name, sizeof(debug_file_name) - 1,
-                         "%s.%ld." LPLD, libcfs_debug_file_path_arr,
-                         cfs_time_current_sec(), (long_ptr_t)arg);
-                printk(CFS_KERN_ALERT "LustreError: dumping log to %s\n",
-                       debug_file_name);
-                cfs_tracefile_dump_all_pages(debug_file_name);
-                libcfs_run_debug_log_upcall(debug_file_name);
-        }
-        CFS_POP_JOURNAL;
+       CFS_DECL_JOURNAL_DATA;
+
+       CFS_PUSH_JOURNAL;
+
+       if (strncmp(libcfs_debug_file_path_arr, "NONE", 4) != 0) {
+               snprintf(debug_file_name, sizeof(debug_file_name) - 1,
+                        "%s.%ld." LPLD, libcfs_debug_file_path_arr,
+                        cfs_time_current_sec(), (long_ptr_t)arg);
+               printk(KERN_ALERT "LustreError: dumping log to %s\n",
+                      debug_file_name);
+               cfs_tracefile_dump_all_pages(debug_file_name);
+               libcfs_run_debug_log_upcall(debug_file_name);
+       }
+       CFS_POP_JOURNAL;
 }
 
 int libcfs_debug_dumplog_thread(void *arg)
@@ -269,7 +269,7 @@ void libcfs_debug_dumplog(void)
                             (void *)(long)current_pid(),
                             "libcfs_debug_dumper");
        if (IS_ERR(dumper))
-               printk(CFS_KERN_ERR "LustreError: cannot start log dump thread:"
+               printk(KERN_ERR "LustreError: cannot start log dump thread:"
                       " %ld\n", PTR_ERR(dumper));
         else
                 cfs_waitq_wait(&wait, CFS_TASK_INTERRUPTIBLE);
@@ -346,9 +346,9 @@ int libcfs_debug_mark_buffer(const char *text)
 
 void libcfs_debug_set_level(unsigned int debug_level)
 {
-        printk(CFS_KERN_WARNING "Lustre: Setting portals debug level to %08x\n",
-               debug_level);
-        libcfs_debug = debug_level;
+       printk(KERN_WARNING "Lustre: Setting portals debug level to %08x\n",
+              debug_level);
+       libcfs_debug = debug_level;
 }
 
 EXPORT_SYMBOL(libcfs_debug_set_level);
index c77ea0a..f84e03b 100644 (file)
@@ -44,10 +44,10 @@ unsigned int cfs_fail_val = 0;
 cfs_waitq_t cfs_race_waitq;
 int cfs_race_state;
 
-CFS_EXPORT_SYMBOL(cfs_fail_loc);
-CFS_EXPORT_SYMBOL(cfs_fail_val);
-CFS_EXPORT_SYMBOL(cfs_race_waitq);
-CFS_EXPORT_SYMBOL(cfs_race_state);
+EXPORT_SYMBOL(cfs_fail_loc);
+EXPORT_SYMBOL(cfs_fail_val);
+EXPORT_SYMBOL(cfs_race_waitq);
+EXPORT_SYMBOL(cfs_race_state);
 
 int __cfs_fail_check_set(__u32 id, __u32 value, int set)
 {
@@ -121,7 +121,7 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set)
 
         return 1;
 }
-CFS_EXPORT_SYMBOL(__cfs_fail_check_set);
+EXPORT_SYMBOL(__cfs_fail_check_set);
 
 int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
 {
@@ -138,4 +138,4 @@ int __cfs_fail_timeout_set(__u32 id, __u32 value, int ms, int set)
         }
         return ret;
 }
-CFS_EXPORT_SYMBOL(__cfs_fail_timeout_set);
+EXPORT_SYMBOL(__cfs_fail_timeout_set);
index f23440d..c1232b7 100644 (file)
@@ -492,7 +492,7 @@ cfs_hash_bd_get(cfs_hash_t *hs, const void *key, cfs_hash_bd_t *bd)
                                      hs->hs_rehash_bits, key, bd);
         }
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_get);
+EXPORT_SYMBOL(cfs_hash_bd_get);
 
 static inline void
 cfs_hash_bd_dep_record(cfs_hash_t *hs, cfs_hash_bd_t *bd, int dep_cur)
@@ -535,7 +535,7 @@ cfs_hash_bd_add_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
         if (!cfs_hash_with_no_itemref(hs))
                 cfs_hash_get(hs, hnode);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_add_locked);
+EXPORT_SYMBOL(cfs_hash_bd_add_locked);
 
 void
 cfs_hash_bd_del_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
@@ -556,7 +556,7 @@ cfs_hash_bd_del_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
         if (!cfs_hash_with_no_itemref(hs))
                 cfs_hash_put_locked(hs, hnode);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_del_locked);
+EXPORT_SYMBOL(cfs_hash_bd_del_locked);
 
 void
 cfs_hash_bd_move_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd_old,
@@ -585,7 +585,7 @@ cfs_hash_bd_move_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd_old,
         if (unlikely(nbkt->hsb_version == 0))
                 nbkt->hsb_version++;
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_move_locked);
+EXPORT_SYMBOL(cfs_hash_bd_move_locked);
 
 enum {
         /** always set, for sanity (avoid ZERO intent) */
@@ -662,7 +662,7 @@ cfs_hash_bd_lookup_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd, const void *key)
         return cfs_hash_bd_lookup_intent(hs, bd, key, NULL,
                                          CFS_HS_LOOKUP_IT_FIND);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_lookup_locked);
+EXPORT_SYMBOL(cfs_hash_bd_lookup_locked);
 
 cfs_hlist_node_t *
 cfs_hash_bd_peek_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd, const void *key)
@@ -670,7 +670,7 @@ cfs_hash_bd_peek_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd, const void *key)
        return cfs_hash_bd_lookup_intent(hs, bd, key, NULL,
                                         CFS_HS_LOOKUP_IT_PEEK);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_peek_locked);
+EXPORT_SYMBOL(cfs_hash_bd_peek_locked);
 
 cfs_hlist_node_t *
 cfs_hash_bd_findadd_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
@@ -681,7 +681,7 @@ cfs_hash_bd_findadd_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
                                          CFS_HS_LOOKUP_IT_ADD |
                                          (!noref * CFS_HS_LOOKUP_MASK_REF));
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_findadd_locked);
+EXPORT_SYMBOL(cfs_hash_bd_findadd_locked);
 
 cfs_hlist_node_t *
 cfs_hash_bd_finddel_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
@@ -691,7 +691,7 @@ cfs_hash_bd_finddel_locked(cfs_hash_t *hs, cfs_hash_bd_t *bd,
         return cfs_hash_bd_lookup_intent(hs, bd, key, hnode,
                                          CFS_HS_LOOKUP_IT_FINDDEL);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_bd_finddel_locked);
+EXPORT_SYMBOL(cfs_hash_bd_finddel_locked);
 
 static void
 cfs_hash_multi_bd_lock(cfs_hash_t *hs, cfs_hash_bd_t *bds,
@@ -840,21 +840,21 @@ cfs_hash_dual_bd_get(cfs_hash_t *hs, const void *key, cfs_hash_bd_t *bds)
 
         cfs_hash_bd_order(&bds[0], &bds[1]);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_dual_bd_get);
+EXPORT_SYMBOL(cfs_hash_dual_bd_get);
 
 void
 cfs_hash_dual_bd_lock(cfs_hash_t *hs, cfs_hash_bd_t *bds, int excl)
 {
         cfs_hash_multi_bd_lock(hs, bds, 2, excl);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_dual_bd_lock);
+EXPORT_SYMBOL(cfs_hash_dual_bd_lock);
 
 void
 cfs_hash_dual_bd_unlock(cfs_hash_t *hs, cfs_hash_bd_t *bds, int excl)
 {
         cfs_hash_multi_bd_unlock(hs, bds, 2, excl);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_dual_bd_unlock);
+EXPORT_SYMBOL(cfs_hash_dual_bd_unlock);
 
 cfs_hlist_node_t *
 cfs_hash_dual_bd_lookup_locked(cfs_hash_t *hs, cfs_hash_bd_t *bds,
@@ -862,7 +862,7 @@ cfs_hash_dual_bd_lookup_locked(cfs_hash_t *hs, cfs_hash_bd_t *bds,
 {
         return cfs_hash_multi_bd_lookup_locked(hs, bds, 2, key);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_dual_bd_lookup_locked);
+EXPORT_SYMBOL(cfs_hash_dual_bd_lookup_locked);
 
 cfs_hlist_node_t *
 cfs_hash_dual_bd_findadd_locked(cfs_hash_t *hs, cfs_hash_bd_t *bds,
@@ -872,7 +872,7 @@ cfs_hash_dual_bd_findadd_locked(cfs_hash_t *hs, cfs_hash_bd_t *bds,
         return cfs_hash_multi_bd_findadd_locked(hs, bds, 2, key,
                                                 hnode, noref);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_dual_bd_findadd_locked);
+EXPORT_SYMBOL(cfs_hash_dual_bd_findadd_locked);
 
 cfs_hlist_node_t *
 cfs_hash_dual_bd_finddel_locked(cfs_hash_t *hs, cfs_hash_bd_t *bds,
@@ -880,7 +880,7 @@ cfs_hash_dual_bd_finddel_locked(cfs_hash_t *hs, cfs_hash_bd_t *bds,
 {
         return cfs_hash_multi_bd_finddel_locked(hs, bds, 2, key, hnode);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_dual_bd_finddel_locked);
+EXPORT_SYMBOL(cfs_hash_dual_bd_finddel_locked);
 
 static void
 cfs_hash_buckets_free(cfs_hash_bucket_t **buckets,
@@ -1088,7 +1088,7 @@ cfs_hash_create(char *name, unsigned cur_bits, unsigned max_bits,
         LIBCFS_FREE(hs, offsetof(cfs_hash_t, hs_name[len]));
         RETURN(NULL);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_create);
+EXPORT_SYMBOL(cfs_hash_create);
 
 /**
  * Cleanup libcfs hash @hs.
@@ -1161,14 +1161,14 @@ cfs_hash_t *cfs_hash_getref(cfs_hash_t *hs)
                 return hs;
         return NULL;
 }
-CFS_EXPORT_SYMBOL(cfs_hash_getref);
+EXPORT_SYMBOL(cfs_hash_getref);
 
 void cfs_hash_putref(cfs_hash_t *hs)
 {
         if (cfs_atomic_dec_and_test(&hs->hs_refcount))
                 cfs_hash_destroy(hs);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_putref);
+EXPORT_SYMBOL(cfs_hash_putref);
 
 static inline int
 cfs_hash_rehash_bits(cfs_hash_t *hs)
@@ -1239,7 +1239,7 @@ cfs_hash_add(cfs_hash_t *hs, const void *key, cfs_hlist_node_t *hnode)
         if (bits > 0)
                 cfs_hash_rehash(hs, cfs_hash_rehash_inline(hs));
 }
-CFS_EXPORT_SYMBOL(cfs_hash_add);
+EXPORT_SYMBOL(cfs_hash_add);
 
 static cfs_hlist_node_t *
 cfs_hash_find_or_add(cfs_hash_t *hs, const void *key,
@@ -1279,7 +1279,7 @@ cfs_hash_add_unique(cfs_hash_t *hs, const void *key, cfs_hlist_node_t *hnode)
         return cfs_hash_find_or_add(hs, key, hnode, 1) != hnode ?
                -EALREADY : 0;
 }
-CFS_EXPORT_SYMBOL(cfs_hash_add_unique);
+EXPORT_SYMBOL(cfs_hash_add_unique);
 
 /**
  * Add item @hnode to libcfs hash @hs using @key.  If this @key
@@ -1295,7 +1295,7 @@ cfs_hash_findadd_unique(cfs_hash_t *hs, const void *key,
 
         return cfs_hash_object(hs, hnode);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_findadd_unique);
+EXPORT_SYMBOL(cfs_hash_findadd_unique);
 
 /**
  * Delete item @hnode from the libcfs hash @hs using @key.  The @key
@@ -1336,7 +1336,7 @@ cfs_hash_del(cfs_hash_t *hs, const void *key, cfs_hlist_node_t *hnode)
 
         return obj;
 }
-CFS_EXPORT_SYMBOL(cfs_hash_del);
+EXPORT_SYMBOL(cfs_hash_del);
 
 /**
  * Delete item given @key in libcfs hash @hs.  The first @key found in
@@ -1349,7 +1349,7 @@ cfs_hash_del_key(cfs_hash_t *hs, const void *key)
 {
         return cfs_hash_del(hs, key, NULL);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_del_key);
+EXPORT_SYMBOL(cfs_hash_del_key);
 
 /**
  * Lookup an item using @key in the libcfs hash @hs and return it.
@@ -1378,7 +1378,7 @@ cfs_hash_lookup(cfs_hash_t *hs, const void *key)
 
         return obj;
 }
-CFS_EXPORT_SYMBOL(cfs_hash_lookup);
+EXPORT_SYMBOL(cfs_hash_lookup);
 
 static void
 cfs_hash_for_each_enter(cfs_hash_t *hs)
@@ -1522,7 +1522,7 @@ cfs_hash_cond_del(cfs_hash_t *hs, cfs_hash_cond_opt_cb_t func, void *data)
 
         cfs_hash_for_each_tight(hs, cfs_hash_cond_del_locked, &arg, 1);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_cond_del);
+EXPORT_SYMBOL(cfs_hash_cond_del);
 
 void
 cfs_hash_for_each(cfs_hash_t *hs,
@@ -1530,7 +1530,7 @@ cfs_hash_for_each(cfs_hash_t *hs,
 {
         cfs_hash_for_each_tight(hs, func, data, 0);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_for_each);
+EXPORT_SYMBOL(cfs_hash_for_each);
 
 void
 cfs_hash_for_each_safe(cfs_hash_t *hs,
@@ -1538,7 +1538,7 @@ cfs_hash_for_each_safe(cfs_hash_t *hs,
 {
         cfs_hash_for_each_tight(hs, func, data, 1);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_for_each_safe);
+EXPORT_SYMBOL(cfs_hash_for_each_safe);
 
 static int
 cfs_hash_peek(cfs_hash_t *hs, cfs_hash_bd_t *bd,
@@ -1556,7 +1556,7 @@ cfs_hash_is_empty(cfs_hash_t *hs)
         cfs_hash_for_each_tight(hs, cfs_hash_peek, &empty, 0);
         return empty;
 }
-CFS_EXPORT_SYMBOL(cfs_hash_is_empty);
+EXPORT_SYMBOL(cfs_hash_is_empty);
 
 __u64
 cfs_hash_size_get(cfs_hash_t *hs)
@@ -1565,7 +1565,7 @@ cfs_hash_size_get(cfs_hash_t *hs)
                cfs_atomic_read(&hs->hs_count) :
                cfs_hash_for_each_tight(hs, NULL, NULL, 0);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_size_get);
+EXPORT_SYMBOL(cfs_hash_size_get);
 
 /*
  * cfs_hash_for_each_relax:
@@ -1666,7 +1666,7 @@ cfs_hash_for_each_nolock(cfs_hash_t *hs,
 
         RETURN(0);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_for_each_nolock);
+EXPORT_SYMBOL(cfs_hash_for_each_nolock);
 
 /**
  * For each hash bucket in the libcfs hash @hs call the passed callback
@@ -1702,7 +1702,7 @@ cfs_hash_for_each_empty(cfs_hash_t *hs,
         cfs_hash_for_each_exit(hs);
         RETURN(0);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_for_each_empty);
+EXPORT_SYMBOL(cfs_hash_for_each_empty);
 
 void
 cfs_hash_hlist_for_each(cfs_hash_t *hs, unsigned hindex,
@@ -1731,7 +1731,7 @@ cfs_hash_hlist_for_each(cfs_hash_t *hs, unsigned hindex,
         cfs_hash_for_each_exit(hs);
 }
 
-CFS_EXPORT_SYMBOL(cfs_hash_hlist_for_each);
+EXPORT_SYMBOL(cfs_hash_hlist_for_each);
 
 /*
  * For each item in the libcfs hash @hs which matches the @key call
@@ -1767,7 +1767,7 @@ cfs_hash_for_each_key(cfs_hash_t *hs, const void *key,
         cfs_hash_dual_bd_unlock(hs, bds, 0);
         cfs_hash_unlock(hs, 0);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_for_each_key);
+EXPORT_SYMBOL(cfs_hash_for_each_key);
 
 /**
  * Rehash the libcfs hash @hs to the given @bits.  This can be used
@@ -1807,7 +1807,7 @@ cfs_hash_rehash_cancel_locked(cfs_hash_t *hs)
                 cfs_hash_lock(hs, 1);
         }
 }
-CFS_EXPORT_SYMBOL(cfs_hash_rehash_cancel_locked);
+EXPORT_SYMBOL(cfs_hash_rehash_cancel_locked);
 
 void
 cfs_hash_rehash_cancel(cfs_hash_t *hs)
@@ -1816,7 +1816,7 @@ cfs_hash_rehash_cancel(cfs_hash_t *hs)
         cfs_hash_rehash_cancel_locked(hs);
         cfs_hash_unlock(hs, 1);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_rehash_cancel);
+EXPORT_SYMBOL(cfs_hash_rehash_cancel);
 
 int
 cfs_hash_rehash(cfs_hash_t *hs, int do_rehash)
@@ -1846,7 +1846,7 @@ cfs_hash_rehash(cfs_hash_t *hs, int do_rehash)
 
         return cfs_hash_rehash_worker(&hs->hs_rehash_wi);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_rehash);
+EXPORT_SYMBOL(cfs_hash_rehash);
 
 static int
 cfs_hash_rehash_bd(cfs_hash_t *hs, cfs_hash_bd_t *old)
@@ -2025,7 +2025,7 @@ void cfs_hash_rehash_key(cfs_hash_t *hs, const void *old_key,
         cfs_hash_multi_bd_unlock(hs, bds, 3, 1);
         cfs_hash_unlock(hs, 0);
 }
-CFS_EXPORT_SYMBOL(cfs_hash_rehash_key);
+EXPORT_SYMBOL(cfs_hash_rehash_key);
 
 int cfs_hash_debug_header(char *str, int size)
 {
@@ -2035,7 +2035,7 @@ int cfs_hash_debug_header(char *str, int size)
                  "flags", "rehash", "count", "maxdep", "maxdepb",
                  " distribution");
 }
-CFS_EXPORT_SYMBOL(cfs_hash_debug_header);
+EXPORT_SYMBOL(cfs_hash_debug_header);
 
 static cfs_hash_bucket_t **
 cfs_hash_full_bkts(cfs_hash_t *hs)
@@ -2134,4 +2134,4 @@ int cfs_hash_debug_str(cfs_hash_t *hs, char *str, int size)
 
         return c;
 }
-CFS_EXPORT_SYMBOL(cfs_hash_debug_str);
+EXPORT_SYMBOL(cfs_hash_debug_str);
index e819be0..c322c85 100644 (file)
@@ -186,7 +186,7 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
 
         return rc;
 }
-CFS_EXPORT_SYMBOL(libcfs_kkuc_msg_put);
+EXPORT_SYMBOL(libcfs_kkuc_msg_put);
 
 /* Broadcast groups are global across all mounted filesystems;
  * i.e. registering for a group on 1 fs will get messages for that
@@ -239,7 +239,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, int group, __u32 data)
 
        return 0;
 }
-CFS_EXPORT_SYMBOL(libcfs_kkuc_group_add);
+EXPORT_SYMBOL(libcfs_kkuc_group_add);
 
 int libcfs_kkuc_group_rem(int uid, int group)
 {
@@ -275,7 +275,7 @@ int libcfs_kkuc_group_rem(int uid, int group)
 
         RETURN(0);
 }
-CFS_EXPORT_SYMBOL(libcfs_kkuc_group_rem);
+EXPORT_SYMBOL(libcfs_kkuc_group_rem);
 
 int libcfs_kkuc_group_put(int group, void *payload)
 {
@@ -305,7 +305,7 @@ int libcfs_kkuc_group_put(int group, void *payload)
 
        RETURN(rc);
 }
-CFS_EXPORT_SYMBOL(libcfs_kkuc_group_put);
+EXPORT_SYMBOL(libcfs_kkuc_group_put);
 
 /**
  * Calls a callback function for each link of the given kuc group.
@@ -339,7 +339,7 @@ int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
 
         RETURN(rc);
 }
-CFS_EXPORT_SYMBOL(libcfs_kkuc_group_foreach);
+EXPORT_SYMBOL(libcfs_kkuc_group_foreach);
 
 #endif /* LUSTRE_UTILS */
 
index 8b54eb0..799f91d 100644 (file)
@@ -46,7 +46,7 @@ cfs_percpt_lock_free(struct cfs_percpt_lock *pcl)
        cfs_percpt_free(pcl->pcl_locks);
        LIBCFS_FREE(pcl, sizeof(*pcl));
 }
-CFS_EXPORT_SYMBOL(cfs_percpt_lock_free);
+EXPORT_SYMBOL(cfs_percpt_lock_free);
 
 /**
  * create cpu-partition lock, see libcfs_private.h for more detail.
@@ -79,7 +79,7 @@ cfs_percpt_lock_alloc(struct cfs_cpt_table *cptab)
 
        return pcl;
 }
-CFS_EXPORT_SYMBOL(cfs_percpt_lock_alloc);
+EXPORT_SYMBOL(cfs_percpt_lock_alloc);
 
 /**
  * lock a CPU partition
@@ -121,7 +121,7 @@ cfs_percpt_lock(struct cfs_percpt_lock *pcl, int index)
                }
        }
 }
-CFS_EXPORT_SYMBOL(cfs_percpt_lock);
+EXPORT_SYMBOL(cfs_percpt_lock);
 
 /** unlock a CPU partition */
 void
@@ -145,7 +145,7 @@ cfs_percpt_unlock(struct cfs_percpt_lock *pcl, int index)
                spin_unlock(pcl->pcl_locks[i]);
        }
 }
-CFS_EXPORT_SYMBOL(cfs_percpt_unlock);
+EXPORT_SYMBOL(cfs_percpt_unlock);
 
 #else /* !__KERNEL__ */
 # ifdef HAVE_LIBPTHREAD
@@ -216,7 +216,7 @@ cfs_percpt_atomic_free(cfs_atomic_t **refs)
 {
        cfs_percpt_free(refs);
 }
-CFS_EXPORT_SYMBOL(cfs_percpt_atomic_free);
+EXPORT_SYMBOL(cfs_percpt_atomic_free);
 
 /** allocate cpu-partition refcount with initial value @init_val */
 cfs_atomic_t **
@@ -234,7 +234,7 @@ cfs_percpt_atomic_alloc(struct cfs_cpt_table *cptab, int init_val)
                cfs_atomic_set(ref, init_val);
        return refs;
 }
-CFS_EXPORT_SYMBOL(cfs_percpt_atomic_alloc);
+EXPORT_SYMBOL(cfs_percpt_atomic_alloc);
 
 /** return sum of cpu-partition refs */
 int
@@ -249,4 +249,4 @@ cfs_percpt_atomic_summary(cfs_atomic_t **refs)
 
        return val;
 }
-CFS_EXPORT_SYMBOL(cfs_percpt_atomic_summary);
+EXPORT_SYMBOL(cfs_percpt_atomic_summary);
index 2d8672a..c7dc6d8 100644 (file)
@@ -87,7 +87,7 @@ cfs_percpt_alloc(struct cfs_cpt_table *cptab, unsigned int size)
        if (arr == NULL)
                return NULL;
 
-       arr->va_size    = size = CFS_L1_CACHE_ALIGN(size);
+       arr->va_size    = size = L1_CACHE_ALIGN(size);
        arr->va_count   = count;
        arr->va_cptab   = cptab;
 
index 62ca84b..2e0c9b5 100644 (file)
@@ -270,7 +270,7 @@ static int crc32pclmul;
 
 int cfs_crypto_register(void)
 {
-       cfs_request_module("crc32c");
+       request_module("crc32c");
 
        crc32 = cfs_crypto_crc32_register();
        adler32 = cfs_crypto_adler32_register();
index cd98ad9..1294537 100644 (file)
@@ -176,7 +176,7 @@ static struct file_operations libcfs_fops = {
        release :       libcfs_psdev_release
 };
 
-cfs_psdev_t libcfs_dev = {
+struct miscdevice libcfs_dev = {
        LNET_MINOR,
        "lnet",
        &libcfs_fops
index 874347e..027802c 100644 (file)
@@ -68,7 +68,7 @@
 #include "tracefile.h"
 
 #ifdef CONFIG_SYSCTL
-static cfs_sysctl_table_header_t *lnet_table_header = NULL;
+static struct ctl_table_header *lnet_table_header = NULL;
 #endif
 extern char lnet_upcall[1024];
 /**
@@ -246,9 +246,9 @@ DECLARE_PROC_HANDLER(proc_debug_mb)
 
 int LL_PROC_PROTO(proc_console_max_delay_cs)
 {
-        int rc, max_delay_cs;
-        cfs_sysctl_table_t dummy = *table;
-        cfs_duration_t d;
+       int rc, max_delay_cs;
+       struct ctl_table dummy = *table;
+       cfs_duration_t d;
 
         dummy.data = &max_delay_cs;
         dummy.proc_handler = &proc_dointvec;
@@ -277,60 +277,60 @@ int LL_PROC_PROTO(proc_console_max_delay_cs)
 
 int LL_PROC_PROTO(proc_console_min_delay_cs)
 {
-        int rc, min_delay_cs;
-        cfs_sysctl_table_t dummy = *table;
-        cfs_duration_t d;
+       int rc, min_delay_cs;
+       struct ctl_table dummy = *table;
+       cfs_duration_t d;
 
-        dummy.data = &min_delay_cs;
-        dummy.proc_handler = &proc_dointvec;
+       dummy.data = &min_delay_cs;
+       dummy.proc_handler = &proc_dointvec;
 
-        if (!write) { /* read */
-                min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100);
-                rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-                return rc;
-        }
+       if (!write) { /* read */
+               min_delay_cs = cfs_duration_sec(libcfs_console_min_delay * 100);
+               rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+               return rc;
+       }
 
-        /* write */
-        min_delay_cs = 0;
-        rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-        if (rc < 0)
-                return rc;
-        if (min_delay_cs <= 0)
-                return -EINVAL;
+       /* write */
+       min_delay_cs = 0;
+       rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+       if (rc < 0)
+               return rc;
+       if (min_delay_cs <= 0)
+               return -EINVAL;
 
-        d = cfs_time_seconds(min_delay_cs) / 100;
-        if (d == 0 || d > libcfs_console_max_delay)
-                return -EINVAL;
-        libcfs_console_min_delay = d;
+       d = cfs_time_seconds(min_delay_cs) / 100;
+       if (d == 0 || d > libcfs_console_max_delay)
+               return -EINVAL;
+       libcfs_console_min_delay = d;
 
-        return rc;
+       return rc;
 }
 
 int LL_PROC_PROTO(proc_console_backoff)
 {
-        int rc, backoff;
-        cfs_sysctl_table_t dummy = *table;
+       int rc, backoff;
+       struct ctl_table dummy = *table;
 
-        dummy.data = &backoff;
-        dummy.proc_handler = &proc_dointvec;
+       dummy.data = &backoff;
+       dummy.proc_handler = &proc_dointvec;
 
-        if (!write) { /* read */
-                backoff= libcfs_console_backoff;
-                rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-                return rc;
-        }
+       if (!write) { /* read */
+               backoff= libcfs_console_backoff;
+               rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+               return rc;
+       }
 
-        /* write */
-        backoff = 0;
-        rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
-        if (rc < 0)
-                return rc;
-        if (backoff <= 0)
-                return -EINVAL;
+       /* write */
+       backoff = 0;
+       rc = ll_proc_dointvec(&dummy, write, filp, buffer, lenp, ppos);
+       if (rc < 0)
+               return rc;
+       if (backoff <= 0)
+               return -EINVAL;
 
-        libcfs_console_backoff = backoff;
+       libcfs_console_backoff = backoff;
 
-        return rc;
+       return rc;
 }
 
 int LL_PROC_PROTO(libcfs_force_lbug)
@@ -393,7 +393,7 @@ static int __proc_cpt_table(void *data, int write,
 }
 DECLARE_PROC_HANDLER(proc_cpt_table)
 
-static cfs_sysctl_table_t lnet_table[] = {
+static struct ctl_table lnet_table[] = {
         /*
          * NB No .strategy entries have been provided since sysctl(8) prefers
          * to go via /proc for portability.
@@ -571,7 +571,7 @@ static cfs_sysctl_table_t lnet_table[] = {
 };
 
 #ifdef CONFIG_SYSCTL
-static cfs_sysctl_table_t top_table[] = {
+static struct ctl_table top_table[] = {
         {
                 INIT_CTL_NAME(CTL_LNET)
                 .procname = "lnet",
@@ -589,18 +589,18 @@ static cfs_sysctl_table_t top_table[] = {
 int insert_proc(void)
 {
 #ifdef CONFIG_SYSCTL
-        if (lnet_table_header == NULL)
-                lnet_table_header = cfs_register_sysctl_table(top_table, 0);
+       if (lnet_table_header == NULL)
+               lnet_table_header = register_sysctl_table(top_table);
 #endif
-        return 0;
+       return 0;
 }
 
 void remove_proc(void)
 {
 #ifdef CONFIG_SYSCTL
-        if (lnet_table_header != NULL)
-                cfs_unregister_sysctl_table(lnet_table_header);
+       if (lnet_table_header != NULL)
+               unregister_sysctl_table(lnet_table_header);
 
-        lnet_table_header = NULL;
+       lnet_table_header = NULL;
 #endif
 }
index f3f8643..8ab7e6c 100644 (file)
@@ -153,35 +153,35 @@ kportal_memhog_alloc (struct libcfs_device_userstate *ldu, int npages, int flags
 /* called when opening /dev/device */
 static int libcfs_psdev_open(unsigned long flags, void *args)
 {
-        struct libcfs_device_userstate *ldu;
-        ENTRY;
+       struct libcfs_device_userstate *ldu;
+       ENTRY;
 
-        PORTAL_MODULE_USE;
+       try_module_get(THIS_MODULE);
 
-        LIBCFS_ALLOC(ldu, sizeof(*ldu));
-        if (ldu != NULL) {
-                ldu->ldu_memhog_pages = 0;
-                ldu->ldu_memhog_root_page = NULL;
-        }
-        *(struct libcfs_device_userstate **)args = ldu;
+       LIBCFS_ALLOC(ldu, sizeof(*ldu));
+       if (ldu != NULL) {
+               ldu->ldu_memhog_pages = 0;
+               ldu->ldu_memhog_root_page = NULL;
+       }
+       *(struct libcfs_device_userstate **)args = ldu;
 
-        RETURN(0);
+       RETURN(0);
 }
 
 /* called when closing /dev/device */
 static int libcfs_psdev_release(unsigned long flags, void *args)
 {
-        struct libcfs_device_userstate *ldu;
-        ENTRY;
+       struct libcfs_device_userstate *ldu;
+       ENTRY;
 
-        ldu = (struct libcfs_device_userstate *)args;
-        if (ldu != NULL) {
-                kportal_memhog_free(ldu);
-                LIBCFS_FREE(ldu, sizeof(*ldu));
-        }
+       ldu = (struct libcfs_device_userstate *)args;
+       if (ldu != NULL) {
+               kportal_memhog_free(ldu);
+               LIBCFS_FREE(ldu, sizeof(*ldu));
+       }
 
-        PORTAL_MODULE_UNUSE;
-        RETURN(0);
+       module_put(THIS_MODULE);
+       RETURN(0);
 }
 
 static struct rw_semaphore ioctl_list_sem;
@@ -287,21 +287,21 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile,unsigned long cmd,
                 break;
 
         case IOC_LIBCFS_PING_TEST: {
-                extern void (kping_client)(struct libcfs_ioctl_data *);
-                void (*ping)(struct libcfs_ioctl_data *);
-
-                CDEBUG(D_IOCTL, "doing %d pings to nid %s (%s)\n",
-                       data->ioc_count, libcfs_nid2str(data->ioc_nid),
-                       libcfs_nid2str(data->ioc_nid));
-                ping = PORTAL_SYMBOL_GET(kping_client);
-                if (!ping)
-                        CERROR("PORTAL_SYMBOL_GET failed\n");
-                else {
-                        ping(data);
-                        PORTAL_SYMBOL_PUT(kping_client);
-                }
-                RETURN(0);
-        }
+               extern void (kping_client)(struct libcfs_ioctl_data *);
+               void (*ping)(struct libcfs_ioctl_data *);
+
+               CDEBUG(D_IOCTL, "doing %d pings to nid %s (%s)\n",
+                      data->ioc_count, libcfs_nid2str(data->ioc_nid),
+                      libcfs_nid2str(data->ioc_nid));
+               ping = symbol_get(kping_client);
+               if (!ping) {
+                       CERROR("symbol_get failed\n");
+               } else {
+                       ping(data);
+                       symbol_put(kping_client);
+               }
+               RETURN(0);
+       }
 
         default: {
                 struct libcfs_ioctl_handler *hand;
@@ -366,7 +366,7 @@ MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
 MODULE_DESCRIPTION("Portals v3.1");
 MODULE_LICENSE("GPL");
 
-extern cfs_psdev_t libcfs_dev;
+extern struct miscdevice libcfs_dev;
 extern struct rw_semaphore cfs_tracefile_sem;
 extern struct mutex cfs_trace_thread_mutex;
 extern struct cfs_wi_sched *cfs_sched_rehash;
@@ -389,7 +389,7 @@ static int init_libcfs_module(void)
 
        rc = libcfs_debug_init(5 * 1024 * 1024);
        if (rc < 0) {
-               printk(CFS_KERN_ERR "LustreError: libcfs_debug_init: %d\n", rc);
+               printk(KERN_ERR "LustreError: libcfs_debug_init: %d\n", rc);
                return (rc);
        }
 
@@ -404,7 +404,7 @@ static int init_libcfs_module(void)
                goto cleanup_debug;
        }
 #endif
-       rc = cfs_psdev_register(&libcfs_dev);
+       rc = misc_register(&libcfs_dev);
        if (rc) {
                CERROR("misc_register: error %d\n", rc);
                goto cleanup_lwt;
@@ -445,7 +445,7 @@ static int init_libcfs_module(void)
  cleanup_wi:
        cfs_wi_shutdown();
  cleanup_deregister:
-       cfs_psdev_deregister(&libcfs_dev);
+       misc_deregister(&libcfs_dev);
  cleanup_lwt:
 #if LWT_SUPPORT
        lwt_fini();
@@ -472,7 +472,7 @@ static void exit_libcfs_module(void)
        cfs_crypto_unregister();
        cfs_wi_shutdown();
 
-       rc = cfs_psdev_deregister(&libcfs_dev);
+       rc = misc_deregister(&libcfs_dev);
        if (rc)
                CERROR("misc_deregister error %d\n", rc);
 
@@ -487,7 +487,7 @@ static void exit_libcfs_module(void)
 
        rc = libcfs_debug_cleanup();
        if (rc)
-               printk(CFS_KERN_ERR "LustreError: libcfs_debug_cleanup: %d\n",
+               printk(KERN_ERR "LustreError: libcfs_debug_cleanup: %d\n",
                       rc);
 
        fini_rwsem(&ioctl_list_sem);
index b55b0bf..765d411 100644 (file)
@@ -81,7 +81,7 @@ unsigned int cfs_rand(void)
 
         return ((seed_x << 16) + (seed_y & 65535));
 }
-CFS_EXPORT_SYMBOL(cfs_rand);
+EXPORT_SYMBOL(cfs_rand);
 
 /**
  * cfs_srand - sets the inital seed
@@ -98,7 +98,7 @@ void cfs_srand(unsigned int seed1, unsigned int seed2)
         if (seed2)
                 seed_y = seed2;
 }
-CFS_EXPORT_SYMBOL(cfs_srand);
+EXPORT_SYMBOL(cfs_srand);
 
 /**
  * cfs_get_random_bytes - generate a bunch of random numbers
@@ -136,4 +136,4 @@ void cfs_get_random_bytes(void *buf, int size)
                 memcpy(buf, &tmp, size);
         }
 }
-CFS_EXPORT_SYMBOL(cfs_get_random_bytes);
+EXPORT_SYMBOL(cfs_get_random_bytes);
index 2a8af1c..49acdf2 100644 (file)
@@ -158,7 +158,7 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len)
                        if (unlikely(tage == NULL)) {
                                if ((!memory_pressure_get() ||
                                     cfs_in_interrupt()) && printk_ratelimit())
-                                       printk(CFS_KERN_WARNING
+                                       printk(KERN_WARNING
                                               "cannot allocate a tage (%ld)\n",
                                               tcd->tcd_cur_pages);
                                return NULL;
@@ -195,10 +195,10 @@ static void cfs_tcd_shrink(struct cfs_trace_cpu_data *tcd)
          * from here: this will lead to infinite recursion.
          */
 
-        if (printk_ratelimit())
-                printk(CFS_KERN_WARNING "debug daemon buffer overflowed; "
-                       "discarding 10%% of pages (%d of %ld)\n",
-                       pgcount + 1, tcd->tcd_cur_pages);
+       if (printk_ratelimit())
+               printk(KERN_WARNING "debug daemon buffer overflowed; "
+                      "discarding 10%% of pages (%d of %ld)\n",
+                      pgcount + 1, tcd->tcd_cur_pages);
 
         CFS_INIT_LIST_HEAD(&pc.pc_pages);
        spin_lock_init(&pc.pc_lock);
@@ -226,10 +226,10 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd,
          */
 
        if (len > PAGE_CACHE_SIZE) {
-                printk(CFS_KERN_ERR
-                       "cowardly refusing to write %lu bytes in a page\n", len);
-                return NULL;
-        }
+               printk(KERN_ERR
+                      "cowardly refusing to write %lu bytes in a page\n", len);
+               return NULL;
+       }
 
         tage = cfs_trace_get_tage_try(tcd, len);
         if (tage != NULL)
@@ -329,14 +329,14 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
                                         tage->used + known_size;
 
                max_nob = PAGE_CACHE_SIZE - tage->used - known_size;
-                if (max_nob <= 0) {
-                        printk(CFS_KERN_EMERG "negative max_nob: %d\n",
-                               max_nob);
-                        mask |= D_ERROR;
-                        cfs_trace_put_tcd(tcd);
-                        tcd = NULL;
-                        goto console;
-                }
+               if (max_nob <= 0) {
+                       printk(KERN_EMERG "negative max_nob: %d\n",
+                              max_nob);
+                       mask |= D_ERROR;
+                       cfs_trace_put_tcd(tcd);
+                       tcd = NULL;
+                       goto console;
+               }
 
                 needed = 0;
                 if (format1) {
@@ -360,9 +360,9 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
                         break;
         }
 
-        if (*(string_buf+needed-1) != '\n')
-                printk(CFS_KERN_INFO "format at %s:%d:%s doesn't end in "
-                       "newline\n", file, msgdata->msg_line, msgdata->msg_fn);
+       if (*(string_buf+needed-1) != '\n')
+               printk(KERN_INFO "format at %s:%d:%s doesn't end in "
+                      "newline\n", file, msgdata->msg_line, msgdata->msg_fn);
 
         header.ph_len = known_size + needed;
        debug_buf = (char *)page_address(tage->page) + tage->used;
@@ -719,20 +719,20 @@ int cfs_tracefile_dump_all_pages(char *filename)
 
                rc = filp_write(filp, page_address(tage->page),
                                tage->used, filp_poff(filp));
-                if (rc != (int)tage->used) {
-                        printk(CFS_KERN_WARNING "wanted to write %u but wrote "
-                               "%d\n", tage->used, rc);
-                        put_pages_back(&pc);
-                        __LASSERT(cfs_list_empty(&pc.pc_pages));
-                        break;
-                }
+               if (rc != (int)tage->used) {
+                       printk(KERN_WARNING "wanted to write %u but wrote "
+                              "%d\n", tage->used, rc);
+                       put_pages_back(&pc);
+                       __LASSERT(cfs_list_empty(&pc.pc_pages));
+                       break;
+               }
                 cfs_list_del(&tage->linkage);
                 cfs_tage_free(tage);
         }
        MMSPACE_CLOSE;
        rc = filp_fsync(filp);
        if (rc)
-               printk(CFS_KERN_ERR "sync returns %d\n", rc);
+               printk(KERN_ERR "sync returns %d\n", rc);
 close:
        filp_close(filp, NULL);
 out:
@@ -882,14 +882,14 @@ int cfs_trace_daemon_command(char *str)
                 rc = -EINVAL;
 #endif
         } else {
-                strcpy(cfs_tracefile, str);
+               strcpy(cfs_tracefile, str);
 
-                printk(CFS_KERN_INFO
-                       "Lustre: debug daemon will attempt to start writing "
-                       "to %s (%lukB max)\n", cfs_tracefile,
-                       (long)(cfs_tracefile_size >> 10));
+               printk(KERN_INFO
+                      "Lustre: debug daemon will attempt to start writing "
+                      "to %s (%lukB max)\n", cfs_tracefile,
+                      (long)(cfs_tracefile_size >> 10));
 
-                cfs_trace_start_thread();
+               cfs_trace_start_thread();
         }
 
         cfs_tracefile_write_unlock();
@@ -923,14 +923,14 @@ int cfs_trace_set_debug_mb(int mb)
        struct cfs_trace_cpu_data *tcd;
 
        if (mb < num_possible_cpus()) {
-               printk(CFS_KERN_WARNING
+               printk(KERN_WARNING
                       "Lustre: %d MB is too small for debug buffer size, "
                       "setting it to %d MB.\n", mb, num_possible_cpus());
                mb = num_possible_cpus();
        }
 
        if (mb > limit) {
-               printk(CFS_KERN_WARNING
+               printk(KERN_WARNING
                       "Lustre: %d MB is too large for debug buffer size, "
                       "setting it to %d MB.\n", mb, limit);
                mb = limit;
@@ -1013,7 +1013,7 @@ static int tracefiled(void *arg)
                        if (IS_ERR(filp)) {
                                rc = PTR_ERR(filp);
                                filp = NULL;
-                               printk(CFS_KERN_WARNING "couldn't open %s: "
+                               printk(KERN_WARNING "couldn't open %s: "
                                       "%d\n", cfs_tracefile, rc);
                        }
                }
@@ -1040,12 +1040,12 @@ static int tracefiled(void *arg)
 
                        rc = filp_write(filp, page_address(tage->page),
                                        tage->used, &f_pos);
-                        if (rc != (int)tage->used) {
-                                printk(CFS_KERN_WARNING "wanted to write %u "
-                                       "but wrote %d\n", tage->used, rc);
-                                put_pages_back(&pc);
-                                __LASSERT(cfs_list_empty(&pc.pc_pages));
-                        }
+                       if (rc != (int)tage->used) {
+                               printk(KERN_WARNING "wanted to write %u "
+                                      "but wrote %d\n", tage->used, rc);
+                               put_pages_back(&pc);
+                               __LASSERT(cfs_list_empty(&pc.pc_pages));
+                       }
                 }
                MMSPACE_CLOSE;
 
@@ -1054,24 +1054,24 @@ static int tracefiled(void *arg)
                 if (!cfs_list_empty(&pc.pc_pages)) {
                         int i;
 
-                       printk(CFS_KERN_ALERT "Lustre: trace pages aren't "
+                       printk(KERN_ALERT "Lustre: trace pages aren't "
                               " empty\n");
-                       printk(CFS_KERN_ERR "total cpus(%d): ",
+                       printk(KERN_ERR "total cpus(%d): ",
                               num_possible_cpus());
                        for (i = 0; i < num_possible_cpus(); i++)
                                if (cpu_online(i))
-                                       printk(CFS_KERN_ERR "%d(on) ", i);
+                                       printk(KERN_ERR "%d(on) ", i);
                                else
-                                       printk(CFS_KERN_ERR "%d(off) ", i);
-                       printk(CFS_KERN_ERR "\n");
-
-                        i = 0;
-                        cfs_list_for_each_entry_safe(tage, tmp, &pc.pc_pages,
-                                                     linkage)
-                                printk(CFS_KERN_ERR "page %d belongs to cpu "
-                                       "%d\n", ++i, tage->cpu);
-                        printk(CFS_KERN_ERR "There are %d pages unwritten\n",
-                               i);
+                                       printk(KERN_ERR "%d(off) ", i);
+                       printk(KERN_ERR "\n");
+
+                       i = 0;
+                       cfs_list_for_each_entry_safe(tage, tmp, &pc.pc_pages,
+                                                    linkage)
+                               printk(KERN_ERR "page %d belongs to cpu "
+                                      "%d\n", ++i, tage->cpu);
+                       printk(KERN_ERR "There are %d pages unwritten\n",
+                              i);
                 }
                 __LASSERT(cfs_list_empty(&pc.pc_pages));
 end_loop:
@@ -1122,16 +1122,16 @@ out:
 
 void cfs_trace_stop_thread(void)
 {
-        struct tracefiled_ctl *tctl = &trace_tctl;
+       struct tracefiled_ctl *tctl = &trace_tctl;
 
        mutex_lock(&cfs_trace_thread_mutex);
-        if (thread_running) {
-                printk(CFS_KERN_INFO
-                       "Lustre: shutting down debug daemon thread...\n");
-                cfs_atomic_set(&tctl->tctl_shutdown, 1);
+       if (thread_running) {
+               printk(KERN_INFO
+                      "Lustre: shutting down debug daemon thread...\n");
+               cfs_atomic_set(&tctl->tctl_shutdown, 1);
                wait_for_completion(&tctl->tctl_stop);
-                thread_running = 0;
-        }
+               thread_running = 0;
+       }
        mutex_unlock(&cfs_trace_thread_mutex);
 }
 
index 50e657b..12c9ce9 100644 (file)
@@ -183,7 +183,7 @@ union cfs_trace_data_union {
                /* The factors to share debug memory. */
                unsigned short          tcd_pages_factor;
        } tcd;
-       char __pad[CFS_L1_CACHE_ALIGN(sizeof(struct cfs_trace_cpu_data))];
+       char __pad[L1_CACHE_ALIGN(sizeof(struct cfs_trace_cpu_data))];
 };
 
 #define TCD_MAX_TYPES      8
index c11fff2..e44f28f 100644 (file)
@@ -174,7 +174,7 @@ static struct file_operations libcfs_fops = {
     /* release:*/ libcfs_psdev_release
 };
 
-cfs_psdev_t libcfs_dev = { 
+struct miscdevice libcfs_dev = {
        LIBCFS_MINOR, 
        "lnet", 
        &libcfs_fops
index 770a452..33ec3aa 100644 (file)
@@ -67,7 +67,7 @@ cfs_proc_entry_t *              cfs_proc_dev = NULL;
 struct kmem_cache *proc_entry_cache;
 
 /* root node for sysctl table */
-cfs_sysctl_table_header_t       root_table_header;
+struct ctl_table_header       root_table_header;
 
 /* The global lock to protect all the access */
 
@@ -899,7 +899,7 @@ struct file_operations proc_sys_file_operations = {
 
 
 /* Scan the sysctl entries in table and add them all into /proc */
-void register_proc_table(cfs_sysctl_table_t * table, cfs_proc_entry_t * root)
+void register_proc_table(struct ctl_table * table, cfs_proc_entry_t * root)
 {
     cfs_proc_entry_t * de;
     int len;
@@ -909,12 +909,12 @@ void register_proc_table(cfs_sysctl_table_t * table, cfs_proc_entry_t * root)
         /* Can't do anything without a proc name. */
         if (!table->procname)
             continue;
-        /* Maybe we can't do anything with it... */
-        if (!table->proc_handler && !table->child) {
-            printk(CFS_KERN_WARNING "SYSCTL: Can't register %s\n",
-                table->procname);
-            continue;
-        }
+       /* Maybe we can't do anything with it... */
+       if (!table->proc_handler && !table->child) {
+           printk(KERN_WARNING "SYSCTL: Can't register %s\n",
+               table->procname);
+           continue;
+       }
 
         len = strlen(table->procname);
         mode = table->mode;
@@ -950,17 +950,17 @@ void register_proc_table(cfs_sysctl_table_t * table, cfs_proc_entry_t * root)
 /*
  * Unregister a /proc sysctl table and any subdirectories.
  */
-void unregister_proc_table(cfs_sysctl_table_t * table, cfs_proc_entry_t *root)
+void unregister_proc_table(struct ctl_table * table, cfs_proc_entry_t *root)
 {
     cfs_proc_entry_t *de;
     for (; table->ctl_name; table++) {
         if (!(de = table->de))
             continue;
         if (de->mode & S_IFDIR) {
-            if (!table->child) {
-                printk (CFS_KERN_ALERT "Help- malformed sysctl tree on free\n");
-                continue;
-            }
+           if (!table->child) {
+               printk (KERN_ALERT "Help- malformed sysctl tree on free\n");
+               continue;
+           }
             unregister_proc_table(table->child, de);
 
             /* Don't unregister directories which still have entries.. */
@@ -978,7 +978,7 @@ void unregister_proc_table(cfs_sysctl_table_t * table, cfs_proc_entry_t *root)
 }
 
 /* The generic string strategy routine: */
-int sysctl_string(cfs_sysctl_table_t *table, int *name, int nlen,
+int sysctl_string(struct ctl_table *table, int *name, int nlen,
           void *oldval, size_t *oldlenp,
           void *newval, size_t newlen, void **context)
 {
@@ -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(cfs_sysctl_table_t *table, int write, struct file *filp,
+static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
           void *buffer, size_t *lenp, int conv, int op)
 {
     int *i, vleft, first=1, neg, val;
@@ -1180,7 +1180,7 @@ static int do_proc_dointvec(cfs_sysctl_table_t *table, int write, struct file *f
  *
  * Returns 0 on success.
  */
-int proc_dointvec(cfs_sysctl_table_t *table, int write, struct file *filp,
+int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
              void *buffer, size_t *lenp)
 {
     return do_proc_dointvec(table,write,filp,buffer,lenp,1,OP_SET);
@@ -1204,7 +1204,7 @@ int proc_dointvec(cfs_sysctl_table_t *table, int write, struct file *filp,
  *
  * Returns 0 on success.
  */
-int proc_dostring(cfs_sysctl_table_t *table, int write, struct file *filp,
+int proc_dostring(struct ctl_table *table, int write, struct file *filp,
           void *buffer, size_t *lenp)
 {
     size_t len;
@@ -1253,10 +1253,9 @@ int proc_dostring(cfs_sysctl_table_t *table, int write, struct file *filp,
 }
 
 /* Perform the actual read/write of a sysctl table entry. */
-int do_sysctl_strategy (cfs_sysctl_table_t *table, 
-            int *name, int nlen,
-            void *oldval, size_t *oldlenp,
-            void *newval, size_t newlen, void **context)
+int do_sysctl_strategy(struct ctl_table *table, int *name, int nlen,
+                      void *oldval, size_t *oldlenp, void *newval,
+                      size_t newlen, void **context)
 {
     int op = 0, rc;
     size_t len;
@@ -1301,9 +1300,9 @@ int do_sysctl_strategy (cfs_sysctl_table_t *table,
 }
 
 static int parse_table(int *name, int nlen,
-               void *oldval, size_t *oldlenp,
-               void *newval, size_t newlen,
-               cfs_sysctl_table_t *table, void **context)
+              void *oldval, size_t *oldlenp,
+              void *newval, size_t newlen,
+              struct ctl_table *table, void **context)
 {
     int n;
 
@@ -1441,24 +1440,21 @@ int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
  * This routine returns %NULL on a failure to register, and a pointer
  * to the table header on success.
  */
-struct ctl_table_header *register_sysctl_table(cfs_sysctl_table_t * table, 
-                           int insert_at_head)
+struct ctl_table_header *
+register_sysctl_table(struct ctl_table *table)
 {
-    struct ctl_table_header *tmp;
-    tmp = kmalloc(sizeof(struct ctl_table_header), 0);
-    if (!tmp)
-        return NULL;
-    tmp->ctl_table = table;
+       struct ctl_table_header *tmp;
+       tmp = kmalloc(sizeof(struct ctl_table_header), 0);
+       if (!tmp)
+               return NULL;
+       tmp->ctl_table = table;
 
-    CFS_INIT_LIST_HEAD(&tmp->ctl_entry);
-    if (insert_at_head)
-        cfs_list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
-    else
-        cfs_list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
+       CFS_INIT_LIST_HEAD(&tmp->ctl_entry);
+       cfs_list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
 #ifdef CONFIG_PROC_FS
-    register_proc_table(table, cfs_proc_sys);
+       register_proc_table(table, cfs_proc_sys);
 #endif
-    return tmp;
+       return tmp;
 }
 
 /**
@@ -1478,7 +1474,7 @@ void unregister_sysctl_table(struct ctl_table_header * header)
 }
 
 
-int cfs_psdev_register(cfs_psdev_t * psdev)
+int misc_register(struct miscdevice * psdev)
 {
     cfs_proc_entry_t *  entry;
 
@@ -1500,7 +1496,7 @@ int cfs_psdev_register(cfs_psdev_t * psdev)
     return 0;
 }
 
-int cfs_psdev_deregister(cfs_psdev_t * psdev)
+int misc_deregister(struct miscdevice * psdev)
 {
     cfs_proc_entry_t *  entry;
 
index 4404e3a..3ff5405 100644 (file)
@@ -89,7 +89,7 @@ int cfs_tracefile_init_arch()
 
 out:
        cfs_tracefile_fini_arch();
-       printk(CFS_KERN_ERR "lnet: Not enough memory\n");
+       printk(KERN_ERR "lnet: Not enough memory\n");
        return -ENOMEM;
 
 }
@@ -194,16 +194,16 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask,
 
        if ((mask & D_EMERG) != 0) {
                prefix = "LustreError";
-               ptype = CFS_KERN_EMERG;
+               ptype = KERN_EMERG;
        } else if ((mask & D_ERROR) != 0) {
                prefix = "LustreError";
-               ptype = CFS_KERN_ERR;
+               ptype = KERN_ERR;
        } else if ((mask & D_WARNING) != 0) {
                prefix = "Lustre";
-               ptype = CFS_KERN_WARNING;
+               ptype = KERN_WARNING;
        } else if ((mask & (D_CONSOLE | libcfs_printk)) != 0) {
                prefix = "Lustre";
-               ptype = CFS_KERN_INFO;
+               ptype = KERN_INFO;
        }
 
        if ((mask & D_CONSOLE) != 0) {
index fb80d88..13b5f02 100644 (file)
@@ -515,9 +515,9 @@ mxlnd_shutdown (lnet_ni_t *ni)
                          "kmx_mem_used %ld\n", cfs_atomic_read(&libcfs_kmemory),
                          kmxlnd_data.kmx_mem_used);
 
-        kmxlnd_data.kmx_init = MXLND_INIT_NOTHING;
-        PORTAL_MODULE_UNUSE;
-        return;
+       kmxlnd_data.kmx_init = MXLND_INIT_NOTHING;
+       module_put(THIS_MODULE);
+       return;
 }
 
 /**
@@ -551,8 +551,8 @@ mxlnd_startup (lnet_ni_t *ni)
         if (ni->ni_maxtxcredits < ni->ni_peertxcredits)
                 ni->ni_maxtxcredits = ni->ni_peertxcredits;
 
-        PORTAL_MODULE_USE;
-        memset (&kmxlnd_data, 0, sizeof (kmxlnd_data));
+       try_module_get(THIS_MODULE);
+       memset (&kmxlnd_data, 0, sizeof (kmxlnd_data));
 
         kmxlnd_data.kmx_ni = ni;
         ni->ni_data = &kmxlnd_data;
index 72d1c33..23165d1 100644 (file)
@@ -130,7 +130,7 @@ enum {
 
 #endif
 
-static cfs_sysctl_table_t kmxlnd_ctl_table[] = {
+static struct ctl_table kmxlnd_ctl_table[] = {
         {
                 .ctl_name = 1,
                 .procname = "n_waitd",
@@ -214,7 +214,7 @@ static cfs_sysctl_table_t kmxlnd_ctl_table[] = {
         {0}
 };
 
-static cfs_sysctl_table_t kmxlnd_top_ctl_table[] = {
+static struct ctl_table kmxlnd_top_ctl_table[] = {
         {
                 .ctl_name = 208,
                 .procname = "mxlnd",
@@ -236,21 +236,21 @@ kmxlnd_initstrtunable(char *space, char *str, int size)
 void
 kmxlnd_sysctl_init (void)
 {
-        kmxlnd_initstrtunable(ipif_basename_space, ipif_name,
-                              sizeof(ipif_basename_space));
+       kmxlnd_initstrtunable(ipif_basename_space, ipif_name,
+                             sizeof(ipif_basename_space));
 
-        kmxlnd_tunables.kib_sysctl =
-                cfs_register_sysctl_table(kmxlnd_top_ctl_table, 0);
+       kmxlnd_tunables.kib_sysctl =
+               register_sysctl_table(kmxlnd_top_ctl_table);
 
-        if (kmxlnd_tunables.kib_sysctl == NULL)
-                CWARN("Can't setup /proc tunables\n");
+       if (kmxlnd_tunables.kib_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
 }
 
 void
 kmxlnd_sysctl_fini (void)
 {
-        if (kmxlnd_tunables.kib_sysctl != NULL)
-                cfs_unregister_sysctl_table(kmxlnd_tunables.kib_sysctl);
+       if (kmxlnd_tunables.kib_sysctl != NULL)
+               unregister_sysctl_table(kmxlnd_tunables.kib_sysctl);
 }
 
 #else
index 3f5ff4e..461eaaf 100644 (file)
@@ -2870,8 +2870,8 @@ kiblnd_base_shutdown(void)
         CDEBUG(D_MALLOC, "after LND base cleanup: kmem %d\n",
                cfs_atomic_read(&libcfs_kmemory));
 
-        kiblnd_data.kib_init = IBLND_INIT_NOTHING;
-        PORTAL_MODULE_UNUSE;
+       kiblnd_data.kib_init = IBLND_INIT_NOTHING;
+       module_put(THIS_MODULE);
 }
 
 void
@@ -2956,8 +2956,8 @@ kiblnd_base_startup(void)
 
         LASSERT (kiblnd_data.kib_init == IBLND_INIT_NOTHING);
 
-        PORTAL_MODULE_USE;
-        memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */
+       try_module_get(THIS_MODULE);
+       memset(&kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags etc */
 
        rwlock_init(&kiblnd_data.kib_global_lock);
 
index 4245526..95e60db 100644 (file)
 
 typedef struct
 {
-        int              *kib_dev_failover;     /* HCA failover */
-        unsigned int     *kib_service;          /* IB service number */
-        int              *kib_min_reconnect_interval; /* first failed connection retry... */
-        int              *kib_max_reconnect_interval; /* ...exponentially increasing to this */
-        int              *kib_cksum;            /* checksum kib_msg_t? */
-        int              *kib_timeout;          /* comms timeout (seconds) */
-        int              *kib_keepalive;        /* keepalive timeout (seconds) */
-        int              *kib_ntx;              /* # tx descs */
-        int              *kib_credits;          /* # concurrent sends */
-        int              *kib_peertxcredits;    /* # concurrent sends to 1 peer */
-        int              *kib_peerrtrcredits;   /* # per-peer router buffer credits */
-        int              *kib_peercredits_hiw;  /* # when eagerly to return credits */
-        int              *kib_peertimeout;      /* seconds to consider peer dead */
-        char            **kib_default_ipif;     /* default IPoIB interface */
-        int              *kib_retry_count;
-        int              *kib_rnr_retry_count;
-        int              *kib_concurrent_sends; /* send work queue sizing */
-        int             *kib_ib_mtu;           /* IB MTU */
-        int              *kib_map_on_demand;    /* map-on-demand if RD has more fragments
-                                                 * than this value, 0 disable map-on-demand */
-        int              *kib_pmr_pool_size;    /* # physical MR in pool */
-        int              *kib_fmr_pool_size;    /* # FMRs in pool */
-        int              *kib_fmr_flush_trigger; /* When to trigger FMR flush */
-        int              *kib_fmr_cache;        /* enable FMR pool cache? */
+       int              *kib_dev_failover;     /* HCA failover */
+       unsigned int     *kib_service;          /* IB service number */
+       int              *kib_min_reconnect_interval; /* first failed connection retry... */
+       int              *kib_max_reconnect_interval; /* ...exponentially increasing to this */
+       int              *kib_cksum;            /* checksum kib_msg_t? */
+       int              *kib_timeout;          /* comms timeout (seconds) */
+       int              *kib_keepalive;        /* keepalive timeout (seconds) */
+       int              *kib_ntx;              /* # tx descs */
+       int              *kib_credits;          /* # concurrent sends */
+       int              *kib_peertxcredits;    /* # concurrent sends to 1 peer */
+       int              *kib_peerrtrcredits;   /* # per-peer router buffer credits */
+       int              *kib_peercredits_hiw;  /* # when eagerly to return credits */
+       int              *kib_peertimeout;      /* seconds to consider peer dead */
+       char            **kib_default_ipif;     /* default IPoIB interface */
+       int              *kib_retry_count;
+       int              *kib_rnr_retry_count;
+       int              *kib_concurrent_sends; /* send work queue sizing */
+       int              *kib_ib_mtu;           /* IB MTU */
+       int              *kib_map_on_demand;    /* map-on-demand if RD has more fragments
+                                                * than this value, 0 disable map-on-demand */
+       int              *kib_pmr_pool_size;    /* # physical MR in pool */
+       int              *kib_fmr_pool_size;    /* # FMRs in pool */
+       int              *kib_fmr_flush_trigger; /* When to trigger FMR flush */
+       int              *kib_fmr_cache;        /* enable FMR pool cache? */
 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
-        cfs_sysctl_table_header_t *kib_sysctl;  /* sysctl interface */
+       struct ctl_table_header *kib_sysctl;  /* sysctl interface */
 #endif
-        int              *kib_require_priv_port;/* accept only privileged ports */
-        int              *kib_use_priv_port;    /* use privileged port for active connect */
+       int              *kib_require_priv_port;/* accept only privileged ports */
+       int              *kib_use_priv_port;    /* use privileged port for active connect */
        /* # threads on each CPT */
        int              *kib_nscheds;
 } kib_tunables_t;
index 40a5ea7..5f900bd 100644 (file)
@@ -231,7 +231,7 @@ enum {
 
 #endif
 
-static cfs_sysctl_table_t kiblnd_ctl_table[] = {
+static struct ctl_table kiblnd_ctl_table[] = {
         {
                 .ctl_name = O2IBLND_SERVICE,
                 .procname = "service",
@@ -404,7 +404,7 @@ static cfs_sysctl_table_t kiblnd_ctl_table[] = {
         {0}
 };
 
-static cfs_sysctl_table_t kiblnd_top_ctl_table[] = {
+static struct ctl_table kiblnd_top_ctl_table[] = {
         {
                 .ctl_name = CTL_O2IBLND,
                 .procname = "o2iblnd",
@@ -426,21 +426,21 @@ kiblnd_initstrtunable(char *space, char *str, int size)
 void
 kiblnd_sysctl_init (void)
 {
-        kiblnd_initstrtunable(ipif_basename_space, ipif_name,
-                              sizeof(ipif_basename_space));
+       kiblnd_initstrtunable(ipif_basename_space, ipif_name,
+                             sizeof(ipif_basename_space));
 
-        kiblnd_tunables.kib_sysctl =
-                cfs_register_sysctl_table(kiblnd_top_ctl_table, 0);
+       kiblnd_tunables.kib_sysctl =
+               register_sysctl_table(kiblnd_top_ctl_table);
 
-        if (kiblnd_tunables.kib_sysctl == NULL)
-                CWARN("Can't setup /proc tunables\n");
+       if (kiblnd_tunables.kib_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
 }
 
 void
 kiblnd_sysctl_fini (void)
 {
-        if (kiblnd_tunables.kib_sysctl != NULL)
-                cfs_unregister_sysctl_table(kiblnd_tunables.kib_sysctl);
+       if (kiblnd_tunables.kib_sysctl != NULL)
+               unregister_sysctl_table(kiblnd_tunables.kib_sysctl);
 }
 
 #else
index 09278dd..ee12cd8 100644 (file)
@@ -629,9 +629,9 @@ kptllnd_base_shutdown (void)
                 LIBCFS_FREE(kptllnd_data.kptl_nak_msg,
                             offsetof(kptl_msg_t, ptlm_u));
 
-        memset(&kptllnd_data, 0, sizeof(kptllnd_data));
-        PORTAL_MODULE_UNUSE;
-        return;
+       memset(&kptllnd_data, 0, sizeof(kptllnd_data));
+       module_put(THIS_MODULE);
+       return;
 }
 
 int
@@ -693,12 +693,12 @@ kptllnd_base_startup (void)
         CFS_INIT_LIST_HEAD(&kptllnd_data.kptl_idle_txs);
         cfs_atomic_set(&kptllnd_data.kptl_ntx, 0);
 
-        /* Uptick the module reference count */
-        PORTAL_MODULE_USE;
+       /* Uptick the module reference count */
+       try_module_get(THIS_MODULE);
 
-        kptllnd_data.kptl_expected_peers =
-                *kptllnd_tunables.kptl_max_nodes *
-                *kptllnd_tunables.kptl_max_procs_per_node;
+       kptllnd_data.kptl_expected_peers =
+               *kptllnd_tunables.kptl_max_nodes *
+               *kptllnd_tunables.kptl_max_procs_per_node;
 
         /*
          * Initialize the Network interface instance
index 76844cd..682367c 100644 (file)
 
 typedef struct
 {
-        int             *kptl_ntx;              /* # tx descs to pre-allocate */
-        int             *kptl_max_nodes;        /* max # nodes all talking to me */
-        int             *kptl_max_procs_per_node; /* max # processes per node */
-        int             *kptl_checksum;         /* checksum kptl_msg_t? */
-        int             *kptl_timeout;          /* comms timeout (seconds) */
-        int             *kptl_portal;           /* portal number */
-        int             *kptl_pid;              /* portals PID (self + kernel peers) */
-        int             *kptl_rxb_npages;       /* number of pages for rx buffer */
-        int             *kptl_rxb_nspare;       /* number of spare rx buffers */
-        int             *kptl_credits;          /* number of credits */
-        int             *kptl_peertxcredits;    /* number of peer tx credits */
-        int             *kptl_peerrtrcredits;   /* number of peer router credits */
-        int             *kptl_max_msg_size;     /* max immd message size*/
-        int             *kptl_peer_hash_table_size; /* # slots in peer hash table */
-        int             *kptl_reschedule_loops; /* scheduler yield loops */
-        int             *kptl_ack_puts;         /* make portals ack PUTs */
+       int             *kptl_ntx;              /* # tx descs to pre-allocate */
+       int             *kptl_max_nodes;        /* max # nodes all talking to me */
+       int             *kptl_max_procs_per_node; /* max # processes per node */
+       int             *kptl_checksum;         /* checksum kptl_msg_t? */
+       int             *kptl_timeout;          /* comms timeout (seconds) */
+       int             *kptl_portal;           /* portal number */
+       int             *kptl_pid;              /* portals PID (self + kernel peers) */
+       int             *kptl_rxb_npages;       /* number of pages for rx buffer */
+       int             *kptl_rxb_nspare;       /* number of spare rx buffers */
+       int             *kptl_credits;          /* number of credits */
+       int             *kptl_peertxcredits;    /* number of peer tx credits */
+       int             *kptl_peerrtrcredits;   /* number of peer router credits */
+       int             *kptl_max_msg_size;     /* max immd message size*/
+       int             *kptl_peer_hash_table_size; /* # slots in peer hash table */
+       int             *kptl_reschedule_loops; /* scheduler yield loops */
+       int             *kptl_ack_puts;         /* make portals ack PUTs */
 #ifdef PJK_DEBUGGING
-        int             *kptl_simulation_bitmap;/* simulation bitmap */
+       int             *kptl_simulation_bitmap;/* simulation bitmap */
 #endif
 
 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
-        cfs_sysctl_table_header_t *kptl_sysctl; /* sysctl interface */
+       struct ctl_table_header *kptl_sysctl; /* sysctl interface */
 #endif
 } kptl_tunables_t;
 
index 09ca397..ed4f13b 100644 (file)
@@ -182,7 +182,7 @@ enum {
 #define KPTLLND_SIMULATION_BITMAP CTL_UNNUMBERED
 #endif
 
-static cfs_sysctl_table_t kptllnd_ctl_table[] = {
+static struct ctl_table kptllnd_ctl_table[] = {
         {
                 .ctl_name = KPTLLND_NTX,
                 .procname = "ntx",
@@ -317,7 +317,7 @@ static cfs_sysctl_table_t kptllnd_ctl_table[] = {
         {0}
 };
 
-static cfs_sysctl_table_t kptllnd_top_ctl_table[] = {
+static struct ctl_table kptllnd_top_ctl_table[] = {
         {
                 .ctl_name = CTL_PTLLND,
                 .procname = "ptllnd",
@@ -332,20 +332,20 @@ static cfs_sysctl_table_t kptllnd_top_ctl_table[] = {
 int
 kptllnd_tunables_init ()
 {
-        kptllnd_tunables.kptl_sysctl =
-                cfs_register_sysctl_table(kptllnd_top_ctl_table, 0);
+       kptllnd_tunables.kptl_sysctl =
+               register_sysctl_table(kptllnd_top_ctl_table, 0);
 
-        if (kptllnd_tunables.kptl_sysctl == NULL)
-                CWARN("Can't setup /proc tunables\n");
+       if (kptllnd_tunables.kptl_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
 
-        return 0;
+       return 0;
 }
 
 void
 kptllnd_tunables_fini ()
 {
-        if (kptllnd_tunables.kptl_sysctl != NULL)
-                cfs_unregister_sysctl_table(kptllnd_tunables.kptl_sysctl);
+       if (kptllnd_tunables.kptl_sysctl != NULL)
+               unregister_sysctl_table(kptllnd_tunables.kptl_sysctl);
 }
 
 #else
index dcee1a8..1dce8d4 100644 (file)
@@ -254,7 +254,7 @@ kqswnal_shutdown(lnet_ni_t *ni)
 
        CDEBUG (D_MALLOC, "done kmem %d\n", cfs_atomic_read(&libcfs_kmemory));
 
-       PORTAL_MODULE_UNUSE;
+       module_put(THIS_MODULE);
 }
 
 int
@@ -311,7 +311,7 @@ kqswnal_startup (lnet_ni_t *ni)
 
        /* pointers/lists/locks initialised */
        kqswnal_data.kqn_init = KQN_INIT_DATA;
-       PORTAL_MODULE_USE;
+       try_module_get(THIS_MODULE);
        
        kqswnal_data.kqn_ep = ep_system();
        if (kqswnal_data.kqn_ep == NULL) {
index 98c433e..49059d2 100644 (file)
@@ -248,7 +248,7 @@ typedef struct
 #endif
 
 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
-        cfs_sysctl_table_header_t *kqn_sysctl;  /* sysctl interface */
+       struct ctl_table_header *kqn_sysctl;  /* sysctl interface */
 #endif
 } kqswnal_tunables_t;
 
index 12c205c..47a3c71 100644 (file)
@@ -117,7 +117,7 @@ enum
 
 #endif
 
-static cfs_sysctl_table_t kqswnal_ctl_table[] = {
+static struct ctl_table kqswnal_ctl_table[] = {
         {
                 .ctl_name = KQSWNAL_TX_MAXCONTIG,
                 .procname = "tx_maxcontig",
@@ -211,7 +211,7 @@ static cfs_sysctl_table_t kqswnal_ctl_table[] = {
         {0}
 };
 
-static cfs_sysctl_table_t kqswnal_top_ctl_table[] = {
+static struct ctl_table kqswnal_top_ctl_table[] = {
         {
                 .ctl_name = CTL_KQSWNAL,
                 .procname = "qswnal",
@@ -226,20 +226,19 @@ static cfs_sysctl_table_t kqswnal_top_ctl_table[] = {
 int
 kqswnal_tunables_init ()
 {
-        kqswnal_tunables.kqn_sysctl =
-                cfs_register_sysctl_table(kqswnal_top_ctl_table, 0);
+       kqswnal_tunables.kqn_sysctl =
+               register_sysctl_table(kqswnal_top_ctl_table);
 
-        if (kqswnal_tunables.kqn_sysctl == NULL)
-                CWARN("Can't setup /proc tunables\n");
+       if (kqswnal_tunables.kqn_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
 
-        return 0;
+       return 0;
 }
 
-void
-kqswnal_tunables_fini ()
+void kqswnal_tunables_fini()
 {
-        if (kqswnal_tunables.kqn_sysctl != NULL)
-                cfs_unregister_sysctl_table(kqswnal_tunables.kqn_sysctl);
+       if (kqswnal_tunables.kqn_sysctl != NULL)
+               unregister_sysctl_table(kqswnal_tunables.kqn_sysctl);
 }
 #else
 int
index 2ada9bd..189db2e 100644 (file)
@@ -1553,8 +1553,8 @@ kranal_shutdown (lnet_ni_t *ni)
         CDEBUG(D_MALLOC, "after NAL cleanup: kmem %d\n",
                cfs_atomic_read(&libcfs_kmemory));
 
-        kranal_data.kra_init = RANAL_INIT_NOTHING;
-        PORTAL_MODULE_UNUSE;
+       kranal_data.kra_init = RANAL_INIT_NOTHING;
+       module_put(THIS_MODULE);
 }
 
 int
@@ -1629,9 +1629,9 @@ kranal_startup (lnet_ni_t *ni)
         CFS_INIT_LIST_HEAD(&kranal_data.kra_idle_txs);
        spin_lock_init(&kranal_data.kra_tx_lock);
 
-        /* OK to call kranal_api_shutdown() to cleanup now */
-        kranal_data.kra_init = RANAL_INIT_DATA;
-        PORTAL_MODULE_USE;
+       /* OK to call kranal_api_shutdown() to cleanup now */
+       kranal_data.kra_init = RANAL_INIT_DATA;
+       try_module_get(THIS_MODULE);
 
         kranal_data.kra_peer_hash_size = RANAL_PEER_HASH_SIZE;
         LIBCFS_ALLOC(kranal_data.kra_peers,
index a3cbb3b..afec808 100644 (file)
@@ -98,7 +98,7 @@ typedef struct
         int              *kra_max_immediate;    /* immediate payload breakpoint */
 
 #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
-        cfs_sysctl_table_header_t *kra_sysctl;  /* sysctl interface */
+       struct ctl_table_header *kra_sysctl;  /* sysctl interface */
 #endif
 } kra_tunables_t;
 
@@ -438,7 +438,7 @@ int kranal_recv(lnet_ni_t *ni, void *private, lnet_msg_t *lntmsg,
 int kranal_accept(lnet_ni_t *ni, struct socket *sock);
 
 extern void kranal_free_acceptsock (kra_acceptsock_t *ras);
-extern int kranal_listener_procint (cfs_sysctl_table_t *table,
+extern int kranal_listener_procint (struct ctl_table *table,
                                     int write, struct file *filp,
                                     void *buffer, size_t *lenp);
 extern void kranal_update_reaper_timeout (long timeout);
index 136bbe7..79f1572 100644 (file)
@@ -113,7 +113,7 @@ enum {
 #define KRENAL_IMMEDIATE_MAX    CTL_UNNUMBERED
 #endif
 
-static cfs_sysctl_table_t kranal_ctl_table[] = {
+static struct ctl_table kranal_ctl_table[] = {
         {
                 .ctl_name = KRANAL_N_CONND,
                 .procname = "n_connd",
@@ -189,7 +189,7 @@ static cfs_sysctl_table_t kranal_ctl_table[] = {
         {0}
 };
 
-static cfs_sysctl_table_t kranal_top_ctl_table[] = {
+static struct ctl_table kranal_top_ctl_table[] = {
         {
                 .ctl_name = CTL_KRANAL,
                 .procname = "ranal",
@@ -204,20 +204,19 @@ static cfs_sysctl_table_t kranal_top_ctl_table[] = {
 int
 kranal_tunables_init ()
 {
-        kranal_tunables.kra_sysctl =
-                cfs_register_sysctl_table(kranal_top_ctl_table, 0);
+       kranal_tunables.kra_sysctl =
+               register_sysctl_table(kranal_top_ctl_table);
 
-        if (kranal_tunables.kra_sysctl == NULL)
-                CWARN("Can't setup /proc tunables\n");
+       if (kranal_tunables.kra_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
 
-        return 0;
+       return 0;
 }
 
-void
-kranal_tunables_fini ()
+void kranal_tunables_fini()
 {
-        if (kranal_tunables.kra_sysctl != NULL)
-                cfs_unregister_sysctl_table(kranal_tunables.kra_sysctl);
+       if (kranal_tunables.kra_sysctl != NULL)
+               unregister_sysctl_table(kranal_tunables.kra_sysctl);
 }
 
 #else
@@ -225,7 +224,7 @@ kranal_tunables_fini ()
 int
 kranal_tunables_init ()
 {
-        return 0;
+       return 0;
 }
 
 void
index 03d581b..37fbe28 100644 (file)
@@ -2346,10 +2346,10 @@ ksocknal_base_shutdown(void)
                 break;
         }
 
-        CDEBUG(D_MALLOC, "after NAL cleanup: kmem %d\n",
-               cfs_atomic_read (&libcfs_kmemory));
+       CDEBUG(D_MALLOC, "after NAL cleanup: kmem %d\n",
+              cfs_atomic_read (&libcfs_kmemory));
 
-        PORTAL_MODULE_UNUSE;
+       module_put(THIS_MODULE);
 }
 
 __u64 ksocknal_new_incarnation (void)
@@ -2409,7 +2409,7 @@ ksocknal_base_startup(void)
 
        /* flag lists/ptrs/locks initialised */
        ksocknal_data.ksnd_init = SOCKNAL_INIT_DATA;
-       PORTAL_MODULE_USE;
+       try_module_get(THIS_MODULE);
 
        ksocknal_data.ksnd_sched_info = cfs_percpt_alloc(lnet_cpt_table(),
                                                         sizeof(*info));
index 3fd04ac..951927b 100644 (file)
@@ -147,7 +147,7 @@ typedef struct
         int              *ksnd_protocol;        /* protocol version */
 #endif
 #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
-        cfs_sysctl_table_header_t *ksnd_sysctl;   /* sysctl interface */
+       struct ctl_table_header *ksnd_sysctl;   /* sysctl interface */
 #endif
 } ksock_tunables_t;
 
index ff50818..363183e 100644 (file)
@@ -101,7 +101,7 @@ SYSCTL_INT(_lnet_ksocknal,    OID_AUTO,         keepalive_intvl,
            CTLTYPE_INT | CTLFLAG_RW ,           &ksocknal_tunables.ksnd_keepalive_intvl, 
            0,                                   "keepalive_intvl");
 
-cfs_sysctl_table_t      ksocknal_top_ctl_table [] = {
+struct ctl_table      ksocknal_top_ctl_table [] = {
         &sysctl__lnet_ksocknal,
         &sysctl__lnet_ksocknal_timeout,
         &sysctl__lnet_ksocknal_credits,
@@ -125,7 +125,7 @@ int
 ksocknal_lib_tunables_init ()
 {
         ksocknal_tunables.ksnd_sysctl =
-                cfs_register_sysctl_table (ksocknal_top_ctl_table, 0);
+               register_sysctl_table (ksocknal_top_ctl_table);
 
         if (ksocknal_tunables.ksnd_sysctl == NULL)
                return -ENOMEM;
@@ -136,8 +136,8 @@ ksocknal_lib_tunables_init ()
 void
 ksocknal_lib_tunables_fini ()
 {
-        if (ksocknal_tunables.ksnd_sysctl != NULL)
-                cfs_unregister_sysctl_table (ksocknal_tunables.ksnd_sysctl);   
+       if (ksocknal_tunables.ksnd_sysctl != NULL)
+               unregister_sysctl_table (ksocknal_tunables.ksnd_sysctl);
 }
 #else
 int
index 1dff915..fa66f21 100644 (file)
@@ -98,7 +98,7 @@ enum {
 #define SOCKLND_ZERO_COPY_RECV_MIN_NFRAGS CTL_UNNUMBERED
 #endif
 
-static cfs_sysctl_table_t ksocknal_ctl_table[] = {
+static struct ctl_table ksocknal_ctl_table[] = {
         {
                 .ctl_name = SOCKLND_TIMEOUT,
                 .procname = "timeout",
@@ -344,7 +344,7 @@ static cfs_sysctl_table_t ksocknal_ctl_table[] = {
 };
 
 
-cfs_sysctl_table_t ksocknal_top_ctl_table[] = {
+struct ctl_table ksocknal_top_ctl_table[] = {
         {
                 .ctl_name = CTL_SOCKLND,
                 .procname = "socknal",
@@ -359,37 +359,37 @@ cfs_sysctl_table_t ksocknal_top_ctl_table[] = {
 int
 ksocknal_lib_tunables_init ()
 {
-        if (!*ksocknal_tunables.ksnd_typed_conns) {
-                int rc = -EINVAL;
+       if (!*ksocknal_tunables.ksnd_typed_conns) {
+               int rc = -EINVAL;
 #if SOCKNAL_VERSION_DEBUG
-                if (*ksocknal_tunables.ksnd_protocol < 3)
-                        rc = 0;
+               if (*ksocknal_tunables.ksnd_protocol < 3)
+                       rc = 0;
 #endif
-                if (rc != 0) {
-                        CERROR("Protocol V3.x MUST have typed connections\n");
-                        return rc;
-                }
-        }
+               if (rc != 0) {
+                       CERROR("Protocol V3.x MUST have typed connections\n");
+                       return rc;
+               }
+       }
 
-        if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags < 2)
-                *ksocknal_tunables.ksnd_zc_recv_min_nfrags = 2;
-        if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags > LNET_MAX_IOV)
-                *ksocknal_tunables.ksnd_zc_recv_min_nfrags = LNET_MAX_IOV;
+       if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags < 2)
+               *ksocknal_tunables.ksnd_zc_recv_min_nfrags = 2;
+       if (*ksocknal_tunables.ksnd_zc_recv_min_nfrags > LNET_MAX_IOV)
+               *ksocknal_tunables.ksnd_zc_recv_min_nfrags = LNET_MAX_IOV;
 
-        ksocknal_tunables.ksnd_sysctl =
-                cfs_register_sysctl_table(ksocknal_top_ctl_table, 0);
+       ksocknal_tunables.ksnd_sysctl =
+               register_sysctl_table(ksocknal_top_ctl_table);
 
-        if (ksocknal_tunables.ksnd_sysctl == NULL)
-                CWARN("Can't setup /proc tunables\n");
+       if (ksocknal_tunables.ksnd_sysctl == NULL)
+               CWARN("Can't setup /proc tunables\n");
 
-        return 0;
+       return 0;
 }
 
 void
 ksocknal_lib_tunables_fini ()
 {
-        if (ksocknal_tunables.ksnd_sysctl != NULL)
-                cfs_unregister_sysctl_table(ksocknal_tunables.ksnd_sysctl);
+       if (ksocknal_tunables.ksnd_sysctl != NULL)
+               unregister_sysctl_table(ksocknal_tunables.ksnd_sysctl);
 }
 #else
 int
index b1899ec..0ffd8b0 100644 (file)
@@ -41,9 +41,9 @@
 #include "socklnd.h"
 
 # if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
-static cfs_sysctl_table_t ksocknal_ctl_table[21];
+static struct ctl_table ksocknal_ctl_table[21];
 
-cfs_sysctl_table_t ksocknal_top_ctl_table[] = {
+struct ctl_table ksocknal_top_ctl_table[] = {
         {
                 /* ctl_name */  200,
                 /* procname */  "socknal",
@@ -248,7 +248,7 @@ ksocknal_lib_tunables_init ()
         LASSERT (i <= sizeof(ksocknal_ctl_table)/sizeof(ksocknal_ctl_table[0]));
 
         ksocknal_tunables.ksnd_sysctl =
-                cfs_register_sysctl_table(ksocknal_top_ctl_table, 0);
+               register_sysctl_table(ksocknal_top_ctl_table);
 
         if (ksocknal_tunables.ksnd_sysctl == NULL)
                 CWARN("Can't setup /proc tunables\n");
@@ -259,8 +259,8 @@ ksocknal_lib_tunables_init ()
 void
 ksocknal_lib_tunables_fini ()
 {
-        if (ksocknal_tunables.ksnd_sysctl != NULL)
-                cfs_unregister_sysctl_table(ksocknal_tunables.ksnd_sysctl);
+       if (ksocknal_tunables.ksnd_sysctl != NULL)
+               unregister_sysctl_table(ksocknal_tunables.ksnd_sysctl);
 }
 #else
 int
index 3151030..50b4043 100644 (file)
@@ -1194,10 +1194,10 @@ lnet_startup_lndnis (void)
 
 #ifdef __KERNEL__
                 if (lnd == NULL) {
-                        LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
-                        rc = cfs_request_module("%s",
-                                                libcfs_lnd2modname(lnd_type));
-                        LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
+                       LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
+                       rc = request_module("%s",
+                                               libcfs_lnd2modname(lnd_type));
+                       LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
 
                         lnd = lnet_find_lnd_by_type(lnd_type);
                         if (lnd == NULL) {
index 6bb052b..588c295 100644 (file)
@@ -30,7 +30,7 @@
 /* This is really lnet_proc.c. You might need to update sanity test 215
  * if any file format is changed. */
 
-static cfs_sysctl_table_header_t *lnet_table_header = NULL;
+static struct ctl_table_header *lnet_table_header = NULL;
 
 #ifndef HAVE_SYSCTL_UNNUMBERED
 #define CTL_LNET         (0x100)
@@ -862,7 +862,7 @@ out:
 }
 DECLARE_PROC_HANDLER(proc_lnet_portal_rotor);
 
-static cfs_sysctl_table_t lnet_table[] = {
+static struct ctl_table lnet_table[] = {
         /*
          * NB No .strategy entries have been provided since sysctl(8) prefers
          * to go via /proc for portability.
@@ -914,7 +914,7 @@ static cfs_sysctl_table_t lnet_table[] = {
        }
 };
 
-static cfs_sysctl_table_t top_table[] = {
+static struct ctl_table top_table[] = {
         {
                 INIT_CTL_NAME(CTL_LNET)
                 .procname = "lnet",
@@ -932,8 +932,8 @@ void
 lnet_proc_init(void)
 {
 #ifdef CONFIG_SYSCTL
-        if (lnet_table_header == NULL)
-                lnet_table_header = cfs_register_sysctl_table(top_table, 0);
+       if (lnet_table_header == NULL)
+               lnet_table_header = register_sysctl_table(top_table);
 #endif
 }
 
@@ -941,10 +941,10 @@ void
 lnet_proc_fini(void)
 {
 #ifdef CONFIG_SYSCTL
-        if (lnet_table_header != NULL)
-                cfs_unregister_sysctl_table(lnet_table_header);
+       if (lnet_table_header != NULL)
+               unregister_sysctl_table(lnet_table_header);
 
-        lnet_table_header = NULL;
+       lnet_table_header = NULL;
 #endif
 }
 
index dc1797f..ce53045 100644 (file)
@@ -65,7 +65,7 @@ DECLARE_EXIT(lnet_selftest_fini);
  * module info
  */
 
-cfs_module_t libcfs_global_module =  {"selftest"};
+struct module libcfs_global_module =  {"selftest"};
 
 /*
  * structure definitions
index a411359..8d9915d 100644 (file)
@@ -299,7 +299,7 @@ int in_group_p(gid_t gid);
 #define recalc_sigpending(l) do {} while (0)
 
 #define call_usermodehelper(path, argv, envp, wait) (0)
-#define CFS_KERN_INFO
+#define KERN_INFO
 
 #if HZ != 1
 #error "liblustre's jiffies currently expects HZ to be 1"
index 5c30afa..ca3f996 100644 (file)
@@ -54,20 +54,20 @@ typedef void (*fsfilt_cb_t)(struct obd_device *obd, __u64 last_rcvd,
                             void *data, int error);
 
 struct fsfilt_operations {
-        cfs_list_t fs_list;
-        cfs_module_t *fs_owner;
-        char   *fs_type;
-        char   *(* fs_getlabel)(struct super_block *sb);
-        void   *(* fs_start)(struct inode *inode, int op, void *desc_private,
-                             int logs);
-        int     (* fs_commit)(struct inode *inode, void *handle,int force_sync);
-        int     (* fs_map_inode_pages)(struct inode *inode, struct page **page,
+       cfs_list_t fs_list;
+       struct module *fs_owner;
+       char   *fs_type;
+       char   *(* fs_getlabel)(struct super_block *sb);
+       void   *(* fs_start)(struct inode *inode, int op, void *desc_private,
+                            int logs);
+       int     (* fs_commit)(struct inode *inode, void *handle,int force_sync);
+       int     (* fs_map_inode_pages)(struct inode *inode, struct page **page,
                                       int pages, unsigned long *blocks,
                                       int create, struct mutex *sem);
-        int     (* fs_write_record)(struct file *, void *, int size, loff_t *,
-                                    int force_sync);
-        int     (* fs_read_record)(struct file *, void *, int size, loff_t *);
-        int     (* fs_setup)(struct super_block *sb);
+       int     (* fs_write_record)(struct file *, void *, int size, loff_t *,
+                                   int force_sync);
+       int     (* fs_read_record)(struct file *, void *, int size, loff_t *);
+       int     (* fs_setup)(struct super_block *sb);
 };
 
 extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops);
index 4e78a72..6156c08 100644 (file)
@@ -487,7 +487,7 @@ lprocfs_stats_counter_size(struct lprocfs_stats *stats)
                percpusize += stats->ls_num * sizeof(__s64);
 
        if ((stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU) == 0)
-               percpusize = CFS_L1_CACHE_ALIGN(percpusize);
+               percpusize = L1_CACHE_ALIGN(percpusize);
 
        return percpusize;
 }
index bd0e58d..366fe5a 100644 (file)
@@ -1111,14 +1111,14 @@ struct lu_context_key {
          * key.
          */
         cfs_atomic_t lct_used;
-        /**
-         * Internal implementation detail: module for this key.
-         */
-        cfs_module_t *lct_owner;
-        /**
-         * References to this key. For debugging.
-         */
-        struct lu_ref  lct_reference;
+       /**
+        * Internal implementation detail: module for this key.
+        */
+       struct module *lct_owner;
+       /**
+        * References to this key. For debugging.
+        */
+       struct lu_ref  lct_reference;
 };
 
 #define LU_KEY_INIT(mod, type)                                    \
index 339cd7c..80d5d13 100644 (file)
@@ -1146,7 +1146,7 @@ struct ptlrpc_nrs_pol_conf {
         * different module to the one the NRS framework is held within
         * (currently ptlrpc), should set this field to THIS_MODULE.
         */
-       cfs_module_t                      *nc_owner;
+       struct module                     *nc_owner;
        /**
         * Policy registration flags; a bitmast of \e nrs_policy_flags
         */
@@ -1221,7 +1221,7 @@ struct ptlrpc_nrs_pol_desc {
         *   then unregistration and lprocfs operations will be properly
         *   serialized.
         */
-       cfs_module_t                           *pd_owner;
+       struct module                          *pd_owner;
        /**
         * Bitmask of \e nrs_policy_flags
         */
index d6fbd2f..11d8460 100644 (file)
@@ -796,11 +796,11 @@ struct ptlrpc_sec_sops {
 };
 
 struct ptlrpc_sec_policy {
-        cfs_module_t                   *sp_owner;
-        char                           *sp_name;
-        __u16                           sp_policy; /* policy number */
-        struct ptlrpc_sec_cops         *sp_cops;   /* client ops */
-        struct ptlrpc_sec_sops         *sp_sops;   /* server ops */
+       struct module                  *sp_owner;
+       char                           *sp_name;
+       __u16                           sp_policy; /* policy number */
+       struct ptlrpc_sec_cops         *sp_cops;   /* client ops */
+       struct ptlrpc_sec_sops         *sp_sops;   /* server ops */
 };
 
 #define PTLRPC_SEC_FL_REVERSE           0x0001 /* reverse sec */
@@ -943,17 +943,17 @@ char *sptlrpc_flavor2name_bulk(struct sptlrpc_flavor *sf,
 char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize);
 char *sptlrpc_secflags2str(__u32 flags, char *buf, int bufsize);
 
-static inline
-struct ptlrpc_sec_policy *sptlrpc_policy_get(struct ptlrpc_sec_policy *policy)
+static inline struct ptlrpc_sec_policy *
+sptlrpc_policy_get(struct ptlrpc_sec_policy *policy)
 {
-        __cfs_module_get(policy->sp_owner);
-        return policy;
+       __module_get(policy->sp_owner);
+       return policy;
 }
 
-static inline
-void sptlrpc_policy_put(struct ptlrpc_sec_policy *policy)
+static inline void
+sptlrpc_policy_put(struct ptlrpc_sec_policy *policy)
 {
-        cfs_module_put(policy->sp_owner);
+       module_put(policy->sp_owner);
 }
 
 /*
index a3801d2..31a92a5 100644 (file)
@@ -1144,9 +1144,9 @@ struct md_enqueue_info {
 };
 
 struct obd_ops {
-        cfs_module_t *o_owner;
-        int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
-                           void *karg, void *uarg);
+       struct module *o_owner;
+       int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len,
+                          void *karg, void *uarg);
         int (*o_get_info)(const struct lu_env *env, struct obd_export *,
                           __u32 keylen, void *key, __u32 *vallen, void *val,
                           struct lov_stripe_md *lsm);
index 42e666f..a8622d7 100644 (file)
@@ -1003,15 +1003,15 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
         if (cfg == NULL)
                 RETURN(-ENOMEM);
 
-        cfs_module_get();
-
-        /* client additional sb info */
-        lsi->lsi_llsbi = sbi = ll_init_sbi();
-        if (!sbi) {
-                cfs_module_put(THIS_MODULE);
-                OBD_FREE_PTR(cfg);
-                RETURN(-ENOMEM);
-        }
+       try_module_get(THIS_MODULE);
+
+       /* client additional sb info */
+       lsi->lsi_llsbi = sbi = ll_init_sbi();
+       if (!sbi) {
+               module_put(THIS_MODULE);
+               OBD_FREE_PTR(cfg);
+               RETURN(-ENOMEM);
+       }
 
         err = ll_options(lsi->lsi_lmd->lmd_opts, &sbi->ll_flags);
         if (err)
@@ -1146,11 +1146,11 @@ void ll_put_super(struct super_block *sb)
         ll_free_sbi(sb);
         lsi->lsi_llsbi = NULL;
 
-        lustre_common_put_super(sb);
+       lustre_common_put_super(sb);
 
-        cfs_module_put(THIS_MODULE);
+       module_put(THIS_MODULE);
 
-        EXIT;
+       EXIT;
 } /* client_put_super */
 
 struct inode *ll_inode_from_resource_lock(struct ldlm_lock *lock)
index 2e24b07..ad3f230 100644 (file)
@@ -489,8 +489,8 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused,
         int                   error;
         loff_t                size;
 
-        if (!cfs_try_module_get(THIS_MODULE))
-                return -ENODEV;
+       if (!try_module_get(THIS_MODULE))
+               return -ENODEV;
 
         error = -EBUSY;
         if (lo->lo_state != LLOOP_UNBOUND)
@@ -557,9 +557,9 @@ static int loop_set_fd(struct lloop_device *lo, struct file *unused,
        return 0;
 
 out:
-        /* This is safe: open() is still holding a reference. */
-        cfs_module_put(THIS_MODULE);
-        return error;
+       /* This is safe: open() is still holding a reference. */
+       module_put(THIS_MODULE);
+       return error;
 }
 
 static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,
@@ -594,10 +594,10 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,
         bd_set_size(bdev, 0);
         mapping_set_gfp_mask(filp->f_mapping, gfp);
         lo->lo_state = LLOOP_UNBOUND;
-        fput(filp);
-        /* This is safe: open() is still holding a reference. */
-        cfs_module_put(THIS_MODULE);
-        return 0;
+       fput(filp);
+       /* This is safe: open() is still holding a reference. */
+       module_put(THIS_MODULE);
+       return 0;
 }
 
 static int lo_open(struct block_device *bdev, fmode_t mode)
index 1170bf5..d5fe34b 100644 (file)
@@ -70,10 +70,10 @@ int fsfilt_register_ops(struct fsfilt_operations *fs_ops)
                         /* unlock fsfilt_types list */
                         RETURN(-EEXIST);
                 }
-        } else {
-                PORTAL_MODULE_USE;
-                cfs_list_add(&fs_ops->fs_list, &fsfilt_types);
-        }
+       } else {
+               try_module_get(THIS_MODULE);
+               cfs_list_add(&fs_ops->fs_list, &fsfilt_types);
+       }
 
         /* unlock fsfilt_types list */
         return 0;
@@ -88,12 +88,12 @@ void fsfilt_unregister_ops(struct fsfilt_operations *fs_ops)
         cfs_list_for_each(p, &fsfilt_types) {
                 struct fsfilt_operations *found;
 
-                found = cfs_list_entry(p, typeof(*found), fs_list);
-                if (found == fs_ops) {
-                        cfs_list_del(p);
-                        PORTAL_MODULE_UNUSE;
-                        break;
-                }
+               found = cfs_list_entry(p, typeof(*found), fs_list);
+               if (found == fs_ops) {
+                       cfs_list_del(p);
+                       module_put(THIS_MODULE);
+                       break;
+               }
         }
         /* unlock fsfilt_types list */
 }
@@ -101,38 +101,38 @@ EXPORT_SYMBOL(fsfilt_unregister_ops);
 
 struct fsfilt_operations *fsfilt_get_ops(const char *type)
 {
-        struct fsfilt_operations *fs_ops;
-
-        /* lock fsfilt_types list */
-        if (!(fs_ops = fsfilt_search_type(type))) {
-                char name[32];
-                int rc;
-
-                snprintf(name, sizeof(name) - 1, "fsfilt_%s", type);
-                name[sizeof(name) - 1] = '\0';
-
-                if (!(rc = cfs_request_module("%s", name))) {
-                        fs_ops = fsfilt_search_type(type);
-                        CDEBUG(D_INFO, "Loaded module '%s'\n", name);
-                        if (!fs_ops)
-                                rc = -ENOENT;
-                }
-
-                if (rc) {
-                        CERROR("Can't find %s interface\n", name);
-                        RETURN(ERR_PTR(rc < 0 ? rc : -rc));
-                        /* unlock fsfilt_types list */
-                }
-        }
-        cfs_try_module_get(fs_ops->fs_owner);
-        /* unlock fsfilt_types list */
-
-        return fs_ops;
+       struct fsfilt_operations *fs_ops;
+
+       /* lock fsfilt_types list */
+       if (!(fs_ops = fsfilt_search_type(type))) {
+               char name[32];
+               int rc;
+
+               snprintf(name, sizeof(name) - 1, "fsfilt_%s", type);
+               name[sizeof(name) - 1] = '\0';
+
+               if (!(rc = request_module("%s", name))) {
+                       fs_ops = fsfilt_search_type(type);
+                       CDEBUG(D_INFO, "Loaded module '%s'\n", name);
+                       if (!fs_ops)
+                               rc = -ENOENT;
+               }
+
+               if (rc) {
+                       CERROR("Can't find %s interface\n", name);
+                       RETURN(ERR_PTR(rc < 0 ? rc : -rc));
+                       /* unlock fsfilt_types list */
+               }
+       }
+       try_module_get(fs_ops->fs_owner);
+       /* unlock fsfilt_types list */
+
+       return fs_ops;
 }
 EXPORT_SYMBOL(fsfilt_get_ops);
 
 void fsfilt_put_ops(struct fsfilt_operations *fs_ops)
 {
-        cfs_module_put(fs_ops->fs_owner);
+       module_put(fs_ops->fs_owner);
 }
 EXPORT_SYMBOL(fsfilt_put_ops);
index 8a0073c..55a0254 100644 (file)
@@ -1836,10 +1836,10 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         int rc;
         ENTRY;
 
-        if (!cfs_try_module_get(THIS_MODULE)) {
-                CERROR("Can't get module. Is it alive?");
-                return -EINVAL;
-        }
+       if (!try_module_get(THIS_MODULE)) {
+               CERROR("Can't get module. Is it alive?");
+               return -EINVAL;
+       }
         switch (cmd) {
         case OBD_IOC_CHANGELOG_SEND:
                 rc = mdc_ioc_changelog_send(obd, karg);
@@ -1972,7 +1972,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, rc = -ENOTTY);
        }
 out:
-       cfs_module_put(THIS_MODULE);
+       module_put(THIS_MODULE);
 
        return rc;
 }
index 4266524..7df4950 100644 (file)
@@ -448,9 +448,9 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 } /* class_handle_ioctl */
 
 #ifdef __KERNEL__
-extern cfs_psdev_t obd_psdev;
+extern struct miscdevice obd_psdev;
 #else
-void *obd_psdev = NULL;
+struct miscdevice obd_psdev;
 #endif
 
 #define OBD_INIT_CHECK
@@ -575,11 +575,11 @@ int init_obdclass(void)
 
         CFS_INIT_LIST_HEAD(&obd_types);
 
-        err = cfs_psdev_register(&obd_psdev);
-        if (err) {
-                CERROR("cannot register %d err %d\n", OBD_DEV_MINOR, err);
-                return err;
-        }
+       err = misc_register(&obd_psdev);
+       if (err) {
+               CERROR("cannot register %d err %d\n", OBD_DEV_MINOR, err);
+               return err;
+       }
 
         /* This struct is already zeroed for us (static global) */
         for (i = 0; i < class_devno_max(); i++)
@@ -690,16 +690,16 @@ static void cleanup_obdclass(void)
 
         lustre_unregister_fs();
 
-        cfs_psdev_deregister(&obd_psdev);
-        for (i = 0; i < class_devno_max(); i++) {
-                struct obd_device *obd = class_num2obd(i);
-                if (obd && obd->obd_set_up &&
-                    OBT(obd) && OBP(obd, detach)) {
-                        /* XXX should this call generic detach otherwise? */
-                        LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
-                        OBP(obd, detach)(obd);
-                }
-        }
+       misc_deregister(&obd_psdev);
+       for (i = 0; i < class_devno_max(); i++) {
+               struct obd_device *obd = class_num2obd(i);
+               if (obd && obd->obd_set_up &&
+                   OBT(obd) && OBP(obd, detach)) {
+                       /* XXX should this call generic detach otherwise? */
+                       LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
+                       OBP(obd, detach)(obd);
+               }
+       }
        llog_info_fini();
 #ifdef HAVE_SERVER_SUPPORT
        lu_ucred_global_fini();
index f5969d2..faf2815 100644 (file)
@@ -193,7 +193,7 @@ static struct cdevsw obd_psdevsw = {
        NULL,
 };
 
-cfs_psdev_t obd_psdev = {
+struct miscdevice obd_psdev = {
        -1,
        NULL,
        "obd",
index 929407f..0ed3736 100644 (file)
@@ -49,7 +49,7 @@
 #define BUILD_VERSION          "Unknown"
 #endif
 
-cfs_sysctl_table_header_t *obd_table_header = NULL;
+struct ctl_table_header *obd_table_header = NULL;
 
 int proc_obd_timeout SYSCTL_HANDLER_ARGS;
 extern unsigned int obd_dump_on_timeout;
@@ -81,7 +81,7 @@ SYSCTL_INT(_lustre,           OID_AUTO,       ldlm_timeout,
           CTLTYPE_INT | CTLFLAG_RW,            &ldlm_timeout,
           0,           "ldlm_timeout");
 
-static cfs_sysctl_table_t      parent_table[] = {
+static struct ctl_table      parent_table[] = {
        &sysctl__lustre,
        &sysctl__lustre_timeout,
        &sysctl__lustre_dump_on_timeout,
@@ -126,7 +126,7 @@ void obd_sysctl_init (void)
 {
 #if 1 
        if ( !obd_table_header ) 
-               obd_table_header = cfs_register_sysctl_table(parent_table, 0);
+               obd_table_header = register_sysctl_table(parent_table);
 #endif
 }
                                                                                                                                                                      
@@ -134,7 +134,7 @@ void obd_sysctl_clean (void)
 {
 #if 1 
        if ( obd_table_header ) 
-               cfs_unregister_sysctl_table(obd_table_header); 
+               unregister_sysctl_table(obd_table_header);
        obd_table_header = NULL;
 #endif
 }
index a1f8a59..c79386e 100644 (file)
@@ -131,9 +131,9 @@ struct obd_type *class_get_type(const char *name)
                if (!strncmp(modname, LUSTRE_MDS_NAME, strlen(LUSTRE_MDS_NAME)))
                        modname = LUSTRE_MDT_NAME;
 
-                if (!cfs_request_module("%s", modname)) {
-                        CDEBUG(D_INFO, "Loaded module '%s'\n", modname);
-                        type = class_search_type(name);
+               if (!request_module("%s", modname)) {
+                       CDEBUG(D_INFO, "Loaded module '%s'\n", modname);
+                       type = class_search_type(name);
                 } else {
                         LCONSOLE_ERROR_MSG(0x158, "Can't load module '%s'\n",
                                            modname);
@@ -143,7 +143,7 @@ struct obd_type *class_get_type(const char *name)
         if (type) {
                spin_lock(&type->obd_type_lock);
                type->typ_refcnt++;
-               cfs_try_module_get(type->typ_dt_ops->o_owner);
+               try_module_get(type->typ_dt_ops->o_owner);
                spin_unlock(&type->obd_type_lock);
        }
        return type;
@@ -155,7 +155,7 @@ void class_put_type(struct obd_type *type)
        LASSERT(type);
        spin_lock(&type->obd_type_lock);
        type->typ_refcnt--;
-       cfs_module_put(type->typ_dt_ops->o_owner);
+       module_put(type->typ_dt_ops->o_owner);
        spin_unlock(&type->obd_type_lock);
 }
 EXPORT_SYMBOL(class_put_type);
index cc7c989..9df58a3 100644 (file)
@@ -174,19 +174,19 @@ EXPORT_SYMBOL(obd_ioctl_popdata);
 /*  opening /dev/obd */
 static int obd_class_open(struct inode * inode, struct file * file)
 {
-        ENTRY;
+       ENTRY;
 
-        PORTAL_MODULE_USE;
-        RETURN(0);
+       try_module_get(THIS_MODULE);
+       RETURN(0);
 }
 
 /*  closing /dev/obd */
 static int obd_class_release(struct inode * inode, struct file * file)
 {
-        ENTRY;
+       ENTRY;
 
-        PORTAL_MODULE_UNUSE;
-        RETURN(0);
+       module_put(THIS_MODULE);
+       RETURN(0);
 }
 
 /* to control /dev/obd */
@@ -216,7 +216,7 @@ static struct file_operations obd_psdev_fops = {
 };
 
 /* modules setup */
-cfs_psdev_t obd_psdev = {
+struct miscdevice obd_psdev = {
         .minor = OBD_DEV_MINOR,
         .name  = OBD_DEV_NAME,
         .fops  = &obd_psdev_fops,
index 4fa96ca..f6c8ecf 100644 (file)
@@ -54,7 +54,7 @@
 #include <lprocfs_status.h>
 
 #ifdef CONFIG_SYSCTL
-cfs_sysctl_table_header_t *obd_table_header = NULL;
+struct ctl_table_header *obd_table_header = NULL;
 #endif
 
 #ifndef HAVE_SYSCTL_UNNUMBERED
@@ -310,7 +310,7 @@ int LL_PROC_PROTO(proc_at_history)
 }
 
 #ifdef CONFIG_SYSCTL
-static cfs_sysctl_table_t obd_table[] = {
+static struct ctl_table obd_table[] = {
         {
                 INIT_CTL_NAME(OBD_TIMEOUT)
                 .procname = "timeout",
@@ -444,7 +444,7 @@ static cfs_sysctl_table_t obd_table[] = {
         {       INIT_CTL_NAME(0)    }
 };
 
-static cfs_sysctl_table_t parent_table[] = {
+static struct ctl_table parent_table[] = {
         {
                 INIT_CTL_NAME(OBD_SYSCTL)
                 .procname = "lustre",
@@ -460,16 +460,16 @@ static cfs_sysctl_table_t parent_table[] = {
 void obd_sysctl_init (void)
 {
 #ifdef CONFIG_SYSCTL
-        if ( !obd_table_header )
-                obd_table_header = cfs_register_sysctl_table(parent_table, 0);
+       if ( !obd_table_header )
+               obd_table_header = register_sysctl_table(parent_table);
 #endif
 }
 
 void obd_sysctl_clean (void)
 {
 #ifdef CONFIG_SYSCTL
-        if ( obd_table_header )
-                cfs_unregister_sysctl_table(obd_table_header);
-        obd_table_header = NULL;
+       if ( obd_table_header )
+               unregister_sysctl_table(obd_table_header);
+       obd_table_header = NULL;
 #endif
 }
index cb2da24..1546068 100644 (file)
@@ -1411,8 +1411,8 @@ static void key_fini(struct lu_context *ctx, int index)
 
                LASSERT(key->lct_owner != NULL);
                if ((ctx->lc_tags & LCT_NOREF) == 0) {
-                       LINVRNT(cfs_module_refcount(key->lct_owner) > 0);
-                       cfs_module_put(key->lct_owner);
+                       LINVRNT(module_refcount(key->lct_owner) > 0);
+                       module_put(key->lct_owner);
                }
                ctx->lc_value[index] = NULL;
        }
@@ -1615,11 +1615,11 @@ static int keys_fill(struct lu_context *ctx)
                         if (unlikely(IS_ERR(value)))
                                 return PTR_ERR(value);
 
-                        LASSERT(key->lct_owner != NULL);
-                        if (!(ctx->lc_tags & LCT_NOREF))
-                                cfs_try_module_get(key->lct_owner);
-                        lu_ref_add_atomic(&key->lct_reference, "ctx", ctx);
-                        cfs_atomic_inc(&key->lct_used);
+                       LASSERT(key->lct_owner != NULL);
+                       if (!(ctx->lc_tags & LCT_NOREF))
+                               try_module_get(key->lct_owner);
+                       lu_ref_add_atomic(&key->lct_reference, "ctx", ctx);
+                       cfs_atomic_inc(&key->lct_used);
                         /*
                          * This is the only place in the code, where an
                          * element of ctx->lc_value[] array is set to non-NULL
index 241f9e0..0103e53 100644 (file)
@@ -2943,10 +2943,10 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
         int err = 0;
         ENTRY;
 
-        if (!cfs_try_module_get(THIS_MODULE)) {
-                CERROR("Can't get module. Is it alive?");
-                return -EINVAL;
-        }
+       if (!try_module_get(THIS_MODULE)) {
+               CERROR("Can't get module. Is it alive?");
+               return -EINVAL;
+       }
         switch (cmd) {
         case OBD_IOC_LOV_GET_CONFIG: {
                 char *buf;
@@ -3017,7 +3017,7 @@ static int osc_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                GOTO(out, err = -ENOTTY);
        }
 out:
-       cfs_module_put(THIS_MODULE);
+       module_put(THIS_MODULE);
        return err;
 }
 
index d9f0a40..fefad46 100644 (file)
@@ -5452,7 +5452,7 @@ static int osd_mount(const struct lu_env *env,
        }
 
        o->od_mnt = vfs_kern_mount(type, s_flags, dev, options);
-       cfs_module_put(type->owner);
+       module_put(type->owner);
 
        if (IS_ERR(o->od_mnt)) {
                rc = PTR_ERR(o->od_mnt);
index 7051454..203e1e7 100644 (file)
@@ -456,33 +456,33 @@ static int iam_path_check(struct iam_path *p)
 
 static int iam_leaf_load(struct iam_path *path)
 {
-        iam_ptr_t block;
-        int err;
-        struct iam_container *c;
-        struct buffer_head   *bh;
-        struct iam_leaf      *leaf;
-        struct iam_descr     *descr;
-
-        c     = path->ip_container;
-        leaf  = &path->ip_leaf;
-        descr = iam_path_descr(path);
-        block = path->ip_frame->leaf;
-        if (block == 0) {
-                /* XXX bug 11027 */
-                printk(CFS_KERN_EMERG "wrong leaf: %lu %d [%p %p %p]\n",
-                       (long unsigned)path->ip_frame->leaf,
-                       dx_get_count(dx_node_get_entries(path, path->ip_frame)),
-                       path->ip_frames[0].bh, path->ip_frames[1].bh,
-                       path->ip_frames[2].bh);
-        }
-        err   = descr->id_ops->id_node_read(c, block, NULL, &bh);
-        if (err == 0) {
-                leaf->il_bh = bh;
-                leaf->il_curidx = block;
-                err = iam_leaf_ops(leaf)->init(leaf);
-                assert_inv(ergo(err == 0, iam_leaf_check(leaf)));
-        }
-        return err;
+       iam_ptr_t block;
+       int err;
+       struct iam_container *c;
+       struct buffer_head   *bh;
+       struct iam_leaf      *leaf;
+       struct iam_descr     *descr;
+
+       c     = path->ip_container;
+       leaf  = &path->ip_leaf;
+       descr = iam_path_descr(path);
+       block = path->ip_frame->leaf;
+       if (block == 0) {
+               /* XXX bug 11027 */
+               printk(KERN_EMERG "wrong leaf: %lu %d [%p %p %p]\n",
+                      (long unsigned)path->ip_frame->leaf,
+                      dx_get_count(dx_node_get_entries(path, path->ip_frame)),
+                      path->ip_frames[0].bh, path->ip_frames[1].bh,
+                      path->ip_frames[2].bh);
+       }
+       err = descr->id_ops->id_node_read(c, block, NULL, &bh);
+       if (err == 0) {
+               leaf->il_bh = bh;
+               leaf->il_curidx = block;
+               err = iam_leaf_ops(leaf)->init(leaf);
+               assert_inv(ergo(err == 0, iam_leaf_check(leaf)));
+       }
+       return err;
 }
 
 static void iam_unlock_htree(struct iam_container *ic,
index aef90aa..7d0e93e 100644 (file)
@@ -241,31 +241,31 @@ static char *hex(char ch, char *area)
 
 static void l_print(struct iam_leaf *leaf, struct iam_lentry *entry)
 {
-        int i;
-        char *area;
-        char h[3];
+       int i;
+       char *area;
+       char h[3];
 
-        area = (char *)entry;
-        printk(CFS_KERN_EMERG "[");
-        for (i = iam_lfix_key_size(leaf); i > 0; --i, ++area)
-                printk("%s", hex(*area, h));
-        printk("]-(");
-        for (i = iam_leaf_descr(leaf)->id_rec_size; i > 0; --i, ++area)
-                printk("%s", hex(*area, h));
-        printk(")\n");
+       area = (char *)entry;
+       printk(KERN_EMERG "[");
+       for (i = iam_lfix_key_size(leaf); i > 0; --i, ++area)
+               printk("%s", hex(*area, h));
+       printk("]-(");
+       for (i = iam_leaf_descr(leaf)->id_rec_size; i > 0; --i, ++area)
+               printk("%s", hex(*area, h));
+       printk(")\n");
 }
 
 static void lfix_print(struct iam_leaf *leaf)
 {
-        struct iam_lentry *entry;
-        int count;
-        int i;
+       struct iam_lentry *entry;
+       int count;
+       int i;
 
-        entry = leaf->il_entries;
-        count = lentry_count_get(leaf);
-        printk(CFS_KERN_EMERG "lfix: %p %p %d\n", leaf, leaf->il_at, count);
-        for (i = 0; i < count; ++i, entry = iam_lfix_shift(leaf, entry, 1))
-                l_print(leaf, entry);
+       entry = leaf->il_entries;
+       count = lentry_count_get(leaf);
+       printk(KERN_EMERG "lfix: %p %p %d\n", leaf, leaf->il_at, count);
+       for (i = 0; i < count; ++i, entry = iam_lfix_shift(leaf, entry, 1))
+               l_print(leaf, entry);
 }
 
 static int iam_lfix_lookup(struct iam_leaf *l, const struct iam_key *k)
index ef53adf..b0b8c4e 100644 (file)
@@ -289,11 +289,11 @@ static struct lvar_leaf_entry *n_cur(const struct iam_leaf *l)
 
 void n_print(const struct iam_leaf *l)
 {
-        struct lvar_leaf_entry *scan;
+       struct lvar_leaf_entry *scan;
 
-        printk(CFS_KERN_EMERG "used: %d\n", h_used(n_head(l)));
-        for (scan = n_start(l); scan < n_end(l); scan = e_next(l, scan))
-                e_print(scan);
+       printk(KERN_EMERG "used: %d\n", h_used(n_head(l)));
+       for (scan = n_start(l); scan < n_end(l); scan = e_next(l, scan))
+               e_print(scan);
 }
 
 #if LDISKFS_CORRECTNESS_ON
index 4956049..7e9e206 100644 (file)
@@ -1080,7 +1080,7 @@ static int osp_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
        d = lu2osp_dev(obd->obd_lu_dev);
        LASSERT(d->opd_dt_dev.dd_ops == &osp_dt_ops);
 
-       if (!cfs_try_module_get(THIS_MODULE)) {
+       if (!try_module_get(THIS_MODULE)) {
                CERROR("%s: can't get module. Is it alive?", obd->obd_name);
                return -EINVAL;
        }
@@ -1104,7 +1104,7 @@ static int osp_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                       cmd, current_comm());
                rc = -ENOTTY;
        }
-       cfs_module_put(THIS_MODULE);
+       module_put(THIS_MODULE);
        return rc;
 }
 
index 482399c..4666688 100644 (file)
@@ -99,14 +99,14 @@ struct subflavor_desc {
 
 /* Each mechanism is described by the following struct: */
 struct gss_api_mech {
-        cfs_list_t              gm_list;
-        cfs_module_t           *gm_owner;
-        char                   *gm_name;
-        rawobj_t                gm_oid;
-        cfs_atomic_t            gm_count;
-        struct gss_api_ops     *gm_ops;
-        int                     gm_sf_num;
-        struct subflavor_desc  *gm_sfs;
+       cfs_list_t              gm_list;
+       struct module           *gm_owner;
+       char                   *gm_name;
+       rawobj_t                gm_oid;
+       cfs_atomic_t            gm_count;
+       struct gss_api_ops     *gm_ops;
+       int                     gm_sf_num;
+       struct subflavor_desc  *gm_sfs;
 };
 
 /* and must provide the following operations: */
index 09449a9..7c5b830 100644 (file)
@@ -88,8 +88,8 @@ void lgss_mech_unregister(struct gss_api_mech *gm)
 
 struct gss_api_mech *lgss_mech_get(struct gss_api_mech *gm)
 {
-        __cfs_module_get(gm->gm_owner);
-        return gm;
+       __module_get(gm->gm_owner);
+       return gm;
 }
 
 struct gss_api_mech *lgss_name_to_mech(char *name)
@@ -99,7 +99,7 @@ struct gss_api_mech *lgss_name_to_mech(char *name)
        spin_lock(&registered_mechs_lock);
        cfs_list_for_each_entry(pos, &registered_mechs, gm_list) {
                if (0 == strcmp(name, pos->gm_name)) {
-                       if (!cfs_try_module_get(pos->gm_owner))
+                       if (!try_module_get(pos->gm_owner))
                                continue;
                        gm = pos;
                        break;
@@ -127,23 +127,23 @@ struct gss_api_mech *lgss_subflavor_to_mech(__u32 subflavor)
        struct gss_api_mech *pos, *gm = NULL;
 
        spin_lock(&registered_mechs_lock);
-        cfs_list_for_each_entry(pos, &registered_mechs, gm_list) {
-                if (!cfs_try_module_get(pos->gm_owner))
-                        continue;
-                if (!mech_supports_subflavor(pos, subflavor)) {
-                        cfs_module_put(pos->gm_owner);
-                        continue;
-                }
-                gm = pos;
-                break;
-        }
+       cfs_list_for_each_entry(pos, &registered_mechs, gm_list) {
+               if (!try_module_get(pos->gm_owner))
+                       continue;
+               if (!mech_supports_subflavor(pos, subflavor)) {
+                       module_put(pos->gm_owner);
+                       continue;
+               }
+               gm = pos;
+               break;
+       }
        spin_unlock(&registered_mechs_lock);
        return gm;
 }
 
 void lgss_mech_put(struct gss_api_mech *gm)
 {
-        cfs_module_put(gm->gm_owner);
+       module_put(gm->gm_owner);
 }
 
 /* The mech could probably be determined from the token instead, but it's just
index 43b05e1..a023a05 100644 (file)
@@ -117,7 +117,7 @@ static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy)
        policy->pol_state = NRS_POL_STATE_STOPPED;
 
        if (cfs_atomic_dec_and_test(&policy->pol_desc->pd_refs))
-               cfs_module_put(policy->pol_desc->pd_owner);
+               module_put(policy->pol_desc->pd_owner);
 
        EXIT;
 }
@@ -259,7 +259,7 @@ static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy)
         * modules.
         */
        if (cfs_atomic_inc_return(&policy->pol_desc->pd_refs) == 1 &&
-           !cfs_try_module_get(policy->pol_desc->pd_owner)) {
+           !try_module_get(policy->pol_desc->pd_owner)) {
                cfs_atomic_dec(&policy->pol_desc->pd_refs);
                CERROR("NRS: cannot get module for policy %s; is it alive?\n",
                       policy->pol_desc->pd_name);
@@ -281,7 +281,7 @@ static int nrs_policy_start_locked(struct ptlrpc_nrs_policy *policy)
                spin_lock(&nrs->nrs_lock);
                if (rc != 0) {
                        if (cfs_atomic_dec_and_test(&policy->pol_desc->pd_refs))
-                               cfs_module_put(policy->pol_desc->pd_owner);
+                               module_put(policy->pol_desc->pd_owner);
 
                        policy->pol_state = NRS_POL_STATE_STOPPED;
                        GOTO(out, rc);
index 1faa98e..857eb2b 100644 (file)
@@ -128,11 +128,11 @@ struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
 
         while (1) {
                read_lock(&policy_lock);
-                policy = policies[number];
-                if (policy && !cfs_try_module_get(policy->sp_owner))
-                        policy = NULL;
-                if (policy == NULL)
-                        flag = cfs_atomic_read(&loaded);
+               policy = policies[number];
+               if (policy && !try_module_get(policy->sp_owner))
+                       policy = NULL;
+               if (policy == NULL)
+                       flag = cfs_atomic_read(&loaded);
                read_unlock(&policy_lock);
 
                 if (policy != NULL || flag != 0 ||
@@ -141,10 +141,10 @@ struct ptlrpc_sec_policy * sptlrpc_wireflavor2policy(__u32 flavor)
 
                 /* try to load gss module, once */
                mutex_lock(&load_mutex);
-                if (cfs_atomic_read(&loaded) == 0) {
-                        if (cfs_request_module("ptlrpc_gss") == 0)
-                                CDEBUG(D_SEC,
-                                       "module ptlrpc_gss loaded on demand\n");
+               if (cfs_atomic_read(&loaded) == 0) {
+                       if (request_module("ptlrpc_gss") == 0)
+                               CDEBUG(D_SEC,
+                                      "module ptlrpc_gss loaded on demand\n");
                         else
                                 CERROR("Unable to load module ptlrpc_gss\n");