main.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 "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. static int __init init_dlm(void)
  27. {
  28. int error;
  29. error = dlm_memory_init();
  30. if (error)
  31. goto out;
  32. error = dlm_lockspace_init();
  33. if (error)
  34. goto out_mem;
  35. error = dlm_config_init();
  36. if (error)
  37. goto out_lockspace;
  38. error = dlm_register_debugfs();
  39. if (error)
  40. goto out_config;
  41. error = dlm_user_init();
  42. if (error)
  43. goto out_debug;
  44. printk("DLM (built %s %s) installed\n", __DATE__, __TIME__);
  45. return 0;
  46. out_debug:
  47. dlm_unregister_debugfs();
  48. out_config:
  49. dlm_config_exit();
  50. out_lockspace:
  51. dlm_lockspace_exit();
  52. out_mem:
  53. dlm_memory_exit();
  54. out:
  55. return error;
  56. }
  57. static void __exit exit_dlm(void)
  58. {
  59. dlm_user_exit();
  60. dlm_config_exit();
  61. dlm_memory_exit();
  62. dlm_lockspace_exit();
  63. dlm_unregister_debugfs();
  64. }
  65. module_init(init_dlm);
  66. module_exit(exit_dlm);
  67. MODULE_DESCRIPTION("Distributed Lock Manager");
  68. MODULE_AUTHOR("Red Hat, Inc.");
  69. MODULE_LICENSE("GPL");
  70. EXPORT_SYMBOL_GPL(dlm_new_lockspace);
  71. EXPORT_SYMBOL_GPL(dlm_release_lockspace);
  72. EXPORT_SYMBOL_GPL(dlm_lock);
  73. EXPORT_SYMBOL_GPL(dlm_unlock);