main.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /******************************************************************************
  2. *******************************************************************************
  3. **
  4. ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  5. ** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
  6. **
  7. ** This copyrighted material is made available to anyone wishing to use,
  8. ** modify, copy, or redistribute it subject to the terms and conditions
  9. ** of the GNU General Public License v.2.
  10. **
  11. *******************************************************************************
  12. ******************************************************************************/
  13. #include "dlm_internal.h"
  14. #include "lockspace.h"
  15. #include "lock.h"
  16. #include "user.h"
  17. #include "memory.h"
  18. #include "lowcomms.h"
  19. #include "config.h"
  20. #ifdef CONFIG_DLM_DEBUG
  21. int dlm_register_debugfs(void);
  22. void dlm_unregister_debugfs(void);
  23. #else
  24. static inline int dlm_register_debugfs(void) { return 0; }
  25. static inline void dlm_unregister_debugfs(void) { }
  26. #endif
  27. static int __init init_dlm(void)
  28. {
  29. int error;
  30. error = dlm_memory_init();
  31. if (error)
  32. goto out;
  33. error = dlm_lockspace_init();
  34. if (error)
  35. goto out_mem;
  36. error = dlm_config_init();
  37. if (error)
  38. goto out_lockspace;
  39. error = dlm_register_debugfs();
  40. if (error)
  41. goto out_config;
  42. error = dlm_lowcomms_init();
  43. if (error)
  44. goto out_debug;
  45. error = dlm_user_init();
  46. if (error)
  47. goto out_lowcomms;
  48. printk("DLM (built %s %s) installed\n", __DATE__, __TIME__);
  49. return 0;
  50. out_lowcomms:
  51. dlm_lowcomms_exit();
  52. out_debug:
  53. dlm_unregister_debugfs();
  54. out_config:
  55. dlm_config_exit();
  56. out_lockspace:
  57. dlm_lockspace_exit();
  58. out_mem:
  59. dlm_memory_exit();
  60. out:
  61. return error;
  62. }
  63. static void __exit exit_dlm(void)
  64. {
  65. dlm_user_exit();
  66. dlm_lowcomms_exit();
  67. dlm_config_exit();
  68. dlm_memory_exit();
  69. dlm_lockspace_exit();
  70. dlm_unregister_debugfs();
  71. }
  72. module_init(init_dlm);
  73. module_exit(exit_dlm);
  74. MODULE_DESCRIPTION("Distributed Lock Manager");
  75. MODULE_AUTHOR("Red Hat, Inc.");
  76. MODULE_LICENSE("GPL");
  77. EXPORT_SYMBOL_GPL(dlm_new_lockspace);
  78. EXPORT_SYMBOL_GPL(dlm_release_lockspace);
  79. EXPORT_SYMBOL_GPL(dlm_lock);
  80. EXPORT_SYMBOL_GPL(dlm_unlock);