main.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. error = dlm_plock_init();
  41. if (error)
  42. goto out_netlink;
  43. printk("DLM installed\n");
  44. return 0;
  45. out_netlink:
  46. dlm_netlink_exit();
  47. out_user:
  48. dlm_user_exit();
  49. out_debug:
  50. dlm_unregister_debugfs();
  51. out_config:
  52. dlm_config_exit();
  53. out_lockspace:
  54. dlm_lockspace_exit();
  55. out_mem:
  56. dlm_memory_exit();
  57. out:
  58. return error;
  59. }
  60. static void __exit exit_dlm(void)
  61. {
  62. dlm_plock_exit();
  63. dlm_netlink_exit();
  64. dlm_user_exit();
  65. dlm_config_exit();
  66. dlm_memory_exit();
  67. dlm_lockspace_exit();
  68. dlm_unregister_debugfs();
  69. }
  70. module_init(init_dlm);
  71. module_exit(exit_dlm);
  72. MODULE_DESCRIPTION("Distributed Lock Manager");
  73. MODULE_AUTHOR("Red Hat, Inc.");
  74. MODULE_LICENSE("GPL");
  75. EXPORT_SYMBOL_GPL(dlm_new_lockspace);
  76. EXPORT_SYMBOL_GPL(dlm_release_lockspace);
  77. EXPORT_SYMBOL_GPL(dlm_lock);
  78. EXPORT_SYMBOL_GPL(dlm_unlock);