David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 1 | /****************************************************************************** |
| 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 Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 21 | #define DLM_DEVICE_VERSION_MAJOR 5 |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 22 | #define DLM_DEVICE_VERSION_MINOR 0 |
| 23 | #define DLM_DEVICE_VERSION_PATCH 0 |
| 24 | |
| 25 | /* struct passed to the lock write */ |
| 26 | struct dlm_lock_params { |
| 27 | __u8 mode; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 28 | __u8 namelen; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 29 | __u16 flags; |
| 30 | __u32 lkid; |
| 31 | __u32 parent; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 32 | 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 Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 38 | char name[0]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | struct dlm_lspace_params { |
| 42 | __u32 flags; |
| 43 | __u32 minor; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 44 | char name[0]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | struct dlm_write_request { |
| 48 | __u32 version[3]; |
| 49 | __u8 cmd; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 50 | __u8 is64bit; |
| 51 | __u8 unused[2]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 52 | |
| 53 | union { |
| 54 | struct dlm_lock_params lock; |
| 55 | struct dlm_lspace_params lspace; |
| 56 | } i; |
| 57 | }; |
| 58 | |
| 59 | /* struct read from the "device" fd, |
| 60 | consists mainly of userspace pointers for the library to use */ |
| 61 | struct dlm_lock_result { |
| 62 | __u32 length; |
| 63 | void __user * user_astaddr; |
| 64 | void __user * user_astparam; |
| 65 | struct dlm_lksb __user * user_lksb; |
| 66 | struct dlm_lksb lksb; |
| 67 | __u8 bast_mode; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 68 | __u8 unused[3]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 69 | /* Offsets may be zero if no data is present */ |
| 70 | __u32 lvb_offset; |
| 71 | }; |
| 72 | |
| 73 | /* Commands passed to the device */ |
| 74 | #define DLM_USER_LOCK 1 |
| 75 | #define DLM_USER_UNLOCK 2 |
| 76 | #define DLM_USER_QUERY 3 |
| 77 | #define DLM_USER_CREATE_LOCKSPACE 4 |
| 78 | #define DLM_USER_REMOVE_LOCKSPACE 5 |
| 79 | |
| 80 | /* Arbitrary length restriction */ |
| 81 | #define MAX_LS_NAME_LEN 64 |
| 82 | |
| 83 | /* Lockspace flags */ |
| 84 | #define DLM_USER_LSFLG_AUTOFREE 1 |
| 85 | #define DLM_USER_LSFLG_FORCEFREE 2 |
| 86 | |