main.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. #include "lowcomms.h"
  20. static int __init init_dlm(void)
  21. {
  22. int error;
  23. error = dlm_memory_init();
  24. if (error)
  25. goto out;
  26. error = dlm_lockspace_init();
  27. if (error)
  28. goto out_mem;
  29. error = dlm_config_init();
  30. if (error)
  31. goto out_lockspace;
  32. error = dlm_register_debugfs();
  33. if (error)
  34. goto out_config;
  35. error = dlm_user_init();
  36. if (error)
  37. goto out_debug;
  38. error = dlm_netlink_init();
  39. if (error)
  40. goto out_user;
  41. error = dlm_plock_init();
  42. if (error)
  43. goto out_netlink;
  44. printk("DLM installed\n");
  45. return 0;
  46. out_netlink:
  47. dlm_netlink_exit();
  48. out_user:
  49. dlm_user_exit();
  50. out_debug:
  51. dlm_unregister_debugfs();
  52. out_config:
  53. dlm_config_exit();
  54. out_lockspace:
  55. dlm_lockspace_exit();
  56. out_mem:
  57. dlm_memory_exit();
  58. out:
  59. return error;
  60. }
  61. static void __exit exit_dlm(void)
  62. {
  63. dlm_plock_exit();
  64. dlm_netlink_exit();
  65. dlm_user_exit();
  66. dlm_config_exit();
  67. dlm_memory_exit();
  68. dlm_lockspace_exit();
  69. dlm_lowcomms_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);