xref: /linux/include/uapi/linux/dlm_device.h (revision 607ca46e97a1b6594b29647d98a32d545c24bdff)
1*607ca46eSDavid Howells /******************************************************************************
2*607ca46eSDavid Howells *******************************************************************************
3*607ca46eSDavid Howells **
4*607ca46eSDavid Howells **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
5*607ca46eSDavid Howells **  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
6*607ca46eSDavid Howells **
7*607ca46eSDavid Howells **  This copyrighted material is made available to anyone wishing to use,
8*607ca46eSDavid Howells **  modify, copy, or redistribute it subject to the terms and conditions
9*607ca46eSDavid Howells **  of the GNU General Public License v.2.
10*607ca46eSDavid Howells **
11*607ca46eSDavid Howells *******************************************************************************
12*607ca46eSDavid Howells ******************************************************************************/
13*607ca46eSDavid Howells 
14*607ca46eSDavid Howells #ifndef _LINUX_DLM_DEVICE_H
15*607ca46eSDavid Howells #define _LINUX_DLM_DEVICE_H
16*607ca46eSDavid Howells 
17*607ca46eSDavid Howells /* This is the device interface for dlm, most users will use a library
18*607ca46eSDavid Howells  * interface.
19*607ca46eSDavid Howells  */
20*607ca46eSDavid Howells 
21*607ca46eSDavid Howells #include <linux/dlm.h>
22*607ca46eSDavid Howells #include <linux/types.h>
23*607ca46eSDavid Howells 
24*607ca46eSDavid Howells #define DLM_USER_LVB_LEN	32
25*607ca46eSDavid Howells 
26*607ca46eSDavid Howells /* Version of the device interface */
27*607ca46eSDavid Howells #define DLM_DEVICE_VERSION_MAJOR 6
28*607ca46eSDavid Howells #define DLM_DEVICE_VERSION_MINOR 0
29*607ca46eSDavid Howells #define DLM_DEVICE_VERSION_PATCH 1
30*607ca46eSDavid Howells 
31*607ca46eSDavid Howells /* struct passed to the lock write */
32*607ca46eSDavid Howells struct dlm_lock_params {
33*607ca46eSDavid Howells 	__u8 mode;
34*607ca46eSDavid Howells 	__u8 namelen;
35*607ca46eSDavid Howells 	__u16 unused;
36*607ca46eSDavid Howells 	__u32 flags;
37*607ca46eSDavid Howells 	__u32 lkid;
38*607ca46eSDavid Howells 	__u32 parent;
39*607ca46eSDavid Howells 	__u64 xid;
40*607ca46eSDavid Howells 	__u64 timeout;
41*607ca46eSDavid Howells 	void __user *castparam;
42*607ca46eSDavid Howells 	void __user *castaddr;
43*607ca46eSDavid Howells 	void __user *bastparam;
44*607ca46eSDavid Howells 	void __user *bastaddr;
45*607ca46eSDavid Howells 	struct dlm_lksb __user *lksb;
46*607ca46eSDavid Howells 	char lvb[DLM_USER_LVB_LEN];
47*607ca46eSDavid Howells 	char name[0];
48*607ca46eSDavid Howells };
49*607ca46eSDavid Howells 
50*607ca46eSDavid Howells struct dlm_lspace_params {
51*607ca46eSDavid Howells 	__u32 flags;
52*607ca46eSDavid Howells 	__u32 minor;
53*607ca46eSDavid Howells 	char name[0];
54*607ca46eSDavid Howells };
55*607ca46eSDavid Howells 
56*607ca46eSDavid Howells struct dlm_purge_params {
57*607ca46eSDavid Howells 	__u32 nodeid;
58*607ca46eSDavid Howells 	__u32 pid;
59*607ca46eSDavid Howells };
60*607ca46eSDavid Howells 
61*607ca46eSDavid Howells struct dlm_write_request {
62*607ca46eSDavid Howells 	__u32 version[3];
63*607ca46eSDavid Howells 	__u8 cmd;
64*607ca46eSDavid Howells 	__u8 is64bit;
65*607ca46eSDavid Howells 	__u8 unused[2];
66*607ca46eSDavid Howells 
67*607ca46eSDavid Howells 	union  {
68*607ca46eSDavid Howells 		struct dlm_lock_params   lock;
69*607ca46eSDavid Howells 		struct dlm_lspace_params lspace;
70*607ca46eSDavid Howells 		struct dlm_purge_params  purge;
71*607ca46eSDavid Howells 	} i;
72*607ca46eSDavid Howells };
73*607ca46eSDavid Howells 
74*607ca46eSDavid Howells struct dlm_device_version {
75*607ca46eSDavid Howells 	__u32 version[3];
76*607ca46eSDavid Howells };
77*607ca46eSDavid Howells 
78*607ca46eSDavid Howells /* struct read from the "device" fd,
79*607ca46eSDavid Howells    consists mainly of userspace pointers for the library to use */
80*607ca46eSDavid Howells 
81*607ca46eSDavid Howells struct dlm_lock_result {
82*607ca46eSDavid Howells 	__u32 version[3];
83*607ca46eSDavid Howells 	__u32 length;
84*607ca46eSDavid Howells 	void __user * user_astaddr;
85*607ca46eSDavid Howells 	void __user * user_astparam;
86*607ca46eSDavid Howells 	struct dlm_lksb __user * user_lksb;
87*607ca46eSDavid Howells 	struct dlm_lksb lksb;
88*607ca46eSDavid Howells 	__u8 bast_mode;
89*607ca46eSDavid Howells 	__u8 unused[3];
90*607ca46eSDavid Howells 	/* Offsets may be zero if no data is present */
91*607ca46eSDavid Howells 	__u32 lvb_offset;
92*607ca46eSDavid Howells };
93*607ca46eSDavid Howells 
94*607ca46eSDavid Howells /* Commands passed to the device */
95*607ca46eSDavid Howells #define DLM_USER_LOCK         1
96*607ca46eSDavid Howells #define DLM_USER_UNLOCK       2
97*607ca46eSDavid Howells #define DLM_USER_QUERY        3
98*607ca46eSDavid Howells #define DLM_USER_CREATE_LOCKSPACE  4
99*607ca46eSDavid Howells #define DLM_USER_REMOVE_LOCKSPACE  5
100*607ca46eSDavid Howells #define DLM_USER_PURGE        6
101*607ca46eSDavid Howells #define DLM_USER_DEADLOCK     7
102*607ca46eSDavid Howells 
103*607ca46eSDavid Howells /* Lockspace flags */
104*607ca46eSDavid Howells #define DLM_USER_LSFLG_AUTOFREE   1
105*607ca46eSDavid Howells #define DLM_USER_LSFLG_FORCEFREE  2
106*607ca46eSDavid Howells 
107*607ca46eSDavid Howells #endif
108*607ca46eSDavid Howells 
109