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 | |
Mike Frysinger | c1c7674 | 2008-04-21 11:35:39 -0500 | [diff] [blame] | 14 | #ifndef _LINUX_DLM_DEVICE_H |
| 15 | #define _LINUX_DLM_DEVICE_H |
| 16 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 17 | /* This is the device interface for dlm, most users will use a library |
| 18 | * interface. |
| 19 | */ |
| 20 | |
Mike Frysinger | c1c7674 | 2008-04-21 11:35:39 -0500 | [diff] [blame] | 21 | #include <linux/dlm.h> |
| 22 | #include <linux/types.h> |
| 23 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 24 | #define DLM_USER_LVB_LEN 32 |
| 25 | |
| 26 | /* Version of the device interface */ |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 27 | #define DLM_DEVICE_VERSION_MAJOR 6 |
| 28 | #define DLM_DEVICE_VERSION_MINOR 0 |
David Teigland | 0f8e0d9 | 2008-08-06 13:30:24 -0500 | [diff] [blame^] | 29 | #define DLM_DEVICE_VERSION_PATCH 1 |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 30 | |
| 31 | /* struct passed to the lock write */ |
| 32 | struct dlm_lock_params { |
| 33 | __u8 mode; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 34 | __u8 namelen; |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 35 | __u16 unused; |
| 36 | __u32 flags; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 37 | __u32 lkid; |
| 38 | __u32 parent; |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 39 | __u64 xid; |
| 40 | __u64 timeout; |
| 41 | void __user *castparam; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 42 | void __user *castaddr; |
| 43 | void __user *bastparam; |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 44 | void __user *bastaddr; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 45 | struct dlm_lksb __user *lksb; |
| 46 | char lvb[DLM_USER_LVB_LEN]; |
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 | |
| 50 | struct dlm_lspace_params { |
| 51 | __u32 flags; |
| 52 | __u32 minor; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 53 | char name[0]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 54 | }; |
| 55 | |
David Teigland | 72c2be7 | 2007-03-30 15:06:16 -0500 | [diff] [blame] | 56 | struct dlm_purge_params { |
| 57 | __u32 nodeid; |
| 58 | __u32 pid; |
| 59 | }; |
| 60 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 61 | struct dlm_write_request { |
| 62 | __u32 version[3]; |
| 63 | __u8 cmd; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 64 | __u8 is64bit; |
| 65 | __u8 unused[2]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 66 | |
| 67 | union { |
| 68 | struct dlm_lock_params lock; |
| 69 | struct dlm_lspace_params lspace; |
David Teigland | 72c2be7 | 2007-03-30 15:06:16 -0500 | [diff] [blame] | 70 | struct dlm_purge_params purge; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 71 | } i; |
| 72 | }; |
| 73 | |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 74 | struct dlm_device_version { |
| 75 | __u32 version[3]; |
| 76 | }; |
| 77 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 78 | /* struct read from the "device" fd, |
| 79 | consists mainly of userspace pointers for the library to use */ |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 80 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 81 | struct dlm_lock_result { |
David Teigland | d7db923 | 2007-05-18 09:00:32 -0500 | [diff] [blame] | 82 | __u32 version[3]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 83 | __u32 length; |
| 84 | void __user * user_astaddr; |
| 85 | void __user * user_astparam; |
| 86 | struct dlm_lksb __user * user_lksb; |
| 87 | struct dlm_lksb lksb; |
| 88 | __u8 bast_mode; |
Patrick Caulfield | 22da645 | 2006-06-09 16:14:20 -0400 | [diff] [blame] | 89 | __u8 unused[3]; |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 90 | /* Offsets may be zero if no data is present */ |
| 91 | __u32 lvb_offset; |
| 92 | }; |
| 93 | |
| 94 | /* Commands passed to the device */ |
| 95 | #define DLM_USER_LOCK 1 |
| 96 | #define DLM_USER_UNLOCK 2 |
| 97 | #define DLM_USER_QUERY 3 |
| 98 | #define DLM_USER_CREATE_LOCKSPACE 4 |
| 99 | #define DLM_USER_REMOVE_LOCKSPACE 5 |
David Teigland | 72c2be7 | 2007-03-30 15:06:16 -0500 | [diff] [blame] | 100 | #define DLM_USER_PURGE 6 |
David Teigland | 8b4021f | 2007-05-29 08:46:00 -0500 | [diff] [blame] | 101 | #define DLM_USER_DEADLOCK 7 |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 102 | |
David Teigland | e7fd417 | 2006-01-18 09:30:29 +0000 | [diff] [blame] | 103 | /* Lockspace flags */ |
| 104 | #define DLM_USER_LSFLG_AUTOFREE 1 |
| 105 | #define DLM_USER_LSFLG_FORCEFREE 2 |
| 106 | |
Mike Frysinger | c1c7674 | 2008-04-21 11:35:39 -0500 | [diff] [blame] | 107 | #endif |
| 108 | |