^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) **
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) **
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) **
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "dlm_internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "lockspace.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "lock.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "user.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "memory.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "config.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "lowcomms.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static int __init init_dlm(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) error = dlm_memory_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) error = dlm_lockspace_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) goto out_mem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) error = dlm_config_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) goto out_lockspace;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) dlm_register_debugfs();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) error = dlm_user_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) goto out_debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) error = dlm_netlink_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) goto out_user;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) error = dlm_plock_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) goto out_netlink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) printk("DLM installed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) out_netlink:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) dlm_netlink_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) out_user:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) dlm_user_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) out_debug:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) dlm_unregister_debugfs();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) dlm_config_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) out_lockspace:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) dlm_lockspace_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) out_mem:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) dlm_memory_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static void __exit exit_dlm(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) dlm_plock_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) dlm_netlink_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) dlm_user_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) dlm_config_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) dlm_memory_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) dlm_lockspace_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) dlm_lowcomms_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) dlm_unregister_debugfs();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) module_init(init_dlm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) module_exit(exit_dlm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) MODULE_DESCRIPTION("Distributed Lock Manager");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) MODULE_AUTHOR("Red Hat, Inc.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) EXPORT_SYMBOL_GPL(dlm_new_lockspace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) EXPORT_SYMBOL_GPL(dlm_release_lockspace);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) EXPORT_SYMBOL_GPL(dlm_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) EXPORT_SYMBOL_GPL(dlm_unlock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)