main.c 2.0 KB

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