blob: f7b9b57348a8c74e1bba7a88b9c099abf67d1c3d [file] [log] [blame]
David Teiglande7fd4172006-01-18 09:30:29 +00001/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
David Teiglandd7db9232007-05-18 09:00:32 -05005** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
David Teiglande7fd4172006-01-18 09:30:29 +00006**
7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions
9** of the GNU General Public License v.2.
10**
11*******************************************************************************
12******************************************************************************/
13
14/* This is the device interface for dlm, most users will use a library
15 * interface.
16 */
17
18#define DLM_USER_LVB_LEN 32
19
20/* Version of the device interface */
David Teiglandd7db9232007-05-18 09:00:32 -050021#define DLM_DEVICE_VERSION_MAJOR 6
22#define DLM_DEVICE_VERSION_MINOR 0
David Teiglande7fd4172006-01-18 09:30:29 +000023#define DLM_DEVICE_VERSION_PATCH 0
24
25/* struct passed to the lock write */
26struct dlm_lock_params {
27 __u8 mode;
Patrick Caulfield22da6452006-06-09 16:14:20 -040028 __u8 namelen;
David Teiglandd7db9232007-05-18 09:00:32 -050029 __u16 unused;
30 __u32 flags;
David Teiglande7fd4172006-01-18 09:30:29 +000031 __u32 lkid;
32 __u32 parent;
David Teiglandd7db9232007-05-18 09:00:32 -050033 __u64 xid;
34 __u64 timeout;
35 void __user *castparam;
David Teiglande7fd4172006-01-18 09:30:29 +000036 void __user *castaddr;
37 void __user *bastparam;
David Teiglandd7db9232007-05-18 09:00:32 -050038 void __user *bastaddr;
David Teiglande7fd4172006-01-18 09:30:29 +000039 struct dlm_lksb __user *lksb;
40 char lvb[DLM_USER_LVB_LEN];
Patrick Caulfield22da6452006-06-09 16:14:20 -040041 char name[0];
David Teiglande7fd4172006-01-18 09:30:29 +000042};
43
44struct dlm_lspace_params {
45 __u32 flags;
46 __u32 minor;
Patrick Caulfield22da6452006-06-09 16:14:20 -040047 char name[0];
David Teiglande7fd4172006-01-18 09:30:29 +000048};
49
David Teigland72c2be72007-03-30 15:06:16 -050050struct dlm_purge_params {
51 __u32 nodeid;
52 __u32 pid;
53};
54
David Teiglande7fd4172006-01-18 09:30:29 +000055struct dlm_write_request {
56 __u32 version[3];
57 __u8 cmd;
Patrick Caulfield22da6452006-06-09 16:14:20 -040058 __u8 is64bit;
59 __u8 unused[2];
David Teiglande7fd4172006-01-18 09:30:29 +000060
61 union {
62 struct dlm_lock_params lock;
63 struct dlm_lspace_params lspace;
David Teigland72c2be72007-03-30 15:06:16 -050064 struct dlm_purge_params purge;
David Teiglande7fd4172006-01-18 09:30:29 +000065 } i;
66};
67
David Teiglandd7db9232007-05-18 09:00:32 -050068struct dlm_device_version {
69 __u32 version[3];
70};
71
David Teiglande7fd4172006-01-18 09:30:29 +000072/* struct read from the "device" fd,
73 consists mainly of userspace pointers for the library to use */
David Teiglandd7db9232007-05-18 09:00:32 -050074
David Teiglande7fd4172006-01-18 09:30:29 +000075struct dlm_lock_result {
David Teiglandd7db9232007-05-18 09:00:32 -050076 __u32 version[3];
David Teiglande7fd4172006-01-18 09:30:29 +000077 __u32 length;
78 void __user * user_astaddr;
79 void __user * user_astparam;
80 struct dlm_lksb __user * user_lksb;
81 struct dlm_lksb lksb;
82 __u8 bast_mode;
Patrick Caulfield22da6452006-06-09 16:14:20 -040083 __u8 unused[3];
David Teiglande7fd4172006-01-18 09:30:29 +000084 /* Offsets may be zero if no data is present */
85 __u32 lvb_offset;
86};
87
88/* Commands passed to the device */
89#define DLM_USER_LOCK 1
90#define DLM_USER_UNLOCK 2
91#define DLM_USER_QUERY 3
92#define DLM_USER_CREATE_LOCKSPACE 4
93#define DLM_USER_REMOVE_LOCKSPACE 5
David Teigland72c2be72007-03-30 15:06:16 -050094#define DLM_USER_PURGE 6
David Teiglande7fd4172006-01-18 09:30:29 +000095
96/* Arbitrary length restriction */
97#define MAX_LS_NAME_LEN 64
98
99/* Lockspace flags */
100#define DLM_USER_LSFLG_AUTOFREE 1
101#define DLM_USER_LSFLG_FORCEFREE 2
102