aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifspdu.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifspdu.h')
-rw-r--r--fs/cifs/cifspdu.h499
1 files changed, 328 insertions, 171 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index aede6a813167..48a05b9df7eb 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -36,9 +36,11 @@
36#define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */ 36#define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */
37#define SMB_COM_DELETE 0x06 /* trivial response */ 37#define SMB_COM_DELETE 0x06 /* trivial response */
38#define SMB_COM_RENAME 0x07 /* trivial response */ 38#define SMB_COM_RENAME 0x07 /* trivial response */
39#define SMB_COM_QUERY_INFORMATION 0x08 /* aka getattr */
39#define SMB_COM_SETATTR 0x09 /* trivial response */ 40#define SMB_COM_SETATTR 0x09 /* trivial response */
40#define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */ 41#define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */
41#define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/ 42#define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/
43#define SMB_COM_OPEN_ANDX 0x2D /* Legacy open for old servers */
42#define SMB_COM_READ_ANDX 0x2E 44#define SMB_COM_READ_ANDX 0x2E
43#define SMB_COM_WRITE_ANDX 0x2F 45#define SMB_COM_WRITE_ANDX 0x2F
44#define SMB_COM_TRANSACTION2 0x32 46#define SMB_COM_TRANSACTION2 0x32
@@ -52,6 +54,7 @@
52#define SMB_COM_NT_TRANSACT 0xA0 54#define SMB_COM_NT_TRANSACT 0xA0
53#define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 55#define SMB_COM_NT_TRANSACT_SECONDARY 0xA1
54#define SMB_COM_NT_CREATE_ANDX 0xA2 56#define SMB_COM_NT_CREATE_ANDX 0xA2
57#define SMB_COM_NT_CANCEL 0xA4 /* no response */
55#define SMB_COM_NT_RENAME 0xA5 /* trivial response */ 58#define SMB_COM_NT_RENAME 0xA5 /* trivial response */
56 59
57/* Transact2 subcommand codes */ 60/* Transact2 subcommand codes */
@@ -59,6 +62,7 @@
59#define TRANS2_FIND_FIRST 0x01 62#define TRANS2_FIND_FIRST 0x01
60#define TRANS2_FIND_NEXT 0x02 63#define TRANS2_FIND_NEXT 0x02
61#define TRANS2_QUERY_FS_INFORMATION 0x03 64#define TRANS2_QUERY_FS_INFORMATION 0x03
65#define TRANS2_SET_FS_INFORMATION 0x04
62#define TRANS2_QUERY_PATH_INFORMATION 0x05 66#define TRANS2_QUERY_PATH_INFORMATION 0x05
63#define TRANS2_SET_PATH_INFORMATION 0x06 67#define TRANS2_SET_PATH_INFORMATION 0x06
64#define TRANS2_QUERY_FILE_INFORMATION 0x07 68#define TRANS2_QUERY_FILE_INFORMATION 0x07
@@ -76,7 +80,7 @@
76#define NT_TRANSACT_GET_USER_QUOTA 0x07 80#define NT_TRANSACT_GET_USER_QUOTA 0x07
77#define NT_TRANSACT_SET_USER_QUOTA 0x08 81#define NT_TRANSACT_SET_USER_QUOTA 0x08
78 82
79#define MAX_CIFS_HDR_SIZE 256 /* chained NTCreateXReadX will probably be biggest */ 83#define MAX_CIFS_HDR_SIZE 256 /* is future chained NTCreateXReadX bigger? */
80 84
81/* internal cifs vfs structures */ 85/* internal cifs vfs structures */
82/***************************************************************** 86/*****************************************************************
@@ -129,10 +133,11 @@
129/* 133/*
130 * SMB flag definitions 134 * SMB flag definitions
131 */ 135 */
132#define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock primitives */ 136#define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock smb */
133#define SMBFLG_RCV_POSTED 0x02 /* obsolete */ 137#define SMBFLG_RCV_POSTED 0x02 /* obsolete */
134#define SMBFLG_RSVD 0x04 138#define SMBFLG_RSVD 0x04
135#define SMBFLG_CASELESS 0x08 /* all pathnames treated as caseless (off implies case sensitive file handling requested) */ 139#define SMBFLG_CASELESS 0x08 /* all pathnames treated as caseless (off
140 implies case sensitive file handling request) */
136#define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */ 141#define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */
137#define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */ 142#define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */
138#define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */ 143#define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */
@@ -141,7 +146,8 @@
141/* 146/*
142 * SMB flag2 definitions 147 * SMB flag2 definitions
143 */ 148 */
144#define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3) path names in response */ 149#define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3)
150 path names in response */
145#define SMBFLG2_KNOWS_EAS cpu_to_le16(2) 151#define SMBFLG2_KNOWS_EAS cpu_to_le16(2)
146#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) 152#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4)
147#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40) 153#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40)
@@ -160,32 +166,32 @@
160 * file and can have any suitable combination of the following values: 166 * file and can have any suitable combination of the following values:
161 */ 167 */
162 168
163#define FILE_READ_DATA 0x00000001 /* Data can be read from the file */ 169#define FILE_READ_DATA 0x00000001 /* Data can be read from the file */
164#define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */ 170#define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */
165#define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */ 171#define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */
166#define FILE_READ_EA 0x00000008 /* Extended attributes associated */ 172#define FILE_READ_EA 0x00000008 /* Extended attributes associated */
167 /* with the file can be read */ 173 /* with the file can be read */
168#define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */ 174#define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */
169 /* with the file can be written */ 175 /* with the file can be written */
170#define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */ 176#define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */
171 /* the file using system paging I/O */ 177 /* the file using system paging I/O */
172#define FILE_DELETE_CHILD 0x00000040 178#define FILE_DELETE_CHILD 0x00000040
173#define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */ 179#define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */
174 /* file can be read */ 180 /* file can be read */
175#define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */ 181#define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */
176 /* file can be written */ 182 /* file can be written */
177#define DELETE 0x00010000 /* The file can be deleted */ 183#define DELETE 0x00010000 /* The file can be deleted */
178#define READ_CONTROL 0x00020000 /* The access control list and */ 184#define READ_CONTROL 0x00020000 /* The access control list and */
179 /* ownership associated with the */ 185 /* ownership associated with the */
180 /* file can be read */ 186 /* file can be read */
181#define WRITE_DAC 0x00040000 /* The access control list and */ 187#define WRITE_DAC 0x00040000 /* The access control list and */
182 /* ownership associated with the */ 188 /* ownership associated with the */
183 /* file can be written. */ 189 /* file can be written. */
184#define WRITE_OWNER 0x00080000 /* Ownership information associated */ 190#define WRITE_OWNER 0x00080000 /* Ownership information associated */
185 /* with the file can be written */ 191 /* with the file can be written */
186#define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */ 192#define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */
187 /* synchronize with the completion */ 193 /* synchronize with the completion */
188 /* of an input/output request */ 194 /* of an input/output request */
189#define GENERIC_ALL 0x10000000 195#define GENERIC_ALL 0x10000000
190#define GENERIC_EXECUTE 0x20000000 196#define GENERIC_EXECUTE 0x20000000
191#define GENERIC_WRITE 0x40000000 197#define GENERIC_WRITE 0x40000000
@@ -193,7 +199,7 @@
193 /* In summary - Relevant file */ 199 /* In summary - Relevant file */
194 /* access flags from CIFS are */ 200 /* access flags from CIFS are */
195 /* file_read_data, file_write_data */ 201 /* file_read_data, file_write_data */
196 /* file_execute, file_read_attributes */ 202 /* file_execute, file_read_attributes*/
197 /* write_dac, and delete. */ 203 /* write_dac, and delete. */
198 204
199/* 205/*
@@ -238,7 +244,8 @@
238#define ATTR_SPARSE 0x0200 244#define ATTR_SPARSE 0x0200
239#define ATTR_REPARSE 0x0400 245#define ATTR_REPARSE 0x0400
240#define ATTR_COMPRESSED 0x0800 246#define ATTR_COMPRESSED 0x0800
241#define ATTR_OFFLINE 0x1000 /* ie file not immediately available - offline storage */ 247#define ATTR_OFFLINE 0x1000 /* ie file not immediately available -
248 on offline storage */
242#define ATTR_NOT_CONTENT_INDEXED 0x2000 249#define ATTR_NOT_CONTENT_INDEXED 0x2000
243#define ATTR_ENCRYPTED 0x4000 250#define ATTR_ENCRYPTED 0x4000
244#define ATTR_POSIX_SEMANTICS 0x01000000 251#define ATTR_POSIX_SEMANTICS 0x01000000
@@ -267,10 +274,18 @@
267/* CreateOptions */ 274/* CreateOptions */
268#define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ 275#define CREATE_NOT_FILE 0x00000001 /* if set must not be file */
269#define CREATE_WRITE_THROUGH 0x00000002 276#define CREATE_WRITE_THROUGH 0x00000002
270#define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ 277#define CREATE_SEQUENTIAL 0x00000004
278#define CREATE_SYNC_ALERT 0x00000010
279#define CREATE_ASYNC_ALERT 0x00000020
280#define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */
281#define CREATE_NO_EA_KNOWLEDGE 0x00000200
282#define CREATE_EIGHT_DOT_THREE 0x00000400
271#define CREATE_RANDOM_ACCESS 0x00000800 283#define CREATE_RANDOM_ACCESS 0x00000800
272#define CREATE_DELETE_ON_CLOSE 0x00001000 284#define CREATE_DELETE_ON_CLOSE 0x00001000
285#define CREATE_OPEN_BY_ID 0x00002000
273#define OPEN_REPARSE_POINT 0x00200000 286#define OPEN_REPARSE_POINT 0x00200000
287#define CREATE_OPTIONS_MASK 0x007FFFFF
288#define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */
274 289
275/* ImpersonationLevel flags */ 290/* ImpersonationLevel flags */
276#define SECURITY_ANONYMOUS 0 291#define SECURITY_ANONYMOUS 0
@@ -297,10 +312,10 @@
297#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */ 312#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */
298#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */ 313#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */
299 314
300#pragma pack(1)
301
302struct smb_hdr { 315struct smb_hdr {
303 __u32 smb_buf_length; /* big endian on wire *//* BB length is only two or three bytes - with one or two byte type preceding it but that is always zero - we could mask the type byte off just in case BB */ 316 __u32 smb_buf_length; /* big endian on wire *//* BB length is only two
317 or three bytes - with one or two byte type preceding it that are
318 zero - we could mask the type byte off just in case BB */
304 __u8 Protocol[4]; 319 __u8 Protocol[4];
305 __u8 Command; 320 __u8 Command;
306 union { 321 union {
@@ -308,9 +323,9 @@ struct smb_hdr {
308 __u8 ErrorClass; 323 __u8 ErrorClass;
309 __u8 Reserved; 324 __u8 Reserved;
310 __le16 Error; 325 __le16 Error;
311 } DosError; 326 } __attribute__((packed)) DosError;
312 __le32 CifsError; 327 __le32 CifsError;
313 } Status; 328 } __attribute__((packed)) Status;
314 __u8 Flags; 329 __u8 Flags;
315 __le16 Flags2; /* note: le */ 330 __le16 Flags2; /* note: le */
316 __le16 PidHigh; 331 __le16 PidHigh;
@@ -318,16 +333,16 @@ struct smb_hdr {
318 struct { 333 struct {
319 __le32 SequenceNumber; /* le */ 334 __le32 SequenceNumber; /* le */
320 __u32 Reserved; /* zero */ 335 __u32 Reserved; /* zero */
321 } Sequence; 336 } __attribute__((packed)) Sequence;
322 __u8 SecuritySignature[8]; /* le */ 337 __u8 SecuritySignature[8]; /* le */
323 } Signature; 338 } __attribute__((packed)) Signature;
324 __u8 pad[2]; 339 __u8 pad[2];
325 __u16 Tid; 340 __u16 Tid;
326 __le16 Pid; 341 __le16 Pid;
327 __u16 Uid; 342 __u16 Uid;
328 __u16 Mid; 343 __u16 Mid;
329 __u8 WordCount; 344 __u8 WordCount;
330}; 345} __attribute__((packed));
331/* given a pointer to an smb_hdr retrieve the value of byte count */ 346/* given a pointer to an smb_hdr retrieve the value of byte count */
332#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) 347#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) )
333#define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) 348#define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) )
@@ -379,7 +394,7 @@ typedef struct negotiate_req {
379 struct smb_hdr hdr; /* wct = 0 */ 394 struct smb_hdr hdr; /* wct = 0 */
380 __le16 ByteCount; 395 __le16 ByteCount;
381 unsigned char DialectsArray[1]; 396 unsigned char DialectsArray[1];
382} NEGOTIATE_REQ; 397} __attribute__((packed)) NEGOTIATE_REQ;
383 398
384typedef struct negotiate_rsp { 399typedef struct negotiate_rsp {
385 struct smb_hdr hdr; /* wct = 17 */ 400 struct smb_hdr hdr; /* wct = 17 */
@@ -397,16 +412,16 @@ typedef struct negotiate_rsp {
397 __u8 EncryptionKeyLength; 412 __u8 EncryptionKeyLength;
398 __u16 ByteCount; 413 __u16 ByteCount;
399 union { 414 union {
400 unsigned char EncryptionKey[1]; /* if cap extended security is off */ 415 unsigned char EncryptionKey[1]; /* cap extended security off */
401 /* followed by Domain name - if extended security is off */ 416 /* followed by Domain name - if extended security is off */
402 /* followed by 16 bytes of server GUID */ 417 /* followed by 16 bytes of server GUID */
403 /* followed by security blob if cap_extended_security negotiated */ 418 /* then security blob if cap_extended_security negotiated */
404 struct { 419 struct {
405 unsigned char GUID[16]; 420 unsigned char GUID[16];
406 unsigned char SecurityBlob[1]; 421 unsigned char SecurityBlob[1];
407 } extended_response; 422 } __attribute__((packed)) extended_response;
408 } u; 423 } __attribute__((packed)) u;
409} NEGOTIATE_RSP; 424} __attribute__((packed)) NEGOTIATE_RSP;
410 425
411/* SecurityMode bits */ 426/* SecurityMode bits */
412#define SECMODE_USER 0x01 /* off indicates share level security */ 427#define SECMODE_USER 0x01 /* off indicates share level security */
@@ -452,7 +467,8 @@ typedef union smb_com_session_setup_andx {
452 unsigned char SecurityBlob[1]; /* followed by */ 467 unsigned char SecurityBlob[1]; /* followed by */
453 /* STRING NativeOS */ 468 /* STRING NativeOS */
454 /* STRING NativeLanMan */ 469 /* STRING NativeLanMan */
455 } req; /* NTLM request format (with extended security */ 470 } __attribute__((packed)) req; /* NTLM request format (with
471 extended security */
456 472
457 struct { /* request format */ 473 struct { /* request format */
458 struct smb_hdr hdr; /* wct = 13 */ 474 struct smb_hdr hdr; /* wct = 13 */
@@ -463,18 +479,19 @@ typedef union smb_com_session_setup_andx {
463 __le16 MaxMpxCount; 479 __le16 MaxMpxCount;
464 __le16 VcNumber; 480 __le16 VcNumber;
465 __u32 SessionKey; 481 __u32 SessionKey;
466 __le16 CaseInsensitivePasswordLength; /* ASCII password length */ 482 __le16 CaseInsensitivePasswordLength; /* ASCII password len */
467 __le16 CaseSensitivePasswordLength; /* Unicode password length */ 483 __le16 CaseSensitivePasswordLength; /* Unicode password length*/
468 __u32 Reserved; /* see below */ 484 __u32 Reserved; /* see below */
469 __le32 Capabilities; 485 __le32 Capabilities;
470 __le16 ByteCount; 486 __le16 ByteCount;
471 unsigned char CaseInsensitivePassword[1]; /* followed by: */ 487 unsigned char CaseInsensitivePassword[1]; /* followed by: */
472 /* unsigned char * CaseSensitivePassword; */ 488 /* unsigned char * CaseSensitivePassword; */
473 /* STRING AccountName */ 489 /* STRING AccountName */
474 /* STRING PrimaryDomain */ 490 /* STRING PrimaryDomain */
475 /* STRING NativeOS */ 491 /* STRING NativeOS */
476 /* STRING NativeLanMan */ 492 /* STRING NativeLanMan */
477 } req_no_secext; /* NTLM request format (without extended security */ 493 } __attribute__((packed)) req_no_secext; /* NTLM request format (without
494 extended security */
478 495
479 struct { /* default (NTLM) response format */ 496 struct { /* default (NTLM) response format */
480 struct smb_hdr hdr; /* wct = 4 */ 497 struct smb_hdr hdr; /* wct = 4 */
@@ -488,7 +505,7 @@ typedef union smb_com_session_setup_andx {
488/* unsigned char * NativeOS; */ 505/* unsigned char * NativeOS; */
489/* unsigned char * NativeLanMan; */ 506/* unsigned char * NativeLanMan; */
490/* unsigned char * PrimaryDomain; */ 507/* unsigned char * PrimaryDomain; */
491 } resp; /* NTLM response format (with or without extended security */ 508 } __attribute__((packed)) resp; /* NTLM response format (with or without extended security */
492 509
493 struct { /* request format */ 510 struct { /* request format */
494 struct smb_hdr hdr; /* wct = 10 */ 511 struct smb_hdr hdr; /* wct = 10 */
@@ -507,7 +524,7 @@ typedef union smb_com_session_setup_andx {
507 /* STRING PrimaryDomain */ 524 /* STRING PrimaryDomain */
508 /* STRING NativeOS */ 525 /* STRING NativeOS */
509 /* STRING NativeLanMan */ 526 /* STRING NativeLanMan */
510 } old_req; /* pre-NTLM (LANMAN2.1) request format */ 527 } __attribute__((packed)) old_req; /* pre-NTLM (LANMAN2.1) request format */
511 528
512 struct { /* default (NTLM) response format */ 529 struct { /* default (NTLM) response format */
513 struct smb_hdr hdr; /* wct = 3 */ 530 struct smb_hdr hdr; /* wct = 3 */
@@ -519,8 +536,8 @@ typedef union smb_com_session_setup_andx {
519 unsigned char NativeOS[1]; /* followed by */ 536 unsigned char NativeOS[1]; /* followed by */
520/* unsigned char * NativeLanMan; */ 537/* unsigned char * NativeLanMan; */
521/* unsigned char * PrimaryDomain; */ 538/* unsigned char * PrimaryDomain; */
522 } old_resp; /* pre-NTLM (LANMAN2.1) response format */ 539 } __attribute__((packed)) old_resp; /* pre-NTLM (LANMAN2.1) response format */
523} SESSION_SETUP_ANDX; 540} __attribute__((packed)) SESSION_SETUP_ANDX;
524 541
525#define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" 542#define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux"
526 543
@@ -530,7 +547,8 @@ typedef union smb_com_session_setup_andx {
530#define CAP_NT_SMBS 0x00000010 547#define CAP_NT_SMBS 0x00000010
531#define CAP_STATUS32 0x00000040 548#define CAP_STATUS32 0x00000040
532#define CAP_LEVEL_II_OPLOCKS 0x00000080 549#define CAP_LEVEL_II_OPLOCKS 0x00000080
533#define CAP_NT_FIND 0x00000200 /* reserved should be zero (presumably because NT_SMBs implies the same thing) */ 550#define CAP_NT_FIND 0x00000200 /* reserved should be zero
551 (because NT_SMBs implies the same thing?) */
534#define CAP_BULK_TRANSFER 0x20000000 552#define CAP_BULK_TRANSFER 0x20000000
535#define CAP_EXTENDED_SECURITY 0x80000000 553#define CAP_EXTENDED_SECURITY 0x80000000
536 554
@@ -548,7 +566,7 @@ typedef struct smb_com_tconx_req {
548 unsigned char Password[1]; /* followed by */ 566 unsigned char Password[1]; /* followed by */
549/* STRING Path *//* \\server\share name */ 567/* STRING Path *//* \\server\share name */
550 /* STRING Service */ 568 /* STRING Service */
551} TCONX_REQ; 569} __attribute__((packed)) TCONX_REQ;
552 570
553typedef struct smb_com_tconx_rsp { 571typedef struct smb_com_tconx_rsp {
554 struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */ 572 struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */
@@ -559,13 +577,14 @@ typedef struct smb_com_tconx_rsp {
559 __u16 ByteCount; 577 __u16 ByteCount;
560 unsigned char Service[1]; /* always ASCII, not Unicode */ 578 unsigned char Service[1]; /* always ASCII, not Unicode */
561 /* STRING NativeFileSystem */ 579 /* STRING NativeFileSystem */
562} TCONX_RSP; 580} __attribute__((packed)) TCONX_RSP;
563 581
564/* tree connect Flags */ 582/* tree connect Flags */
565#define DISCONNECT_TID 0x0001 583#define DISCONNECT_TID 0x0001
566#define TCON_EXTENDED_SECINFO 0x0008 584#define TCON_EXTENDED_SECINFO 0x0008
567/* OptionalSupport bits */ 585/* OptionalSupport bits */
568#define SMB_SUPPORT_SEARCH_BITS 0x0001 /* must have bits (exclusive searches suppt. */ 586#define SMB_SUPPORT_SEARCH_BITS 0x0001 /* "must have" directory search bits
587 (exclusive searches supported) */
569#define SMB_SHARE_IS_IN_DFS 0x0002 588#define SMB_SHARE_IS_IN_DFS 0x0002
570 589
571typedef struct smb_com_logoff_andx_req { 590typedef struct smb_com_logoff_andx_req {
@@ -574,7 +593,7 @@ typedef struct smb_com_logoff_andx_req {
574 __u8 AndXReserved; 593 __u8 AndXReserved;
575 __u16 AndXOffset; 594 __u16 AndXOffset;
576 __u16 ByteCount; 595 __u16 ByteCount;
577} LOGOFF_ANDX_REQ; 596} __attribute__((packed)) LOGOFF_ANDX_REQ;
578 597
579typedef struct smb_com_logoff_andx_rsp { 598typedef struct smb_com_logoff_andx_rsp {
580 struct smb_hdr hdr; /* wct = 2 */ 599 struct smb_hdr hdr; /* wct = 2 */
@@ -582,38 +601,39 @@ typedef struct smb_com_logoff_andx_rsp {
582 __u8 AndXReserved; 601 __u8 AndXReserved;
583 __u16 AndXOffset; 602 __u16 AndXOffset;
584 __u16 ByteCount; 603 __u16 ByteCount;
585} LOGOFF_ANDX_RSP; 604} __attribute__((packed)) LOGOFF_ANDX_RSP;
586 605
587typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on tree_connect PDU to effect disconnect *//* probably the simplest SMB PDU */ 606typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on tree_connect PDU to effect disconnect *//* probably the simplest SMB PDU */
588 struct { 607 struct {
589 struct smb_hdr hdr; /* wct = 0 */ 608 struct smb_hdr hdr; /* wct = 0 */
590 __u16 ByteCount; /* bcc = 0 */ 609 __u16 ByteCount; /* bcc = 0 */
591 } req; 610 } __attribute__((packed)) req;
592 struct { 611 struct {
593 struct smb_hdr hdr; /* wct = 0 */ 612 struct smb_hdr hdr; /* wct = 0 */
594 __u16 ByteCount; /* bcc = 0 */ 613 __u16 ByteCount; /* bcc = 0 */
595 } resp; 614 } __attribute__((packed)) resp;
596} TREE_DISCONNECT; 615} __attribute__((packed)) TREE_DISCONNECT;
597 616
598typedef struct smb_com_close_req { 617typedef struct smb_com_close_req {
599 struct smb_hdr hdr; /* wct = 3 */ 618 struct smb_hdr hdr; /* wct = 3 */
600 __u16 FileID; 619 __u16 FileID;
601 __u32 LastWriteTime; /* should be zero */ 620 __u32 LastWriteTime; /* should be zero */
602 __u16 ByteCount; /* 0 */ 621 __u16 ByteCount; /* 0 */
603} CLOSE_REQ; 622} __attribute__((packed)) CLOSE_REQ;
604 623
605typedef struct smb_com_close_rsp { 624typedef struct smb_com_close_rsp {
606 struct smb_hdr hdr; /* wct = 0 */ 625 struct smb_hdr hdr; /* wct = 0 */
607 __u16 ByteCount; /* bct = 0 */ 626 __u16 ByteCount; /* bct = 0 */
608} CLOSE_RSP; 627} __attribute__((packed)) CLOSE_RSP;
609 628
610typedef struct smb_com_findclose_req { 629typedef struct smb_com_findclose_req {
611 struct smb_hdr hdr; /* wct = 1 */ 630 struct smb_hdr hdr; /* wct = 1 */
612 __u16 FileID; 631 __u16 FileID;
613 __u16 ByteCount; /* 0 */ 632 __u16 ByteCount; /* 0 */
614} FINDCLOSE_REQ; 633} __attribute__((packed)) FINDCLOSE_REQ;
615 634
616/* OpenFlags */ 635/* OpenFlags */
636#define REQ_MORE_INFO 0x00000001 /* legacy (OPEN_AND_X) only */
617#define REQ_OPLOCK 0x00000002 637#define REQ_OPLOCK 0x00000002
618#define REQ_BATCHOPLOCK 0x00000004 638#define REQ_BATCHOPLOCK 0x00000004
619#define REQ_OPENDIRONLY 0x00000008 639#define REQ_OPENDIRONLY 0x00000008
@@ -637,7 +657,7 @@ typedef struct smb_com_open_req { /* also handles create */
637 __u8 SecurityFlags; 657 __u8 SecurityFlags;
638 __le16 ByteCount; 658 __le16 ByteCount;
639 char fileName[1]; 659 char fileName[1];
640} OPEN_REQ; 660} __attribute__((packed)) OPEN_REQ;
641 661
642/* open response: oplock levels */ 662/* open response: oplock levels */
643#define OPLOCK_NONE 0 663#define OPLOCK_NONE 0
@@ -667,7 +687,63 @@ typedef struct smb_com_open_rsp {
667 __le16 DeviceState; 687 __le16 DeviceState;
668 __u8 DirectoryFlag; 688 __u8 DirectoryFlag;
669 __u16 ByteCount; /* bct = 0 */ 689 __u16 ByteCount; /* bct = 0 */
670} OPEN_RSP; 690} __attribute__((packed)) OPEN_RSP;
691
692/* format of legacy open request */
693typedef struct smb_com_openx_req {
694 struct smb_hdr hdr; /* wct = 15 */
695 __u8 AndXCommand;
696 __u8 AndXReserved;
697 __le16 AndXOffset;
698 __le16 OpenFlags;
699 __le16 Mode;
700 __le16 Sattr; /* search attributes */
701 __le16 FileAttributes; /* dos attrs */
702 __le32 CreateTime; /* os2 format */
703 __le16 OpenFunction;
704 __le32 EndOfFile;
705 __le32 Timeout;
706 __le32 Reserved;
707 __le16 ByteCount; /* file name follows */
708 char fileName[1];
709} __attribute__((packed)) OPENX_REQ;
710
711typedef struct smb_com_openx_rsp {
712 struct smb_hdr hdr; /* wct = 15 */
713 __u8 AndXCommand;
714 __u8 AndXReserved;
715 __le16 AndXOffset;
716 __u16 Fid;
717 __le16 FileAttributes;
718 __le32 LastWriteTime; /* os2 format */
719 __le32 EndOfFile;
720 __le16 Access;
721 __le16 FileType;
722 __le16 IPCState;
723 __le16 Action;
724 __u32 FileId;
725 __u16 Reserved;
726 __u16 ByteCount;
727} __attribute__((packed)) OPENX_RSP;
728
729/* Legacy write request for older servers */
730typedef struct smb_com_writex_req {
731 struct smb_hdr hdr; /* wct = 12 */
732 __u8 AndXCommand;
733 __u8 AndXReserved;
734 __le16 AndXOffset;
735 __u16 Fid;
736 __le32 OffsetLow;
737 __u32 Reserved; /* Timeout */
738 __le16 WriteMode; /* 1 = write through */
739 __le16 Remaining;
740 __le16 Reserved2;
741 __le16 DataLengthLow;
742 __le16 DataOffset;
743 __le16 ByteCount;
744 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
745 char Data[0];
746} __attribute__((packed)) WRITEX_REQ;
671 747
672typedef struct smb_com_write_req { 748typedef struct smb_com_write_req {
673 struct smb_hdr hdr; /* wct = 14 */ 749 struct smb_hdr hdr; /* wct = 14 */
@@ -686,7 +762,7 @@ typedef struct smb_com_write_req {
686 __le16 ByteCount; 762 __le16 ByteCount;
687 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ 763 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
688 char Data[0]; 764 char Data[0];
689} WRITE_REQ; 765} __attribute__((packed)) WRITE_REQ;
690 766
691typedef struct smb_com_write_rsp { 767typedef struct smb_com_write_rsp {
692 struct smb_hdr hdr; /* wct = 6 */ 768 struct smb_hdr hdr; /* wct = 6 */
@@ -698,7 +774,22 @@ typedef struct smb_com_write_rsp {
698 __le16 CountHigh; 774 __le16 CountHigh;
699 __u16 Reserved; 775 __u16 Reserved;
700 __u16 ByteCount; 776 __u16 ByteCount;
701} WRITE_RSP; 777} __attribute__((packed)) WRITE_RSP;
778
779/* legacy read request for older servers */
780typedef struct smb_com_readx_req {
781 struct smb_hdr hdr; /* wct = 10 */
782 __u8 AndXCommand;
783 __u8 AndXReserved;
784 __le16 AndXOffset;
785 __u16 Fid;
786 __le32 OffsetLow;
787 __le16 MaxCount;
788 __le16 MinCount; /* obsolete */
789 __le32 Reserved;
790 __le16 Remaining;
791 __le16 ByteCount;
792} __attribute__((packed)) READX_REQ;
702 793
703typedef struct smb_com_read_req { 794typedef struct smb_com_read_req {
704 struct smb_hdr hdr; /* wct = 12 */ 795 struct smb_hdr hdr; /* wct = 12 */
@@ -713,7 +804,7 @@ typedef struct smb_com_read_req {
713 __le16 Remaining; 804 __le16 Remaining;
714 __le32 OffsetHigh; 805 __le32 OffsetHigh;
715 __le16 ByteCount; 806 __le16 ByteCount;
716} READ_REQ; 807} __attribute__((packed)) READ_REQ;
717 808
718typedef struct smb_com_read_rsp { 809typedef struct smb_com_read_rsp {
719 struct smb_hdr hdr; /* wct = 12 */ 810 struct smb_hdr hdr; /* wct = 12 */
@@ -730,7 +821,7 @@ typedef struct smb_com_read_rsp {
730 __u16 ByteCount; 821 __u16 ByteCount;
731 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ 822 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
732 char Data[1]; 823 char Data[1];
733} READ_RSP; 824} __attribute__((packed)) READ_RSP;
734 825
735typedef struct locking_andx_range { 826typedef struct locking_andx_range {
736 __le16 Pid; 827 __le16 Pid;
@@ -739,7 +830,7 @@ typedef struct locking_andx_range {
739 __le32 OffsetLow; 830 __le32 OffsetLow;
740 __le32 LengthHigh; 831 __le32 LengthHigh;
741 __le32 LengthLow; 832 __le32 LengthLow;
742} LOCKING_ANDX_RANGE; 833} __attribute__((packed)) LOCKING_ANDX_RANGE;
743 834
744#define LOCKING_ANDX_SHARED_LOCK 0x01 835#define LOCKING_ANDX_SHARED_LOCK 0x01
745#define LOCKING_ANDX_OPLOCK_RELEASE 0x02 836#define LOCKING_ANDX_OPLOCK_RELEASE 0x02
@@ -760,7 +851,7 @@ typedef struct smb_com_lock_req {
760 __le16 NumberOfLocks; 851 __le16 NumberOfLocks;
761 __le16 ByteCount; 852 __le16 ByteCount;
762 LOCKING_ANDX_RANGE Locks[1]; 853 LOCKING_ANDX_RANGE Locks[1];
763} LOCK_REQ; 854} __attribute__((packed)) LOCK_REQ;
764 855
765 856
766typedef struct cifs_posix_lock { 857typedef struct cifs_posix_lock {
@@ -770,7 +861,7 @@ typedef struct cifs_posix_lock {
770 __le64 start; 861 __le64 start;
771 __le64 length; 862 __le64 length;
772 /* BB what about additional owner info to identify network client */ 863 /* BB what about additional owner info to identify network client */
773} CIFS_POSIX_LOCK; 864} __attribute__((packed)) CIFS_POSIX_LOCK;
774 865
775typedef struct smb_com_lock_rsp { 866typedef struct smb_com_lock_rsp {
776 struct smb_hdr hdr; /* wct = 2 */ 867 struct smb_hdr hdr; /* wct = 2 */
@@ -778,7 +869,7 @@ typedef struct smb_com_lock_rsp {
778 __u8 AndXReserved; 869 __u8 AndXReserved;
779 __le16 AndXOffset; 870 __le16 AndXOffset;
780 __u16 ByteCount; 871 __u16 ByteCount;
781} LOCK_RSP; 872} __attribute__((packed)) LOCK_RSP;
782 873
783typedef struct smb_com_rename_req { 874typedef struct smb_com_rename_req {
784 struct smb_hdr hdr; /* wct = 1 */ 875 struct smb_hdr hdr; /* wct = 1 */
@@ -788,7 +879,7 @@ typedef struct smb_com_rename_req {
788 unsigned char OldFileName[1]; 879 unsigned char OldFileName[1];
789 /* followed by __u8 BufferFormat2 */ 880 /* followed by __u8 BufferFormat2 */
790 /* followed by NewFileName */ 881 /* followed by NewFileName */
791} RENAME_REQ; 882} __attribute__((packed)) RENAME_REQ;
792 883
793 /* copy request flags */ 884 /* copy request flags */
794#define COPY_MUST_BE_FILE 0x0001 885#define COPY_MUST_BE_FILE 0x0001
@@ -808,7 +899,7 @@ typedef struct smb_com_copy_req {
808 unsigned char OldFileName[1]; 899 unsigned char OldFileName[1];
809 /* followed by __u8 BufferFormat2 */ 900 /* followed by __u8 BufferFormat2 */
810 /* followed by NewFileName string */ 901 /* followed by NewFileName string */
811} COPY_REQ; 902} __attribute__((packed)) COPY_REQ;
812 903
813typedef struct smb_com_copy_rsp { 904typedef struct smb_com_copy_rsp {
814 struct smb_hdr hdr; /* wct = 1 */ 905 struct smb_hdr hdr; /* wct = 1 */
@@ -816,7 +907,7 @@ typedef struct smb_com_copy_rsp {
816 __u16 ByteCount; /* may be zero */ 907 __u16 ByteCount; /* may be zero */
817 __u8 BufferFormat; /* 0x04 - only present if errored file follows */ 908 __u8 BufferFormat; /* 0x04 - only present if errored file follows */
818 unsigned char ErrorFileName[1]; /* only present if error in copy */ 909 unsigned char ErrorFileName[1]; /* only present if error in copy */
819} COPY_RSP; 910} __attribute__((packed)) COPY_RSP;
820 911
821#define CREATE_HARD_LINK 0x103 912#define CREATE_HARD_LINK 0x103
822#define MOVEFILE_COPY_ALLOWED 0x0002 913#define MOVEFILE_COPY_ALLOWED 0x0002
@@ -832,12 +923,12 @@ typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */
832 unsigned char OldFileName[1]; 923 unsigned char OldFileName[1];
833 /* followed by __u8 BufferFormat2 */ 924 /* followed by __u8 BufferFormat2 */
834 /* followed by NewFileName */ 925 /* followed by NewFileName */
835} NT_RENAME_REQ; 926} __attribute__((packed)) NT_RENAME_REQ;
836 927
837typedef struct smb_com_rename_rsp { 928typedef struct smb_com_rename_rsp {
838 struct smb_hdr hdr; /* wct = 0 */ 929 struct smb_hdr hdr; /* wct = 0 */
839 __u16 ByteCount; /* bct = 0 */ 930 __u16 ByteCount; /* bct = 0 */
840} RENAME_RSP; 931} __attribute__((packed)) RENAME_RSP;
841 932
842typedef struct smb_com_delete_file_req { 933typedef struct smb_com_delete_file_req {
843 struct smb_hdr hdr; /* wct = 1 */ 934 struct smb_hdr hdr; /* wct = 1 */
@@ -845,36 +936,52 @@ typedef struct smb_com_delete_file_req {
845 __le16 ByteCount; 936 __le16 ByteCount;
846 __u8 BufferFormat; /* 4 = ASCII */ 937 __u8 BufferFormat; /* 4 = ASCII */
847 unsigned char fileName[1]; 938 unsigned char fileName[1];
848} DELETE_FILE_REQ; 939} __attribute__((packed)) DELETE_FILE_REQ;
849 940
850typedef struct smb_com_delete_file_rsp { 941typedef struct smb_com_delete_file_rsp {
851 struct smb_hdr hdr; /* wct = 0 */ 942 struct smb_hdr hdr; /* wct = 0 */
852 __u16 ByteCount; /* bct = 0 */ 943 __u16 ByteCount; /* bct = 0 */
853} DELETE_FILE_RSP; 944} __attribute__((packed)) DELETE_FILE_RSP;
854 945
855typedef struct smb_com_delete_directory_req { 946typedef struct smb_com_delete_directory_req {
856 struct smb_hdr hdr; /* wct = 0 */ 947 struct smb_hdr hdr; /* wct = 0 */
857 __le16 ByteCount; 948 __le16 ByteCount;
858 __u8 BufferFormat; /* 4 = ASCII */ 949 __u8 BufferFormat; /* 4 = ASCII */
859 unsigned char DirName[1]; 950 unsigned char DirName[1];
860} DELETE_DIRECTORY_REQ; 951} __attribute__((packed)) DELETE_DIRECTORY_REQ;
861 952
862typedef struct smb_com_delete_directory_rsp { 953typedef struct smb_com_delete_directory_rsp {
863 struct smb_hdr hdr; /* wct = 0 */ 954 struct smb_hdr hdr; /* wct = 0 */
864 __u16 ByteCount; /* bct = 0 */ 955 __u16 ByteCount; /* bct = 0 */
865} DELETE_DIRECTORY_RSP; 956} __attribute__((packed)) DELETE_DIRECTORY_RSP;
866 957
867typedef struct smb_com_create_directory_req { 958typedef struct smb_com_create_directory_req {
868 struct smb_hdr hdr; /* wct = 0 */ 959 struct smb_hdr hdr; /* wct = 0 */
869 __le16 ByteCount; 960 __le16 ByteCount;
870 __u8 BufferFormat; /* 4 = ASCII */ 961 __u8 BufferFormat; /* 4 = ASCII */
871 unsigned char DirName[1]; 962 unsigned char DirName[1];
872} CREATE_DIRECTORY_REQ; 963} __attribute__((packed)) CREATE_DIRECTORY_REQ;
873 964
874typedef struct smb_com_create_directory_rsp { 965typedef struct smb_com_create_directory_rsp {
875 struct smb_hdr hdr; /* wct = 0 */ 966 struct smb_hdr hdr; /* wct = 0 */
876 __u16 ByteCount; /* bct = 0 */ 967 __u16 ByteCount; /* bct = 0 */
877} CREATE_DIRECTORY_RSP; 968} __attribute__((packed)) CREATE_DIRECTORY_RSP;
969
970typedef struct smb_com_query_information_req {
971 struct smb_hdr hdr; /* wct = 0 */
972 __le16 ByteCount; /* 1 + namelen + 1 */
973 __u8 BufferFormat; /* 4 = ASCII */
974 unsigned char FileName[1];
975} __attribute__((packed)) QUERY_INFORMATION_REQ;
976
977typedef struct smb_com_query_information_rsp {
978 struct smb_hdr hdr; /* wct = 10 */
979 __le16 attr;
980 __le32 last_write_time;
981 __le32 size;
982 __u16 reserved[5];
983 __le16 ByteCount; /* bcc = 0 */
984} __attribute__((packed)) QUERY_INFORMATION_RSP;
878 985
879typedef struct smb_com_setattr_req { 986typedef struct smb_com_setattr_req {
880 struct smb_hdr hdr; /* wct = 8 */ 987 struct smb_hdr hdr; /* wct = 8 */
@@ -885,12 +992,12 @@ typedef struct smb_com_setattr_req {
885 __u16 ByteCount; 992 __u16 ByteCount;
886 __u8 BufferFormat; /* 4 = ASCII */ 993 __u8 BufferFormat; /* 4 = ASCII */
887 unsigned char fileName[1]; 994 unsigned char fileName[1];
888} SETATTR_REQ; 995} __attribute__((packed)) SETATTR_REQ;
889 996
890typedef struct smb_com_setattr_rsp { 997typedef struct smb_com_setattr_rsp {
891 struct smb_hdr hdr; /* wct = 0 */ 998 struct smb_hdr hdr; /* wct = 0 */
892 __u16 ByteCount; /* bct = 0 */ 999 __u16 ByteCount; /* bct = 0 */
893} SETATTR_RSP; 1000} __attribute__((packed)) SETATTR_RSP;
894 1001
895/* empty wct response to setattr */ 1002/* empty wct response to setattr */
896 1003
@@ -920,7 +1027,7 @@ typedef struct smb_com_transaction_ioctl_req {
920 __le16 ByteCount; 1027 __le16 ByteCount;
921 __u8 Pad[3]; 1028 __u8 Pad[3];
922 __u8 Data[1]; 1029 __u8 Data[1];
923} TRANSACT_IOCTL_REQ; 1030} __attribute__((packed)) TRANSACT_IOCTL_REQ;
924 1031
925typedef struct smb_com_transaction_ioctl_rsp { 1032typedef struct smb_com_transaction_ioctl_rsp {
926 struct smb_hdr hdr; /* wct = 19 */ 1033 struct smb_hdr hdr; /* wct = 19 */
@@ -937,7 +1044,7 @@ typedef struct smb_com_transaction_ioctl_rsp {
937 __le16 ReturnedDataLen; 1044 __le16 ReturnedDataLen;
938 __u16 ByteCount; 1045 __u16 ByteCount;
939 __u8 Pad[3]; 1046 __u8 Pad[3];
940} TRANSACT_IOCTL_RSP; 1047} __attribute__((packed)) TRANSACT_IOCTL_RSP;
941 1048
942typedef struct smb_com_transaction_change_notify_req { 1049typedef struct smb_com_transaction_change_notify_req {
943 struct smb_hdr hdr; /* wct = 23 */ 1050 struct smb_hdr hdr; /* wct = 23 */
@@ -961,7 +1068,7 @@ typedef struct smb_com_transaction_change_notify_req {
961 __le16 ByteCount; 1068 __le16 ByteCount;
962/* __u8 Pad[3];*/ 1069/* __u8 Pad[3];*/
963/* __u8 Data[1];*/ 1070/* __u8 Data[1];*/
964} TRANSACT_CHANGE_NOTIFY_REQ; 1071} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ;
965 1072
966typedef struct smb_com_transaction_change_notify_rsp { 1073typedef struct smb_com_transaction_change_notify_rsp {
967 struct smb_hdr hdr; /* wct = 18 */ 1074 struct smb_hdr hdr; /* wct = 18 */
@@ -977,7 +1084,7 @@ typedef struct smb_com_transaction_change_notify_rsp {
977 __u8 SetupCount; /* 0 */ 1084 __u8 SetupCount; /* 0 */
978 __u16 ByteCount; 1085 __u16 ByteCount;
979 /* __u8 Pad[3]; */ 1086 /* __u8 Pad[3]; */
980} TRANSACT_CHANGE_NOTIFY_RSP; 1087} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_RSP;
981/* Completion Filter flags for Notify */ 1088/* Completion Filter flags for Notify */
982#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 1089#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
983#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 1090#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
@@ -1008,7 +1115,7 @@ struct file_notify_information {
1008 __le32 Action; 1115 __le32 Action;
1009 __le32 FileNameLength; 1116 __le32 FileNameLength;
1010 __u8 FileName[0]; 1117 __u8 FileName[0];
1011}; 1118} __attribute__((packed));
1012 1119
1013struct reparse_data { 1120struct reparse_data {
1014 __u32 ReparseTag; 1121 __u32 ReparseTag;
@@ -1019,7 +1126,7 @@ struct reparse_data {
1019 __u16 TargetNameOffset; 1126 __u16 TargetNameOffset;
1020 __u16 TargetNameLen; 1127 __u16 TargetNameLen;
1021 char LinkNamesBuf[1]; 1128 char LinkNamesBuf[1];
1022}; 1129} __attribute__((packed));
1023 1130
1024struct cifs_quota_data { 1131struct cifs_quota_data {
1025 __u32 rsrvd1; /* 0 */ 1132 __u32 rsrvd1; /* 0 */
@@ -1029,7 +1136,7 @@ struct cifs_quota_data {
1029 __u64 soft_limit; 1136 __u64 soft_limit;
1030 __u64 hard_limit; 1137 __u64 hard_limit;
1031 char sid[1]; /* variable size? */ 1138 char sid[1]; /* variable size? */
1032}; 1139} __attribute__((packed));
1033 1140
1034/* quota sub commands */ 1141/* quota sub commands */
1035#define QUOTA_LIST_CONTINUE 0 1142#define QUOTA_LIST_CONTINUE 0
@@ -1055,12 +1162,12 @@ struct trans2_req {
1055 __u8 Reserved3; 1162 __u8 Reserved3;
1056 __le16 SubCommand; /* 1st setup word - SetupCount words follow */ 1163 __le16 SubCommand; /* 1st setup word - SetupCount words follow */
1057 __le16 ByteCount; 1164 __le16 ByteCount;
1058}; 1165} __attribute__((packed));
1059 1166
1060struct smb_t2_req { 1167struct smb_t2_req {
1061 struct smb_hdr hdr; 1168 struct smb_hdr hdr;
1062 struct trans2_req t2_req; 1169 struct trans2_req t2_req;
1063}; 1170} __attribute__((packed));
1064 1171
1065struct trans2_resp { 1172struct trans2_resp {
1066 /* struct smb_hdr hdr precedes. Note wct = 10 + setup count */ 1173 /* struct smb_hdr hdr precedes. Note wct = 10 + setup count */
@@ -1079,12 +1186,12 @@ struct trans2_resp {
1079 __u16 ByteCount; 1186 __u16 ByteCount;
1080 __u16 Reserved2;*/ 1187 __u16 Reserved2;*/
1081 /* data area follows */ 1188 /* data area follows */
1082}; 1189} __attribute__((packed));
1083 1190
1084struct smb_t2_rsp { 1191struct smb_t2_rsp {
1085 struct smb_hdr hdr; 1192 struct smb_hdr hdr;
1086 struct trans2_resp t2_rsp; 1193 struct trans2_resp t2_rsp;
1087}; 1194} __attribute__((packed));
1088 1195
1089/* PathInfo/FileInfo infolevels */ 1196/* PathInfo/FileInfo infolevels */
1090#define SMB_INFO_STANDARD 1 1197#define SMB_INFO_STANDARD 1
@@ -1171,14 +1278,14 @@ typedef struct smb_com_transaction2_qpi_req {
1171 __le16 InformationLevel; 1278 __le16 InformationLevel;
1172 __u32 Reserved4; 1279 __u32 Reserved4;
1173 char FileName[1]; 1280 char FileName[1];
1174} TRANSACTION2_QPI_REQ; 1281} __attribute__((packed)) TRANSACTION2_QPI_REQ;
1175 1282
1176typedef struct smb_com_transaction2_qpi_rsp { 1283typedef struct smb_com_transaction2_qpi_rsp {
1177 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1284 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1178 struct trans2_resp t2; 1285 struct trans2_resp t2;
1179 __u16 ByteCount; 1286 __u16 ByteCount;
1180 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ 1287 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */
1181} TRANSACTION2_QPI_RSP; 1288} __attribute__((packed)) TRANSACTION2_QPI_RSP;
1182 1289
1183typedef struct smb_com_transaction2_spi_req { 1290typedef struct smb_com_transaction2_spi_req {
1184 struct smb_hdr hdr; /* wct = 15 */ 1291 struct smb_hdr hdr; /* wct = 15 */
@@ -1204,21 +1311,21 @@ typedef struct smb_com_transaction2_spi_req {
1204 __le16 InformationLevel; 1311 __le16 InformationLevel;
1205 __u32 Reserved4; 1312 __u32 Reserved4;
1206 char FileName[1]; 1313 char FileName[1];
1207} TRANSACTION2_SPI_REQ; 1314} __attribute__((packed)) TRANSACTION2_SPI_REQ;
1208 1315
1209typedef struct smb_com_transaction2_spi_rsp { 1316typedef struct smb_com_transaction2_spi_rsp {
1210 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1317 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1211 struct trans2_resp t2; 1318 struct trans2_resp t2;
1212 __u16 ByteCount; 1319 __u16 ByteCount;
1213 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ 1320 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */
1214} TRANSACTION2_SPI_RSP; 1321} __attribute__((packed)) TRANSACTION2_SPI_RSP;
1215 1322
1216struct set_file_rename { 1323struct set_file_rename {
1217 __le32 overwrite; /* 1 = overwrite dest */ 1324 __le32 overwrite; /* 1 = overwrite dest */
1218 __u32 root_fid; /* zero */ 1325 __u32 root_fid; /* zero */
1219 __le32 target_name_len; 1326 __le32 target_name_len;
1220 char target_name[0]; /* Must be unicode */ 1327 char target_name[0]; /* Must be unicode */
1221}; 1328} __attribute__((packed));
1222 1329
1223struct smb_com_transaction2_sfi_req { 1330struct smb_com_transaction2_sfi_req {
1224 struct smb_hdr hdr; /* wct = 15 */ 1331 struct smb_hdr hdr; /* wct = 15 */
@@ -1244,7 +1351,7 @@ struct smb_com_transaction2_sfi_req {
1244 __u16 Fid; 1351 __u16 Fid;
1245 __le16 InformationLevel; 1352 __le16 InformationLevel;
1246 __u16 Reserved4; 1353 __u16 Reserved4;
1247}; 1354} __attribute__((packed));
1248 1355
1249struct smb_com_transaction2_sfi_rsp { 1356struct smb_com_transaction2_sfi_rsp {
1250 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1357 struct smb_hdr hdr; /* wct = 10 + SetupCount */
@@ -1252,7 +1359,7 @@ struct smb_com_transaction2_sfi_rsp {
1252 __u16 ByteCount; 1359 __u16 ByteCount;
1253 __u16 Reserved2; /* parameter word reserved - 1360 __u16 Reserved2; /* parameter word reserved -
1254 present for infolevels > 100 */ 1361 present for infolevels > 100 */
1255}; 1362} __attribute__((packed));
1256 1363
1257struct smb_t2_qfi_req { 1364struct smb_t2_qfi_req {
1258 struct smb_hdr hdr; 1365 struct smb_hdr hdr;
@@ -1260,7 +1367,7 @@ struct smb_t2_qfi_req {
1260 __u8 Pad; 1367 __u8 Pad;
1261 __u16 Fid; 1368 __u16 Fid;
1262 __le16 InformationLevel; 1369 __le16 InformationLevel;
1263}; 1370} __attribute__((packed));
1264 1371
1265struct smb_t2_qfi_rsp { 1372struct smb_t2_qfi_rsp {
1266 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1373 struct smb_hdr hdr; /* wct = 10 + SetupCount */
@@ -1268,7 +1375,7 @@ struct smb_t2_qfi_rsp {
1268 __u16 ByteCount; 1375 __u16 ByteCount;
1269 __u16 Reserved2; /* parameter word reserved - 1376 __u16 Reserved2; /* parameter word reserved -
1270 present for infolevels > 100 */ 1377 present for infolevels > 100 */
1271}; 1378} __attribute__((packed));
1272 1379
1273/* 1380/*
1274 * Flags on T2 FINDFIRST and FINDNEXT 1381 * Flags on T2 FINDFIRST and FINDNEXT
@@ -1310,13 +1417,13 @@ typedef struct smb_com_transaction2_ffirst_req {
1310 __le16 InformationLevel; 1417 __le16 InformationLevel;
1311 __le32 SearchStorageType; 1418 __le32 SearchStorageType;
1312 char FileName[1]; 1419 char FileName[1];
1313} TRANSACTION2_FFIRST_REQ; 1420} __attribute__((packed)) TRANSACTION2_FFIRST_REQ;
1314 1421
1315typedef struct smb_com_transaction2_ffirst_rsp { 1422typedef struct smb_com_transaction2_ffirst_rsp {
1316 struct smb_hdr hdr; /* wct = 10 */ 1423 struct smb_hdr hdr; /* wct = 10 */
1317 struct trans2_resp t2; 1424 struct trans2_resp t2;
1318 __u16 ByteCount; 1425 __u16 ByteCount;
1319} TRANSACTION2_FFIRST_RSP; 1426} __attribute__((packed)) TRANSACTION2_FFIRST_RSP;
1320 1427
1321typedef struct smb_com_transaction2_ffirst_rsp_parms { 1428typedef struct smb_com_transaction2_ffirst_rsp_parms {
1322 __u16 SearchHandle; 1429 __u16 SearchHandle;
@@ -1324,7 +1431,7 @@ typedef struct smb_com_transaction2_ffirst_rsp_parms {
1324 __le16 EndofSearch; 1431 __le16 EndofSearch;
1325 __le16 EAErrorOffset; 1432 __le16 EAErrorOffset;
1326 __le16 LastNameOffset; 1433 __le16 LastNameOffset;
1327} T2_FFIRST_RSP_PARMS; 1434} __attribute__((packed)) T2_FFIRST_RSP_PARMS;
1328 1435
1329typedef struct smb_com_transaction2_fnext_req { 1436typedef struct smb_com_transaction2_fnext_req {
1330 struct smb_hdr hdr; /* wct = 15 */ 1437 struct smb_hdr hdr; /* wct = 15 */
@@ -1352,20 +1459,20 @@ typedef struct smb_com_transaction2_fnext_req {
1352 __u32 ResumeKey; 1459 __u32 ResumeKey;
1353 __le16 SearchFlags; 1460 __le16 SearchFlags;
1354 char ResumeFileName[1]; 1461 char ResumeFileName[1];
1355} TRANSACTION2_FNEXT_REQ; 1462} __attribute__((packed)) TRANSACTION2_FNEXT_REQ;
1356 1463
1357typedef struct smb_com_transaction2_fnext_rsp { 1464typedef struct smb_com_transaction2_fnext_rsp {
1358 struct smb_hdr hdr; /* wct = 10 */ 1465 struct smb_hdr hdr; /* wct = 10 */
1359 struct trans2_resp t2; 1466 struct trans2_resp t2;
1360 __u16 ByteCount; 1467 __u16 ByteCount;
1361} TRANSACTION2_FNEXT_RSP; 1468} __attribute__((packed)) TRANSACTION2_FNEXT_RSP;
1362 1469
1363typedef struct smb_com_transaction2_fnext_rsp_parms { 1470typedef struct smb_com_transaction2_fnext_rsp_parms {
1364 __le16 SearchCount; 1471 __le16 SearchCount;
1365 __le16 EndofSearch; 1472 __le16 EndofSearch;
1366 __le16 EAErrorOffset; 1473 __le16 EAErrorOffset;
1367 __le16 LastNameOffset; 1474 __le16 LastNameOffset;
1368} T2_FNEXT_RSP_PARMS; 1475} __attribute__((packed)) T2_FNEXT_RSP_PARMS;
1369 1476
1370/* QFSInfo Levels */ 1477/* QFSInfo Levels */
1371#define SMB_INFO_ALLOCATION 1 1478#define SMB_INFO_ALLOCATION 1
@@ -1402,14 +1509,51 @@ typedef struct smb_com_transaction2_qfsi_req {
1402 __le16 ByteCount; 1509 __le16 ByteCount;
1403 __u8 Pad; 1510 __u8 Pad;
1404 __le16 InformationLevel; 1511 __le16 InformationLevel;
1405} TRANSACTION2_QFSI_REQ; 1512} __attribute__((packed)) TRANSACTION2_QFSI_REQ;
1406 1513
1407typedef struct smb_com_transaction_qfsi_rsp { 1514typedef struct smb_com_transaction_qfsi_rsp {
1408 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1515 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1409 struct trans2_resp t2; 1516 struct trans2_resp t2;
1410 __u16 ByteCount; 1517 __u16 ByteCount;
1411 __u8 Pad; /* may be three bytes *//* followed by data area */ 1518 __u8 Pad; /* may be three bytes *//* followed by data area */
1412} TRANSACTION2_QFSI_RSP; 1519} __attribute__((packed)) TRANSACTION2_QFSI_RSP;
1520
1521
1522/* SETFSInfo Levels */
1523#define SMB_SET_CIFS_UNIX_INFO 0x200
1524typedef struct smb_com_transaction2_setfsi_req {
1525 struct smb_hdr hdr; /* wct = 15 */
1526 __le16 TotalParameterCount;
1527 __le16 TotalDataCount;
1528 __le16 MaxParameterCount;
1529 __le16 MaxDataCount;
1530 __u8 MaxSetupCount;
1531 __u8 Reserved;
1532 __le16 Flags;
1533 __le32 Timeout;
1534 __u16 Reserved2;
1535 __le16 ParameterCount; /* 4 */
1536 __le16 ParameterOffset;
1537 __le16 DataCount; /* 12 */
1538 __le16 DataOffset;
1539 __u8 SetupCount; /* one */
1540 __u8 Reserved3;
1541 __le16 SubCommand; /* TRANS2_SET_FS_INFORMATION */
1542 __le16 ByteCount;
1543 __u8 Pad;
1544 __u16 FileNum; /* Parameters start. */
1545 __le16 InformationLevel;/* Parameters end. */
1546 __le16 ClientUnixMajor; /* Data start. */
1547 __le16 ClientUnixMinor;
1548 __le64 ClientUnixCap; /* Data end */
1549} __attribute__((packed)) TRANSACTION2_SETFSI_REQ;
1550
1551typedef struct smb_com_transaction2_setfsi_rsp {
1552 struct smb_hdr hdr; /* wct = 10 */
1553 struct trans2_resp t2;
1554 __u16 ByteCount;
1555} __attribute__((packed)) TRANSACTION2_SETFSI_RSP;
1556
1413 1557
1414typedef struct smb_com_transaction2_get_dfs_refer_req { 1558typedef struct smb_com_transaction2_get_dfs_refer_req {
1415 struct smb_hdr hdr; /* wct = 15 */ 1559 struct smb_hdr hdr; /* wct = 15 */
@@ -1433,7 +1577,7 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
1433 __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ 1577 __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */
1434 __le16 MaxReferralLevel; 1578 __le16 MaxReferralLevel;
1435 char RequestFileName[1]; 1579 char RequestFileName[1];
1436} TRANSACTION2_GET_DFS_REFER_REQ; 1580} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
1437 1581
1438typedef struct dfs_referral_level_3 { 1582typedef struct dfs_referral_level_3 {
1439 __le16 VersionNumber; 1583 __le16 VersionNumber;
@@ -1445,7 +1589,7 @@ typedef struct dfs_referral_level_3 {
1445 __le16 DfsPathOffset; 1589 __le16 DfsPathOffset;
1446 __le16 DfsAlternatePathOffset; 1590 __le16 DfsAlternatePathOffset;
1447 __le16 NetworkAddressOffset; 1591 __le16 NetworkAddressOffset;
1448} REFERRAL3; 1592} __attribute__((packed)) REFERRAL3;
1449 1593
1450typedef struct smb_com_transaction_get_dfs_refer_rsp { 1594typedef struct smb_com_transaction_get_dfs_refer_rsp {
1451 struct smb_hdr hdr; /* wct = 10 */ 1595 struct smb_hdr hdr; /* wct = 10 */
@@ -1458,7 +1602,7 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
1458 __u16 Pad2; 1602 __u16 Pad2;
1459 REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ 1603 REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */
1460 /* followed by the strings pointed to by the referral structures */ 1604 /* followed by the strings pointed to by the referral structures */
1461} TRANSACTION2_GET_DFS_REFER_RSP; 1605} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_RSP;
1462 1606
1463/* DFS Flags */ 1607/* DFS Flags */
1464#define DFSREF_REFERRAL_SERVER 0x0001 1608#define DFSREF_REFERRAL_SERVER 0x0001
@@ -1512,7 +1656,7 @@ struct serverInfo {
1512 unsigned char versionMinor; 1656 unsigned char versionMinor;
1513 unsigned long type; 1657 unsigned long type;
1514 unsigned int commentOffset; 1658 unsigned int commentOffset;
1515}; 1659} __attribute__((packed));
1516 1660
1517/* 1661/*
1518 * The following structure is the format of the data returned on a NetShareEnum 1662 * The following structure is the format of the data returned on a NetShareEnum
@@ -1524,39 +1668,55 @@ struct shareInfo {
1524 char pad; 1668 char pad;
1525 unsigned short type; 1669 unsigned short type;
1526 unsigned int commentOffset; 1670 unsigned int commentOffset;
1527}; 1671} __attribute__((packed));
1528 1672
1529struct aliasInfo { 1673struct aliasInfo {
1530 char aliasName[9]; 1674 char aliasName[9];
1531 char pad; 1675 char pad;
1532 unsigned int commentOffset; 1676 unsigned int commentOffset;
1533 unsigned char type[2]; 1677 unsigned char type[2];
1534}; 1678} __attribute__((packed));
1535 1679
1536struct aliasInfo92 { 1680struct aliasInfo92 {
1537 int aliasNameOffset; 1681 int aliasNameOffset;
1538 int serverNameOffset; 1682 int serverNameOffset;
1539 int shareNameOffset; 1683 int shareNameOffset;
1540}; 1684} __attribute__((packed));
1541 1685
1542typedef struct { 1686typedef struct {
1543 __le64 TotalAllocationUnits; 1687 __le64 TotalAllocationUnits;
1544 __le64 FreeAllocationUnits; 1688 __le64 FreeAllocationUnits;
1545 __le32 SectorsPerAllocationUnit; 1689 __le32 SectorsPerAllocationUnit;
1546 __le32 BytesPerSector; 1690 __le32 BytesPerSector;
1547} FILE_SYSTEM_INFO; /* size info, level 0x103 */ 1691} __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */
1692
1693typedef struct {
1694 __le32 fsid;
1695 __le32 SectorsPerAllocationUnit;
1696 __le32 TotalAllocationUnits;
1697 __le32 FreeAllocationUnits;
1698 __le16 BytesPerSector;
1699} __attribute__((packed)) FILE_SYSTEM_ALLOC_INFO;
1548 1700
1549typedef struct { 1701typedef struct {
1550 __le16 MajorVersionNumber; 1702 __le16 MajorVersionNumber;
1551 __le16 MinorVersionNumber; 1703 __le16 MinorVersionNumber;
1552 __le64 Capability; 1704 __le64 Capability;
1553} FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ 1705} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */
1706
1707/* Version numbers for CIFS UNIX major and minor. */
1708#define CIFS_UNIX_MAJOR_VERSION 1
1709#define CIFS_UNIX_MINOR_VERSION 0
1710
1554/* Linux/Unix extensions capability flags */ 1711/* Linux/Unix extensions capability flags */
1555#define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ 1712#define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */
1556#define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */ 1713#define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */
1557#define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ 1714#define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */
1558#define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ 1715#define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */
1716#define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Use POSIX pathnames on the wire. */
1717
1559#define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */ 1718#define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */
1719
1560typedef struct { 1720typedef struct {
1561 /* For undefined recommended transfer size return -1 in that field */ 1721 /* For undefined recommended transfer size return -1 in that field */
1562 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ 1722 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */
@@ -1577,7 +1737,7 @@ typedef struct {
1577 __le64 FileSysIdentifier; /* fsid */ 1737 __le64 FileSysIdentifier; /* fsid */
1578 /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */ 1738 /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
1579 /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ 1739 /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */
1580} FILE_SYSTEM_POSIX_INFO; 1740} __attribute__((packed)) FILE_SYSTEM_POSIX_INFO;
1581 1741
1582/* DeviceType Flags */ 1742/* DeviceType Flags */
1583#define FILE_DEVICE_CD_ROM 0x00000002 1743#define FILE_DEVICE_CD_ROM 0x00000002
@@ -1602,14 +1762,14 @@ typedef struct {
1602typedef struct { 1762typedef struct {
1603 __le32 DeviceType; 1763 __le32 DeviceType;
1604 __le32 DeviceCharacteristics; 1764 __le32 DeviceCharacteristics;
1605} FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ 1765} __attribute__((packed)) FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */
1606 1766
1607typedef struct { 1767typedef struct {
1608 __le32 Attributes; 1768 __le32 Attributes;
1609 __le32 MaxPathNameComponentLength; 1769 __le32 MaxPathNameComponentLength;
1610 __le32 FileSystemNameLen; 1770 __le32 FileSystemNameLen;
1611 char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */ 1771 char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */
1612} FILE_SYSTEM_ATTRIBUTE_INFO; 1772} __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO;
1613 1773
1614/******************************************************************************/ 1774/******************************************************************************/
1615/* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */ 1775/* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */
@@ -1636,7 +1796,7 @@ typedef struct { /* data block encoding of response to level 263 QPathInfo */
1636 __le32 AlignmentRequirement; 1796 __le32 AlignmentRequirement;
1637 __le32 FileNameLength; 1797 __le32 FileNameLength;
1638 char FileName[1]; 1798 char FileName[1];
1639} FILE_ALL_INFO; /* level 0x107 QPathInfo */ 1799} __attribute__((packed)) FILE_ALL_INFO; /* level 0x107 QPathInfo */
1640 1800
1641/* defines for enumerating possible values of the Unix type field below */ 1801/* defines for enumerating possible values of the Unix type field below */
1642#define UNIX_FILE 0 1802#define UNIX_FILE 0
@@ -1660,11 +1820,11 @@ typedef struct {
1660 __u64 UniqueId; 1820 __u64 UniqueId;
1661 __le64 Permissions; 1821 __le64 Permissions;
1662 __le64 Nlinks; 1822 __le64 Nlinks;
1663} FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */ 1823} __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */
1664 1824
1665typedef struct { 1825typedef struct {
1666 char LinkDest[1]; 1826 char LinkDest[1];
1667} FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */ 1827} __attribute__((packed)) FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */
1668 1828
1669/* The following three structures are needed only for 1829/* The following three structures are needed only for
1670 setting time to NT4 and some older servers via 1830 setting time to NT4 and some older servers via
@@ -1673,13 +1833,13 @@ typedef struct {
1673 __u16 Day:5; 1833 __u16 Day:5;
1674 __u16 Month:4; 1834 __u16 Month:4;
1675 __u16 Year:7; 1835 __u16 Year:7;
1676} SMB_DATE; 1836} __attribute__((packed)) SMB_DATE;
1677 1837
1678typedef struct { 1838typedef struct {
1679 __u16 TwoSeconds:5; 1839 __u16 TwoSeconds:5;
1680 __u16 Minutes:6; 1840 __u16 Minutes:6;
1681 __u16 Hours:5; 1841 __u16 Hours:5;
1682} SMB_TIME; 1842} __attribute__((packed)) SMB_TIME;
1683 1843
1684typedef struct { 1844typedef struct {
1685 __le16 CreationDate; /* SMB Date see above */ 1845 __le16 CreationDate; /* SMB Date see above */
@@ -1692,7 +1852,7 @@ typedef struct {
1692 __le32 AllocationSize; 1852 __le32 AllocationSize;
1693 __le16 Attributes; /* verify not u32 */ 1853 __le16 Attributes; /* verify not u32 */
1694 __le32 EASize; 1854 __le32 EASize;
1695} FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */ 1855} __attribute__((packed)) FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */
1696 1856
1697typedef struct { 1857typedef struct {
1698 __le64 CreationTime; 1858 __le64 CreationTime;
@@ -1701,19 +1861,19 @@ typedef struct {
1701 __le64 ChangeTime; 1861 __le64 ChangeTime;
1702 __le32 Attributes; 1862 __le32 Attributes;
1703 __u32 Pad; 1863 __u32 Pad;
1704} FILE_BASIC_INFO; /* size info, level 0x101 */ 1864} __attribute__((packed)) FILE_BASIC_INFO; /* size info, level 0x101 */
1705 1865
1706struct file_allocation_info { 1866struct file_allocation_info {
1707 __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ 1867 __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */
1708}; /* size used on disk, level 0x103 for set, 0x105 for query */ 1868} __attribute__((packed)); /* size used on disk, level 0x103 for set, 0x105 for query */
1709 1869
1710struct file_end_of_file_info { 1870struct file_end_of_file_info {
1711 __le64 FileSize; /* offset to end of file */ 1871 __le64 FileSize; /* offset to end of file */
1712}; /* size info, level 0x104 for set, 0x106 for query */ 1872} __attribute__((packed)); /* size info, level 0x104 for set, 0x106 for query */
1713 1873
1714struct file_alt_name_info { 1874struct file_alt_name_info {
1715 __u8 alt_name[1]; 1875 __u8 alt_name[1];
1716}; /* level 0x0108 */ 1876} __attribute__((packed)); /* level 0x0108 */
1717 1877
1718struct file_stream_info { 1878struct file_stream_info {
1719 __le32 number_of_streams; /* BB check sizes and verify location */ 1879 __le32 number_of_streams; /* BB check sizes and verify location */
@@ -1730,7 +1890,7 @@ struct file_compression_info {
1730 __u8 ch_shift; 1890 __u8 ch_shift;
1731 __u8 cl_shift; 1891 __u8 cl_shift;
1732 __u8 pad[3]; 1892 __u8 pad[3];
1733}; /* level 0x10b */ 1893} __attribute__((packed)); /* level 0x10b */
1734 1894
1735/* POSIX ACL set/query path info structures */ 1895/* POSIX ACL set/query path info structures */
1736#define CIFS_ACL_VERSION 1 1896#define CIFS_ACL_VERSION 1
@@ -1738,7 +1898,7 @@ struct cifs_posix_ace { /* access control entry (ACE) */
1738 __u8 cifs_e_tag; 1898 __u8 cifs_e_tag;
1739 __u8 cifs_e_perm; 1899 __u8 cifs_e_perm;
1740 __le64 cifs_uid; /* or gid */ 1900 __le64 cifs_uid; /* or gid */
1741}; 1901} __attribute__((packed));
1742 1902
1743struct cifs_posix_acl { /* access conrol list (ACL) */ 1903struct cifs_posix_acl { /* access conrol list (ACL) */
1744 __le16 version; 1904 __le16 version;
@@ -1747,7 +1907,7 @@ struct cifs_posix_acl { /* access conrol list (ACL) */
1747 struct cifs_posix_ace ace_array[0]; 1907 struct cifs_posix_ace ace_array[0];
1748 /* followed by 1908 /* followed by
1749 struct cifs_posix_ace default_ace_arraay[] */ 1909 struct cifs_posix_ace default_ace_arraay[] */
1750}; /* level 0x204 */ 1910} __attribute__((packed)); /* level 0x204 */
1751 1911
1752/* types of access control entries already defined in posix_acl.h */ 1912/* types of access control entries already defined in posix_acl.h */
1753/* #define CIFS_POSIX_ACL_USER_OBJ 0x01 1913/* #define CIFS_POSIX_ACL_USER_OBJ 0x01
@@ -1766,15 +1926,15 @@ struct cifs_posix_acl { /* access conrol list (ACL) */
1766 1926
1767struct file_internal_info { 1927struct file_internal_info {
1768 __u64 UniqueId; /* inode number */ 1928 __u64 UniqueId; /* inode number */
1769}; /* level 0x3ee */ 1929} __attribute__((packed)); /* level 0x3ee */
1770struct file_mode_info { 1930struct file_mode_info {
1771 __le32 Mode; 1931 __le32 Mode;
1772}; /* level 0x3f8 */ 1932} __attribute__((packed)); /* level 0x3f8 */
1773 1933
1774struct file_attrib_tag { 1934struct file_attrib_tag {
1775 __le32 Attribute; 1935 __le32 Attribute;
1776 __le32 ReparseTag; 1936 __le32 ReparseTag;
1777}; /* level 0x40b */ 1937} __attribute__((packed)); /* level 0x40b */
1778 1938
1779 1939
1780/********************************************************/ 1940/********************************************************/
@@ -1798,7 +1958,7 @@ typedef struct {
1798 __le64 Permissions; 1958 __le64 Permissions;
1799 __le64 Nlinks; 1959 __le64 Nlinks;
1800 char FileName[1]; 1960 char FileName[1];
1801} FILE_UNIX_INFO; /* level 0x202 */ 1961} __attribute__((packed)) FILE_UNIX_INFO; /* level 0x202 */
1802 1962
1803typedef struct { 1963typedef struct {
1804 __le32 NextEntryOffset; 1964 __le32 NextEntryOffset;
@@ -1812,7 +1972,7 @@ typedef struct {
1812 __le32 ExtFileAttributes; 1972 __le32 ExtFileAttributes;
1813 __le32 FileNameLength; 1973 __le32 FileNameLength;
1814 char FileName[1]; 1974 char FileName[1];
1815} FILE_DIRECTORY_INFO; /* level 0x101 FF response data area */ 1975} __attribute__((packed)) FILE_DIRECTORY_INFO; /* level 0x101 FF response data area */
1816 1976
1817typedef struct { 1977typedef struct {
1818 __le32 NextEntryOffset; 1978 __le32 NextEntryOffset;
@@ -1827,7 +1987,7 @@ typedef struct {
1827 __le32 FileNameLength; 1987 __le32 FileNameLength;
1828 __le32 EaSize; /* length of the xattrs */ 1988 __le32 EaSize; /* length of the xattrs */
1829 char FileName[1]; 1989 char FileName[1];
1830} FILE_FULL_DIRECTORY_INFO; /* level 0x102 FF response data area */ 1990} __attribute__((packed)) FILE_FULL_DIRECTORY_INFO; /* level 0x102 FF response data area */
1831 1991
1832typedef struct { 1992typedef struct {
1833 __le32 NextEntryOffset; 1993 __le32 NextEntryOffset;
@@ -1844,7 +2004,7 @@ typedef struct {
1844 __le32 Reserved; 2004 __le32 Reserved;
1845 __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/ 2005 __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
1846 char FileName[1]; 2006 char FileName[1];
1847} SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF response data area */ 2007} __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF response data area */
1848 2008
1849typedef struct { 2009typedef struct {
1850 __le32 NextEntryOffset; 2010 __le32 NextEntryOffset;
@@ -1862,18 +2022,18 @@ typedef struct {
1862 __u8 Reserved; 2022 __u8 Reserved;
1863 __u8 ShortName[12]; 2023 __u8 ShortName[12];
1864 char FileName[1]; 2024 char FileName[1];
1865} FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */ 2025} __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */
1866 2026
1867 2027
1868struct gea { 2028struct gea {
1869 unsigned char name_len; 2029 unsigned char name_len;
1870 char name[1]; 2030 char name[1];
1871}; 2031} __attribute__((packed));
1872 2032
1873struct gealist { 2033struct gealist {
1874 unsigned long list_len; 2034 unsigned long list_len;
1875 struct gea list[1]; 2035 struct gea list[1];
1876}; 2036} __attribute__((packed));
1877 2037
1878struct fea { 2038struct fea {
1879 unsigned char EA_flags; 2039 unsigned char EA_flags;
@@ -1881,21 +2041,21 @@ struct fea {
1881 __le16 value_len; 2041 __le16 value_len;
1882 char name[1]; 2042 char name[1];
1883 /* optionally followed by value */ 2043 /* optionally followed by value */
1884}; 2044} __attribute__((packed));
1885/* flags for _FEA.fEA */ 2045/* flags for _FEA.fEA */
1886#define FEA_NEEDEA 0x80 /* need EA bit */ 2046#define FEA_NEEDEA 0x80 /* need EA bit */
1887 2047
1888struct fealist { 2048struct fealist {
1889 __le32 list_len; 2049 __le32 list_len;
1890 struct fea list[1]; 2050 struct fea list[1];
1891}; 2051} __attribute__((packed));
1892 2052
1893/* used to hold an arbitrary blob of data */ 2053/* used to hold an arbitrary blob of data */
1894struct data_blob { 2054struct data_blob {
1895 __u8 *data; 2055 __u8 *data;
1896 size_t length; 2056 size_t length;
1897 void (*free) (struct data_blob * data_blob); 2057 void (*free) (struct data_blob * data_blob);
1898}; 2058} __attribute__((packed));
1899 2059
1900 2060
1901#ifdef CONFIG_CIFS_POSIX 2061#ifdef CONFIG_CIFS_POSIX
@@ -1907,18 +2067,17 @@ struct data_blob {
1907 perhaps add a CreateDevice - to create Pipes and other special .inodes 2067 perhaps add a CreateDevice - to create Pipes and other special .inodes
1908 Also note POSIX open flags 2068 Also note POSIX open flags
1909 2) Close - to return the last write time to do cache across close more safely 2069 2) Close - to return the last write time to do cache across close more safely
1910 3) PosixQFSInfo - to return statfs info 2070 3) FindFirst return unique inode number - what about resume key, two
1911 4) FindFirst return unique inode number - what about resume key, two forms short (matches readdir) and full (enough info to cache inodes) 2071 forms short (matches readdir) and full (enough info to cache inodes)
1912 5) Mkdir - set mode 2072 4) Mkdir - set mode
1913 2073
1914 And under consideration: 2074 And under consideration:
1915 6) FindClose2 (return nanosecond timestamp ??) 2075 5) FindClose2 (return nanosecond timestamp ??)
1916 7) Use nanosecond timestamps throughout all time fields if 2076 6) Use nanosecond timestamps throughout all time fields if
1917 corresponding attribute flag is set 2077 corresponding attribute flag is set
1918 8) sendfile - handle based copy 2078 7) sendfile - handle based copy
1919 9) Direct i/o 2079 8) Direct i/o
1920 10) "POSIX ACL" support 2080 9) Misc fcntls?
1921 11) Misc fcntls?
1922 2081
1923 what about fixing 64 bit alignment 2082 what about fixing 64 bit alignment
1924 2083
@@ -1974,7 +2133,7 @@ struct data_blob {
1974 2133
1975 */ 2134 */
1976 2135
1977/* xsymlink is a symlink format that can be used 2136/* xsymlink is a symlink format (used by MacOS) that can be used
1978 to save symlink info in a regular file when 2137 to save symlink info in a regular file when
1979 mounted to operating systems that do not 2138 mounted to operating systems that do not
1980 support the cifs Unix extensions or EAs (for xattr 2139 support the cifs Unix extensions or EAs (for xattr
@@ -1999,7 +2158,7 @@ struct xsymlink {
1999 char cr2; /* \n */ 2158 char cr2; /* \n */
2000/* if room left, then end with \n then 0x20s by convention but not required */ 2159/* if room left, then end with \n then 0x20s by convention but not required */
2001 char path[1024]; 2160 char path[1024];
2002}; 2161} __attribute__((packed));
2003 2162
2004typedef struct file_xattr_info { 2163typedef struct file_xattr_info {
2005 /* BB do we need another field for flags? BB */ 2164 /* BB do we need another field for flags? BB */
@@ -2007,7 +2166,7 @@ typedef struct file_xattr_info {
2007 __u32 xattr_value_len; 2166 __u32 xattr_value_len;
2008 char xattr_name[0]; 2167 char xattr_name[0];
2009 /* followed by xattr_value[xattr_value_len], no pad */ 2168 /* followed by xattr_value[xattr_value_len], no pad */
2010} FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ 2169} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */
2011 2170
2012 2171
2013/* flags for chattr command */ 2172/* flags for chattr command */
@@ -2033,10 +2192,8 @@ typedef struct file_xattr_info {
2033typedef struct file_chattr_info { 2192typedef struct file_chattr_info {
2034 __le64 mask; /* list of all possible attribute bits */ 2193 __le64 mask; /* list of all possible attribute bits */
2035 __le64 mode; /* list of actual attribute bits on this inode */ 2194 __le64 mode; /* list of actual attribute bits on this inode */
2036} FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */ 2195} __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */
2037 2196
2038#endif 2197#endif
2039 2198
2040#pragma pack() /* resume default structure packing */
2041
2042#endif /* _CIFSPDU_H */ 2199#endif /* _CIFSPDU_H */