main.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /******************************************************************************
  2. *******************************************************************************
  3. **
  4. ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  5. ** Copyright (C) 2004-2007 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 "config.h"
  19. #ifdef CONFIG_DLM_DEBUG
  20. int dlm_register_debugfs(void);
  21. void dlm_unregister_debugfs(void);
  22. #else
  23. static inline int dlm_register_debugfs(void) { return 0; }
  24. static inline void dlm_unregister_debugfs(void) { }
  25. #endif
  26. int dlm_netlink_init(void);
  27. void dlm_netlink_exit(void);
  28. static int __init init_dlm(void)
  29. {
  30. int error;
  31. error = dlm_memory_init();
  32. if (error)
  33. goto out;
  34. error = dlm_lockspace_init();
  35. if (error)
  36. goto out_mem;
  37. error = dlm_config_init();
  38. if (error)
  39. goto out_lockspace;
  40. error = dlm_register_debugfs();
  41. if (error)
  42. goto out_config;
  43. error = dlm_user_init();
  44. if (error)
  45. goto out_debug;
  46. error = dlm_netlink_init();
  47. if (error)
  48. goto out_user;
  49. printk("DLM (built %s %s) installed\n", __DATE__, __TIME__);
  50. return 0;
  51. out_user:
  52. dlm_user_exit();
  53. out_debug:
  54. dlm_unregister_debugfs();
  55. out_config:
  56. dlm_config_exit();
  57. out_lockspace:
  58. dlm_lockspace_exit();
  59. out_mem:
  60. dlm_memory_exit();
  61. out:
  62. return error;
  63. }
  64. static void __exit exit_dlm(void)
  65. {
  66. dlm_netlink_exit();
  67. dlm_user_exit();
  68. dlm_config_exit();
  69. dlm_memory_exit();
  70. dlm_lockspace_exit();
  71. dlm_unregister_debugfs();
  72. }
  73. module_init(init_dlm);
  74. module_exit(exit_dlm);
  75. MODULE_DESCRIPTION("Distributed Lock Manager");
  76. MODULE_AUTHOR("Red Hat, Inc.");
  77. MODULE_LICENSE("GPL");
  78. EXPORT_SYMBOL_GPL(dlm_new_lockspace);
  79. EXPORT_SYMBOL_GPL(dlm_release_lockspace);
  80. EXPORT_SYMBOL_GPL(dlm_lock);
  81. EXPORT_SYMBOL_GPL(dlm_unlock);