blob: c2735cab2ebf2966b61f5d932cf1fd77401d978f [file] [log] [blame]
David Teiglande7fd4172006-01-18 09:30:29 +00001/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved.
6**
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 */
Patrick Caulfield22da6452006-06-09 16:14:20 -040021#define DLM_DEVICE_VERSION_MAJOR 5
David Teigland72c2be72007-03-30 15:06:16 -050022#define DLM_DEVICE_VERSION_MINOR 1
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 Teiglande7fd4172006-01-18 09:30:29 +000029 __u16 flags;
30 __u32 lkid;
31 __u32 parent;
David Teiglande7fd4172006-01-18 09:30:29 +000032 void __user *castparam;
33 void __user *castaddr;
34 void __user *bastparam;
35 void __user *bastaddr;
36 struct dlm_lksb __user *lksb;
37 char lvb[DLM_USER_LVB_LEN];
Patrick Caulfield22da6452006-06-09 16:14:20 -040038 char name[0];
David Teiglande7fd4172006-01-18 09:30:29 +000039};
40
41struct dlm_lspace_params {
42 __u32 flags;
43 __u32 minor;
Patrick Caulfield22da6452006-06-09 16:14:20 -040044 char name[0];
David Teiglande7fd4172006-01-18 09:30:29 +000045};
46
David Teigland72c2be72007-03-30 15:06:16 -050047struct dlm_purge_params {
48 __u32 nodeid;
49 __u32 pid;
50};
51
David Teiglande7fd4172006-01-18 09:30:29 +000052struct dlm_write_request {
53 __u32 version[3];
54 __u8 cmd;
Patrick Caulfield22da6452006-06-09 16:14:20 -040055 __u8 is64bit;
56 __u8 unused[2];
David Teiglande7fd4172006-01-18 09:30:29 +000057
58 union {
59 struct dlm_lock_params lock;
60 struct dlm_lspace_params lspace;
David Teigland72c2be72007-03-30 15:06:16 -050061 struct dlm_purge_params purge;
David Teiglande7fd4172006-01-18 09:30:29 +000062 } i;
63};
64
65/* struct read from the "device" fd,
66 consists mainly of userspace pointers for the library to use */
67struct dlm_lock_result {
68 __u32 length;
69 void __user * user_astaddr;
70 void __user * user_astparam;
71 struct dlm_lksb __user * user_lksb;
72 struct dlm_lksb lksb;
73 __u8 bast_mode;
Patrick Caulfield22da6452006-06-09 16:14:20 -040074 __u8 unused[3];
David Teiglande7fd4172006-01-18 09:30:29 +000075 /* Offsets may be zero if no data is present */
76 __u32 lvb_offset;
77};
78
79/* Commands passed to the device */
80#define DLM_USER_LOCK 1
81#define DLM_USER_UNLOCK 2
82#define DLM_USER_QUERY 3
83#define DLM_USER_CREATE_LOCKSPACE 4
84#define DLM_USER_REMOVE_LOCKSPACE 5
David Teigland72c2be72007-03-30 15:06:16 -050085#define DLM_USER_PURGE 6
David Teiglande7fd4172006-01-18 09:30:29 +000086
87/* Arbitrary length restriction */
88#define MAX_LS_NAME_LEN 64
89
90/* Lockspace flags */
91#define DLM_USER_LSFLG_AUTOFREE 1
92#define DLM_USER_LSFLG_FORCEFREE 2
93