xref: /linux/include/uapi/linux/dlm.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells /******************************************************************************
3607ca46eSDavid Howells *******************************************************************************
4607ca46eSDavid Howells **
5607ca46eSDavid Howells **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
6607ca46eSDavid Howells **  Copyright (C) 2004-2011 Red Hat, Inc.  All rights reserved.
7607ca46eSDavid Howells **
8607ca46eSDavid Howells **  This copyrighted material is made available to anyone wishing to use,
9607ca46eSDavid Howells **  modify, copy, or redistribute it subject to the terms and conditions
10607ca46eSDavid Howells **  of the GNU General Public License v.2.
11607ca46eSDavid Howells **
12607ca46eSDavid Howells *******************************************************************************
13607ca46eSDavid Howells ******************************************************************************/
14607ca46eSDavid Howells 
15607ca46eSDavid Howells #ifndef _UAPI__DLM_DOT_H__
16607ca46eSDavid Howells #define _UAPI__DLM_DOT_H__
17607ca46eSDavid Howells 
18607ca46eSDavid Howells /*
19607ca46eSDavid Howells  * Interface to Distributed Lock Manager (DLM)
20607ca46eSDavid Howells  * routines and structures to use DLM lockspaces
21607ca46eSDavid Howells  */
22607ca46eSDavid Howells 
23607ca46eSDavid Howells /* Lock levels and flags are here */
24607ca46eSDavid Howells #include <linux/dlmconstants.h>
25607ca46eSDavid Howells #include <linux/types.h>
26607ca46eSDavid Howells 
27607ca46eSDavid Howells typedef void dlm_lockspace_t;
28607ca46eSDavid Howells 
29607ca46eSDavid Howells /*
30607ca46eSDavid Howells  * Lock status block
31607ca46eSDavid Howells  *
32607ca46eSDavid Howells  * Use this structure to specify the contents of the lock value block.  For a
33607ca46eSDavid Howells  * conversion request, this structure is used to specify the lock ID of the
34607ca46eSDavid Howells  * lock.  DLM writes the status of the lock request and the lock ID assigned
35607ca46eSDavid Howells  * to the request in the lock status block.
36607ca46eSDavid Howells  *
37607ca46eSDavid Howells  * sb_lkid: the returned lock ID.  It is set on new (non-conversion) requests.
38607ca46eSDavid Howells  * It is available when dlm_lock returns.
39607ca46eSDavid Howells  *
40607ca46eSDavid Howells  * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules
41607ca46eSDavid Howells  * shown for the DLM_LKF_VALBLK flag.
42607ca46eSDavid Howells  *
43607ca46eSDavid Howells  * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock,
44607ca46eSDavid Howells  * it was first demoted to NL to avoid conversion deadlock.
45607ca46eSDavid Howells  * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid.
46607ca46eSDavid Howells  *
47607ca46eSDavid Howells  * sb_status: the returned status of the lock request set prior to AST
48607ca46eSDavid Howells  * execution.  Possible return values:
49607ca46eSDavid Howells  *
50607ca46eSDavid Howells  * 0 if lock request was successful
51607ca46eSDavid Howells  * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
52607ca46eSDavid Howells  * -DLM_EUNLOCK if unlock request was successful
53607ca46eSDavid Howells  * -DLM_ECANCEL if a cancel completed successfully
54607ca46eSDavid Howells  * -EDEADLK if a deadlock was detected
55607ca46eSDavid Howells  * -ETIMEDOUT if the lock request was canceled due to a timeout
56607ca46eSDavid Howells  */
57607ca46eSDavid Howells 
58607ca46eSDavid Howells #define DLM_SBF_DEMOTED		0x01
59607ca46eSDavid Howells #define DLM_SBF_VALNOTVALID	0x02
60607ca46eSDavid Howells #define DLM_SBF_ALTMODE		0x04
61607ca46eSDavid Howells 
62607ca46eSDavid Howells struct dlm_lksb {
63607ca46eSDavid Howells 	int 	 sb_status;
64607ca46eSDavid Howells 	__u32	 sb_lkid;
65607ca46eSDavid Howells 	char 	 sb_flags;
66607ca46eSDavid Howells 	char *	 sb_lvbptr;
67607ca46eSDavid Howells };
68607ca46eSDavid Howells 
69607ca46eSDavid Howells /* dlm_new_lockspace() flags */
70607ca46eSDavid Howells 
71*01c7a597SAlexander Aring /* DLM_LSFL_TIMEWARN is deprecated and reserved. DO NOT USE! */
72607ca46eSDavid Howells #define DLM_LSFL_TIMEWARN	0x00000002
73607ca46eSDavid Howells #define DLM_LSFL_NEWEXCL     	0x00000008
74607ca46eSDavid Howells 
75607ca46eSDavid Howells 
76607ca46eSDavid Howells #endif /* _UAPI__DLM_DOT_H__ */
77