12522fe45SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2e7fd4179SDavid Teigland /******************************************************************************
3e7fd4179SDavid Teigland *******************************************************************************
4e7fd4179SDavid Teigland **
53ae1acf9SDavid Teigland ** Copyright (C) 2005-2007 Red Hat, Inc. All rights reserved.
6e7fd4179SDavid Teigland **
7e7fd4179SDavid Teigland **
8e7fd4179SDavid Teigland *******************************************************************************
9e7fd4179SDavid Teigland ******************************************************************************/
10e7fd4179SDavid Teigland
11e7fd4179SDavid Teigland #ifndef __LOCK_DOT_H__
12e7fd4179SDavid Teigland #define __LOCK_DOT_H__
13e7fd4179SDavid Teigland
14a345da3eSDavid Teigland void dlm_dump_rsb(struct dlm_rsb *r);
15*11519351SAlexander Aring void dlm_dump_rsb_name(struct dlm_ls *ls, const char *name, int len);
16597d0caeSDavid Teigland void dlm_print_lkb(struct dlm_lkb *lkb);
17*11519351SAlexander Aring void dlm_receive_message_saved(struct dlm_ls *ls, const struct dlm_message *ms,
186d40c4a7SDavid Teigland uint32_t saved_seq);
19*11519351SAlexander Aring void dlm_receive_buffer(const union dlm_packet *p, int nodeid);
20e7fd4179SDavid Teigland int dlm_modes_compat(int mode1, int mode2);
21e7fd4179SDavid Teigland void dlm_put_rsb(struct dlm_rsb *r);
22e7fd4179SDavid Teigland void dlm_hold_rsb(struct dlm_rsb *r);
23e7fd4179SDavid Teigland int dlm_put_lkb(struct dlm_lkb *lkb);
24e7fd4179SDavid Teigland void dlm_scan_rsbs(struct dlm_ls *ls);
2585e86edfSDavid Teigland int dlm_lock_recovery_try(struct dlm_ls *ls);
2685e86edfSDavid Teigland void dlm_unlock_recovery(struct dlm_ls *ls);
276b0afc0cSAlexander Aring
28*11519351SAlexander Aring int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
29*11519351SAlexander Aring int len, unsigned int flags, int *r_nodeid, int *result);
30e7fd4179SDavid Teigland
3156171e0dSAlexander Aring int dlm_search_rsb_tree(struct rb_root *tree, const void *name, int len,
32c04fecb4SDavid Teigland struct dlm_rsb **r_ret);
337210cb7aSDavid Teigland
344875647aSDavid Teigland void dlm_recover_purge(struct dlm_ls *ls);
35e7fd4179SDavid Teigland void dlm_purge_mstcpy_locks(struct dlm_rsb *r);
364875647aSDavid Teigland void dlm_recover_grant(struct dlm_ls *ls);
37e7fd4179SDavid Teigland int dlm_recover_waiters_post(struct dlm_ls *ls);
38e7fd4179SDavid Teigland void dlm_recover_waiters_pre(struct dlm_ls *ls);
39*11519351SAlexander Aring int dlm_recover_master_copy(struct dlm_ls *ls, const struct dlm_rcom *rc,
40b9d2f6adSAlexander Aring __le32 *rl_remid, __le32 *rl_result);
41*11519351SAlexander Aring int dlm_recover_process_copy(struct dlm_ls *ls, const struct dlm_rcom *rc,
42c4f4e135SAlexander Aring uint64_t seq);
43e7fd4179SDavid Teigland
446b0afc0cSAlexander Aring int dlm_user_request(struct dlm_ls *ls, struct dlm_user_args *ua, int mode,
456b0afc0cSAlexander Aring uint32_t flags, void *name, unsigned int namelen);
466b0afc0cSAlexander Aring int dlm_user_convert(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
476b0afc0cSAlexander Aring int mode, uint32_t flags, uint32_t lkid, char *lvb_in);
482ab4bd8eSDavid Teigland int dlm_user_adopt_orphan(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
492ab4bd8eSDavid Teigland int mode, uint32_t flags, void *name, unsigned int namelen,
508d614a44SAlexander Aring uint32_t *lkid);
51597d0caeSDavid Teigland int dlm_user_unlock(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
52597d0caeSDavid Teigland uint32_t flags, uint32_t lkid, char *lvb_in);
53597d0caeSDavid Teigland int dlm_user_cancel(struct dlm_ls *ls, struct dlm_user_args *ua_tmp,
54597d0caeSDavid Teigland uint32_t flags, uint32_t lkid);
5572c2be77SDavid Teigland int dlm_user_purge(struct dlm_ls *ls, struct dlm_user_proc *proc,
5672c2be77SDavid Teigland int nodeid, int pid);
578b4021faSDavid Teigland int dlm_user_deadlock(struct dlm_ls *ls, uint32_t flags, uint32_t lkid);
58597d0caeSDavid Teigland void dlm_clear_proc_locks(struct dlm_ls *ls, struct dlm_user_proc *proc);
595054e79dSAlexander Aring int dlm_debug_add_lkb(struct dlm_ls *ls, uint32_t lkb_id, char *name, int len,
605054e79dSAlexander Aring int lkb_nodeid, unsigned int lkb_flags, int lkb_status);
6163eab2b0SAlexander Aring int dlm_debug_add_lkb_to_waiters(struct dlm_ls *ls, uint32_t lkb_id,
6263eab2b0SAlexander Aring int mstype, int to_nodeid);
63597d0caeSDavid Teigland
is_master(struct dlm_rsb * r)64e7fd4179SDavid Teigland static inline int is_master(struct dlm_rsb *r)
65e7fd4179SDavid Teigland {
66e7fd4179SDavid Teigland return !r->res_nodeid;
67e7fd4179SDavid Teigland }
68e7fd4179SDavid Teigland
lock_rsb(struct dlm_rsb * r)69e7fd4179SDavid Teigland static inline void lock_rsb(struct dlm_rsb *r)
70e7fd4179SDavid Teigland {
7190135925SDavid Teigland mutex_lock(&r->res_mutex);
72e7fd4179SDavid Teigland }
73e7fd4179SDavid Teigland
unlock_rsb(struct dlm_rsb * r)74e7fd4179SDavid Teigland static inline void unlock_rsb(struct dlm_rsb *r)
75e7fd4179SDavid Teigland {
7690135925SDavid Teigland mutex_unlock(&r->res_mutex);
77e7fd4179SDavid Teigland }
78e7fd4179SDavid Teigland
79e7fd4179SDavid Teigland #endif
80e7fd4179SDavid Teigland
81