Whamcloud - gitweb
* ghastly hack to serialise RapkSetRiParams with comms scheduler thread
[fs/lustre-release.git] / lnet / lnet / module.c
index 40e9da4..21b91a5 100644 (file)
 #endif
 #define DEBUG_SUBSYSTEM S_PORTALS
 
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/smp_lock.h>
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#include <linux/fs.h>
-#include <linux/stat.h>
-#include <asm/uaccess.h>
-#include <asm/segment.h>
-#include <linux/miscdevice.h>
-
 #include <portals/lib-p30.h>
 #include <portals/p30.h>
 #include <portals/nal.h>
-#include <linux/kp30.h>
-#include <linux/kpr.h>
-#include <linux/portals_compat25.h>
+#include <libcfs/kp30.h>
+#include <portals/kpr.h>
 
 extern void (kping_client)(struct portal_ioctl_data *);
 
-static int kportal_ioctl(struct portal_ioctl_data *data, 
+static int kportal_ioctl(struct portal_ioctl_data *data,
                          unsigned int cmd, unsigned long arg)
 {
         int err;
@@ -81,9 +60,10 @@ static int kportal_ioctl(struct portal_ioctl_data *data,
                 ptl_handle_ni_t    nih;
                 ptl_process_id_t   pid;
 
-                CDEBUG (D_IOCTL, "Getting nid for nal [%d]\n", data->ioc_nal);
+                CDEBUG (D_IOCTL, "Getting nid for nal [%x]\n", data->ioc_nal);
 
-                err = PtlNIInit(data->ioc_nal, 0, NULL, NULL, &nih);
+                err = PtlNIInit(data->ioc_nal, LUSTRE_SRV_PTL_PID, NULL,
+                                NULL, &nih);
                 if (!(err == PTL_OK || err == PTL_IFACE_DUP))
                         RETURN (-EINVAL);
 
@@ -104,7 +84,8 @@ static int kportal_ioctl(struct portal_ioctl_data *data,
                 CDEBUG (D_IOCTL, "fail nid: [%d] "LPU64" count %d\n",
                         data->ioc_nal, data->ioc_nid, data->ioc_count);
 
-                err = PtlNIInit(data->ioc_nal, 0, NULL, NULL, &nih);
+                err = PtlNIInit(data->ioc_nal, LUSTRE_SRV_PTL_PID, NULL,
+                                NULL, &nih);
                 if (!(err == PTL_OK || err == PTL_IFACE_DUP))
                         return (-EINVAL);
 
@@ -128,12 +109,14 @@ static int kportal_ioctl(struct portal_ioctl_data *data,
 }
 
 DECLARE_IOCTL_HANDLER(kportal_ioctl_handler, kportal_ioctl);
+extern struct semaphore ptl_mutex;
 
 static int init_kportals_module(void)
 {
         int rc;
         ENTRY;
 
+        init_mutex(&ptl_mutex);
         rc = PtlInit(NULL);
         if (rc) {
                 CERROR("PtlInit: error %d\n", rc);
@@ -160,7 +143,6 @@ EXPORT_SYMBOL(ptl_register_nal);
 EXPORT_SYMBOL(ptl_unregister_nal);
 
 EXPORT_SYMBOL(ptl_err_str);
-EXPORT_SYMBOL(lib_dispatch);
 EXPORT_SYMBOL(PtlMEAttach);
 EXPORT_SYMBOL(PtlMEInsert);
 EXPORT_SYMBOL(PtlMEUnlink);
@@ -192,10 +174,9 @@ EXPORT_SYMBOL(lib_parse);
 EXPORT_SYMBOL(lib_create_reply_msg);
 EXPORT_SYMBOL(lib_init);
 EXPORT_SYMBOL(lib_fini);
-EXPORT_SYMBOL(dispatch_name);
 
 MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
 MODULE_DESCRIPTION("Portals v3.1");
 MODULE_LICENSE("GPL");
-module_init(init_kportals_module);
-module_exit(exit_kportals_module);
+
+cfs_module(portals, "1.0.0", init_kportals_module, exit_kportals_module);