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. |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 5 | ** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 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 */ |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 21 | #define DLM_DEVICE_VERSION_MAJOR 6 |
| 22 | #define DLM_DEVICE_VERSION_MINOR 0 |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 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 | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 29 | __u16 unused; |
| 30 | __u32 flags; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 31 | __u32 lkid; |
| 32 | __u32 parent; |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 33 | __u64 xid; |
| 34 | __u64 timeout; |
| 35 | void __user *castparam; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 36 | void __user *castaddr; |
| 37 | void __user *bastparam; |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 38 | void __user *bastaddr; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 39 | struct dlm_lksb __user *lksb; |
| 40 | char lvb[DLM_USER_LVB_LEN]; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 41 | char name[0]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | struct dlm_lspace_params { |
| 45 | __u32 flags; |
| 46 | __u32 minor; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 47 | char name[0]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 48 | }; |
| 49 | |
David Teigland | 72c2be7 | 2007-03-30 15:06:16 -0500 | [diff] [blame] | 50 | struct dlm_purge_params { |
| 51 | __u32 nodeid; |
| 52 | __u32 pid; |
| 53 | }; |
| 54 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 55 | struct dlm_write_request { |
| 56 | __u32 version[3]; |
| 57 | __u8 cmd; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 58 | __u8 is64bit; |
| 59 | __u8 unused[2]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 60 | |
| 61 | union { |
| 62 | struct dlm_lock_params lock; |
| 63 | struct dlm_lspace_params lspace; |
David Teigland | 72c2be7 | 2007-03-30 15:06:16 -0500 | [diff] [blame] | 64 | struct dlm_purge_params purge; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 65 | } i; |
| 66 | }; |
| 67 | |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 68 | struct dlm_device_version { |
| 69 | __u32 version[3]; |
| 70 | }; |
| 71 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 72 | /* struct read from the "device" fd, |
| 73 | consists mainly of userspace pointers for the library to use */ |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 74 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 75 | struct dlm_lock_result { |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 76 | __u32 version[3]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 77 | __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 Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 83 | __u8 unused[3]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 84 | /* 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 Teigland | 72c2be7 | 2007-03-30 15:06:16 -0500 | [diff] [blame] | 94 | #define DLM_USER_PURGE 6 |
David Teigland | 8b4021f | 2007-05-29 08:46:00 -0500 | [diff] [blame] | 95 | #define DLM_USER_DEADLOCK 7 |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 96 | |
| 97 | /* Arbitrary length restriction */ |
| 98 | #define MAX_LS_NAME_LEN 64 |
| 99 | |
| 100 | /* Lockspace flags */ |
| 101 | #define DLM_USER_LSFLG_AUTOFREE 1 |
| 102 | #define DLM_USER_LSFLG_FORCEFREE 2 |
| 103 | |