Joe Perches | 1917a69 | 2016-03-27 14:34:52 -0700 | [diff] [blame] | 1 | #include <linux/kernel.h> |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 2 | #include <linux/types.h> |
Guenter Roeck | 81b784b | 2015-08-01 18:29:37 -0700 | [diff] [blame] | 3 | #include <linux/spinlock_types.h> |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 4 | #include <linux/slab.h> |
Mike Marshall | 2c590d5 | 2015-07-24 10:37:15 -0400 | [diff] [blame] | 5 | #include <linux/ioctl.h> |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 6 | |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 7 | /* pvfs2-config.h ***********************************************************/ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 8 | #define ORANGEFS_VERSION_MAJOR 2 |
| 9 | #define ORANGEFS_VERSION_MINOR 9 |
| 10 | #define ORANGEFS_VERSION_SUB 0 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 11 | |
| 12 | /* khandle stuff ***********************************************************/ |
| 13 | |
| 14 | /* |
| 15 | * The 2.9 core will put 64 bit handles in here like this: |
| 16 | * 1234 0000 0000 5678 |
| 17 | * The 3.0 and beyond cores will put 128 bit handles in here like this: |
| 18 | * 1234 5678 90AB CDEF |
| 19 | * The kernel module will always use the first four bytes and |
| 20 | * the last four bytes as an inum. |
| 21 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 22 | struct orangefs_khandle { |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 23 | unsigned char u[16]; |
| 24 | } __aligned(8); |
| 25 | |
| 26 | /* |
| 27 | * kernel version of an object ref. |
| 28 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 29 | struct orangefs_object_kref { |
| 30 | struct orangefs_khandle khandle; |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 31 | __s32 fs_id; |
| 32 | __s32 __pad1; |
| 33 | }; |
| 34 | |
| 35 | /* |
| 36 | * compare 2 khandles assumes little endian thus from large address to |
| 37 | * small address |
| 38 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 39 | static inline int ORANGEFS_khandle_cmp(const struct orangefs_khandle *kh1, |
| 40 | const struct orangefs_khandle *kh2) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 41 | { |
| 42 | int i; |
| 43 | |
| 44 | for (i = 15; i >= 0; i--) { |
| 45 | if (kh1->u[i] > kh2->u[i]) |
| 46 | return 1; |
| 47 | if (kh1->u[i] < kh2->u[i]) |
| 48 | return -1; |
| 49 | } |
| 50 | |
| 51 | return 0; |
| 52 | } |
| 53 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 54 | static inline void ORANGEFS_khandle_to(const struct orangefs_khandle *kh, |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 55 | void *p, int size) |
| 56 | { |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 57 | |
Mike Marshall | 50e0158 | 2015-09-29 11:17:26 -0400 | [diff] [blame] | 58 | memcpy(p, kh->u, 16); |
Mike Marshall | a9bb3ba | 2016-04-06 11:19:37 -0400 | [diff] [blame] | 59 | memset(p + 16, 0, size - 16); |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 60 | |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 61 | } |
| 62 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 63 | static inline void ORANGEFS_khandle_from(struct orangefs_khandle *kh, |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 64 | void *p, int size) |
| 65 | { |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 66 | memset(kh, 0, 16); |
Mike Marshall | 50e0158 | 2015-09-29 11:17:26 -0400 | [diff] [blame] | 67 | memcpy(kh->u, p, 16); |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 68 | |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | /* pvfs2-types.h ************************************************************/ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 72 | typedef __u32 ORANGEFS_uid; |
| 73 | typedef __u32 ORANGEFS_gid; |
| 74 | typedef __s32 ORANGEFS_fs_id; |
| 75 | typedef __u32 ORANGEFS_permissions; |
| 76 | typedef __u64 ORANGEFS_time; |
| 77 | typedef __s64 ORANGEFS_size; |
| 78 | typedef __u64 ORANGEFS_flags; |
| 79 | typedef __u64 ORANGEFS_ds_position; |
| 80 | typedef __s32 ORANGEFS_error; |
| 81 | typedef __s64 ORANGEFS_offset; |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 82 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 83 | #define ORANGEFS_SUPER_MAGIC 0x20030528 |
Martin Brandenburg | 894ac43 | 2015-10-02 12:11:19 -0400 | [diff] [blame] | 84 | |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 85 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 86 | * ORANGEFS error codes are a signed 32-bit integer. Error codes are negative, but |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 87 | * the sign is stripped before decoding. |
| 88 | */ |
Martin Brandenburg | 894ac43 | 2015-10-02 12:11:19 -0400 | [diff] [blame] | 89 | |
| 90 | /* Bit 31 is not used since it is the sign. */ |
| 91 | |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 92 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 93 | * Bit 30 specifies that this is a ORANGEFS error. A ORANGEFS error is either an |
| 94 | * encoded errno value or a ORANGEFS protocol error. |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 95 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 96 | #define ORANGEFS_ERROR_BIT (1 << 30) |
Martin Brandenburg | 894ac43 | 2015-10-02 12:11:19 -0400 | [diff] [blame] | 97 | |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 98 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 99 | * Bit 29 specifies that this is a ORANGEFS protocol error and not an encoded |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 100 | * errno value. |
| 101 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 102 | #define ORANGEFS_NON_ERRNO_ERROR_BIT (1 << 29) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 103 | |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 104 | /* |
| 105 | * Bits 9, 8, and 7 specify the error class, which encodes the section of |
Martin Brandenburg | 894ac43 | 2015-10-02 12:11:19 -0400 | [diff] [blame] | 106 | * server code the error originated in for logging purposes. It is not used |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 107 | * in the kernel except to be masked out. |
| 108 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 109 | #define ORANGEFS_ERROR_CLASS_BITS 0x380 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 110 | |
Martin Brandenburg | 894ac43 | 2015-10-02 12:11:19 -0400 | [diff] [blame] | 111 | /* Bits 6 - 0 are reserved for the actual error code. */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 112 | #define ORANGEFS_ERROR_NUMBER_BITS 0x7f |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 113 | |
Mike Marshall | 575e946 | 2015-12-04 12:56:14 -0500 | [diff] [blame] | 114 | /* Encoded errno values decoded by PINT_errno_mapping in orangefs-utils.c. */ |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 115 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 116 | /* Our own ORANGEFS protocol error codes. */ |
| 117 | #define ORANGEFS_ECANCEL (1|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 118 | #define ORANGEFS_EDEVINIT (2|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 119 | #define ORANGEFS_EDETAIL (3|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 120 | #define ORANGEFS_EHOSTNTFD (4|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 121 | #define ORANGEFS_EADDRNTFD (5|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 122 | #define ORANGEFS_ENORECVR (6|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 123 | #define ORANGEFS_ETRYAGAIN (7|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 124 | #define ORANGEFS_ENOTPVFS (8|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
| 125 | #define ORANGEFS_ESECURITY (9|ORANGEFS_NON_ERRNO_ERROR_BIT|ORANGEFS_ERROR_BIT) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 126 | |
| 127 | /* permission bits */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 128 | #define ORANGEFS_O_EXECUTE (1 << 0) |
| 129 | #define ORANGEFS_O_WRITE (1 << 1) |
| 130 | #define ORANGEFS_O_READ (1 << 2) |
| 131 | #define ORANGEFS_G_EXECUTE (1 << 3) |
| 132 | #define ORANGEFS_G_WRITE (1 << 4) |
| 133 | #define ORANGEFS_G_READ (1 << 5) |
| 134 | #define ORANGEFS_U_EXECUTE (1 << 6) |
| 135 | #define ORANGEFS_U_WRITE (1 << 7) |
| 136 | #define ORANGEFS_U_READ (1 << 8) |
| 137 | /* no ORANGEFS_U_VTX (sticky bit) */ |
| 138 | #define ORANGEFS_G_SGID (1 << 10) |
| 139 | #define ORANGEFS_U_SUID (1 << 11) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 140 | |
| 141 | /* definition taken from stdint.h */ |
| 142 | #define INT32_MAX (2147483647) |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 143 | #define ORANGEFS_ITERATE_START (INT32_MAX - 1) |
| 144 | #define ORANGEFS_ITERATE_END (INT32_MAX - 2) |
| 145 | #define ORANGEFS_ITERATE_NEXT (INT32_MAX - 3) |
| 146 | #define ORANGEFS_READDIR_START ORANGEFS_ITERATE_START |
| 147 | #define ORANGEFS_READDIR_END ORANGEFS_ITERATE_END |
| 148 | #define ORANGEFS_IMMUTABLE_FL FS_IMMUTABLE_FL |
| 149 | #define ORANGEFS_APPEND_FL FS_APPEND_FL |
| 150 | #define ORANGEFS_NOATIME_FL FS_NOATIME_FL |
| 151 | #define ORANGEFS_MIRROR_FL 0x01000000ULL |
| 152 | #define ORANGEFS_O_EXECUTE (1 << 0) |
| 153 | #define ORANGEFS_FS_ID_NULL ((__s32)0) |
| 154 | #define ORANGEFS_ATTR_SYS_UID (1 << 0) |
| 155 | #define ORANGEFS_ATTR_SYS_GID (1 << 1) |
| 156 | #define ORANGEFS_ATTR_SYS_PERM (1 << 2) |
| 157 | #define ORANGEFS_ATTR_SYS_ATIME (1 << 3) |
| 158 | #define ORANGEFS_ATTR_SYS_CTIME (1 << 4) |
| 159 | #define ORANGEFS_ATTR_SYS_MTIME (1 << 5) |
| 160 | #define ORANGEFS_ATTR_SYS_TYPE (1 << 6) |
| 161 | #define ORANGEFS_ATTR_SYS_ATIME_SET (1 << 7) |
| 162 | #define ORANGEFS_ATTR_SYS_MTIME_SET (1 << 8) |
| 163 | #define ORANGEFS_ATTR_SYS_SIZE (1 << 20) |
| 164 | #define ORANGEFS_ATTR_SYS_LNK_TARGET (1 << 24) |
| 165 | #define ORANGEFS_ATTR_SYS_DFILE_COUNT (1 << 25) |
| 166 | #define ORANGEFS_ATTR_SYS_DIRENT_COUNT (1 << 26) |
| 167 | #define ORANGEFS_ATTR_SYS_BLKSIZE (1 << 28) |
| 168 | #define ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT (1 << 29) |
| 169 | #define ORANGEFS_ATTR_SYS_COMMON_ALL \ |
| 170 | (ORANGEFS_ATTR_SYS_UID | \ |
| 171 | ORANGEFS_ATTR_SYS_GID | \ |
| 172 | ORANGEFS_ATTR_SYS_PERM | \ |
| 173 | ORANGEFS_ATTR_SYS_ATIME | \ |
| 174 | ORANGEFS_ATTR_SYS_CTIME | \ |
| 175 | ORANGEFS_ATTR_SYS_MTIME | \ |
| 176 | ORANGEFS_ATTR_SYS_TYPE) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 177 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 178 | #define ORANGEFS_ATTR_SYS_ALL_SETABLE \ |
| 179 | (ORANGEFS_ATTR_SYS_COMMON_ALL-ORANGEFS_ATTR_SYS_TYPE) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 180 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 181 | #define ORANGEFS_ATTR_SYS_ALL_NOHINT \ |
| 182 | (ORANGEFS_ATTR_SYS_COMMON_ALL | \ |
| 183 | ORANGEFS_ATTR_SYS_SIZE | \ |
| 184 | ORANGEFS_ATTR_SYS_LNK_TARGET | \ |
| 185 | ORANGEFS_ATTR_SYS_DFILE_COUNT | \ |
| 186 | ORANGEFS_ATTR_SYS_MIRROR_COPIES_COUNT | \ |
| 187 | ORANGEFS_ATTR_SYS_DIRENT_COUNT | \ |
| 188 | ORANGEFS_ATTR_SYS_BLKSIZE) |
Martin Brandenburg | 933287d | 2016-01-30 13:46:54 -0500 | [diff] [blame] | 189 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 190 | #define ORANGEFS_XATTR_REPLACE 0x2 |
| 191 | #define ORANGEFS_XATTR_CREATE 0x1 |
| 192 | #define ORANGEFS_MAX_SERVER_ADDR_LEN 256 |
| 193 | #define ORANGEFS_NAME_MAX 256 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 194 | /* |
| 195 | * max extended attribute name len as imposed by the VFS and exploited for the |
| 196 | * upcall request types. |
| 197 | * NOTE: Please retain them as multiples of 8 even if you wish to change them |
| 198 | * This is *NECESSARY* for supporting 32 bit user-space binaries on a 64-bit |
| 199 | * kernel. Due to implementation within DBPF, this really needs to be |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 200 | * ORANGEFS_NAME_MAX, which it was the same value as, but no reason to let it |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 201 | * break if that changes in the future. |
| 202 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 203 | #define ORANGEFS_MAX_XATTR_NAMELEN ORANGEFS_NAME_MAX /* Not the same as |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 204 | * XATTR_NAME_MAX defined |
| 205 | * by <linux/xattr.h> |
| 206 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 207 | #define ORANGEFS_MAX_XATTR_VALUELEN 8192 /* Not the same as XATTR_SIZE_MAX |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 208 | * defined by <linux/xattr.h> |
| 209 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 210 | #define ORANGEFS_MAX_XATTR_LISTLEN 16 /* Not the same as XATTR_LIST_MAX |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 211 | * defined by <linux/xattr.h> |
| 212 | */ |
| 213 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 214 | * ORANGEFS I/O operation types, used in both system and server interfaces. |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 215 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 216 | enum ORANGEFS_io_type { |
| 217 | ORANGEFS_IO_READ = 1, |
| 218 | ORANGEFS_IO_WRITE = 2 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 219 | }; |
| 220 | |
| 221 | /* |
| 222 | * If this enum is modified the server parameters related to the precreate pool |
| 223 | * batch and low threshold sizes may need to be modified to reflect this |
| 224 | * change. |
| 225 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 226 | enum orangefs_ds_type { |
| 227 | ORANGEFS_TYPE_NONE = 0, |
| 228 | ORANGEFS_TYPE_METAFILE = (1 << 0), |
| 229 | ORANGEFS_TYPE_DATAFILE = (1 << 1), |
| 230 | ORANGEFS_TYPE_DIRECTORY = (1 << 2), |
| 231 | ORANGEFS_TYPE_SYMLINK = (1 << 3), |
| 232 | ORANGEFS_TYPE_DIRDATA = (1 << 4), |
| 233 | ORANGEFS_TYPE_INTERNAL = (1 << 5) /* for the server's private use */ |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 234 | }; |
| 235 | |
| 236 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 237 | * ORANGEFS_certificate simply stores a buffer with the buffer size. |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 238 | * The buffer can be converted to an OpenSSL X509 struct for use. |
| 239 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 240 | struct ORANGEFS_certificate { |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 241 | __u32 buf_size; |
| 242 | unsigned char *buf; |
| 243 | }; |
| 244 | |
| 245 | /* |
| 246 | * A credential identifies a user and is signed by the client/user |
| 247 | * private key. |
| 248 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 249 | struct ORANGEFS_credential { |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 250 | __u32 userid; /* user id */ |
| 251 | __u32 num_groups; /* length of group_array */ |
| 252 | __u32 *group_array; /* groups for which the user is a member */ |
| 253 | char *issuer; /* alias of the issuing server */ |
| 254 | __u64 timeout; /* seconds after epoch to time out */ |
| 255 | __u32 sig_size; /* length of the signature in bytes */ |
| 256 | unsigned char *signature; /* digital signature */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 257 | struct ORANGEFS_certificate certificate; /* user certificate buffer */ |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 258 | }; |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 259 | #define extra_size_ORANGEFS_credential (ORANGEFS_REQ_LIMIT_GROUPS * \ |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 260 | sizeof(__u32) + \ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 261 | ORANGEFS_REQ_LIMIT_ISSUER + \ |
| 262 | ORANGEFS_REQ_LIMIT_SIGNATURE + \ |
| 263 | extra_size_ORANGEFS_certificate) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 264 | |
| 265 | /* This structure is used by the VFS-client interaction alone */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 266 | struct ORANGEFS_keyval_pair { |
| 267 | char key[ORANGEFS_MAX_XATTR_NAMELEN]; |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 268 | __s32 key_sz; /* __s32 for portable, fixed-size structures */ |
| 269 | __s32 val_sz; |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 270 | char val[ORANGEFS_MAX_XATTR_VALUELEN]; |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 271 | }; |
| 272 | |
| 273 | /* pvfs2-sysint.h ***********************************************************/ |
| 274 | /* Describes attributes for a file, directory, or symlink. */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 275 | struct ORANGEFS_sys_attr_s { |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 276 | __u32 owner; |
| 277 | __u32 group; |
| 278 | __u32 perms; |
| 279 | __u64 atime; |
| 280 | __u64 mtime; |
| 281 | __u64 ctime; |
| 282 | __s64 size; |
| 283 | |
| 284 | /* NOTE: caller must free if valid */ |
| 285 | char *link_target; |
| 286 | |
| 287 | /* Changed to __s32 so that size of structure does not change */ |
| 288 | __s32 dfile_count; |
| 289 | |
| 290 | /* Changed to __s32 so that size of structure does not change */ |
| 291 | __s32 distr_dir_servers_initial; |
| 292 | |
| 293 | /* Changed to __s32 so that size of structure does not change */ |
| 294 | __s32 distr_dir_servers_max; |
| 295 | |
| 296 | /* Changed to __s32 so that size of structure does not change */ |
| 297 | __s32 distr_dir_split_size; |
| 298 | |
| 299 | __u32 mirror_copies_count; |
| 300 | |
| 301 | /* NOTE: caller must free if valid */ |
| 302 | char *dist_name; |
| 303 | |
| 304 | /* NOTE: caller must free if valid */ |
| 305 | char *dist_params; |
| 306 | |
| 307 | __s64 dirent_count; |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 308 | enum orangefs_ds_type objtype; |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 309 | __u64 flags; |
| 310 | __u32 mask; |
| 311 | __s64 blksize; |
| 312 | }; |
| 313 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 314 | #define ORANGEFS_LOOKUP_LINK_NO_FOLLOW 0 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 315 | |
| 316 | /* pint-dev.h ***************************************************************/ |
| 317 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 318 | /* parameter structure used in ORANGEFS_DEV_DEBUG ioctl command */ |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 319 | struct dev_mask_info_s { |
| 320 | enum { |
| 321 | KERNEL_MASK, |
| 322 | CLIENT_MASK, |
| 323 | } mask_type; |
| 324 | __u64 mask_value; |
| 325 | }; |
| 326 | |
| 327 | struct dev_mask2_info_s { |
| 328 | __u64 mask1_value; |
| 329 | __u64 mask2_value; |
| 330 | }; |
| 331 | |
| 332 | /* pvfs2-util.h *************************************************************/ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 333 | __s32 ORANGEFS_util_translate_mode(int mode); |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 334 | |
| 335 | /* pvfs2-debug.h ************************************************************/ |
Mike Marshall | 575e946 | 2015-12-04 12:56:14 -0500 | [diff] [blame] | 336 | #include "orangefs-debug.h" |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 337 | |
| 338 | /* pvfs2-internal.h *********************************************************/ |
| 339 | #define llu(x) (unsigned long long)(x) |
| 340 | #define lld(x) (long long)(x) |
| 341 | |
| 342 | /* pint-dev-shared.h ********************************************************/ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 343 | #define ORANGEFS_DEV_MAGIC 'k' |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 344 | |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 345 | #define ORANGEFS_READDIR_DEFAULT_DESC_COUNT 5 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 346 | |
| 347 | #define DEV_GET_MAGIC 0x1 |
| 348 | #define DEV_GET_MAX_UPSIZE 0x2 |
| 349 | #define DEV_GET_MAX_DOWNSIZE 0x3 |
| 350 | #define DEV_MAP 0x4 |
| 351 | #define DEV_REMOUNT_ALL 0x5 |
| 352 | #define DEV_DEBUG 0x6 |
| 353 | #define DEV_UPSTREAM 0x7 |
| 354 | #define DEV_CLIENT_MASK 0x8 |
| 355 | #define DEV_CLIENT_STRING 0x9 |
| 356 | #define DEV_MAX_NR 0xa |
| 357 | |
| 358 | /* supported ioctls, codes are with respect to user-space */ |
| 359 | enum { |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 360 | ORANGEFS_DEV_GET_MAGIC = _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAGIC, __s32), |
| 361 | ORANGEFS_DEV_GET_MAX_UPSIZE = |
| 362 | _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_UPSIZE, __s32), |
| 363 | ORANGEFS_DEV_GET_MAX_DOWNSIZE = |
| 364 | _IOW(ORANGEFS_DEV_MAGIC, DEV_GET_MAX_DOWNSIZE, __s32), |
| 365 | ORANGEFS_DEV_MAP = _IO(ORANGEFS_DEV_MAGIC, DEV_MAP), |
| 366 | ORANGEFS_DEV_REMOUNT_ALL = _IO(ORANGEFS_DEV_MAGIC, DEV_REMOUNT_ALL), |
| 367 | ORANGEFS_DEV_DEBUG = _IOR(ORANGEFS_DEV_MAGIC, DEV_DEBUG, __s32), |
| 368 | ORANGEFS_DEV_UPSTREAM = _IOW(ORANGEFS_DEV_MAGIC, DEV_UPSTREAM, int), |
| 369 | ORANGEFS_DEV_CLIENT_MASK = _IOW(ORANGEFS_DEV_MAGIC, |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 370 | DEV_CLIENT_MASK, |
| 371 | struct dev_mask2_info_s), |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 372 | ORANGEFS_DEV_CLIENT_STRING = _IOW(ORANGEFS_DEV_MAGIC, |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 373 | DEV_CLIENT_STRING, |
| 374 | char *), |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 375 | ORANGEFS_DEV_MAXNR = DEV_MAX_NR, |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 376 | }; |
| 377 | |
| 378 | /* |
| 379 | * version number for use in communicating between kernel space and user |
Mike Marshall | 5480494 | 2015-10-05 13:44:24 -0400 | [diff] [blame] | 380 | * space. Zero signifies the upstream version of the kernel module. |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 381 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 382 | #define ORANGEFS_KERNEL_PROTO_VERSION 0 |
Martin Brandenburg | 878dfd3 | 2016-03-30 16:18:43 -0400 | [diff] [blame] | 383 | #define ORANGEFS_MINIMUM_USERSPACE_VERSION 20903 |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 384 | |
| 385 | /* |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 386 | * describes memory regions to map in the ORANGEFS_DEV_MAP ioctl. |
Mike Marshall | 575e946 | 2015-12-04 12:56:14 -0500 | [diff] [blame] | 387 | * NOTE: See devorangefs-req.c for 32 bit compat structure. |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 388 | * Since this structure has a variable-sized layout that is different |
| 389 | * on 32 and 64 bit platforms, we need to normalize to a 64 bit layout |
| 390 | * on such systems before servicing ioctl calls from user-space binaries |
| 391 | * that may be 32 bit! |
| 392 | */ |
Yi Liu | 8bb8aef | 2015-11-24 15:12:14 -0500 | [diff] [blame] | 393 | struct ORANGEFS_dev_map_desc { |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 394 | void *ptr; |
| 395 | __s32 total_size; |
| 396 | __s32 size; |
| 397 | __s32 count; |
| 398 | }; |
| 399 | |
| 400 | /* gossip.h *****************************************************************/ |
| 401 | |
| 402 | #ifdef GOSSIP_DISABLE_DEBUG |
Joe Perches | 1917a69 | 2016-03-27 14:34:52 -0700 | [diff] [blame] | 403 | #define gossip_debug(mask, fmt, ...) \ |
| 404 | do { \ |
| 405 | if (0) \ |
| 406 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ |
| 407 | } while (0) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 408 | #else |
Martin Brandenburg | 44f4641 | 2016-08-15 11:38:36 -0400 | [diff] [blame] | 409 | extern __u64 orangefs_gossip_debug_mask; |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 410 | |
| 411 | /* try to avoid function call overhead by checking masks in macro */ |
Joe Perches | 1917a69 | 2016-03-27 14:34:52 -0700 | [diff] [blame] | 412 | #define gossip_debug(mask, fmt, ...) \ |
| 413 | do { \ |
Martin Brandenburg | 44f4641 | 2016-08-15 11:38:36 -0400 | [diff] [blame] | 414 | if (orangefs_gossip_debug_mask & (mask)) \ |
Joe Perches | 1917a69 | 2016-03-27 14:34:52 -0700 | [diff] [blame] | 415 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 416 | } while (0) |
| 417 | #endif /* GOSSIP_DISABLE_DEBUG */ |
| 418 | |
| 419 | /* do file and line number printouts w/ the GNU preprocessor */ |
Joe Perches | 1917a69 | 2016-03-27 14:34:52 -0700 | [diff] [blame] | 420 | #define gossip_ldebug(mask, fmt, ...) \ |
| 421 | gossip_debug(mask, "%s: " fmt, __func__, ##__VA_ARGS__) |
Mike Marshall | f7ab093 | 2015-07-17 10:38:11 -0400 | [diff] [blame] | 422 | |
Joe Perches | 1917a69 | 2016-03-27 14:34:52 -0700 | [diff] [blame] | 423 | #define gossip_err pr_err |
| 424 | #define gossip_lerr(fmt, ...) \ |
| 425 | gossip_err("%s line %d: " fmt, \ |
| 426 | __FILE__, __LINE__, ##__VA_ARGS__) |