main.c 1.9 KB

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