+#ifdef __KERNEL__
+static int __init obdecho_init(void)
+{
+ struct lprocfs_static_vars lvars;
+ int rc;
+
+ ENTRY;
+ LCONSOLE_INFO("Echo OBD driver; http://www.lustre.org/\n");
+
+ LASSERT(CFS_PAGE_SIZE % OBD_ECHO_BLOCK_SIZE == 0);
+
+ lprocfs_echo_init_vars(&lvars);
+
+# ifdef HAVE_SERVER_SUPPORT
+ rc = echo_persistent_pages_init();
+ if (rc != 0)
+ goto failed_0;
+
+ rc = class_register_type(&echo_obd_ops, NULL, lvars.module_vars,
+ LUSTRE_ECHO_NAME, NULL);
+ if (rc != 0)
+ goto failed_1;
+# endif
+
+ rc = echo_client_init();
+
+# ifdef HAVE_SERVER_SUPPORT
+ if (rc == 0)
+ RETURN(0);
+
+ class_unregister_type(LUSTRE_ECHO_NAME);
+failed_1:
+ echo_persistent_pages_fini();
+failed_0:
+# endif
+ RETURN(rc);
+}
+
+static void /*__exit*/ obdecho_exit(void)
+{
+ echo_client_exit();
+
+# ifdef HAVE_SERVER_SUPPORT
+ class_unregister_type(LUSTRE_ECHO_NAME);
+ echo_persistent_pages_fini();
+# endif
+}
+
+MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
+MODULE_DESCRIPTION("Lustre Testing Echo OBD driver");
+MODULE_LICENSE("GPL");
+
+cfs_module(obdecho, LUSTRE_VERSION_STRING, obdecho_init, obdecho_exit);
+#endif /* __KERNEL__ */
+