Whamcloud - gitweb
LU-6245 libcfs: remove libcfsutil.h
[fs/lustre-release.git] / lnet / selftest / module.c
index 74ea2a8..cdebec9 100644 (file)
@@ -26,6 +26,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -35,6 +37,7 @@
 #define DEBUG_SUBSYSTEM S_LNET
 
 #include "selftest.h"
+#include "console.h"
 
 enum {
        LST_INIT_NONE           = 0,
@@ -45,24 +48,19 @@ enum {
        LST_INIT_CONSOLE
 };
 
-extern int lstcon_console_init(void);
-extern int lstcon_console_fini(void);
-
 static int lst_init_step = LST_INIT_NONE;
 
 struct cfs_wi_sched *lst_sched_serial;
 struct cfs_wi_sched **lst_sched_test;
 
-void
+static void
 lnet_selftest_fini(void)
 {
        int     i;
 
         switch (lst_init_step) {
-#ifdef __KERNEL__
                 case LST_INIT_CONSOLE:
                         lstcon_console_fini();
-#endif
                 case LST_INIT_FW:
                         sfw_shutdown();
                 case LST_INIT_RPC:
@@ -101,7 +99,7 @@ lnet_selftest_structure_assertion(void)
         CLASSERT(sizeof(srpc_stat_reqst_t) == 28);
 }
 
-int
+static int
 lnet_selftest_init(void)
 {
        int     nscheds;
@@ -150,51 +148,21 @@ lnet_selftest_init(void)
         }
         lst_init_step = LST_INIT_FW;
 
-#ifdef __KERNEL__
         rc = lstcon_console_init();
         if (rc != 0) {
                 CERROR("LST can't startup console\n");
                 goto error;
         }
        lst_init_step = LST_INIT_CONSOLE;
-#endif
        return 0;
 error:
        lnet_selftest_fini();
        return rc;
 }
 
-#ifdef __KERNEL__
 
 MODULE_DESCRIPTION("LNet Selftest");
 MODULE_LICENSE("GPL");
 
 cfs_module(lnet, "0.9.0", lnet_selftest_init, lnet_selftest_fini);
 
-#else
-
-int
-selftest_wait_events (void)
-{
-        int evts = 0;
-
-        for (;;) {
-                /* Consume all pending events */
-                while (srpc_check_event(0))
-                        evts++;
-                evts += stt_check_events();
-                evts += swi_check_events();
-                if (evts != 0) break;
-
-                /* Nothing happened, block for events */
-                evts += srpc_check_event(stt_poll_interval());
-                /* We may have blocked, check for expired timers */
-                evts += stt_check_events();
-                if (evts == 0) /* timed out and still no event */
-                        break;
-        }
-
-        return evts;
-}
-
-#endif