xref: /linux/include/uapi/linux/dlm_device.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
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-2007 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 _LINUX_DLM_DEVICE_H
16607ca46eSDavid Howells #define _LINUX_DLM_DEVICE_H
17607ca46eSDavid Howells 
18607ca46eSDavid Howells /* This is the device interface for dlm, most users will use a library
19607ca46eSDavid Howells  * interface.
20607ca46eSDavid Howells  */
21607ca46eSDavid Howells 
22607ca46eSDavid Howells #include <linux/dlm.h>
23607ca46eSDavid Howells #include <linux/types.h>
24607ca46eSDavid Howells 
25607ca46eSDavid Howells #define DLM_USER_LVB_LEN	32
26607ca46eSDavid Howells 
27607ca46eSDavid Howells /* Version of the device interface */
28607ca46eSDavid Howells #define DLM_DEVICE_VERSION_MAJOR 6
29607ca46eSDavid Howells #define DLM_DEVICE_VERSION_MINOR 0
30b96f4650SDavid Teigland #define DLM_DEVICE_VERSION_PATCH 2
31607ca46eSDavid Howells 
32607ca46eSDavid Howells /* struct passed to the lock write */
33607ca46eSDavid Howells struct dlm_lock_params {
34607ca46eSDavid Howells 	__u8 mode;
35607ca46eSDavid Howells 	__u8 namelen;
36607ca46eSDavid Howells 	__u16 unused;
37607ca46eSDavid Howells 	__u32 flags;
38607ca46eSDavid Howells 	__u32 lkid;
39607ca46eSDavid Howells 	__u32 parent;
40607ca46eSDavid Howells 	__u64 xid;
41607ca46eSDavid Howells 	__u64 timeout;
42607ca46eSDavid Howells 	void __user *castparam;
43607ca46eSDavid Howells 	void __user *castaddr;
44607ca46eSDavid Howells 	void __user *bastparam;
45607ca46eSDavid Howells 	void __user *bastaddr;
46607ca46eSDavid Howells 	struct dlm_lksb __user *lksb;
47607ca46eSDavid Howells 	char lvb[DLM_USER_LVB_LEN];
48*47c66248SKees Cook 	char name[];
49607ca46eSDavid Howells };
50607ca46eSDavid Howells 
51607ca46eSDavid Howells struct dlm_lspace_params {
52607ca46eSDavid Howells 	__u32 flags;
53607ca46eSDavid Howells 	__u32 minor;
54*47c66248SKees Cook 	char name[];
55607ca46eSDavid Howells };
56607ca46eSDavid Howells 
57607ca46eSDavid Howells struct dlm_purge_params {
58607ca46eSDavid Howells 	__u32 nodeid;
59607ca46eSDavid Howells 	__u32 pid;
60607ca46eSDavid Howells };
61607ca46eSDavid Howells 
62607ca46eSDavid Howells struct dlm_write_request {
63607ca46eSDavid Howells 	__u32 version[3];
64607ca46eSDavid Howells 	__u8 cmd;
65607ca46eSDavid Howells 	__u8 is64bit;
66607ca46eSDavid Howells 	__u8 unused[2];
67607ca46eSDavid Howells 
68607ca46eSDavid Howells 	union  {
69607ca46eSDavid Howells 		struct dlm_lock_params   lock;
70607ca46eSDavid Howells 		struct dlm_lspace_params lspace;
71607ca46eSDavid Howells 		struct dlm_purge_params  purge;
72607ca46eSDavid Howells 	} i;
73607ca46eSDavid Howells };
74607ca46eSDavid Howells 
75607ca46eSDavid Howells struct dlm_device_version {
76607ca46eSDavid Howells 	__u32 version[3];
77607ca46eSDavid Howells };
78607ca46eSDavid Howells 
79607ca46eSDavid Howells /* struct read from the "device" fd,
80607ca46eSDavid Howells    consists mainly of userspace pointers for the library to use */
81607ca46eSDavid Howells 
82607ca46eSDavid Howells struct dlm_lock_result {
83607ca46eSDavid Howells 	__u32 version[3];
84607ca46eSDavid Howells 	__u32 length;
85607ca46eSDavid Howells 	void __user * user_astaddr;
86607ca46eSDavid Howells 	void __user * user_astparam;
87607ca46eSDavid Howells 	struct dlm_lksb __user * user_lksb;
88607ca46eSDavid Howells 	struct dlm_lksb lksb;
89607ca46eSDavid Howells 	__u8 bast_mode;
90607ca46eSDavid Howells 	__u8 unused[3];
91607ca46eSDavid Howells 	/* Offsets may be zero if no data is present */
92607ca46eSDavid Howells 	__u32 lvb_offset;
93607ca46eSDavid Howells };
94607ca46eSDavid Howells 
95607ca46eSDavid Howells /* Commands passed to the device */
96607ca46eSDavid Howells #define DLM_USER_LOCK         1
97607ca46eSDavid Howells #define DLM_USER_UNLOCK       2
98607ca46eSDavid Howells #define DLM_USER_QUERY        3
99607ca46eSDavid Howells #define DLM_USER_CREATE_LOCKSPACE  4
100607ca46eSDavid Howells #define DLM_USER_REMOVE_LOCKSPACE  5
101607ca46eSDavid Howells #define DLM_USER_PURGE        6
102607ca46eSDavid Howells #define DLM_USER_DEADLOCK     7
103607ca46eSDavid Howells 
104607ca46eSDavid Howells /* Lockspace flags */
105607ca46eSDavid Howells #define DLM_USER_LSFLG_AUTOFREE   1
106607ca46eSDavid Howells #define DLM_USER_LSFLG_FORCEFREE  2
107607ca46eSDavid Howells 
108607ca46eSDavid Howells #endif
109607ca46eSDavid Howells 
110