Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * fs/cifs/cifspdu.h |
| 3 | * |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 4 | * Copyright (c) International Business Machines Corp., 2002,2007 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Author(s): Steve French (sfrench@us.ibm.com) |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU Lesser General Public License as published |
| 9 | * by the Free Software Foundation; either version 2.1 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 15 | * the GNU Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public License |
| 18 | * along with this library; if not, write to the Free Software |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #ifndef _CIFSPDU_H |
| 23 | #define _CIFSPDU_H |
| 24 | |
| 25 | #include <net/sock.h> |
| 26 | |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 27 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
| 28 | #define LANMAN_PROT 0 |
Steve French | 9ac00b7 | 2006-09-30 04:13:17 +0000 | [diff] [blame] | 29 | #define LANMAN2_PROT 1 |
| 30 | #define CIFS_PROT 2 |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 31 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #define CIFS_PROT 0 |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 33 | #endif |
| 34 | #define POSIX_PROT CIFS_PROT+1 |
| 35 | #define BAD_PROT 0xFFFF |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | /* SMB command codes */ |
Steve French | c14e894 | 2007-02-15 01:33:18 +0000 | [diff] [blame] | 38 | /* |
| 39 | * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses |
| 40 | * (ie which include no useful data other than the SMB error code itself). |
| 41 | * Knowing this helps avoid response buffer allocations and copy in some cases |
| 42 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #define SMB_COM_CREATE_DIRECTORY 0x00 /* trivial response */ |
| 44 | #define SMB_COM_DELETE_DIRECTORY 0x01 /* trivial response */ |
| 45 | #define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */ |
| 46 | #define SMB_COM_DELETE 0x06 /* trivial response */ |
| 47 | #define SMB_COM_RENAME 0x07 /* trivial response */ |
Steve French | 6b8edfe | 2005-08-23 20:26:03 -0700 | [diff] [blame] | 48 | #define SMB_COM_QUERY_INFORMATION 0x08 /* aka getattr */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #define SMB_COM_SETATTR 0x09 /* trivial response */ |
| 50 | #define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */ |
| 51 | #define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/ |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 52 | #define SMB_COM_OPEN_ANDX 0x2D /* Legacy open for old servers */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | #define SMB_COM_READ_ANDX 0x2E |
| 54 | #define SMB_COM_WRITE_ANDX 0x2F |
| 55 | #define SMB_COM_TRANSACTION2 0x32 |
| 56 | #define SMB_COM_TRANSACTION2_SECONDARY 0x33 |
| 57 | #define SMB_COM_FIND_CLOSE2 0x34 /* trivial response */ |
| 58 | #define SMB_COM_TREE_DISCONNECT 0x71 /* trivial response */ |
| 59 | #define SMB_COM_NEGOTIATE 0x72 |
| 60 | #define SMB_COM_SESSION_SETUP_ANDX 0x73 |
| 61 | #define SMB_COM_LOGOFF_ANDX 0x74 /* trivial response */ |
| 62 | #define SMB_COM_TREE_CONNECT_ANDX 0x75 |
| 63 | #define SMB_COM_NT_TRANSACT 0xA0 |
| 64 | #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 |
| 65 | #define SMB_COM_NT_CREATE_ANDX 0xA2 |
Steve French | ff5dbd9 | 2005-08-24 17:10:36 -0700 | [diff] [blame] | 66 | #define SMB_COM_NT_CANCEL 0xA4 /* no response */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | #define SMB_COM_NT_RENAME 0xA5 /* trivial response */ |
| 68 | |
| 69 | /* Transact2 subcommand codes */ |
| 70 | #define TRANS2_OPEN 0x00 |
| 71 | #define TRANS2_FIND_FIRST 0x01 |
| 72 | #define TRANS2_FIND_NEXT 0x02 |
| 73 | #define TRANS2_QUERY_FS_INFORMATION 0x03 |
Jeremy Allison | ac67055 | 2005-06-22 17:26:35 -0700 | [diff] [blame] | 74 | #define TRANS2_SET_FS_INFORMATION 0x04 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | #define TRANS2_QUERY_PATH_INFORMATION 0x05 |
| 76 | #define TRANS2_SET_PATH_INFORMATION 0x06 |
| 77 | #define TRANS2_QUERY_FILE_INFORMATION 0x07 |
| 78 | #define TRANS2_SET_FILE_INFORMATION 0x08 |
| 79 | #define TRANS2_GET_DFS_REFERRAL 0x10 |
| 80 | #define TRANS2_REPORT_DFS_INCOSISTENCY 0x11 |
| 81 | |
| 82 | /* NT Transact subcommand codes */ |
| 83 | #define NT_TRANSACT_CREATE 0x01 |
| 84 | #define NT_TRANSACT_IOCTL 0x02 |
| 85 | #define NT_TRANSACT_SET_SECURITY_DESC 0x03 |
| 86 | #define NT_TRANSACT_NOTIFY_CHANGE 0x04 |
| 87 | #define NT_TRANSACT_RENAME 0x05 |
| 88 | #define NT_TRANSACT_QUERY_SECURITY_DESC 0x06 |
| 89 | #define NT_TRANSACT_GET_USER_QUOTA 0x07 |
| 90 | #define NT_TRANSACT_SET_USER_QUOTA 0x08 |
| 91 | |
Steve French | ec637e3 | 2005-12-12 20:53:18 -0800 | [diff] [blame] | 92 | #define MAX_CIFS_SMALL_BUFFER_SIZE 448 /* big enough for most */ |
| 93 | /* future chained NTCreateXReadX bigger, but for time being NTCreateX biggest */ |
| 94 | /* among the requests (NTCreateX response is bigger with wct of 34) */ |
| 95 | #define MAX_CIFS_HDR_SIZE 0x58 /* 4 len + 32 hdr + (2*24 wct) + 2 bct + 2 pad */ |
| 96 | #define CIFS_SMALL_PATH 120 /* allows for (448-88)/3 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | |
| 98 | /* internal cifs vfs structures */ |
| 99 | /***************************************************************** |
| 100 | * All constants go here |
| 101 | ***************************************************************** |
| 102 | */ |
| 103 | |
| 104 | /* |
| 105 | * Starting value for maximum SMB size negotiation |
| 106 | */ |
| 107 | #define CIFS_MAX_MSGSIZE (4*4096) |
| 108 | |
| 109 | /* |
| 110 | * Size of encrypted user password in bytes |
| 111 | */ |
| 112 | #define CIFS_ENCPWD_SIZE (16) |
| 113 | |
| 114 | /* |
| 115 | * Size of the crypto key returned on the negotiate SMB in bytes |
| 116 | */ |
| 117 | #define CIFS_CRYPTO_KEY_SIZE (8) |
| 118 | |
| 119 | /* |
| 120 | * Size of the session key (crypto key encrypted with the password |
| 121 | */ |
Steve French | 7c7b25b | 2006-06-01 19:20:10 +0000 | [diff] [blame] | 122 | #define CIFS_SESS_KEY_SIZE (24) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
| 124 | /* |
| 125 | * Maximum user name length |
| 126 | */ |
| 127 | #define CIFS_UNLEN (20) |
| 128 | |
| 129 | /* |
| 130 | * Flags on SMB open |
| 131 | */ |
| 132 | #define SMBOPEN_WRITE_THROUGH 0x4000 |
| 133 | #define SMBOPEN_DENY_ALL 0x0010 |
| 134 | #define SMBOPEN_DENY_WRITE 0x0020 |
| 135 | #define SMBOPEN_DENY_READ 0x0030 |
| 136 | #define SMBOPEN_DENY_NONE 0x0040 |
| 137 | #define SMBOPEN_READ 0x0000 |
| 138 | #define SMBOPEN_WRITE 0x0001 |
| 139 | #define SMBOPEN_READWRITE 0x0002 |
| 140 | #define SMBOPEN_EXECUTE 0x0003 |
| 141 | |
| 142 | #define SMBOPEN_OCREATE 0x0010 |
| 143 | #define SMBOPEN_OTRUNC 0x0002 |
| 144 | #define SMBOPEN_OAPPEND 0x0001 |
| 145 | |
| 146 | /* |
| 147 | * SMB flag definitions |
| 148 | */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 149 | #define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock smb */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | #define SMBFLG_RCV_POSTED 0x02 /* obsolete */ |
| 151 | #define SMBFLG_RSVD 0x04 |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 152 | #define SMBFLG_CASELESS 0x08 /* all pathnames treated as caseless (off |
| 153 | implies case sensitive file handling request) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | #define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */ |
| 155 | #define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */ |
| 156 | #define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */ |
| 157 | #define SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */ |
| 158 | |
| 159 | /* |
| 160 | * SMB flag2 definitions |
| 161 | */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 162 | #define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3) |
| 163 | path names in response */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | #define SMBFLG2_KNOWS_EAS cpu_to_le16(2) |
| 165 | #define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) |
| 166 | #define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40) |
| 167 | #define SMBFLG2_EXT_SEC cpu_to_le16(0x800) |
| 168 | #define SMBFLG2_DFS cpu_to_le16(0x1000) |
| 169 | #define SMBFLG2_PAGING_IO cpu_to_le16(0x2000) |
| 170 | #define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000) |
| 171 | #define SMBFLG2_UNICODE cpu_to_le16(0x8000) |
| 172 | |
| 173 | /* |
| 174 | * These are the file access permission bits defined in CIFS for the |
| 175 | * NTCreateAndX as well as the level 0x107 |
| 176 | * TRANS2_QUERY_PATH_INFORMATION API. The level 0x107, SMB_QUERY_FILE_ALL_INFO |
| 177 | * responds with the AccessFlags. |
| 178 | * The AccessFlags specifies the access permissions a caller has to the |
| 179 | * file and can have any suitable combination of the following values: |
| 180 | */ |
| 181 | |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 182 | #define FILE_READ_DATA 0x00000001 /* Data can be read from the file */ |
| 183 | #define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */ |
| 184 | #define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */ |
| 185 | #define FILE_READ_EA 0x00000008 /* Extended attributes associated */ |
| 186 | /* with the file can be read */ |
| 187 | #define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */ |
| 188 | /* with the file can be written */ |
| 189 | #define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */ |
| 190 | /* the file using system paging I/O */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | #define FILE_DELETE_CHILD 0x00000040 |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 192 | #define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */ |
| 193 | /* file can be read */ |
| 194 | #define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */ |
| 195 | /* file can be written */ |
| 196 | #define DELETE 0x00010000 /* The file can be deleted */ |
| 197 | #define READ_CONTROL 0x00020000 /* The access control list and */ |
| 198 | /* ownership associated with the */ |
| 199 | /* file can be read */ |
| 200 | #define WRITE_DAC 0x00040000 /* The access control list and */ |
| 201 | /* ownership associated with the */ |
| 202 | /* file can be written. */ |
| 203 | #define WRITE_OWNER 0x00080000 /* Ownership information associated */ |
| 204 | /* with the file can be written */ |
| 205 | #define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */ |
| 206 | /* synchronize with the completion */ |
| 207 | /* of an input/output request */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | #define GENERIC_ALL 0x10000000 |
| 209 | #define GENERIC_EXECUTE 0x20000000 |
| 210 | #define GENERIC_WRITE 0x40000000 |
| 211 | #define GENERIC_READ 0x80000000 |
| 212 | /* In summary - Relevant file */ |
| 213 | /* access flags from CIFS are */ |
| 214 | /* file_read_data, file_write_data */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 215 | /* file_execute, file_read_attributes*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | /* write_dac, and delete. */ |
| 217 | |
| 218 | /* |
| 219 | * Invalid readdir handle |
| 220 | */ |
| 221 | #define CIFS_NO_HANDLE 0xFFFF |
| 222 | |
Al Viro | 82c05a1 | 2007-03-14 09:19:40 +0000 | [diff] [blame^] | 223 | #define NO_CHANGE_64 cpu_to_le64(0xFFFFFFFFFFFFFFFFULL) |
Steve French | c7af185 | 2007-03-01 04:11:22 +0000 | [diff] [blame] | 224 | #define NO_CHANGE_32 0xFFFFFFFFUL |
| 225 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | /* IPC$ in ASCII */ |
| 227 | #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24" |
| 228 | |
| 229 | /* IPC$ in Unicode */ |
| 230 | #define CIFS_IPC_UNICODE_RESOURCE "\x00\x49\x00\x50\x00\x43\x00\x24\x00\x00" |
| 231 | |
| 232 | /* Unicode Null terminate 2 bytes of 0 */ |
| 233 | #define UNICODE_NULL "\x00\x00" |
| 234 | #define ASCII_NULL 0x00 |
| 235 | |
| 236 | /* |
| 237 | * Server type values (returned on EnumServer API |
| 238 | */ |
| 239 | #define CIFS_SV_TYPE_DC 0x00000008 |
| 240 | #define CIFS_SV_TYPE_BACKDC 0x00000010 |
| 241 | |
| 242 | /* |
| 243 | * Alias type flags (From EnumAlias API call |
| 244 | */ |
| 245 | #define CIFS_ALIAS_TYPE_FILE 0x0001 |
| 246 | #define CIFS_SHARE_TYPE_FILE 0x0000 |
| 247 | |
| 248 | /* |
| 249 | * File Attribute flags |
| 250 | */ |
| 251 | #define ATTR_READONLY 0x0001 |
| 252 | #define ATTR_HIDDEN 0x0002 |
| 253 | #define ATTR_SYSTEM 0x0004 |
| 254 | #define ATTR_VOLUME 0x0008 |
| 255 | #define ATTR_DIRECTORY 0x0010 |
| 256 | #define ATTR_ARCHIVE 0x0020 |
| 257 | #define ATTR_DEVICE 0x0040 |
| 258 | #define ATTR_NORMAL 0x0080 |
| 259 | #define ATTR_TEMPORARY 0x0100 |
| 260 | #define ATTR_SPARSE 0x0200 |
| 261 | #define ATTR_REPARSE 0x0400 |
| 262 | #define ATTR_COMPRESSED 0x0800 |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 263 | #define ATTR_OFFLINE 0x1000 /* ie file not immediately available - |
| 264 | on offline storage */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | #define ATTR_NOT_CONTENT_INDEXED 0x2000 |
| 266 | #define ATTR_ENCRYPTED 0x4000 |
| 267 | #define ATTR_POSIX_SEMANTICS 0x01000000 |
| 268 | #define ATTR_BACKUP_SEMANTICS 0x02000000 |
| 269 | #define ATTR_DELETE_ON_CLOSE 0x04000000 |
| 270 | #define ATTR_SEQUENTIAL_SCAN 0x08000000 |
| 271 | #define ATTR_RANDOM_ACCESS 0x10000000 |
| 272 | #define ATTR_NO_BUFFERING 0x20000000 |
| 273 | #define ATTR_WRITE_THROUGH 0x80000000 |
| 274 | |
| 275 | /* ShareAccess flags */ |
| 276 | #define FILE_NO_SHARE 0x00000000 |
| 277 | #define FILE_SHARE_READ 0x00000001 |
| 278 | #define FILE_SHARE_WRITE 0x00000002 |
| 279 | #define FILE_SHARE_DELETE 0x00000004 |
| 280 | #define FILE_SHARE_ALL 0x00000007 |
| 281 | |
| 282 | /* CreateDisposition flags */ |
| 283 | #define FILE_SUPERSEDE 0x00000000 |
| 284 | #define FILE_OPEN 0x00000001 |
| 285 | #define FILE_CREATE 0x00000002 |
| 286 | #define FILE_OPEN_IF 0x00000003 |
| 287 | #define FILE_OVERWRITE 0x00000004 |
| 288 | #define FILE_OVERWRITE_IF 0x00000005 |
| 289 | |
| 290 | /* CreateOptions */ |
| 291 | #define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ |
| 292 | #define CREATE_WRITE_THROUGH 0x00000002 |
Steve French | eda3c02 | 2005-07-21 15:20:28 -0700 | [diff] [blame] | 293 | #define CREATE_SEQUENTIAL 0x00000004 |
| 294 | #define CREATE_SYNC_ALERT 0x00000010 |
| 295 | #define CREATE_ASYNC_ALERT 0x00000020 |
| 296 | #define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ |
| 297 | #define CREATE_NO_EA_KNOWLEDGE 0x00000200 |
| 298 | #define CREATE_EIGHT_DOT_THREE 0x00000400 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | #define CREATE_RANDOM_ACCESS 0x00000800 |
| 300 | #define CREATE_DELETE_ON_CLOSE 0x00001000 |
Steve French | eda3c02 | 2005-07-21 15:20:28 -0700 | [diff] [blame] | 301 | #define CREATE_OPEN_BY_ID 0x00002000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | #define OPEN_REPARSE_POINT 0x00200000 |
Steve French | eda3c02 | 2005-07-21 15:20:28 -0700 | [diff] [blame] | 303 | #define CREATE_OPTIONS_MASK 0x007FFFFF |
| 304 | #define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
| 306 | /* ImpersonationLevel flags */ |
| 307 | #define SECURITY_ANONYMOUS 0 |
| 308 | #define SECURITY_IDENTIFICATION 1 |
| 309 | #define SECURITY_IMPERSONATION 2 |
| 310 | #define SECURITY_DELEGATION 3 |
| 311 | |
| 312 | /* SecurityFlags */ |
| 313 | #define SECURITY_CONTEXT_TRACKING 0x01 |
| 314 | #define SECURITY_EFFECTIVE_ONLY 0x02 |
| 315 | |
| 316 | /* |
| 317 | * Default PID value, used in all SMBs where the PID is not important |
| 318 | */ |
| 319 | #define CIFS_DFT_PID 0x1234 |
| 320 | |
| 321 | /* |
| 322 | * We use the same routine for Copy and Move SMBs. This flag is used to |
| 323 | * distinguish |
| 324 | */ |
| 325 | #define CIFS_COPY_OP 1 |
| 326 | #define CIFS_RENAME_OP 2 |
| 327 | |
| 328 | #define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */ |
| 329 | #define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */ |
| 330 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | struct smb_hdr { |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 332 | __u32 smb_buf_length; /* big endian on wire *//* BB length is only two |
| 333 | or three bytes - with one or two byte type preceding it that are |
| 334 | zero - we could mask the type byte off just in case BB */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | __u8 Protocol[4]; |
| 336 | __u8 Command; |
| 337 | union { |
| 338 | struct { |
| 339 | __u8 ErrorClass; |
| 340 | __u8 Reserved; |
| 341 | __le16 Error; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 342 | } __attribute__((packed)) DosError; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | __le32 CifsError; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 344 | } __attribute__((packed)) Status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | __u8 Flags; |
| 346 | __le16 Flags2; /* note: le */ |
| 347 | __le16 PidHigh; |
| 348 | union { |
| 349 | struct { |
| 350 | __le32 SequenceNumber; /* le */ |
| 351 | __u32 Reserved; /* zero */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 352 | } __attribute__((packed)) Sequence; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | __u8 SecuritySignature[8]; /* le */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 354 | } __attribute__((packed)) Signature; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | __u8 pad[2]; |
| 356 | __u16 Tid; |
| 357 | __le16 Pid; |
| 358 | __u16 Uid; |
| 359 | __u16 Mid; |
| 360 | __u8 WordCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 361 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | /* given a pointer to an smb_hdr retrieve the value of byte count */ |
| 363 | #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) |
Steve French | e4eb295 | 2005-04-28 22:41:09 -0700 | [diff] [blame] | 364 | #define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ |
| 366 | #define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) |
| 367 | |
| 368 | /* |
| 369 | * Computer Name Length |
| 370 | */ |
| 371 | #define CNLEN 15 |
| 372 | |
| 373 | /* |
| 374 | * Share Name Length @S8A |
| 375 | * Note: This length is limited by the SMB used to get @S8A |
| 376 | * the Share info. NetShareEnum only returns 13 @S8A |
| 377 | * chars, including the null termination. @S8A |
| 378 | */ |
| 379 | #define SNLEN 12 /*@S8A */ |
| 380 | |
| 381 | /* |
| 382 | * Comment Length |
| 383 | */ |
| 384 | #define MAXCOMMENTLEN 40 |
| 385 | |
| 386 | /* |
| 387 | * The OS/2 maximum path name |
| 388 | */ |
| 389 | #define MAX_PATHCONF 256 |
| 390 | |
| 391 | /* |
| 392 | * SMB frame definitions (following must be packed structs) |
| 393 | * See the SNIA CIFS Specification for details. |
| 394 | * |
| 395 | * The Naming convention is the lower case version of the |
| 396 | * smb command code name for the struct and this is typedef to the |
| 397 | * uppercase version of the same name with the prefix SMB_ removed |
| 398 | * for brevity. Although typedefs are not commonly used for |
| 399 | * structure definitions in the Linux kernel, their use in the |
| 400 | * CIFS standards document, which this code is based on, may |
| 401 | * make this one of the cases where typedefs for structures make |
| 402 | * sense to improve readability for readers of the standards doc. |
| 403 | * Typedefs can always be removed later if they are too distracting |
| 404 | * and they are only used for the CIFSs PDUs themselves, not |
| 405 | * internal cifs vfs structures |
| 406 | * |
| 407 | */ |
| 408 | |
| 409 | typedef struct negotiate_req { |
| 410 | struct smb_hdr hdr; /* wct = 0 */ |
| 411 | __le16 ByteCount; |
| 412 | unsigned char DialectsArray[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 413 | } __attribute__((packed)) NEGOTIATE_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 415 | /* Dialect index is 13 for LANMAN */ |
| 416 | |
Steve French | b815f1e | 2006-10-02 05:53:29 +0000 | [diff] [blame] | 417 | #define MIN_TZ_ADJ (15 * 60) /* minimum grid for timezones in seconds */ |
| 418 | |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 419 | typedef struct lanman_neg_rsp { |
| 420 | struct smb_hdr hdr; /* wct = 13 */ |
| 421 | __le16 DialectIndex; |
| 422 | __le16 SecurityMode; |
| 423 | __le16 MaxBufSize; |
| 424 | __le16 MaxMpxCount; |
| 425 | __le16 MaxNumberVcs; |
| 426 | __le16 RawMode; |
| 427 | __le32 SessionKey; |
Steve French | 175ec9e | 2006-09-30 01:07:38 +0000 | [diff] [blame] | 428 | struct { |
| 429 | __le16 Time; |
| 430 | __le16 Date; |
| 431 | } __attribute__((packed)) SrvTime; |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 432 | __le16 ServerTimeZone; |
| 433 | __le16 EncryptionKeyLength; |
| 434 | __le16 Reserved; |
| 435 | __u16 ByteCount; |
| 436 | unsigned char EncryptionKey[1]; |
| 437 | } __attribute__((packed)) LANMAN_NEG_RSP; |
| 438 | |
Steve French | 254e55e | 2006-06-04 05:53:15 +0000 | [diff] [blame] | 439 | #define READ_RAW_ENABLE 1 |
| 440 | #define WRITE_RAW_ENABLE 2 |
| 441 | #define RAW_ENABLE (READ_RAW_ENABLE | WRITE_RAW_ENABLE) |
| 442 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | typedef struct negotiate_rsp { |
| 444 | struct smb_hdr hdr; /* wct = 17 */ |
| 445 | __le16 DialectIndex; |
| 446 | __u8 SecurityMode; |
| 447 | __le16 MaxMpxCount; |
| 448 | __le16 MaxNumberVcs; |
| 449 | __le32 MaxBufferSize; |
| 450 | __le32 MaxRawSize; |
| 451 | __le32 SessionKey; |
| 452 | __le32 Capabilities; /* see below */ |
| 453 | __le32 SystemTimeLow; |
| 454 | __le32 SystemTimeHigh; |
| 455 | __le16 ServerTimeZone; |
| 456 | __u8 EncryptionKeyLength; |
| 457 | __u16 ByteCount; |
| 458 | union { |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 459 | unsigned char EncryptionKey[1]; /* cap extended security off */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | /* followed by Domain name - if extended security is off */ |
| 461 | /* followed by 16 bytes of server GUID */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 462 | /* then security blob if cap_extended_security negotiated */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | struct { |
| 464 | unsigned char GUID[16]; |
| 465 | unsigned char SecurityBlob[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 466 | } __attribute__((packed)) extended_response; |
| 467 | } __attribute__((packed)) u; |
| 468 | } __attribute__((packed)) NEGOTIATE_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | |
| 470 | /* SecurityMode bits */ |
| 471 | #define SECMODE_USER 0x01 /* off indicates share level security */ |
| 472 | #define SECMODE_PW_ENCRYPT 0x02 |
| 473 | #define SECMODE_SIGN_ENABLED 0x04 /* SMB security signatures enabled */ |
| 474 | #define SECMODE_SIGN_REQUIRED 0x08 /* SMB security signatures required */ |
| 475 | |
| 476 | /* Negotiate response Capabilities */ |
| 477 | #define CAP_RAW_MODE 0x00000001 |
| 478 | #define CAP_MPX_MODE 0x00000002 |
| 479 | #define CAP_UNICODE 0x00000004 |
| 480 | #define CAP_LARGE_FILES 0x00000008 |
| 481 | #define CAP_NT_SMBS 0x00000010 /* implies CAP_NT_FIND */ |
| 482 | #define CAP_RPC_REMOTE_APIS 0x00000020 |
| 483 | #define CAP_STATUS32 0x00000040 |
| 484 | #define CAP_LEVEL_II_OPLOCKS 0x00000080 |
| 485 | #define CAP_LOCK_AND_READ 0x00000100 |
| 486 | #define CAP_NT_FIND 0x00000200 |
| 487 | #define CAP_DFS 0x00001000 |
| 488 | #define CAP_INFOLEVEL_PASSTHRU 0x00002000 |
| 489 | #define CAP_LARGE_READ_X 0x00004000 |
| 490 | #define CAP_LARGE_WRITE_X 0x00008000 |
| 491 | #define CAP_UNIX 0x00800000 |
| 492 | #define CAP_RESERVED 0x02000000 |
| 493 | #define CAP_BULK_TRANSFER 0x20000000 |
| 494 | #define CAP_COMPRESSED_DATA 0x40000000 |
| 495 | #define CAP_EXTENDED_SECURITY 0x80000000 |
| 496 | |
| 497 | typedef union smb_com_session_setup_andx { |
| 498 | struct { /* request format */ |
| 499 | struct smb_hdr hdr; /* wct = 12 */ |
| 500 | __u8 AndXCommand; |
| 501 | __u8 AndXReserved; |
| 502 | __le16 AndXOffset; |
| 503 | __le16 MaxBufferSize; |
| 504 | __le16 MaxMpxCount; |
| 505 | __le16 VcNumber; |
| 506 | __u32 SessionKey; |
| 507 | __le16 SecurityBlobLength; |
| 508 | __u32 Reserved; |
| 509 | __le32 Capabilities; /* see below */ |
| 510 | __le16 ByteCount; |
| 511 | unsigned char SecurityBlob[1]; /* followed by */ |
| 512 | /* STRING NativeOS */ |
| 513 | /* STRING NativeLanMan */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 514 | } __attribute__((packed)) req; /* NTLM request format (with |
| 515 | extended security */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | |
| 517 | struct { /* request format */ |
| 518 | struct smb_hdr hdr; /* wct = 13 */ |
| 519 | __u8 AndXCommand; |
| 520 | __u8 AndXReserved; |
| 521 | __le16 AndXOffset; |
| 522 | __le16 MaxBufferSize; |
| 523 | __le16 MaxMpxCount; |
| 524 | __le16 VcNumber; |
| 525 | __u32 SessionKey; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 526 | __le16 CaseInsensitivePasswordLength; /* ASCII password len */ |
| 527 | __le16 CaseSensitivePasswordLength; /* Unicode password length*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | __u32 Reserved; /* see below */ |
| 529 | __le32 Capabilities; |
| 530 | __le16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 531 | unsigned char CaseInsensitivePassword[1]; /* followed by: */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | /* unsigned char * CaseSensitivePassword; */ |
| 533 | /* STRING AccountName */ |
| 534 | /* STRING PrimaryDomain */ |
| 535 | /* STRING NativeOS */ |
| 536 | /* STRING NativeLanMan */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 537 | } __attribute__((packed)) req_no_secext; /* NTLM request format (without |
| 538 | extended security */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | |
| 540 | struct { /* default (NTLM) response format */ |
| 541 | struct smb_hdr hdr; /* wct = 4 */ |
| 542 | __u8 AndXCommand; |
| 543 | __u8 AndXReserved; |
| 544 | __le16 AndXOffset; |
| 545 | __le16 Action; /* see below */ |
| 546 | __le16 SecurityBlobLength; |
| 547 | __u16 ByteCount; |
| 548 | unsigned char SecurityBlob[1]; /* followed by */ |
| 549 | /* unsigned char * NativeOS; */ |
| 550 | /* unsigned char * NativeLanMan; */ |
| 551 | /* unsigned char * PrimaryDomain; */ |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 552 | } __attribute__((packed)) resp; /* NTLM response |
| 553 | (with or without extended sec) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | |
| 555 | struct { /* request format */ |
| 556 | struct smb_hdr hdr; /* wct = 10 */ |
| 557 | __u8 AndXCommand; |
| 558 | __u8 AndXReserved; |
| 559 | __le16 AndXOffset; |
| 560 | __le16 MaxBufferSize; |
| 561 | __le16 MaxMpxCount; |
| 562 | __le16 VcNumber; |
| 563 | __u32 SessionKey; |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 564 | __le16 PasswordLength; |
| 565 | __u32 Reserved; /* encrypt key len and offset */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | __le16 ByteCount; |
| 567 | unsigned char AccountPassword[1]; /* followed by */ |
| 568 | /* STRING AccountName */ |
| 569 | /* STRING PrimaryDomain */ |
| 570 | /* STRING NativeOS */ |
| 571 | /* STRING NativeLanMan */ |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 572 | } __attribute__((packed)) old_req; /* pre-NTLM (LANMAN2.1) req format */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | |
| 574 | struct { /* default (NTLM) response format */ |
| 575 | struct smb_hdr hdr; /* wct = 3 */ |
| 576 | __u8 AndXCommand; |
| 577 | __u8 AndXReserved; |
| 578 | __le16 AndXOffset; |
| 579 | __le16 Action; /* see below */ |
| 580 | __u16 ByteCount; |
| 581 | unsigned char NativeOS[1]; /* followed by */ |
| 582 | /* unsigned char * NativeLanMan; */ |
| 583 | /* unsigned char * PrimaryDomain; */ |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 584 | } __attribute__((packed)) old_resp; /* pre-NTLM (LANMAN2.1) response */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 585 | } __attribute__((packed)) SESSION_SETUP_ANDX; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | |
Steve French | f64b23a | 2006-06-05 05:27:37 +0000 | [diff] [blame] | 587 | /* format of NLTMv2 Response ie "case sensitive password" hash when NTLMv2 */ |
| 588 | |
Steve French | 33ec32f | 2006-12-08 04:14:28 +0000 | [diff] [blame] | 589 | #define NTLMSSP_SERVER_TYPE 1 |
| 590 | #define NTLMSSP_DOMAIN_TYPE 2 |
| 591 | #define NTLMSSP_FQ_DOMAIN_TYPE 3 |
| 592 | #define NTLMSSP_DNS_DOMAIN_TYPE 4 |
| 593 | #define NTLMSSP_DNS_PARENT_TYPE 5 |
| 594 | |
Steve French | f64b23a | 2006-06-05 05:27:37 +0000 | [diff] [blame] | 595 | struct ntlmssp2_name { |
| 596 | __le16 type; |
| 597 | __le16 length; |
| 598 | /* char name[length]; */ |
| 599 | } __attribute__((packed)); |
| 600 | |
| 601 | struct ntlmv2_resp { |
| 602 | char ntlmv2_hash[CIFS_ENCPWD_SIZE]; |
Steve French | 6d027cf | 2006-06-05 16:26:05 +0000 | [diff] [blame] | 603 | __le32 blob_signature; |
Steve French | f64b23a | 2006-06-05 05:27:37 +0000 | [diff] [blame] | 604 | __u32 reserved; |
| 605 | __le64 time; |
| 606 | __u64 client_chal; /* random */ |
| 607 | __u32 reserved2; |
Steve French | 33ec32f | 2006-12-08 04:14:28 +0000 | [diff] [blame] | 608 | struct ntlmssp2_name names[2]; |
Steve French | f64b23a | 2006-06-05 05:27:37 +0000 | [diff] [blame] | 609 | /* array of name entries could follow ending in minimum 4 byte struct */ |
| 610 | } __attribute__((packed)); |
| 611 | |
| 612 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | #define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" |
| 614 | |
| 615 | /* Capabilities bits (for NTLM SessSetup request) */ |
| 616 | #define CAP_UNICODE 0x00000004 |
| 617 | #define CAP_LARGE_FILES 0x00000008 |
| 618 | #define CAP_NT_SMBS 0x00000010 |
| 619 | #define CAP_STATUS32 0x00000040 |
| 620 | #define CAP_LEVEL_II_OPLOCKS 0x00000080 |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 621 | #define CAP_NT_FIND 0x00000200 /* reserved should be zero |
| 622 | (because NT_SMBs implies the same thing?) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | #define CAP_BULK_TRANSFER 0x20000000 |
| 624 | #define CAP_EXTENDED_SECURITY 0x80000000 |
| 625 | |
| 626 | /* Action bits */ |
| 627 | #define GUEST_LOGIN 1 |
| 628 | |
| 629 | typedef struct smb_com_tconx_req { |
| 630 | struct smb_hdr hdr; /* wct = 4 */ |
| 631 | __u8 AndXCommand; |
| 632 | __u8 AndXReserved; |
| 633 | __le16 AndXOffset; |
| 634 | __le16 Flags; /* see below */ |
| 635 | __le16 PasswordLength; |
| 636 | __le16 ByteCount; |
| 637 | unsigned char Password[1]; /* followed by */ |
| 638 | /* STRING Path *//* \\server\share name */ |
| 639 | /* STRING Service */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 640 | } __attribute__((packed)) TCONX_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 641 | |
| 642 | typedef struct smb_com_tconx_rsp { |
Steve French | f64b23a | 2006-06-05 05:27:37 +0000 | [diff] [blame] | 643 | struct smb_hdr hdr; /* wct = 3 note that Win2000 has sent wct = 7 |
| 644 | in some cases on responses. Four unspecified |
| 645 | words followed OptionalSupport */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | __u8 AndXCommand; |
| 647 | __u8 AndXReserved; |
| 648 | __le16 AndXOffset; |
| 649 | __le16 OptionalSupport; /* see below */ |
| 650 | __u16 ByteCount; |
| 651 | unsigned char Service[1]; /* always ASCII, not Unicode */ |
| 652 | /* STRING NativeFileSystem */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 653 | } __attribute__((packed)) TCONX_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | |
| 655 | /* tree connect Flags */ |
| 656 | #define DISCONNECT_TID 0x0001 |
| 657 | #define TCON_EXTENDED_SECINFO 0x0008 |
| 658 | /* OptionalSupport bits */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 659 | #define SMB_SUPPORT_SEARCH_BITS 0x0001 /* "must have" directory search bits |
| 660 | (exclusive searches supported) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | #define SMB_SHARE_IS_IN_DFS 0x0002 |
| 662 | |
| 663 | typedef struct smb_com_logoff_andx_req { |
| 664 | struct smb_hdr hdr; /* wct = 2 */ |
| 665 | __u8 AndXCommand; |
| 666 | __u8 AndXReserved; |
| 667 | __u16 AndXOffset; |
| 668 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 669 | } __attribute__((packed)) LOGOFF_ANDX_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 670 | |
| 671 | typedef struct smb_com_logoff_andx_rsp { |
| 672 | struct smb_hdr hdr; /* wct = 2 */ |
| 673 | __u8 AndXCommand; |
| 674 | __u8 AndXReserved; |
| 675 | __u16 AndXOffset; |
| 676 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 677 | } __attribute__((packed)) LOGOFF_ANDX_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 678 | |
Steve French | 86c96b4 | 2005-11-18 20:25:31 -0800 | [diff] [blame] | 679 | typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on |
| 680 | tree_connect PDU to effect disconnect */ |
| 681 | /* tdis is probably simplest SMB PDU */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 682 | struct { |
| 683 | struct smb_hdr hdr; /* wct = 0 */ |
| 684 | __u16 ByteCount; /* bcc = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 685 | } __attribute__((packed)) req; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | struct { |
| 687 | struct smb_hdr hdr; /* wct = 0 */ |
| 688 | __u16 ByteCount; /* bcc = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 689 | } __attribute__((packed)) resp; |
| 690 | } __attribute__((packed)) TREE_DISCONNECT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | |
| 692 | typedef struct smb_com_close_req { |
| 693 | struct smb_hdr hdr; /* wct = 3 */ |
| 694 | __u16 FileID; |
Steve French | b815f1e | 2006-10-02 05:53:29 +0000 | [diff] [blame] | 695 | __u32 LastWriteTime; /* should be zero or -1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 696 | __u16 ByteCount; /* 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 697 | } __attribute__((packed)) CLOSE_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 698 | |
| 699 | typedef struct smb_com_close_rsp { |
| 700 | struct smb_hdr hdr; /* wct = 0 */ |
| 701 | __u16 ByteCount; /* bct = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 702 | } __attribute__((packed)) CLOSE_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | |
| 704 | typedef struct smb_com_findclose_req { |
| 705 | struct smb_hdr hdr; /* wct = 1 */ |
| 706 | __u16 FileID; |
| 707 | __u16 ByteCount; /* 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 708 | } __attribute__((packed)) FINDCLOSE_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | |
| 710 | /* OpenFlags */ |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 711 | #define REQ_MORE_INFO 0x00000001 /* legacy (OPEN_AND_X) only */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | #define REQ_OPLOCK 0x00000002 |
| 713 | #define REQ_BATCHOPLOCK 0x00000004 |
| 714 | #define REQ_OPENDIRONLY 0x00000008 |
| 715 | |
| 716 | typedef struct smb_com_open_req { /* also handles create */ |
| 717 | struct smb_hdr hdr; /* wct = 24 */ |
| 718 | __u8 AndXCommand; |
| 719 | __u8 AndXReserved; |
| 720 | __le16 AndXOffset; |
| 721 | __u8 Reserved; /* Must Be Zero */ |
| 722 | __le16 NameLength; |
| 723 | __le32 OpenFlags; |
| 724 | __le32 RootDirectoryFid; |
| 725 | __le32 DesiredAccess; |
| 726 | __le64 AllocationSize; |
| 727 | __le32 FileAttributes; |
| 728 | __le32 ShareAccess; |
| 729 | __le32 CreateDisposition; |
| 730 | __le32 CreateOptions; |
| 731 | __le32 ImpersonationLevel; |
| 732 | __u8 SecurityFlags; |
| 733 | __le16 ByteCount; |
| 734 | char fileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 735 | } __attribute__((packed)) OPEN_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 736 | |
| 737 | /* open response: oplock levels */ |
| 738 | #define OPLOCK_NONE 0 |
| 739 | #define OPLOCK_EXCLUSIVE 1 |
| 740 | #define OPLOCK_BATCH 2 |
| 741 | #define OPLOCK_READ 3 /* level 2 oplock */ |
| 742 | |
| 743 | /* open response for CreateAction shifted left */ |
| 744 | #define CIFS_CREATE_ACTION 0x20000 /* file created */ |
| 745 | |
| 746 | typedef struct smb_com_open_rsp { |
| 747 | struct smb_hdr hdr; /* wct = 34 BB */ |
| 748 | __u8 AndXCommand; |
| 749 | __u8 AndXReserved; |
| 750 | __le16 AndXOffset; |
| 751 | __u8 OplockLevel; |
| 752 | __u16 Fid; |
| 753 | __le32 CreateAction; |
| 754 | __le64 CreationTime; |
| 755 | __le64 LastAccessTime; |
| 756 | __le64 LastWriteTime; |
| 757 | __le64 ChangeTime; |
| 758 | __le32 FileAttributes; |
| 759 | __le64 AllocationSize; |
| 760 | __le64 EndOfFile; |
| 761 | __le16 FileType; |
| 762 | __le16 DeviceState; |
| 763 | __u8 DirectoryFlag; |
| 764 | __u16 ByteCount; /* bct = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 765 | } __attribute__((packed)) OPEN_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 766 | |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 767 | /* format of legacy open request */ |
| 768 | typedef struct smb_com_openx_req { |
| 769 | struct smb_hdr hdr; /* wct = 15 */ |
| 770 | __u8 AndXCommand; |
| 771 | __u8 AndXReserved; |
| 772 | __le16 AndXOffset; |
| 773 | __le16 OpenFlags; |
| 774 | __le16 Mode; |
| 775 | __le16 Sattr; /* search attributes */ |
| 776 | __le16 FileAttributes; /* dos attrs */ |
| 777 | __le32 CreateTime; /* os2 format */ |
| 778 | __le16 OpenFunction; |
| 779 | __le32 EndOfFile; |
| 780 | __le32 Timeout; |
| 781 | __le32 Reserved; |
Steve French | 70ca734 | 2005-09-22 16:32:06 -0700 | [diff] [blame] | 782 | __le16 ByteCount; /* file name follows */ |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 783 | char fileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 784 | } __attribute__((packed)) OPENX_REQ; |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 785 | |
| 786 | typedef struct smb_com_openx_rsp { |
| 787 | struct smb_hdr hdr; /* wct = 15 */ |
| 788 | __u8 AndXCommand; |
| 789 | __u8 AndXReserved; |
| 790 | __le16 AndXOffset; |
| 791 | __u16 Fid; |
| 792 | __le16 FileAttributes; |
| 793 | __le32 LastWriteTime; /* os2 format */ |
| 794 | __le32 EndOfFile; |
| 795 | __le16 Access; |
| 796 | __le16 FileType; |
| 797 | __le16 IPCState; |
| 798 | __le16 Action; |
| 799 | __u32 FileId; |
| 800 | __u16 Reserved; |
| 801 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 802 | } __attribute__((packed)) OPENX_RSP; |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 803 | |
Steve French | 595dcfe | 2007-02-08 18:11:42 +0000 | [diff] [blame] | 804 | /* For encoding of POSIX Open Request - see trans2 function 0x209 data struct */ |
| 805 | |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 806 | /* Legacy write request for older servers */ |
| 807 | typedef struct smb_com_writex_req { |
| 808 | struct smb_hdr hdr; /* wct = 12 */ |
| 809 | __u8 AndXCommand; |
| 810 | __u8 AndXReserved; |
| 811 | __le16 AndXOffset; |
| 812 | __u16 Fid; |
| 813 | __le32 OffsetLow; |
| 814 | __u32 Reserved; /* Timeout */ |
| 815 | __le16 WriteMode; /* 1 = write through */ |
| 816 | __le16 Remaining; |
| 817 | __le16 Reserved2; |
| 818 | __le16 DataLengthLow; |
| 819 | __le16 DataOffset; |
| 820 | __le16 ByteCount; |
| 821 | __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ |
| 822 | char Data[0]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 823 | } __attribute__((packed)) WRITEX_REQ; |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 824 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 825 | typedef struct smb_com_write_req { |
| 826 | struct smb_hdr hdr; /* wct = 14 */ |
| 827 | __u8 AndXCommand; |
| 828 | __u8 AndXReserved; |
| 829 | __le16 AndXOffset; |
| 830 | __u16 Fid; |
| 831 | __le32 OffsetLow; |
| 832 | __u32 Reserved; |
| 833 | __le16 WriteMode; |
| 834 | __le16 Remaining; |
| 835 | __le16 DataLengthHigh; |
| 836 | __le16 DataLengthLow; |
| 837 | __le16 DataOffset; |
| 838 | __le32 OffsetHigh; |
| 839 | __le16 ByteCount; |
| 840 | __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ |
| 841 | char Data[0]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 842 | } __attribute__((packed)) WRITE_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | |
| 844 | typedef struct smb_com_write_rsp { |
| 845 | struct smb_hdr hdr; /* wct = 6 */ |
| 846 | __u8 AndXCommand; |
| 847 | __u8 AndXReserved; |
| 848 | __le16 AndXOffset; |
| 849 | __le16 Count; |
| 850 | __le16 Remaining; |
| 851 | __le16 CountHigh; |
| 852 | __u16 Reserved; |
| 853 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 854 | } __attribute__((packed)) WRITE_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 855 | |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 856 | /* legacy read request for older servers */ |
| 857 | typedef struct smb_com_readx_req { |
| 858 | struct smb_hdr hdr; /* wct = 10 */ |
| 859 | __u8 AndXCommand; |
| 860 | __u8 AndXReserved; |
| 861 | __le16 AndXOffset; |
| 862 | __u16 Fid; |
| 863 | __le32 OffsetLow; |
| 864 | __le16 MaxCount; |
| 865 | __le16 MinCount; /* obsolete */ |
| 866 | __le32 Reserved; |
| 867 | __le16 Remaining; |
| 868 | __le16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 869 | } __attribute__((packed)) READX_REQ; |
Steve French | a9d02ad | 2005-08-24 23:06:05 -0700 | [diff] [blame] | 870 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 871 | typedef struct smb_com_read_req { |
| 872 | struct smb_hdr hdr; /* wct = 12 */ |
| 873 | __u8 AndXCommand; |
| 874 | __u8 AndXReserved; |
| 875 | __le16 AndXOffset; |
| 876 | __u16 Fid; |
| 877 | __le32 OffsetLow; |
| 878 | __le16 MaxCount; |
| 879 | __le16 MinCount; /* obsolete */ |
| 880 | __le32 MaxCountHigh; |
| 881 | __le16 Remaining; |
| 882 | __le32 OffsetHigh; |
| 883 | __le16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 884 | } __attribute__((packed)) READ_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 885 | |
| 886 | typedef struct smb_com_read_rsp { |
| 887 | struct smb_hdr hdr; /* wct = 12 */ |
| 888 | __u8 AndXCommand; |
| 889 | __u8 AndXReserved; |
| 890 | __le16 AndXOffset; |
| 891 | __le16 Remaining; |
| 892 | __le16 DataCompactionMode; |
| 893 | __le16 Reserved; |
| 894 | __le16 DataLength; |
| 895 | __le16 DataOffset; |
| 896 | __le16 DataLengthHigh; |
| 897 | __u64 Reserved2; |
| 898 | __u16 ByteCount; |
| 899 | __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ |
| 900 | char Data[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 901 | } __attribute__((packed)) READ_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 902 | |
| 903 | typedef struct locking_andx_range { |
| 904 | __le16 Pid; |
| 905 | __le16 Pad; |
| 906 | __le32 OffsetHigh; |
| 907 | __le32 OffsetLow; |
| 908 | __le32 LengthHigh; |
| 909 | __le32 LengthLow; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 910 | } __attribute__((packed)) LOCKING_ANDX_RANGE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 911 | |
| 912 | #define LOCKING_ANDX_SHARED_LOCK 0x01 |
| 913 | #define LOCKING_ANDX_OPLOCK_RELEASE 0x02 |
| 914 | #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04 |
| 915 | #define LOCKING_ANDX_CANCEL_LOCK 0x08 |
| 916 | #define LOCKING_ANDX_LARGE_FILES 0x10 /* always on for us */ |
| 917 | |
| 918 | typedef struct smb_com_lock_req { |
| 919 | struct smb_hdr hdr; /* wct = 8 */ |
| 920 | __u8 AndXCommand; |
| 921 | __u8 AndXReserved; |
| 922 | __le16 AndXOffset; |
| 923 | __u16 Fid; |
| 924 | __u8 LockType; |
| 925 | __u8 OplockLevel; |
| 926 | __le32 Timeout; |
| 927 | __le16 NumberOfUnlocks; |
| 928 | __le16 NumberOfLocks; |
| 929 | __le16 ByteCount; |
| 930 | LOCKING_ANDX_RANGE Locks[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 931 | } __attribute__((packed)) LOCK_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 932 | |
Steve French | 08547b0 | 2006-02-28 22:39:25 +0000 | [diff] [blame] | 933 | /* lock type */ |
| 934 | #define CIFS_RDLCK 0 |
| 935 | #define CIFS_WRLCK 1 |
| 936 | #define CIFS_UNLCK 2 |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 937 | typedef struct cifs_posix_lock { |
| 938 | __le16 lock_type; /* 0 = Read, 1 = Write, 2 = Unlock */ |
| 939 | __le16 lock_flags; /* 1 = Wait (only valid for setlock) */ |
| 940 | __le32 pid; |
| 941 | __le64 start; |
| 942 | __le64 length; |
| 943 | /* BB what about additional owner info to identify network client */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 944 | } __attribute__((packed)) CIFS_POSIX_LOCK; |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 945 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 946 | typedef struct smb_com_lock_rsp { |
| 947 | struct smb_hdr hdr; /* wct = 2 */ |
| 948 | __u8 AndXCommand; |
| 949 | __u8 AndXReserved; |
| 950 | __le16 AndXOffset; |
| 951 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 952 | } __attribute__((packed)) LOCK_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 953 | |
| 954 | typedef struct smb_com_rename_req { |
| 955 | struct smb_hdr hdr; /* wct = 1 */ |
| 956 | __le16 SearchAttributes; /* target file attributes */ |
| 957 | __le16 ByteCount; |
| 958 | __u8 BufferFormat; /* 4 = ASCII or Unicode */ |
| 959 | unsigned char OldFileName[1]; |
| 960 | /* followed by __u8 BufferFormat2 */ |
| 961 | /* followed by NewFileName */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 962 | } __attribute__((packed)) RENAME_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 963 | |
| 964 | /* copy request flags */ |
| 965 | #define COPY_MUST_BE_FILE 0x0001 |
| 966 | #define COPY_MUST_BE_DIR 0x0002 |
| 967 | #define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */ |
| 968 | #define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */ |
| 969 | #define COPY_VERIFY_WRITES 0x0010 |
| 970 | #define COPY_TREE 0x0020 |
| 971 | |
| 972 | typedef struct smb_com_copy_req { |
| 973 | struct smb_hdr hdr; /* wct = 3 */ |
| 974 | __u16 Tid2; |
| 975 | __le16 OpenFunction; |
| 976 | __le16 Flags; |
| 977 | __le16 ByteCount; |
| 978 | __u8 BufferFormat; /* 4 = ASCII or Unicode */ |
| 979 | unsigned char OldFileName[1]; |
| 980 | /* followed by __u8 BufferFormat2 */ |
| 981 | /* followed by NewFileName string */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 982 | } __attribute__((packed)) COPY_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 983 | |
| 984 | typedef struct smb_com_copy_rsp { |
| 985 | struct smb_hdr hdr; /* wct = 1 */ |
| 986 | __le16 CopyCount; /* number of files copied */ |
| 987 | __u16 ByteCount; /* may be zero */ |
| 988 | __u8 BufferFormat; /* 0x04 - only present if errored file follows */ |
| 989 | unsigned char ErrorFileName[1]; /* only present if error in copy */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 990 | } __attribute__((packed)) COPY_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 991 | |
| 992 | #define CREATE_HARD_LINK 0x103 |
| 993 | #define MOVEFILE_COPY_ALLOWED 0x0002 |
| 994 | #define MOVEFILE_REPLACE_EXISTING 0x0001 |
| 995 | |
| 996 | typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */ |
| 997 | struct smb_hdr hdr; /* wct = 4 */ |
| 998 | __le16 SearchAttributes; /* target file attributes */ |
| 999 | __le16 Flags; /* spec says Information Level */ |
| 1000 | __le32 ClusterCount; |
| 1001 | __le16 ByteCount; |
| 1002 | __u8 BufferFormat; /* 4 = ASCII or Unicode */ |
| 1003 | unsigned char OldFileName[1]; |
| 1004 | /* followed by __u8 BufferFormat2 */ |
| 1005 | /* followed by NewFileName */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1006 | } __attribute__((packed)) NT_RENAME_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1007 | |
| 1008 | typedef struct smb_com_rename_rsp { |
| 1009 | struct smb_hdr hdr; /* wct = 0 */ |
| 1010 | __u16 ByteCount; /* bct = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1011 | } __attribute__((packed)) RENAME_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1012 | |
| 1013 | typedef struct smb_com_delete_file_req { |
| 1014 | struct smb_hdr hdr; /* wct = 1 */ |
| 1015 | __le16 SearchAttributes; |
| 1016 | __le16 ByteCount; |
| 1017 | __u8 BufferFormat; /* 4 = ASCII */ |
| 1018 | unsigned char fileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1019 | } __attribute__((packed)) DELETE_FILE_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1020 | |
| 1021 | typedef struct smb_com_delete_file_rsp { |
| 1022 | struct smb_hdr hdr; /* wct = 0 */ |
| 1023 | __u16 ByteCount; /* bct = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1024 | } __attribute__((packed)) DELETE_FILE_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1025 | |
| 1026 | typedef struct smb_com_delete_directory_req { |
| 1027 | struct smb_hdr hdr; /* wct = 0 */ |
| 1028 | __le16 ByteCount; |
| 1029 | __u8 BufferFormat; /* 4 = ASCII */ |
| 1030 | unsigned char DirName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1031 | } __attribute__((packed)) DELETE_DIRECTORY_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1032 | |
| 1033 | typedef struct smb_com_delete_directory_rsp { |
| 1034 | struct smb_hdr hdr; /* wct = 0 */ |
| 1035 | __u16 ByteCount; /* bct = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1036 | } __attribute__((packed)) DELETE_DIRECTORY_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1037 | |
| 1038 | typedef struct smb_com_create_directory_req { |
| 1039 | struct smb_hdr hdr; /* wct = 0 */ |
| 1040 | __le16 ByteCount; |
| 1041 | __u8 BufferFormat; /* 4 = ASCII */ |
| 1042 | unsigned char DirName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1043 | } __attribute__((packed)) CREATE_DIRECTORY_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1044 | |
| 1045 | typedef struct smb_com_create_directory_rsp { |
| 1046 | struct smb_hdr hdr; /* wct = 0 */ |
| 1047 | __u16 ByteCount; /* bct = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1048 | } __attribute__((packed)) CREATE_DIRECTORY_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1049 | |
Steve French | 6b8edfe | 2005-08-23 20:26:03 -0700 | [diff] [blame] | 1050 | typedef struct smb_com_query_information_req { |
| 1051 | struct smb_hdr hdr; /* wct = 0 */ |
| 1052 | __le16 ByteCount; /* 1 + namelen + 1 */ |
| 1053 | __u8 BufferFormat; /* 4 = ASCII */ |
| 1054 | unsigned char FileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1055 | } __attribute__((packed)) QUERY_INFORMATION_REQ; |
Steve French | 6b8edfe | 2005-08-23 20:26:03 -0700 | [diff] [blame] | 1056 | |
| 1057 | typedef struct smb_com_query_information_rsp { |
| 1058 | struct smb_hdr hdr; /* wct = 10 */ |
| 1059 | __le16 attr; |
| 1060 | __le32 last_write_time; |
| 1061 | __le32 size; |
| 1062 | __u16 reserved[5]; |
| 1063 | __le16 ByteCount; /* bcc = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1064 | } __attribute__((packed)) QUERY_INFORMATION_RSP; |
Steve French | 6b8edfe | 2005-08-23 20:26:03 -0700 | [diff] [blame] | 1065 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1066 | typedef struct smb_com_setattr_req { |
| 1067 | struct smb_hdr hdr; /* wct = 8 */ |
| 1068 | __le16 attr; |
| 1069 | __le16 time_low; |
| 1070 | __le16 time_high; |
| 1071 | __le16 reserved[5]; /* must be zero */ |
| 1072 | __u16 ByteCount; |
| 1073 | __u8 BufferFormat; /* 4 = ASCII */ |
| 1074 | unsigned char fileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1075 | } __attribute__((packed)) SETATTR_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1076 | |
| 1077 | typedef struct smb_com_setattr_rsp { |
| 1078 | struct smb_hdr hdr; /* wct = 0 */ |
| 1079 | __u16 ByteCount; /* bct = 0 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1080 | } __attribute__((packed)) SETATTR_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1081 | |
| 1082 | /* empty wct response to setattr */ |
| 1083 | |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 1084 | /*******************************************************/ |
| 1085 | /* NT Transact structure defintions follow */ |
| 1086 | /* Currently only ioctl, acl (get security descriptor) */ |
| 1087 | /* and notify are implemented */ |
| 1088 | /*******************************************************/ |
| 1089 | typedef struct smb_com_ntransact_req { |
| 1090 | struct smb_hdr hdr; /* wct >= 19 */ |
| 1091 | __u8 MaxSetupCount; |
| 1092 | __u16 Reserved; |
| 1093 | __le32 TotalParameterCount; |
| 1094 | __le32 TotalDataCount; |
| 1095 | __le32 MaxParameterCount; |
| 1096 | __le32 MaxDataCount; |
| 1097 | __le32 ParameterCount; |
| 1098 | __le32 ParameterOffset; |
| 1099 | __le32 DataCount; |
| 1100 | __le32 DataOffset; |
| 1101 | __u8 SetupCount; /* four setup words follow subcommand */ |
| 1102 | /* SNIA spec incorrectly included spurious pad here */ |
| 1103 | __le16 SubCommand; /* 2 = IOCTL/FSCTL */ |
| 1104 | /* SetupCount words follow then */ |
| 1105 | __le16 ByteCount; |
| 1106 | __u8 Pad[3]; |
| 1107 | __u8 Parms[0]; |
| 1108 | } __attribute__((packed)) NTRANSACT_REQ; |
| 1109 | |
| 1110 | typedef struct smb_com_ntransact_rsp { |
| 1111 | struct smb_hdr hdr; /* wct = 18 */ |
| 1112 | __u8 Reserved[3]; |
| 1113 | __le32 TotalParameterCount; |
| 1114 | __le32 TotalDataCount; |
| 1115 | __le32 ParameterCount; |
| 1116 | __le32 ParameterOffset; |
| 1117 | __le32 ParameterDisplacement; |
| 1118 | __le32 DataCount; |
| 1119 | __le32 DataOffset; |
| 1120 | __le32 DataDisplacement; |
| 1121 | __u8 SetupCount; /* 0 */ |
| 1122 | __u16 ByteCount; |
| 1123 | /* __u8 Pad[3]; */ |
| 1124 | /* parms and data follow */ |
| 1125 | } __attribute__((packed)) NTRANSACT_RSP; |
| 1126 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1127 | typedef struct smb_com_transaction_ioctl_req { |
| 1128 | struct smb_hdr hdr; /* wct = 23 */ |
| 1129 | __u8 MaxSetupCount; |
| 1130 | __u16 Reserved; |
| 1131 | __le32 TotalParameterCount; |
| 1132 | __le32 TotalDataCount; |
| 1133 | __le32 MaxParameterCount; |
| 1134 | __le32 MaxDataCount; |
| 1135 | __le32 ParameterCount; |
| 1136 | __le32 ParameterOffset; |
| 1137 | __le32 DataCount; |
| 1138 | __le32 DataOffset; |
| 1139 | __u8 SetupCount; /* four setup words follow subcommand */ |
| 1140 | /* SNIA spec incorrectly included spurious pad here */ |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 1141 | __le16 SubCommand; /* 2 = IOCTL/FSCTL */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1142 | __le32 FunctionCode; |
| 1143 | __u16 Fid; |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 1144 | __u8 IsFsctl; /* 1 = File System Control 0 = device control (IOCTL) */ |
| 1145 | __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1146 | __le16 ByteCount; |
| 1147 | __u8 Pad[3]; |
| 1148 | __u8 Data[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1149 | } __attribute__((packed)) TRANSACT_IOCTL_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1150 | |
| 1151 | typedef struct smb_com_transaction_ioctl_rsp { |
| 1152 | struct smb_hdr hdr; /* wct = 19 */ |
| 1153 | __u8 Reserved[3]; |
| 1154 | __le32 TotalParameterCount; |
| 1155 | __le32 TotalDataCount; |
| 1156 | __le32 ParameterCount; |
| 1157 | __le32 ParameterOffset; |
| 1158 | __le32 ParameterDisplacement; |
| 1159 | __le32 DataCount; |
| 1160 | __le32 DataOffset; |
| 1161 | __le32 DataDisplacement; |
| 1162 | __u8 SetupCount; /* 1 */ |
| 1163 | __le16 ReturnedDataLen; |
| 1164 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1165 | } __attribute__((packed)) TRANSACT_IOCTL_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1166 | |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 1167 | #define CIFS_ACL_OWNER 1 |
| 1168 | #define CIFS_ACL_GROUP 2 |
| 1169 | #define CIFS_ACL_DACL 4 |
| 1170 | #define CIFS_ACL_SACL 8 |
| 1171 | |
| 1172 | typedef struct smb_com_transaction_qsec_req { |
| 1173 | struct smb_hdr hdr; /* wct = 19 */ |
| 1174 | __u8 MaxSetupCount; |
| 1175 | __u16 Reserved; |
| 1176 | __le32 TotalParameterCount; |
| 1177 | __le32 TotalDataCount; |
| 1178 | __le32 MaxParameterCount; |
| 1179 | __le32 MaxDataCount; |
| 1180 | __le32 ParameterCount; |
| 1181 | __le32 ParameterOffset; |
| 1182 | __le32 DataCount; |
| 1183 | __le32 DataOffset; |
| 1184 | __u8 SetupCount; /* no setup words follow subcommand */ |
| 1185 | /* SNIA spec incorrectly included spurious pad here */ |
| 1186 | __le16 SubCommand; /* 6 = QUERY_SECURITY_DESC */ |
| 1187 | __le16 ByteCount; /* bcc = 3 + 8 */ |
| 1188 | __u8 Pad[3]; |
| 1189 | __u16 Fid; |
| 1190 | __u16 Reserved2; |
| 1191 | __le32 AclFlags; |
| 1192 | } __attribute__((packed)) QUERY_SEC_DESC_REQ; |
| 1193 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1194 | typedef struct smb_com_transaction_change_notify_req { |
| 1195 | struct smb_hdr hdr; /* wct = 23 */ |
| 1196 | __u8 MaxSetupCount; |
| 1197 | __u16 Reserved; |
| 1198 | __le32 TotalParameterCount; |
| 1199 | __le32 TotalDataCount; |
| 1200 | __le32 MaxParameterCount; |
| 1201 | __le32 MaxDataCount; |
| 1202 | __le32 ParameterCount; |
| 1203 | __le32 ParameterOffset; |
| 1204 | __le32 DataCount; |
| 1205 | __le32 DataOffset; |
| 1206 | __u8 SetupCount; /* four setup words follow subcommand */ |
| 1207 | /* SNIA spec incorrectly included spurious pad here */ |
| 1208 | __le16 SubCommand;/* 4 = Change Notify */ |
| 1209 | __le32 CompletionFilter; /* operation to monitor */ |
| 1210 | __u16 Fid; |
| 1211 | __u8 WatchTree; /* 1 = Monitor subdirectories */ |
| 1212 | __u8 Reserved2; |
| 1213 | __le16 ByteCount; |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 1214 | /* __u8 Pad[3];*/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1215 | /* __u8 Data[1];*/ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1216 | } __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1217 | |
Steve French | 0a4b92c | 2006-01-12 15:44:21 -0800 | [diff] [blame] | 1218 | /* BB eventually change to use generic ntransact rsp struct |
| 1219 | and validation routine */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1220 | typedef struct smb_com_transaction_change_notify_rsp { |
| 1221 | struct smb_hdr hdr; /* wct = 18 */ |
| 1222 | __u8 Reserved[3]; |
| 1223 | __le32 TotalParameterCount; |
| 1224 | __le32 TotalDataCount; |
| 1225 | __le32 ParameterCount; |
| 1226 | __le32 ParameterOffset; |
| 1227 | __le32 ParameterDisplacement; |
| 1228 | __le32 DataCount; |
| 1229 | __le32 DataOffset; |
| 1230 | __le32 DataDisplacement; |
| 1231 | __u8 SetupCount; /* 0 */ |
| 1232 | __u16 ByteCount; |
| 1233 | /* __u8 Pad[3]; */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1234 | } __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1235 | /* Completion Filter flags for Notify */ |
| 1236 | #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 |
| 1237 | #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 |
| 1238 | #define FILE_NOTIFY_CHANGE_NAME 0x00000003 |
| 1239 | #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 |
| 1240 | #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 |
| 1241 | #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 |
| 1242 | #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 |
| 1243 | #define FILE_NOTIFY_CHANGE_CREATION 0x00000040 |
| 1244 | #define FILE_NOTIFY_CHANGE_EA 0x00000080 |
| 1245 | #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 |
| 1246 | #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 |
| 1247 | #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 |
| 1248 | #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 |
| 1249 | |
| 1250 | #define FILE_ACTION_ADDED 0x00000001 |
| 1251 | #define FILE_ACTION_REMOVED 0x00000002 |
| 1252 | #define FILE_ACTION_MODIFIED 0x00000003 |
| 1253 | #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 |
| 1254 | #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 |
| 1255 | #define FILE_ACTION_ADDED_STREAM 0x00000006 |
| 1256 | #define FILE_ACTION_REMOVED_STREAM 0x00000007 |
| 1257 | #define FILE_ACTION_MODIFIED_STREAM 0x00000008 |
| 1258 | |
| 1259 | /* response contains array of the following structures */ |
| 1260 | struct file_notify_information { |
| 1261 | __le32 NextEntryOffset; |
| 1262 | __le32 Action; |
| 1263 | __le32 FileNameLength; |
| 1264 | __u8 FileName[0]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1265 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1266 | |
| 1267 | struct reparse_data { |
| 1268 | __u32 ReparseTag; |
| 1269 | __u16 ReparseDataLength; |
| 1270 | __u16 Reserved; |
| 1271 | __u16 AltNameOffset; |
| 1272 | __u16 AltNameLen; |
| 1273 | __u16 TargetNameOffset; |
| 1274 | __u16 TargetNameLen; |
| 1275 | char LinkNamesBuf[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1276 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1277 | |
| 1278 | struct cifs_quota_data { |
| 1279 | __u32 rsrvd1; /* 0 */ |
| 1280 | __u32 sid_size; |
| 1281 | __u64 rsrvd2; /* 0 */ |
| 1282 | __u64 space_used; |
| 1283 | __u64 soft_limit; |
| 1284 | __u64 hard_limit; |
| 1285 | char sid[1]; /* variable size? */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1286 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1287 | |
| 1288 | /* quota sub commands */ |
| 1289 | #define QUOTA_LIST_CONTINUE 0 |
| 1290 | #define QUOTA_LIST_START 0x100 |
| 1291 | #define QUOTA_FOR_SID 0x101 |
| 1292 | |
| 1293 | struct trans2_req { |
| 1294 | /* struct smb_hdr hdr precedes. Set wct = 14+ */ |
| 1295 | __le16 TotalParameterCount; |
| 1296 | __le16 TotalDataCount; |
| 1297 | __le16 MaxParameterCount; |
| 1298 | __le16 MaxDataCount; |
| 1299 | __u8 MaxSetupCount; |
| 1300 | __u8 Reserved; |
| 1301 | __le16 Flags; |
| 1302 | __le32 Timeout; |
| 1303 | __u16 Reserved2; |
| 1304 | __le16 ParameterCount; |
| 1305 | __le16 ParameterOffset; |
| 1306 | __le16 DataCount; |
| 1307 | __le16 DataOffset; |
| 1308 | __u8 SetupCount; |
| 1309 | __u8 Reserved3; |
| 1310 | __le16 SubCommand; /* 1st setup word - SetupCount words follow */ |
| 1311 | __le16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1312 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1313 | |
| 1314 | struct smb_t2_req { |
| 1315 | struct smb_hdr hdr; |
| 1316 | struct trans2_req t2_req; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1317 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1318 | |
| 1319 | struct trans2_resp { |
| 1320 | /* struct smb_hdr hdr precedes. Note wct = 10 + setup count */ |
| 1321 | __le16 TotalParameterCount; |
| 1322 | __le16 TotalDataCount; |
| 1323 | __u16 Reserved; |
| 1324 | __le16 ParameterCount; |
| 1325 | __le16 ParameterOffset; |
| 1326 | __le16 ParameterDisplacement; |
| 1327 | __le16 DataCount; |
| 1328 | __le16 DataOffset; |
| 1329 | __le16 DataDisplacement; |
| 1330 | __u8 SetupCount; |
| 1331 | __u8 Reserved1; |
| 1332 | /* SetupWords[SetupCount]; |
| 1333 | __u16 ByteCount; |
| 1334 | __u16 Reserved2;*/ |
| 1335 | /* data area follows */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1336 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1337 | |
| 1338 | struct smb_t2_rsp { |
| 1339 | struct smb_hdr hdr; |
| 1340 | struct trans2_resp t2_rsp; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1341 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1342 | |
| 1343 | /* PathInfo/FileInfo infolevels */ |
| 1344 | #define SMB_INFO_STANDARD 1 |
| 1345 | #define SMB_SET_FILE_EA 2 |
| 1346 | #define SMB_QUERY_FILE_EA_SIZE 2 |
| 1347 | #define SMB_INFO_QUERY_EAS_FROM_LIST 3 |
| 1348 | #define SMB_INFO_QUERY_ALL_EAS 4 |
| 1349 | #define SMB_INFO_IS_NAME_VALID 6 |
| 1350 | #define SMB_QUERY_FILE_BASIC_INFO 0x101 |
| 1351 | #define SMB_QUERY_FILE_STANDARD_INFO 0x102 |
| 1352 | #define SMB_QUERY_FILE_EA_INFO 0x103 |
| 1353 | #define SMB_QUERY_FILE_NAME_INFO 0x104 |
| 1354 | #define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 |
| 1355 | #define SMB_QUERY_FILE_END_OF_FILEINFO 0x106 |
| 1356 | #define SMB_QUERY_FILE_ALL_INFO 0x107 |
| 1357 | #define SMB_QUERY_ALT_NAME_INFO 0x108 |
| 1358 | #define SMB_QUERY_FILE_STREAM_INFO 0x109 |
| 1359 | #define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B |
| 1360 | #define SMB_QUERY_FILE_UNIX_BASIC 0x200 |
| 1361 | #define SMB_QUERY_FILE_UNIX_LINK 0x201 |
| 1362 | #define SMB_QUERY_POSIX_ACL 0x204 |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1363 | #define SMB_QUERY_XATTR 0x205 /* e.g. system EA name space */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1364 | #define SMB_QUERY_ATTR_FLAGS 0x206 /* append,immutable etc. */ |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 1365 | #define SMB_QUERY_POSIX_PERMISSION 0x207 |
| 1366 | #define SMB_QUERY_POSIX_LOCK 0x208 |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1367 | /* #define SMB_POSIX_OPEN 0x209 */ |
| 1368 | /* #define SMB_POSIX_UNLINK 0x20a */ |
| 1369 | #define SMB_QUERY_FILE__UNIX_INFO2 0x20b |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1370 | #define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee |
| 1371 | #define SMB_QUERY_FILE_ACCESS_INFO 0x3f0 |
| 1372 | #define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */ |
| 1373 | #define SMB_QUERY_FILE_POSITION_INFO 0x3f6 |
| 1374 | #define SMB_QUERY_FILE_MODE_INFO 0x3f8 |
| 1375 | #define SMB_QUERY_FILE_ALGN_INFO 0x3f9 |
| 1376 | |
| 1377 | |
| 1378 | #define SMB_SET_FILE_BASIC_INFO 0x101 |
| 1379 | #define SMB_SET_FILE_DISPOSITION_INFO 0x102 |
| 1380 | #define SMB_SET_FILE_ALLOCATION_INFO 0x103 |
| 1381 | #define SMB_SET_FILE_END_OF_FILE_INFO 0x104 |
| 1382 | #define SMB_SET_FILE_UNIX_BASIC 0x200 |
| 1383 | #define SMB_SET_FILE_UNIX_LINK 0x201 |
| 1384 | #define SMB_SET_FILE_UNIX_HLINK 0x203 |
| 1385 | #define SMB_SET_POSIX_ACL 0x204 |
| 1386 | #define SMB_SET_XATTR 0x205 |
| 1387 | #define SMB_SET_ATTR_FLAGS 0x206 /* append, immutable etc. */ |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 1388 | #define SMB_SET_POSIX_LOCK 0x208 |
Steve French | 2fe87f0 | 2006-09-21 07:02:52 +0000 | [diff] [blame] | 1389 | #define SMB_POSIX_OPEN 0x209 |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1390 | #define SMB_POSIX_UNLINK 0x20a |
| 1391 | #define SMB_SET_FILE_UNIX_INFO2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1392 | #define SMB_SET_FILE_BASIC_INFO2 0x3ec |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1393 | #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 /* BB check if qpathinfo too */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1394 | #define SMB_FILE_ALL_INFO2 0x3fa |
| 1395 | #define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb |
| 1396 | #define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc |
| 1397 | #define SMB_FILE_MOVE_CLUSTER_INFO 0x407 |
| 1398 | #define SMB_FILE_QUOTA_INFO 0x408 |
| 1399 | #define SMB_FILE_REPARSEPOINT_INFO 0x409 |
| 1400 | #define SMB_FILE_MAXIMUM_INFO 0x40d |
| 1401 | |
| 1402 | /* Find File infolevels */ |
Steve French | 5bafd76 | 2006-06-07 00:18:43 +0000 | [diff] [blame] | 1403 | #define SMB_FIND_FILE_INFO_STANDARD 0x001 |
| 1404 | #define SMB_FIND_FILE_QUERY_EA_SIZE 0x002 |
| 1405 | #define SMB_FIND_FILE_QUERY_EAS_FROM_LIST 0x003 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1406 | #define SMB_FIND_FILE_DIRECTORY_INFO 0x101 |
| 1407 | #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 |
| 1408 | #define SMB_FIND_FILE_NAMES_INFO 0x103 |
| 1409 | #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 |
| 1410 | #define SMB_FIND_FILE_ID_FULL_DIR_INFO 0x105 |
| 1411 | #define SMB_FIND_FILE_ID_BOTH_DIR_INFO 0x106 |
| 1412 | #define SMB_FIND_FILE_UNIX 0x202 |
| 1413 | |
| 1414 | typedef struct smb_com_transaction2_qpi_req { |
| 1415 | struct smb_hdr hdr; /* wct = 14+ */ |
| 1416 | __le16 TotalParameterCount; |
| 1417 | __le16 TotalDataCount; |
| 1418 | __le16 MaxParameterCount; |
| 1419 | __le16 MaxDataCount; |
| 1420 | __u8 MaxSetupCount; |
| 1421 | __u8 Reserved; |
| 1422 | __le16 Flags; |
| 1423 | __le32 Timeout; |
| 1424 | __u16 Reserved2; |
| 1425 | __le16 ParameterCount; |
| 1426 | __le16 ParameterOffset; |
| 1427 | __le16 DataCount; |
| 1428 | __le16 DataOffset; |
| 1429 | __u8 SetupCount; |
| 1430 | __u8 Reserved3; |
| 1431 | __le16 SubCommand; /* one setup word */ |
| 1432 | __le16 ByteCount; |
| 1433 | __u8 Pad; |
| 1434 | __le16 InformationLevel; |
| 1435 | __u32 Reserved4; |
| 1436 | char FileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1437 | } __attribute__((packed)) TRANSACTION2_QPI_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1438 | |
| 1439 | typedef struct smb_com_transaction2_qpi_rsp { |
| 1440 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
| 1441 | struct trans2_resp t2; |
| 1442 | __u16 ByteCount; |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1443 | __u16 Reserved2; /* parameter word is present for infolevels > 100 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1444 | } __attribute__((packed)) TRANSACTION2_QPI_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1445 | |
| 1446 | typedef struct smb_com_transaction2_spi_req { |
| 1447 | struct smb_hdr hdr; /* wct = 15 */ |
| 1448 | __le16 TotalParameterCount; |
| 1449 | __le16 TotalDataCount; |
| 1450 | __le16 MaxParameterCount; |
| 1451 | __le16 MaxDataCount; |
| 1452 | __u8 MaxSetupCount; |
| 1453 | __u8 Reserved; |
| 1454 | __le16 Flags; |
| 1455 | __le32 Timeout; |
| 1456 | __u16 Reserved2; |
| 1457 | __le16 ParameterCount; |
| 1458 | __le16 ParameterOffset; |
| 1459 | __le16 DataCount; |
| 1460 | __le16 DataOffset; |
| 1461 | __u8 SetupCount; |
| 1462 | __u8 Reserved3; |
| 1463 | __le16 SubCommand; /* one setup word */ |
| 1464 | __le16 ByteCount; |
| 1465 | __u8 Pad; |
| 1466 | __u16 Pad1; |
| 1467 | __le16 InformationLevel; |
| 1468 | __u32 Reserved4; |
| 1469 | char FileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1470 | } __attribute__((packed)) TRANSACTION2_SPI_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1471 | |
| 1472 | typedef struct smb_com_transaction2_spi_rsp { |
| 1473 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
| 1474 | struct trans2_resp t2; |
| 1475 | __u16 ByteCount; |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1476 | __u16 Reserved2; /* parameter word is present for infolevels > 100 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1477 | } __attribute__((packed)) TRANSACTION2_SPI_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1478 | |
| 1479 | struct set_file_rename { |
| 1480 | __le32 overwrite; /* 1 = overwrite dest */ |
| 1481 | __u32 root_fid; /* zero */ |
| 1482 | __le32 target_name_len; |
| 1483 | char target_name[0]; /* Must be unicode */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1484 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1485 | |
| 1486 | struct smb_com_transaction2_sfi_req { |
| 1487 | struct smb_hdr hdr; /* wct = 15 */ |
| 1488 | __le16 TotalParameterCount; |
| 1489 | __le16 TotalDataCount; |
| 1490 | __le16 MaxParameterCount; |
| 1491 | __le16 MaxDataCount; |
| 1492 | __u8 MaxSetupCount; |
| 1493 | __u8 Reserved; |
| 1494 | __le16 Flags; |
| 1495 | __le32 Timeout; |
| 1496 | __u16 Reserved2; |
| 1497 | __le16 ParameterCount; |
| 1498 | __le16 ParameterOffset; |
| 1499 | __le16 DataCount; |
| 1500 | __le16 DataOffset; |
| 1501 | __u8 SetupCount; |
| 1502 | __u8 Reserved3; |
| 1503 | __le16 SubCommand; /* one setup word */ |
| 1504 | __le16 ByteCount; |
| 1505 | __u8 Pad; |
| 1506 | __u16 Pad1; |
| 1507 | __u16 Fid; |
| 1508 | __le16 InformationLevel; |
| 1509 | __u16 Reserved4; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1510 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1511 | |
| 1512 | struct smb_com_transaction2_sfi_rsp { |
| 1513 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
| 1514 | struct trans2_resp t2; |
| 1515 | __u16 ByteCount; |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 1516 | __u16 Reserved2; /* parameter word reserved - |
| 1517 | present for infolevels > 100 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1518 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1519 | |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 1520 | struct smb_t2_qfi_req { |
| 1521 | struct smb_hdr hdr; |
| 1522 | struct trans2_req t2; |
| 1523 | __u8 Pad; |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 1524 | __u16 Fid; |
| 1525 | __le16 InformationLevel; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1526 | } __attribute__((packed)); |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 1527 | |
| 1528 | struct smb_t2_qfi_rsp { |
| 1529 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
| 1530 | struct trans2_resp t2; |
| 1531 | __u16 ByteCount; |
| 1532 | __u16 Reserved2; /* parameter word reserved - |
| 1533 | present for infolevels > 100 */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1534 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1535 | |
| 1536 | /* |
| 1537 | * Flags on T2 FINDFIRST and FINDNEXT |
| 1538 | */ |
| 1539 | #define CIFS_SEARCH_CLOSE_ALWAYS 0x0001 |
| 1540 | #define CIFS_SEARCH_CLOSE_AT_END 0x0002 |
| 1541 | #define CIFS_SEARCH_RETURN_RESUME 0x0004 |
| 1542 | #define CIFS_SEARCH_CONTINUE_FROM_LAST 0x0008 |
| 1543 | #define CIFS_SEARCH_BACKUP_SEARCH 0x0010 |
| 1544 | |
| 1545 | /* |
| 1546 | * Size of the resume key on FINDFIRST and FINDNEXT calls |
| 1547 | */ |
| 1548 | #define CIFS_SMB_RESUME_KEY_SIZE 4 |
| 1549 | |
| 1550 | typedef struct smb_com_transaction2_ffirst_req { |
| 1551 | struct smb_hdr hdr; /* wct = 15 */ |
| 1552 | __le16 TotalParameterCount; |
| 1553 | __le16 TotalDataCount; |
| 1554 | __le16 MaxParameterCount; |
| 1555 | __le16 MaxDataCount; |
| 1556 | __u8 MaxSetupCount; |
| 1557 | __u8 Reserved; |
| 1558 | __le16 Flags; |
| 1559 | __le32 Timeout; |
| 1560 | __u16 Reserved2; |
| 1561 | __le16 ParameterCount; |
| 1562 | __le16 ParameterOffset; |
| 1563 | __le16 DataCount; |
| 1564 | __le16 DataOffset; |
| 1565 | __u8 SetupCount; /* one */ |
| 1566 | __u8 Reserved3; |
| 1567 | __le16 SubCommand; /* TRANS2_FIND_FIRST */ |
| 1568 | __le16 ByteCount; |
| 1569 | __u8 Pad; |
| 1570 | __le16 SearchAttributes; |
| 1571 | __le16 SearchCount; |
| 1572 | __le16 SearchFlags; |
| 1573 | __le16 InformationLevel; |
| 1574 | __le32 SearchStorageType; |
| 1575 | char FileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1576 | } __attribute__((packed)) TRANSACTION2_FFIRST_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1577 | |
| 1578 | typedef struct smb_com_transaction2_ffirst_rsp { |
| 1579 | struct smb_hdr hdr; /* wct = 10 */ |
| 1580 | struct trans2_resp t2; |
| 1581 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1582 | } __attribute__((packed)) TRANSACTION2_FFIRST_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1583 | |
| 1584 | typedef struct smb_com_transaction2_ffirst_rsp_parms { |
| 1585 | __u16 SearchHandle; |
| 1586 | __le16 SearchCount; |
| 1587 | __le16 EndofSearch; |
| 1588 | __le16 EAErrorOffset; |
| 1589 | __le16 LastNameOffset; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1590 | } __attribute__((packed)) T2_FFIRST_RSP_PARMS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1591 | |
| 1592 | typedef struct smb_com_transaction2_fnext_req { |
| 1593 | struct smb_hdr hdr; /* wct = 15 */ |
| 1594 | __le16 TotalParameterCount; |
| 1595 | __le16 TotalDataCount; |
| 1596 | __le16 MaxParameterCount; |
| 1597 | __le16 MaxDataCount; |
| 1598 | __u8 MaxSetupCount; |
| 1599 | __u8 Reserved; |
| 1600 | __le16 Flags; |
| 1601 | __le32 Timeout; |
| 1602 | __u16 Reserved2; |
| 1603 | __le16 ParameterCount; |
| 1604 | __le16 ParameterOffset; |
| 1605 | __le16 DataCount; |
| 1606 | __le16 DataOffset; |
| 1607 | __u8 SetupCount; /* one */ |
| 1608 | __u8 Reserved3; |
| 1609 | __le16 SubCommand; /* TRANS2_FIND_NEXT */ |
| 1610 | __le16 ByteCount; |
| 1611 | __u8 Pad; |
| 1612 | __u16 SearchHandle; |
| 1613 | __le16 SearchCount; |
| 1614 | __le16 InformationLevel; |
| 1615 | __u32 ResumeKey; |
| 1616 | __le16 SearchFlags; |
| 1617 | char ResumeFileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1618 | } __attribute__((packed)) TRANSACTION2_FNEXT_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1619 | |
| 1620 | typedef struct smb_com_transaction2_fnext_rsp { |
| 1621 | struct smb_hdr hdr; /* wct = 10 */ |
| 1622 | struct trans2_resp t2; |
| 1623 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1624 | } __attribute__((packed)) TRANSACTION2_FNEXT_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1625 | |
| 1626 | typedef struct smb_com_transaction2_fnext_rsp_parms { |
| 1627 | __le16 SearchCount; |
| 1628 | __le16 EndofSearch; |
| 1629 | __le16 EAErrorOffset; |
| 1630 | __le16 LastNameOffset; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1631 | } __attribute__((packed)) T2_FNEXT_RSP_PARMS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1632 | |
| 1633 | /* QFSInfo Levels */ |
| 1634 | #define SMB_INFO_ALLOCATION 1 |
| 1635 | #define SMB_INFO_VOLUME 2 |
| 1636 | #define SMB_QUERY_FS_VOLUME_INFO 0x102 |
| 1637 | #define SMB_QUERY_FS_SIZE_INFO 0x103 |
| 1638 | #define SMB_QUERY_FS_DEVICE_INFO 0x104 |
| 1639 | #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 |
| 1640 | #define SMB_QUERY_CIFS_UNIX_INFO 0x200 |
| 1641 | #define SMB_QUERY_POSIX_FS_INFO 0x201 |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1642 | #define SMB_QUERY_POSIX_WHO_AM_I 0x202 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1643 | #define SMB_QUERY_LABEL_INFO 0x3ea |
| 1644 | #define SMB_QUERY_FS_QUOTA_INFO 0x3ee |
| 1645 | #define SMB_QUERY_FS_FULL_SIZE_INFO 0x3ef |
| 1646 | #define SMB_QUERY_OBJECTID_INFO 0x3f0 |
| 1647 | |
| 1648 | typedef struct smb_com_transaction2_qfsi_req { |
| 1649 | struct smb_hdr hdr; /* wct = 14+ */ |
| 1650 | __le16 TotalParameterCount; |
| 1651 | __le16 TotalDataCount; |
| 1652 | __le16 MaxParameterCount; |
| 1653 | __le16 MaxDataCount; |
| 1654 | __u8 MaxSetupCount; |
| 1655 | __u8 Reserved; |
| 1656 | __le16 Flags; |
| 1657 | __le32 Timeout; |
| 1658 | __u16 Reserved2; |
| 1659 | __le16 ParameterCount; |
| 1660 | __le16 ParameterOffset; |
| 1661 | __le16 DataCount; |
| 1662 | __le16 DataOffset; |
| 1663 | __u8 SetupCount; |
| 1664 | __u8 Reserved3; |
| 1665 | __le16 SubCommand; /* one setup word */ |
| 1666 | __le16 ByteCount; |
| 1667 | __u8 Pad; |
| 1668 | __le16 InformationLevel; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1669 | } __attribute__((packed)) TRANSACTION2_QFSI_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1670 | |
| 1671 | typedef struct smb_com_transaction_qfsi_rsp { |
| 1672 | struct smb_hdr hdr; /* wct = 10 + SetupCount */ |
| 1673 | struct trans2_resp t2; |
| 1674 | __u16 ByteCount; |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1675 | __u8 Pad; /* may be three bytes? *//* followed by data area */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1676 | } __attribute__((packed)) TRANSACTION2_QFSI_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1677 | |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1678 | typedef struct whoami_rsp_data { /* Query level 0x202 */ |
| 1679 | __u32 flags; /* 0 = Authenticated user 1 = GUEST */ |
| 1680 | __u32 mask; /* which flags bits server understands ie 0x0001 */ |
| 1681 | __u64 unix_user_id; |
| 1682 | __u64 unix_user_gid; |
| 1683 | __u32 number_of_supplementary_gids; /* may be zero */ |
| 1684 | __u32 number_of_sids; /* may be zero */ |
| 1685 | __u32 length_of_sid_array; /* in bytes - may be zero */ |
| 1686 | __u32 pad; /* reserved - MBZ */ |
| 1687 | /* __u64 gid_array[0]; */ /* may be empty */ |
| 1688 | /* __u8 * psid_list */ /* may be empty */ |
| 1689 | } __attribute__((packed)) WHOAMI_RSP_DATA; |
Jeremy Allison | ac67055 | 2005-06-22 17:26:35 -0700 | [diff] [blame] | 1690 | |
| 1691 | /* SETFSInfo Levels */ |
| 1692 | #define SMB_SET_CIFS_UNIX_INFO 0x200 |
| 1693 | typedef struct smb_com_transaction2_setfsi_req { |
| 1694 | struct smb_hdr hdr; /* wct = 15 */ |
| 1695 | __le16 TotalParameterCount; |
| 1696 | __le16 TotalDataCount; |
| 1697 | __le16 MaxParameterCount; |
| 1698 | __le16 MaxDataCount; |
| 1699 | __u8 MaxSetupCount; |
| 1700 | __u8 Reserved; |
| 1701 | __le16 Flags; |
| 1702 | __le32 Timeout; |
| 1703 | __u16 Reserved2; |
| 1704 | __le16 ParameterCount; /* 4 */ |
| 1705 | __le16 ParameterOffset; |
| 1706 | __le16 DataCount; /* 12 */ |
| 1707 | __le16 DataOffset; |
| 1708 | __u8 SetupCount; /* one */ |
| 1709 | __u8 Reserved3; |
| 1710 | __le16 SubCommand; /* TRANS2_SET_FS_INFORMATION */ |
| 1711 | __le16 ByteCount; |
| 1712 | __u8 Pad; |
| 1713 | __u16 FileNum; /* Parameters start. */ |
| 1714 | __le16 InformationLevel;/* Parameters end. */ |
| 1715 | __le16 ClientUnixMajor; /* Data start. */ |
| 1716 | __le16 ClientUnixMinor; |
| 1717 | __le64 ClientUnixCap; /* Data end */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1718 | } __attribute__((packed)) TRANSACTION2_SETFSI_REQ; |
Jeremy Allison | ac67055 | 2005-06-22 17:26:35 -0700 | [diff] [blame] | 1719 | |
| 1720 | typedef struct smb_com_transaction2_setfsi_rsp { |
| 1721 | struct smb_hdr hdr; /* wct = 10 */ |
| 1722 | struct trans2_resp t2; |
| 1723 | __u16 ByteCount; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1724 | } __attribute__((packed)) TRANSACTION2_SETFSI_RSP; |
Jeremy Allison | ac67055 | 2005-06-22 17:26:35 -0700 | [diff] [blame] | 1725 | |
| 1726 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1727 | typedef struct smb_com_transaction2_get_dfs_refer_req { |
| 1728 | struct smb_hdr hdr; /* wct = 15 */ |
| 1729 | __le16 TotalParameterCount; |
| 1730 | __le16 TotalDataCount; |
| 1731 | __le16 MaxParameterCount; |
| 1732 | __le16 MaxDataCount; |
| 1733 | __u8 MaxSetupCount; |
| 1734 | __u8 Reserved; |
| 1735 | __le16 Flags; |
| 1736 | __le32 Timeout; |
| 1737 | __u16 Reserved2; |
| 1738 | __le16 ParameterCount; |
| 1739 | __le16 ParameterOffset; |
| 1740 | __le16 DataCount; |
| 1741 | __le16 DataOffset; |
| 1742 | __u8 SetupCount; |
| 1743 | __u8 Reserved3; |
| 1744 | __le16 SubCommand; /* one setup word */ |
| 1745 | __le16 ByteCount; |
| 1746 | __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ |
| 1747 | __le16 MaxReferralLevel; |
| 1748 | char RequestFileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1749 | } __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1750 | |
| 1751 | typedef struct dfs_referral_level_3 { |
| 1752 | __le16 VersionNumber; |
| 1753 | __le16 ReferralSize; |
| 1754 | __le16 ServerType; /* 0x0001 = CIFS server */ |
| 1755 | __le16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ |
| 1756 | __le16 TimeToLive; |
| 1757 | __le16 Proximity; |
| 1758 | __le16 DfsPathOffset; |
| 1759 | __le16 DfsAlternatePathOffset; |
| 1760 | __le16 NetworkAddressOffset; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1761 | } __attribute__((packed)) REFERRAL3; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1762 | |
| 1763 | typedef struct smb_com_transaction_get_dfs_refer_rsp { |
| 1764 | struct smb_hdr hdr; /* wct = 10 */ |
| 1765 | struct trans2_resp t2; |
| 1766 | __u16 ByteCount; |
| 1767 | __u8 Pad; |
| 1768 | __le16 PathConsumed; |
| 1769 | __le16 NumberOfReferrals; |
| 1770 | __le16 DFSFlags; |
| 1771 | __u16 Pad2; |
| 1772 | REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ |
| 1773 | /* followed by the strings pointed to by the referral structures */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1774 | } __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_RSP; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1775 | |
| 1776 | /* DFS Flags */ |
| 1777 | #define DFSREF_REFERRAL_SERVER 0x0001 |
| 1778 | #define DFSREF_STORAGE_SERVER 0x0002 |
| 1779 | |
| 1780 | /* IOCTL information */ |
| 1781 | /* List of ioctl function codes that look to be of interest to remote clients like this. */ |
| 1782 | /* Need to do some experimentation to make sure they all work remotely. */ |
| 1783 | /* Some of the following such as the encryption/compression ones would be */ |
| 1784 | /* invoked from tools via a specialized hook into the VFS rather than via the */ |
| 1785 | /* standard vfs entry points */ |
| 1786 | #define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 |
| 1787 | #define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 |
| 1788 | #define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 |
| 1789 | #define FSCTL_LOCK_VOLUME 0x00090018 |
| 1790 | #define FSCTL_UNLOCK_VOLUME 0x0009001C |
| 1791 | #define FSCTL_GET_COMPRESSION 0x0009003C |
| 1792 | #define FSCTL_SET_COMPRESSION 0x0009C040 |
| 1793 | #define FSCTL_REQUEST_FILTER_OPLOCK 0x0009008C |
| 1794 | #define FSCTL_FILESYS_GET_STATISTICS 0x00090090 |
| 1795 | #define FSCTL_SET_REPARSE_POINT 0x000900A4 |
| 1796 | #define FSCTL_GET_REPARSE_POINT 0x000900A8 |
| 1797 | #define FSCTL_DELETE_REPARSE_POINT 0x000900AC |
| 1798 | #define FSCTL_SET_SPARSE 0x000900C4 |
| 1799 | #define FSCTL_SET_ZERO_DATA 0x000900C8 |
| 1800 | #define FSCTL_SET_ENCRYPTION 0x000900D7 |
| 1801 | #define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB |
| 1802 | #define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF |
| 1803 | #define FSCTL_READ_RAW_ENCRYPTED 0x000900E3 |
| 1804 | #define FSCTL_SIS_COPYFILE 0x00090100 |
| 1805 | #define FSCTL_SIS_LINK_FILES 0x0009C104 |
| 1806 | |
| 1807 | #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 |
| 1808 | #define IO_REPARSE_TAG_HSM 0xC0000004 |
| 1809 | #define IO_REPARSE_TAG_SIS 0x80000007 |
| 1810 | |
| 1811 | /* |
| 1812 | ************************************************************************ |
| 1813 | * All structs for everything above the SMB PDUs themselves |
| 1814 | * (such as the T2 level specific data) go here |
| 1815 | ************************************************************************ |
| 1816 | */ |
| 1817 | |
| 1818 | /* |
| 1819 | * Information on a server |
| 1820 | */ |
| 1821 | |
| 1822 | struct serverInfo { |
| 1823 | char name[16]; |
| 1824 | unsigned char versionMajor; |
| 1825 | unsigned char versionMinor; |
| 1826 | unsigned long type; |
| 1827 | unsigned int commentOffset; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1828 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1829 | |
| 1830 | /* |
| 1831 | * The following structure is the format of the data returned on a NetShareEnum |
| 1832 | * with level "90" (x5A) |
| 1833 | */ |
| 1834 | |
| 1835 | struct shareInfo { |
| 1836 | char shareName[13]; |
| 1837 | char pad; |
| 1838 | unsigned short type; |
| 1839 | unsigned int commentOffset; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1840 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1841 | |
| 1842 | struct aliasInfo { |
| 1843 | char aliasName[9]; |
| 1844 | char pad; |
| 1845 | unsigned int commentOffset; |
| 1846 | unsigned char type[2]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1847 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1848 | |
| 1849 | struct aliasInfo92 { |
| 1850 | int aliasNameOffset; |
| 1851 | int serverNameOffset; |
| 1852 | int shareNameOffset; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1853 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1854 | |
| 1855 | typedef struct { |
| 1856 | __le64 TotalAllocationUnits; |
| 1857 | __le64 FreeAllocationUnits; |
| 1858 | __le32 SectorsPerAllocationUnit; |
| 1859 | __le32 BytesPerSector; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1860 | } __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1861 | |
| 1862 | typedef struct { |
Steve French | 2096243 | 2005-09-21 22:05:57 -0700 | [diff] [blame] | 1863 | __le32 fsid; |
| 1864 | __le32 SectorsPerAllocationUnit; |
| 1865 | __le32 TotalAllocationUnits; |
| 1866 | __le32 FreeAllocationUnits; |
| 1867 | __le16 BytesPerSector; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1868 | } __attribute__((packed)) FILE_SYSTEM_ALLOC_INFO; |
Steve French | 2096243 | 2005-09-21 22:05:57 -0700 | [diff] [blame] | 1869 | |
| 1870 | typedef struct { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1871 | __le16 MajorVersionNumber; |
| 1872 | __le16 MinorVersionNumber; |
| 1873 | __le64 Capability; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1874 | } __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ |
Jeremy Allison | ac67055 | 2005-06-22 17:26:35 -0700 | [diff] [blame] | 1875 | |
| 1876 | /* Version numbers for CIFS UNIX major and minor. */ |
| 1877 | #define CIFS_UNIX_MAJOR_VERSION 1 |
| 1878 | #define CIFS_UNIX_MINOR_VERSION 0 |
| 1879 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1880 | /* Linux/Unix extensions capability flags */ |
| 1881 | #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 1882 | #define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */ |
| 1883 | #define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ |
| 1884 | #define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ |
Steve French | 82940a4 | 2006-03-02 03:24:57 +0000 | [diff] [blame] | 1885 | #define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Allow POSIX path chars */ |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1886 | #define CIFS_UNIX_POSIX_PATH_OPS_CAP 0x00000020 /* Allow new POSIX path based |
| 1887 | calls including posix open |
| 1888 | and posix unlink */ |
Steve French | 82940a4 | 2006-03-02 03:24:57 +0000 | [diff] [blame] | 1889 | #ifdef CONFIG_CIFS_POSIX |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1890 | #define CIFS_UNIX_CAP_MASK 0x0000003b |
Steve French | 82940a4 | 2006-03-02 03:24:57 +0000 | [diff] [blame] | 1891 | #else |
| 1892 | #define CIFS_UNIX_CAP_MASK 0x00000013 |
| 1893 | #endif /* CONFIG_CIFS_POSIX */ |
| 1894 | |
Jeremy Allison | ac67055 | 2005-06-22 17:26:35 -0700 | [diff] [blame] | 1895 | |
Steve French | f28ac91 | 2005-04-28 22:41:07 -0700 | [diff] [blame] | 1896 | #define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */ |
Jeremy Allison | ac67055 | 2005-06-22 17:26:35 -0700 | [diff] [blame] | 1897 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1898 | typedef struct { |
| 1899 | /* For undefined recommended transfer size return -1 in that field */ |
| 1900 | __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ |
| 1901 | __le32 BlockSize; |
| 1902 | /* The next three fields are in terms of the block size. |
| 1903 | (above). If block size is unknown, 4096 would be a |
| 1904 | reasonable block size for a server to report. |
| 1905 | Note that returning the blocks/blocksavail removes need |
| 1906 | to make a second call (to QFSInfo level 0x103 to get this info. |
| 1907 | UserBlockAvail is typically less than or equal to BlocksAvail, |
| 1908 | if no distinction is made return the same value in each */ |
| 1909 | __le64 TotalBlocks; |
| 1910 | __le64 BlocksAvail; /* bfree */ |
| 1911 | __le64 UserBlocksAvail; /* bavail */ |
| 1912 | /* For undefined Node fields or FSID return -1 */ |
| 1913 | __le64 TotalFileNodes; |
| 1914 | __le64 FreeFileNodes; |
| 1915 | __le64 FileSysIdentifier; /* fsid */ |
| 1916 | /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */ |
| 1917 | /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1918 | } __attribute__((packed)) FILE_SYSTEM_POSIX_INFO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1919 | |
| 1920 | /* DeviceType Flags */ |
| 1921 | #define FILE_DEVICE_CD_ROM 0x00000002 |
| 1922 | #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003 |
| 1923 | #define FILE_DEVICE_DFS 0x00000006 |
| 1924 | #define FILE_DEVICE_DISK 0x00000007 |
| 1925 | #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008 |
| 1926 | #define FILE_DEVICE_FILE_SYSTEM 0x00000009 |
| 1927 | #define FILE_DEVICE_NAMED_PIPE 0x00000011 |
| 1928 | #define FILE_DEVICE_NETWORK 0x00000012 |
| 1929 | #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014 |
| 1930 | #define FILE_DEVICE_NULL 0x00000015 |
| 1931 | #define FILE_DEVICE_PARALLEL_PORT 0x00000016 |
| 1932 | #define FILE_DEVICE_PRINTER 0x00000018 |
| 1933 | #define FILE_DEVICE_SERIAL_PORT 0x0000001b |
| 1934 | #define FILE_DEVICE_STREAMS 0x0000001e |
| 1935 | #define FILE_DEVICE_TAPE 0x0000001f |
| 1936 | #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020 |
| 1937 | #define FILE_DEVICE_VIRTUAL_DISK 0x00000024 |
| 1938 | #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 |
| 1939 | |
| 1940 | typedef struct { |
| 1941 | __le32 DeviceType; |
| 1942 | __le32 DeviceCharacteristics; |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 1943 | } __attribute__((packed)) FILE_SYSTEM_DEVICE_INFO; /* device info level 0x104 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1944 | |
| 1945 | typedef struct { |
| 1946 | __le32 Attributes; |
| 1947 | __le32 MaxPathNameComponentLength; |
| 1948 | __le32 FileSystemNameLen; |
Steve French | 3979877 | 2006-05-31 22:40:51 +0000 | [diff] [blame] | 1949 | char FileSystemName[52]; /* do not have to save this - get subset? */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 1950 | } __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1951 | |
| 1952 | /******************************************************************************/ |
| 1953 | /* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */ |
| 1954 | /******************************************************************************/ |
| 1955 | typedef struct { /* data block encoding of response to level 263 QPathInfo */ |
| 1956 | __le64 CreationTime; |
| 1957 | __le64 LastAccessTime; |
| 1958 | __le64 LastWriteTime; |
| 1959 | __le64 ChangeTime; |
| 1960 | __le32 Attributes; |
| 1961 | __u32 Pad1; |
| 1962 | __le64 AllocationSize; |
| 1963 | __le64 EndOfFile; /* size ie offset to first free byte in file */ |
| 1964 | __le32 NumberOfLinks; /* hard links */ |
| 1965 | __u8 DeletePending; |
| 1966 | __u8 Directory; |
| 1967 | __u16 Pad2; |
| 1968 | __u64 IndexNumber; |
| 1969 | __le32 EASize; |
| 1970 | __le32 AccessFlags; |
| 1971 | __u64 IndexNumber1; |
| 1972 | __le64 CurrentByteOffset; |
| 1973 | __le32 Mode; |
| 1974 | __le32 AlignmentRequirement; |
| 1975 | __le32 FileNameLength; |
| 1976 | char FileName[1]; |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 1977 | } __attribute__((packed)) FILE_ALL_INFO; /* level 0x107 QPathInfo */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1978 | |
| 1979 | /* defines for enumerating possible values of the Unix type field below */ |
| 1980 | #define UNIX_FILE 0 |
| 1981 | #define UNIX_DIR 1 |
| 1982 | #define UNIX_SYMLINK 2 |
| 1983 | #define UNIX_CHARDEV 3 |
| 1984 | #define UNIX_BLOCKDEV 4 |
| 1985 | #define UNIX_FIFO 5 |
| 1986 | #define UNIX_SOCKET 6 |
| 1987 | typedef struct { |
| 1988 | __le64 EndOfFile; |
| 1989 | __le64 NumOfBytes; |
| 1990 | __le64 LastStatusChange; /*SNIA specs DCE time for the 3 time fields */ |
| 1991 | __le64 LastAccessTime; |
| 1992 | __le64 LastModificationTime; |
| 1993 | __le64 Uid; |
| 1994 | __le64 Gid; |
| 1995 | __le32 Type; |
| 1996 | __le64 DevMajor; |
| 1997 | __le64 DevMinor; |
| 1998 | __u64 UniqueId; |
| 1999 | __le64 Permissions; |
| 2000 | __le64 Nlinks; |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2001 | } __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2002 | |
| 2003 | typedef struct { |
| 2004 | char LinkDest[1]; |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2005 | } __attribute__((packed)) FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2006 | |
| 2007 | /* The following three structures are needed only for |
| 2008 | setting time to NT4 and some older servers via |
| 2009 | the primitive DOS time format */ |
| 2010 | typedef struct { |
| 2011 | __u16 Day:5; |
| 2012 | __u16 Month:4; |
| 2013 | __u16 Year:7; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2014 | } __attribute__((packed)) SMB_DATE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2015 | |
| 2016 | typedef struct { |
| 2017 | __u16 TwoSeconds:5; |
| 2018 | __u16 Minutes:6; |
| 2019 | __u16 Hours:5; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2020 | } __attribute__((packed)) SMB_TIME; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2021 | |
| 2022 | typedef struct { |
| 2023 | __le16 CreationDate; /* SMB Date see above */ |
| 2024 | __le16 CreationTime; /* SMB Time */ |
| 2025 | __le16 LastAccessDate; |
| 2026 | __le16 LastAccessTime; |
| 2027 | __le16 LastWriteDate; |
| 2028 | __le16 LastWriteTime; |
| 2029 | __le32 DataSize; /* File Size (EOF) */ |
| 2030 | __le32 AllocationSize; |
| 2031 | __le16 Attributes; /* verify not u32 */ |
| 2032 | __le32 EASize; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2033 | } __attribute__((packed)) FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2034 | |
| 2035 | typedef struct { |
| 2036 | __le64 CreationTime; |
| 2037 | __le64 LastAccessTime; |
| 2038 | __le64 LastWriteTime; |
| 2039 | __le64 ChangeTime; |
| 2040 | __le32 Attributes; |
| 2041 | __u32 Pad; |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2042 | } __attribute__((packed)) FILE_BASIC_INFO; /* size info, level 0x101 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2043 | |
| 2044 | struct file_allocation_info { |
| 2045 | __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ |
Steve French | 5bafd76 | 2006-06-07 00:18:43 +0000 | [diff] [blame] | 2046 | } __attribute__((packed)); /* size used on disk, for level 0x103 for set, |
| 2047 | 0x105 for query */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2048 | |
| 2049 | struct file_end_of_file_info { |
| 2050 | __le64 FileSize; /* offset to end of file */ |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2051 | } __attribute__((packed)); /* size info, level 0x104 for set, 0x106 for query */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2052 | |
| 2053 | struct file_alt_name_info { |
| 2054 | __u8 alt_name[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2055 | } __attribute__((packed)); /* level 0x0108 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2056 | |
| 2057 | struct file_stream_info { |
| 2058 | __le32 number_of_streams; /* BB check sizes and verify location */ |
| 2059 | /* followed by info on streams themselves |
| 2060 | u64 size; |
| 2061 | u64 allocation_size |
| 2062 | stream info */ |
| 2063 | }; /* level 0x109 */ |
| 2064 | |
| 2065 | struct file_compression_info { |
| 2066 | __le64 compressed_size; |
| 2067 | __le16 format; |
| 2068 | __u8 unit_shift; |
| 2069 | __u8 ch_shift; |
| 2070 | __u8 cl_shift; |
| 2071 | __u8 pad[3]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2072 | } __attribute__((packed)); /* level 0x10b */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2073 | |
| 2074 | /* POSIX ACL set/query path info structures */ |
| 2075 | #define CIFS_ACL_VERSION 1 |
| 2076 | struct cifs_posix_ace { /* access control entry (ACE) */ |
| 2077 | __u8 cifs_e_tag; |
| 2078 | __u8 cifs_e_perm; |
| 2079 | __le64 cifs_uid; /* or gid */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2080 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2081 | |
| 2082 | struct cifs_posix_acl { /* access conrol list (ACL) */ |
| 2083 | __le16 version; |
| 2084 | __le16 access_entry_count; /* access ACL - count of entries */ |
| 2085 | __le16 default_entry_count; /* default ACL - count of entries */ |
| 2086 | struct cifs_posix_ace ace_array[0]; |
| 2087 | /* followed by |
| 2088 | struct cifs_posix_ace default_ace_arraay[] */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2089 | } __attribute__((packed)); /* level 0x204 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2090 | |
| 2091 | /* types of access control entries already defined in posix_acl.h */ |
| 2092 | /* #define CIFS_POSIX_ACL_USER_OBJ 0x01 |
| 2093 | #define CIFS_POSIX_ACL_USER 0x02 |
| 2094 | #define CIFS_POSIX_ACL_GROUP_OBJ 0x04 |
| 2095 | #define CIFS_POSIX_ACL_GROUP 0x08 |
| 2096 | #define CIFS_POSIX_ACL_MASK 0x10 |
| 2097 | #define CIFS_POSIX_ACL_OTHER 0x20 */ |
| 2098 | |
| 2099 | /* types of perms */ |
| 2100 | /* #define CIFS_POSIX_ACL_EXECUTE 0x01 |
| 2101 | #define CIFS_POSIX_ACL_WRITE 0x02 |
| 2102 | #define CIFS_POSIX_ACL_READ 0x04 */ |
| 2103 | |
| 2104 | /* end of POSIX ACL definitions */ |
| 2105 | |
Steve French | 595dcfe | 2007-02-08 18:11:42 +0000 | [diff] [blame] | 2106 | typedef struct { |
| 2107 | __u32 OpenFlags; /* same as NT CreateX */ |
| 2108 | __u32 PosixOpenFlags; |
| 2109 | __u32 Mode; |
| 2110 | __u16 Level; /* reply level requested (see QPathInfo levels) */ |
| 2111 | __u16 Pad; /* reserved - MBZ */ |
| 2112 | } __attribute__((packed)) OPEN_PSX_REQ; /* level 0x209 SetPathInfo data */ |
| 2113 | |
| 2114 | typedef struct { |
| 2115 | /* reply varies based on requested level */ |
Steve French | 8af1897 | 2007-02-14 04:42:51 +0000 | [diff] [blame] | 2116 | } __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */ |
Steve French | 595dcfe | 2007-02-08 18:11:42 +0000 | [diff] [blame] | 2117 | |
| 2118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2119 | struct file_internal_info { |
| 2120 | __u64 UniqueId; /* inode number */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2121 | } __attribute__((packed)); /* level 0x3ee */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2122 | struct file_mode_info { |
| 2123 | __le32 Mode; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2124 | } __attribute__((packed)); /* level 0x3f8 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2125 | |
| 2126 | struct file_attrib_tag { |
| 2127 | __le32 Attribute; |
| 2128 | __le32 ReparseTag; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2129 | } __attribute__((packed)); /* level 0x40b */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2130 | |
| 2131 | |
| 2132 | /********************************************************/ |
| 2133 | /* FindFirst/FindNext transact2 data buffer formats */ |
| 2134 | /********************************************************/ |
| 2135 | |
| 2136 | typedef struct { |
| 2137 | __le32 NextEntryOffset; |
| 2138 | __u32 ResumeKey; /* as with FileIndex - no need to convert */ |
| 2139 | __le64 EndOfFile; |
| 2140 | __le64 NumOfBytes; |
| 2141 | __le64 LastStatusChange; /*SNIA specs DCE time for the 3 time fields */ |
| 2142 | __le64 LastAccessTime; |
| 2143 | __le64 LastModificationTime; |
| 2144 | __le64 Uid; |
| 2145 | __le64 Gid; |
| 2146 | __le32 Type; |
| 2147 | __le64 DevMajor; |
| 2148 | __le64 DevMinor; |
| 2149 | __u64 UniqueId; |
| 2150 | __le64 Permissions; |
| 2151 | __le64 Nlinks; |
| 2152 | char FileName[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2153 | } __attribute__((packed)) FILE_UNIX_INFO; /* level 0x202 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2154 | |
| 2155 | typedef struct { |
| 2156 | __le32 NextEntryOffset; |
| 2157 | __u32 FileIndex; |
| 2158 | __le64 CreationTime; |
| 2159 | __le64 LastAccessTime; |
| 2160 | __le64 LastWriteTime; |
| 2161 | __le64 ChangeTime; |
| 2162 | __le64 EndOfFile; |
| 2163 | __le64 AllocationSize; |
| 2164 | __le32 ExtFileAttributes; |
| 2165 | __le32 FileNameLength; |
| 2166 | char FileName[1]; |
Steve French | 5bafd76 | 2006-06-07 00:18:43 +0000 | [diff] [blame] | 2167 | } __attribute__((packed)) FILE_DIRECTORY_INFO; /* level 0x101 FF resp data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2168 | |
| 2169 | typedef struct { |
| 2170 | __le32 NextEntryOffset; |
| 2171 | __u32 FileIndex; |
| 2172 | __le64 CreationTime; |
| 2173 | __le64 LastAccessTime; |
| 2174 | __le64 LastWriteTime; |
| 2175 | __le64 ChangeTime; |
| 2176 | __le64 EndOfFile; |
| 2177 | __le64 AllocationSize; |
| 2178 | __le32 ExtFileAttributes; |
| 2179 | __le32 FileNameLength; |
| 2180 | __le32 EaSize; /* length of the xattrs */ |
| 2181 | char FileName[1]; |
Steve French | 5bafd76 | 2006-06-07 00:18:43 +0000 | [diff] [blame] | 2182 | } __attribute__((packed)) FILE_FULL_DIRECTORY_INFO; /* level 0x102 rsp data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2183 | |
| 2184 | typedef struct { |
| 2185 | __le32 NextEntryOffset; |
| 2186 | __u32 FileIndex; |
| 2187 | __le64 CreationTime; |
| 2188 | __le64 LastAccessTime; |
| 2189 | __le64 LastWriteTime; |
| 2190 | __le64 ChangeTime; |
| 2191 | __le64 EndOfFile; |
| 2192 | __le64 AllocationSize; |
| 2193 | __le32 ExtFileAttributes; |
| 2194 | __le32 FileNameLength; |
| 2195 | __le32 EaSize; /* EA size */ |
| 2196 | __le32 Reserved; |
| 2197 | __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/ |
| 2198 | char FileName[1]; |
Steve French | 5bafd76 | 2006-06-07 00:18:43 +0000 | [diff] [blame] | 2199 | } __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2200 | |
| 2201 | typedef struct { |
| 2202 | __le32 NextEntryOffset; |
| 2203 | __u32 FileIndex; |
| 2204 | __le64 CreationTime; |
| 2205 | __le64 LastAccessTime; |
| 2206 | __le64 LastWriteTime; |
| 2207 | __le64 ChangeTime; |
| 2208 | __le64 EndOfFile; |
| 2209 | __le64 AllocationSize; |
| 2210 | __le32 ExtFileAttributes; |
| 2211 | __le32 FileNameLength; |
| 2212 | __le32 EaSize; /* length of the xattrs */ |
| 2213 | __u8 ShortNameLength; |
| 2214 | __u8 Reserved; |
| 2215 | __u8 ShortName[12]; |
| 2216 | char FileName[1]; |
Steve French | 5bafd76 | 2006-06-07 00:18:43 +0000 | [diff] [blame] | 2217 | } __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FFrsp data */ |
| 2218 | |
| 2219 | typedef struct { |
| 2220 | __u32 ResumeKey; |
| 2221 | __le16 CreationDate; /* SMB Date */ |
| 2222 | __le16 CreationTime; /* SMB Time */ |
| 2223 | __le16 LastAccessDate; |
| 2224 | __le16 LastAccessTime; |
| 2225 | __le16 LastWriteDate; |
| 2226 | __le16 LastWriteTime; |
| 2227 | __le32 DataSize; /* File Size (EOF) */ |
| 2228 | __le32 AllocationSize; |
| 2229 | __le16 Attributes; /* verify not u32 */ |
| 2230 | __u8 FileNameLength; |
| 2231 | char FileName[1]; |
| 2232 | } __attribute__((packed)) FIND_FILE_STANDARD_INFO; /* level 0x1 FF resp data */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2233 | |
| 2234 | |
Steve French | 86c96b4 | 2005-11-18 20:25:31 -0800 | [diff] [blame] | 2235 | struct win_dev { |
| 2236 | unsigned char type[8]; /* IntxCHR or IntxBLK */ |
| 2237 | __le64 major; |
| 2238 | __le64 minor; |
| 2239 | } __attribute__((packed)); |
| 2240 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2241 | struct gea { |
| 2242 | unsigned char name_len; |
| 2243 | char name[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2244 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2245 | |
| 2246 | struct gealist { |
| 2247 | unsigned long list_len; |
| 2248 | struct gea list[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2249 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2250 | |
| 2251 | struct fea { |
| 2252 | unsigned char EA_flags; |
| 2253 | __u8 name_len; |
| 2254 | __le16 value_len; |
| 2255 | char name[1]; |
| 2256 | /* optionally followed by value */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2257 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2258 | /* flags for _FEA.fEA */ |
| 2259 | #define FEA_NEEDEA 0x80 /* need EA bit */ |
| 2260 | |
| 2261 | struct fealist { |
| 2262 | __le32 list_len; |
| 2263 | struct fea list[1]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2264 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2265 | |
| 2266 | /* used to hold an arbitrary blob of data */ |
| 2267 | struct data_blob { |
| 2268 | __u8 *data; |
| 2269 | size_t length; |
| 2270 | void (*free) (struct data_blob * data_blob); |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2271 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2272 | |
| 2273 | |
| 2274 | #ifdef CONFIG_CIFS_POSIX |
| 2275 | /* |
| 2276 | For better POSIX semantics from Linux client, (even better |
| 2277 | than the existing CIFS Unix Extensions) we need updated PDUs for: |
| 2278 | |
| 2279 | 1) PosixCreateX - to set and return the mode, inode#, device info and |
| 2280 | perhaps add a CreateDevice - to create Pipes and other special .inodes |
| 2281 | Also note POSIX open flags |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2282 | 2) Close - to return the last write time to do cache across close |
| 2283 | more safely |
Steve French | 1982c34 | 2005-08-17 12:38:22 -0700 | [diff] [blame] | 2284 | 3) FindFirst return unique inode number - what about resume key, two |
| 2285 | forms short (matches readdir) and full (enough info to cache inodes) |
| 2286 | 4) Mkdir - set mode |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2287 | |
| 2288 | And under consideration: |
Steve French | 1982c34 | 2005-08-17 12:38:22 -0700 | [diff] [blame] | 2289 | 5) FindClose2 (return nanosecond timestamp ??) |
| 2290 | 6) Use nanosecond timestamps throughout all time fields if |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2291 | corresponding attribute flag is set |
Steve French | 1982c34 | 2005-08-17 12:38:22 -0700 | [diff] [blame] | 2292 | 7) sendfile - handle based copy |
| 2293 | 8) Direct i/o |
| 2294 | 9) Misc fcntls? |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2295 | |
| 2296 | what about fixing 64 bit alignment |
| 2297 | |
| 2298 | There are also various legacy SMB/CIFS requests used as is |
| 2299 | |
| 2300 | From existing Lanman and NTLM dialects: |
| 2301 | -------------------------------------- |
| 2302 | NEGOTIATE |
| 2303 | SESSION_SETUP_ANDX (BB which?) |
| 2304 | TREE_CONNECT_ANDX (BB which wct?) |
| 2305 | TREE_DISCONNECT (BB add volume timestamp on response) |
| 2306 | LOGOFF_ANDX |
| 2307 | DELETE (note delete open file behavior) |
| 2308 | DELETE_DIRECTORY |
| 2309 | READ_AND_X |
| 2310 | WRITE_AND_X |
| 2311 | LOCKING_AND_X (note posix lock semantics) |
| 2312 | RENAME (note rename across dirs and open file rename posix behaviors) |
| 2313 | NT_RENAME (for hardlinks) Is this good enough for all features? |
| 2314 | FIND_CLOSE2 |
| 2315 | TRANSACTION2 (18 cases) |
| 2316 | SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2 |
| 2317 | (BB verify that never need to set allocation size) |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2318 | SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via |
| 2319 | Unix ext?) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2320 | |
| 2321 | COPY (note support for copy across directories) - FUTURE, OPTIONAL |
| 2322 | setting/getting OS/2 EAs - FUTURE (BB can this handle |
| 2323 | setting Linux xattrs perfectly) - OPTIONAL |
| 2324 | dnotify - FUTURE, OPTIONAL |
| 2325 | quota - FUTURE, OPTIONAL |
| 2326 | |
| 2327 | Note that various requests implemented for NT interop such as |
| 2328 | NT_TRANSACT (IOCTL) QueryReparseInfo |
| 2329 | are unneeded to servers compliant with the CIFS POSIX extensions |
| 2330 | |
| 2331 | From CIFS Unix Extensions: |
| 2332 | ------------------------- |
| 2333 | T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks |
| 2334 | T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2) |
| 2335 | T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK) |
| 2336 | T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields |
| 2337 | Actually need QUERY_FILE_UNIX_INFO since has inode num |
| 2338 | BB what about a) blksize/blkbits/blocks |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2339 | b) i_version |
| 2340 | c) i_rdev |
| 2341 | d) notify mask? |
| 2342 | e) generation |
| 2343 | f) size_seqcount |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2344 | T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2345 | TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2346 | T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL |
| 2347 | |
| 2348 | |
| 2349 | */ |
| 2350 | |
Steve French | 1982c34 | 2005-08-17 12:38:22 -0700 | [diff] [blame] | 2351 | /* xsymlink is a symlink format (used by MacOS) that can be used |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2352 | to save symlink info in a regular file when |
| 2353 | mounted to operating systems that do not |
| 2354 | support the cifs Unix extensions or EAs (for xattr |
| 2355 | based symlinks). For such a file to be recognized |
| 2356 | as containing symlink data: |
| 2357 | |
| 2358 | 1) file size must be 1067, |
| 2359 | 2) signature must begin file data, |
| 2360 | 3) length field must be set to ASCII representation |
| 2361 | of a number which is less than or equal to 1024, |
| 2362 | 4) md5 must match that of the path data */ |
| 2363 | |
| 2364 | struct xsymlink { |
| 2365 | /* 1067 bytes */ |
| 2366 | char signature[4]; /* XSym */ /* not null terminated */ |
| 2367 | char cr0; /* \n */ |
| 2368 | /* ASCII representation of length (4 bytes decimal) terminated by \n not null */ |
| 2369 | char length[4]; |
| 2370 | char cr1; /* \n */ |
| 2371 | /* md5 of valid subset of path ie path[0] through path[length-1] */ |
| 2372 | __u8 md5[32]; |
| 2373 | char cr2; /* \n */ |
| 2374 | /* if room left, then end with \n then 0x20s by convention but not required */ |
| 2375 | char path[1024]; |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2376 | } __attribute__((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2377 | |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 2378 | typedef struct file_xattr_info { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2379 | /* BB do we need another field for flags? BB */ |
| 2380 | __u32 xattr_name_len; |
| 2381 | __u32 xattr_value_len; |
| 2382 | char xattr_name[0]; |
| 2383 | /* followed by xattr_value[xattr_value_len], no pad */ |
Steve French | 87f440e | 2007-02-07 00:29:46 +0000 | [diff] [blame] | 2384 | } __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2385 | |
| 2386 | |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 2387 | /* flags for chattr command */ |
| 2388 | #define EXT_SECURE_DELETE 0x00000001 /* EXT3_SECRM_FL */ |
| 2389 | #define EXT_ENABLE_UNDELETE 0x00000002 /* EXT3_UNRM_FL */ |
| 2390 | /* Reserved for compress file 0x4 */ |
| 2391 | #define EXT_SYNCHRONOUS 0x00000008 /* EXT3_SYNC_FL */ |
| 2392 | #define EXT_IMMUTABLE_FL 0x00000010 /* EXT3_IMMUTABLE_FL */ |
| 2393 | #define EXT_OPEN_APPEND_ONLY 0x00000020 /* EXT3_APPEND_FL */ |
| 2394 | #define EXT_DO_NOT_BACKUP 0x00000040 /* EXT3_NODUMP_FL */ |
| 2395 | #define EXT_NO_UPDATE_ATIME 0x00000080 /* EXT3_NOATIME_FL */ |
| 2396 | /* 0x100 through 0x800 reserved for compression flags and are GET-ONLY */ |
| 2397 | #define EXT_HASH_TREE_INDEXED_DIR 0x00001000 /* GET-ONLY EXT3_INDEX_FL */ |
| 2398 | /* 0x2000 reserved for IMAGIC_FL */ |
| 2399 | #define EXT_JOURNAL_THIS_FILE 0x00004000 /* GET-ONLY EXT3_JOURNAL_DATA_FL */ |
| 2400 | /* 0x8000 reserved for EXT3_NOTAIL_FL */ |
| 2401 | #define EXT_SYNCHRONOUS_DIR 0x00010000 /* EXT3_DIRSYNC_FL */ |
| 2402 | #define EXT_TOPDIR 0x00020000 /* EXT3_TOPDIR_FL */ |
| 2403 | |
| 2404 | #define EXT_SET_MASK 0x000300FF |
| 2405 | #define EXT_GET_MASK 0x0003DFFF |
| 2406 | |
| 2407 | typedef struct file_chattr_info { |
| 2408 | __le64 mask; /* list of all possible attribute bits */ |
| 2409 | __le64 mode; /* list of actual attribute bits on this inode */ |
Steve French | 0753ca7 | 2005-10-27 13:55:12 -0700 | [diff] [blame] | 2410 | } __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */ |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 2411 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2412 | #endif |
| 2413 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2414 | #endif /* _CIFSPDU_H */ |