aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-10-27 16:55:12 -0400
committerSteve French <sfrench@us.ibm.com>2005-10-27 16:55:12 -0400
commit0753ca7bc2b876dd136e9db11a20f85cbe4e08b1 (patch)
tree9fca686e1ca5886342232fe16292bae675a1004f
parent04290949b3daef35d6279dcc05f01b549ac1772b (diff)
[CIFS] Change pragma pack(1) to attribute(packed) to allow cifs on arm to access
unaligned structures coming in off the wire gcc on arm processors generates very odd code with pragma pack specified - although it does pack the structures in some sense - it does not allow you to access unaligned elements in nested structures at the right offset as other architectures do. Oddly enough though, specifying the structures as packed the long way - one by one with the packed attribute does work. Rather than fighting over whether this is a gcc bug or some obscure side effect of pragma pack, it is easier to do what most (all but 96 other places in the kernel) do - and replace pragma pack with dozens of attribute(packed) structure qualifiers. Much more verbose ... but at least it works. Signed-off-by: David Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com> CG: -----------------------------------------------------------------------
-rw-r--r--fs/cifs/cifspdu.h343
-rw-r--r--fs/cifs/ntlmssp.h12
-rw-r--r--fs/cifs/rfc1002pdu.h13
3 files changed, 182 insertions, 186 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 193f06eb43f9..48a05b9df7eb 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -80,7 +80,7 @@
80#define NT_TRANSACT_GET_USER_QUOTA 0x07 80#define NT_TRANSACT_GET_USER_QUOTA 0x07
81#define NT_TRANSACT_SET_USER_QUOTA 0x08 81#define NT_TRANSACT_SET_USER_QUOTA 0x08
82 82
83#define MAX_CIFS_HDR_SIZE 256 /* chained NTCreateXReadX will probably be biggest */ 83#define MAX_CIFS_HDR_SIZE 256 /* is future chained NTCreateXReadX bigger? */
84 84
85/* internal cifs vfs structures */ 85/* internal cifs vfs structures */
86/***************************************************************** 86/*****************************************************************
@@ -133,10 +133,11 @@
133/* 133/*
134 * SMB flag definitions 134 * SMB flag definitions
135 */ 135 */
136#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 */
137#define SMBFLG_RCV_POSTED 0x02 /* obsolete */ 137#define SMBFLG_RCV_POSTED 0x02 /* obsolete */
138#define SMBFLG_RSVD 0x04 138#define SMBFLG_RSVD 0x04
139#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) */
140#define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */ 141#define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */
141#define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */ 142#define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */
142#define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */ 143#define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */
@@ -145,7 +146,8 @@
145/* 146/*
146 * SMB flag2 definitions 147 * SMB flag2 definitions
147 */ 148 */
148#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 */
149#define SMBFLG2_KNOWS_EAS cpu_to_le16(2) 151#define SMBFLG2_KNOWS_EAS cpu_to_le16(2)
150#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) 152#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4)
151#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40) 153#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40)
@@ -164,32 +166,32 @@
164 * file and can have any suitable combination of the following values: 166 * file and can have any suitable combination of the following values:
165 */ 167 */
166 168
167#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 */
168#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 */
169#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 */
170#define FILE_READ_EA 0x00000008 /* Extended attributes associated */ 172#define FILE_READ_EA 0x00000008 /* Extended attributes associated */
171 /* with the file can be read */ 173 /* with the file can be read */
172#define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */ 174#define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */
173 /* with the file can be written */ 175 /* with the file can be written */
174#define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */ 176#define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */
175 /* the file using system paging I/O */ 177 /* the file using system paging I/O */
176#define FILE_DELETE_CHILD 0x00000040 178#define FILE_DELETE_CHILD 0x00000040
177#define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */ 179#define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */
178 /* file can be read */ 180 /* file can be read */
179#define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */ 181#define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */
180 /* file can be written */ 182 /* file can be written */
181#define DELETE 0x00010000 /* The file can be deleted */ 183#define DELETE 0x00010000 /* The file can be deleted */
182#define READ_CONTROL 0x00020000 /* The access control list and */ 184#define READ_CONTROL 0x00020000 /* The access control list and */
183 /* ownership associated with the */ 185 /* ownership associated with the */
184 /* file can be read */ 186 /* file can be read */
185#define WRITE_DAC 0x00040000 /* The access control list and */ 187#define WRITE_DAC 0x00040000 /* The access control list and */
186 /* ownership associated with the */ 188 /* ownership associated with the */
187 /* file can be written. */ 189 /* file can be written. */
188#define WRITE_OWNER 0x00080000 /* Ownership information associated */ 190#define WRITE_OWNER 0x00080000 /* Ownership information associated */
189 /* with the file can be written */ 191 /* with the file can be written */
190#define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */ 192#define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */
191 /* synchronize with the completion */ 193 /* synchronize with the completion */
192 /* of an input/output request */ 194 /* of an input/output request */
193#define GENERIC_ALL 0x10000000 195#define GENERIC_ALL 0x10000000
194#define GENERIC_EXECUTE 0x20000000 196#define GENERIC_EXECUTE 0x20000000
195#define GENERIC_WRITE 0x40000000 197#define GENERIC_WRITE 0x40000000
@@ -197,7 +199,7 @@
197 /* In summary - Relevant file */ 199 /* In summary - Relevant file */
198 /* access flags from CIFS are */ 200 /* access flags from CIFS are */
199 /* file_read_data, file_write_data */ 201 /* file_read_data, file_write_data */
200 /* file_execute, file_read_attributes */ 202 /* file_execute, file_read_attributes*/
201 /* write_dac, and delete. */ 203 /* write_dac, and delete. */
202 204
203/* 205/*
@@ -242,7 +244,8 @@
242#define ATTR_SPARSE 0x0200 244#define ATTR_SPARSE 0x0200
243#define ATTR_REPARSE 0x0400 245#define ATTR_REPARSE 0x0400
244#define ATTR_COMPRESSED 0x0800 246#define ATTR_COMPRESSED 0x0800
245#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 */
246#define ATTR_NOT_CONTENT_INDEXED 0x2000 249#define ATTR_NOT_CONTENT_INDEXED 0x2000
247#define ATTR_ENCRYPTED 0x4000 250#define ATTR_ENCRYPTED 0x4000
248#define ATTR_POSIX_SEMANTICS 0x01000000 251#define ATTR_POSIX_SEMANTICS 0x01000000
@@ -309,10 +312,10 @@
309#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */ 312#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */
310#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */ 313#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */
311 314
312#pragma pack(1)
313
314struct smb_hdr { 315struct smb_hdr {
315 __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 */
316 __u8 Protocol[4]; 319 __u8 Protocol[4];
317 __u8 Command; 320 __u8 Command;
318 union { 321 union {
@@ -320,9 +323,9 @@ struct smb_hdr {
320 __u8 ErrorClass; 323 __u8 ErrorClass;
321 __u8 Reserved; 324 __u8 Reserved;
322 __le16 Error; 325 __le16 Error;
323 } DosError; 326 } __attribute__((packed)) DosError;
324 __le32 CifsError; 327 __le32 CifsError;
325 } Status; 328 } __attribute__((packed)) Status;
326 __u8 Flags; 329 __u8 Flags;
327 __le16 Flags2; /* note: le */ 330 __le16 Flags2; /* note: le */
328 __le16 PidHigh; 331 __le16 PidHigh;
@@ -330,16 +333,16 @@ struct smb_hdr {
330 struct { 333 struct {
331 __le32 SequenceNumber; /* le */ 334 __le32 SequenceNumber; /* le */
332 __u32 Reserved; /* zero */ 335 __u32 Reserved; /* zero */
333 } Sequence; 336 } __attribute__((packed)) Sequence;
334 __u8 SecuritySignature[8]; /* le */ 337 __u8 SecuritySignature[8]; /* le */
335 } Signature; 338 } __attribute__((packed)) Signature;
336 __u8 pad[2]; 339 __u8 pad[2];
337 __u16 Tid; 340 __u16 Tid;
338 __le16 Pid; 341 __le16 Pid;
339 __u16 Uid; 342 __u16 Uid;
340 __u16 Mid; 343 __u16 Mid;
341 __u8 WordCount; 344 __u8 WordCount;
342}; 345} __attribute__((packed));
343/* 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 */
344#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) ) )
345#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) ) )
@@ -391,7 +394,7 @@ typedef struct negotiate_req {
391 struct smb_hdr hdr; /* wct = 0 */ 394 struct smb_hdr hdr; /* wct = 0 */
392 __le16 ByteCount; 395 __le16 ByteCount;
393 unsigned char DialectsArray[1]; 396 unsigned char DialectsArray[1];
394} NEGOTIATE_REQ; 397} __attribute__((packed)) NEGOTIATE_REQ;
395 398
396typedef struct negotiate_rsp { 399typedef struct negotiate_rsp {
397 struct smb_hdr hdr; /* wct = 17 */ 400 struct smb_hdr hdr; /* wct = 17 */
@@ -409,16 +412,16 @@ typedef struct negotiate_rsp {
409 __u8 EncryptionKeyLength; 412 __u8 EncryptionKeyLength;
410 __u16 ByteCount; 413 __u16 ByteCount;
411 union { 414 union {
412 unsigned char EncryptionKey[1]; /* if cap extended security is off */ 415 unsigned char EncryptionKey[1]; /* cap extended security off */
413 /* followed by Domain name - if extended security is off */ 416 /* followed by Domain name - if extended security is off */
414 /* followed by 16 bytes of server GUID */ 417 /* followed by 16 bytes of server GUID */
415 /* followed by security blob if cap_extended_security negotiated */ 418 /* then security blob if cap_extended_security negotiated */
416 struct { 419 struct {
417 unsigned char GUID[16]; 420 unsigned char GUID[16];
418 unsigned char SecurityBlob[1]; 421 unsigned char SecurityBlob[1];
419 } extended_response; 422 } __attribute__((packed)) extended_response;
420 } u; 423 } __attribute__((packed)) u;
421} NEGOTIATE_RSP; 424} __attribute__((packed)) NEGOTIATE_RSP;
422 425
423/* SecurityMode bits */ 426/* SecurityMode bits */
424#define SECMODE_USER 0x01 /* off indicates share level security */ 427#define SECMODE_USER 0x01 /* off indicates share level security */
@@ -464,7 +467,8 @@ typedef union smb_com_session_setup_andx {
464 unsigned char SecurityBlob[1]; /* followed by */ 467 unsigned char SecurityBlob[1]; /* followed by */
465 /* STRING NativeOS */ 468 /* STRING NativeOS */
466 /* STRING NativeLanMan */ 469 /* STRING NativeLanMan */
467 } req; /* NTLM request format (with extended security */ 470 } __attribute__((packed)) req; /* NTLM request format (with
471 extended security */
468 472
469 struct { /* request format */ 473 struct { /* request format */
470 struct smb_hdr hdr; /* wct = 13 */ 474 struct smb_hdr hdr; /* wct = 13 */
@@ -475,18 +479,19 @@ typedef union smb_com_session_setup_andx {
475 __le16 MaxMpxCount; 479 __le16 MaxMpxCount;
476 __le16 VcNumber; 480 __le16 VcNumber;
477 __u32 SessionKey; 481 __u32 SessionKey;
478 __le16 CaseInsensitivePasswordLength; /* ASCII password length */ 482 __le16 CaseInsensitivePasswordLength; /* ASCII password len */
479 __le16 CaseSensitivePasswordLength; /* Unicode password length */ 483 __le16 CaseSensitivePasswordLength; /* Unicode password length*/
480 __u32 Reserved; /* see below */ 484 __u32 Reserved; /* see below */
481 __le32 Capabilities; 485 __le32 Capabilities;
482 __le16 ByteCount; 486 __le16 ByteCount;
483 unsigned char CaseInsensitivePassword[1]; /* followed by: */ 487 unsigned char CaseInsensitivePassword[1]; /* followed by: */
484 /* unsigned char * CaseSensitivePassword; */ 488 /* unsigned char * CaseSensitivePassword; */
485 /* STRING AccountName */ 489 /* STRING AccountName */
486 /* STRING PrimaryDomain */ 490 /* STRING PrimaryDomain */
487 /* STRING NativeOS */ 491 /* STRING NativeOS */
488 /* STRING NativeLanMan */ 492 /* STRING NativeLanMan */
489 } req_no_secext; /* NTLM request format (without extended security */ 493 } __attribute__((packed)) req_no_secext; /* NTLM request format (without
494 extended security */
490 495
491 struct { /* default (NTLM) response format */ 496 struct { /* default (NTLM) response format */
492 struct smb_hdr hdr; /* wct = 4 */ 497 struct smb_hdr hdr; /* wct = 4 */
@@ -500,7 +505,7 @@ typedef union smb_com_session_setup_andx {
500/* unsigned char * NativeOS; */ 505/* unsigned char * NativeOS; */
501/* unsigned char * NativeLanMan; */ 506/* unsigned char * NativeLanMan; */
502/* unsigned char * PrimaryDomain; */ 507/* unsigned char * PrimaryDomain; */
503 } resp; /* NTLM response format (with or without extended security */ 508 } __attribute__((packed)) resp; /* NTLM response format (with or without extended security */
504 509
505 struct { /* request format */ 510 struct { /* request format */
506 struct smb_hdr hdr; /* wct = 10 */ 511 struct smb_hdr hdr; /* wct = 10 */
@@ -519,7 +524,7 @@ typedef union smb_com_session_setup_andx {
519 /* STRING PrimaryDomain */ 524 /* STRING PrimaryDomain */
520 /* STRING NativeOS */ 525 /* STRING NativeOS */
521 /* STRING NativeLanMan */ 526 /* STRING NativeLanMan */
522 } old_req; /* pre-NTLM (LANMAN2.1) request format */ 527 } __attribute__((packed)) old_req; /* pre-NTLM (LANMAN2.1) request format */
523 528
524 struct { /* default (NTLM) response format */ 529 struct { /* default (NTLM) response format */
525 struct smb_hdr hdr; /* wct = 3 */ 530 struct smb_hdr hdr; /* wct = 3 */
@@ -531,8 +536,8 @@ typedef union smb_com_session_setup_andx {
531 unsigned char NativeOS[1]; /* followed by */ 536 unsigned char NativeOS[1]; /* followed by */
532/* unsigned char * NativeLanMan; */ 537/* unsigned char * NativeLanMan; */
533/* unsigned char * PrimaryDomain; */ 538/* unsigned char * PrimaryDomain; */
534 } old_resp; /* pre-NTLM (LANMAN2.1) response format */ 539 } __attribute__((packed)) old_resp; /* pre-NTLM (LANMAN2.1) response format */
535} SESSION_SETUP_ANDX; 540} __attribute__((packed)) SESSION_SETUP_ANDX;
536 541
537#define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux" 542#define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux"
538 543
@@ -542,7 +547,8 @@ typedef union smb_com_session_setup_andx {
542#define CAP_NT_SMBS 0x00000010 547#define CAP_NT_SMBS 0x00000010
543#define CAP_STATUS32 0x00000040 548#define CAP_STATUS32 0x00000040
544#define CAP_LEVEL_II_OPLOCKS 0x00000080 549#define CAP_LEVEL_II_OPLOCKS 0x00000080
545#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?) */
546#define CAP_BULK_TRANSFER 0x20000000 552#define CAP_BULK_TRANSFER 0x20000000
547#define CAP_EXTENDED_SECURITY 0x80000000 553#define CAP_EXTENDED_SECURITY 0x80000000
548 554
@@ -560,7 +566,7 @@ typedef struct smb_com_tconx_req {
560 unsigned char Password[1]; /* followed by */ 566 unsigned char Password[1]; /* followed by */
561/* STRING Path *//* \\server\share name */ 567/* STRING Path *//* \\server\share name */
562 /* STRING Service */ 568 /* STRING Service */
563} TCONX_REQ; 569} __attribute__((packed)) TCONX_REQ;
564 570
565typedef struct smb_com_tconx_rsp { 571typedef struct smb_com_tconx_rsp {
566 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 */
@@ -571,13 +577,14 @@ typedef struct smb_com_tconx_rsp {
571 __u16 ByteCount; 577 __u16 ByteCount;
572 unsigned char Service[1]; /* always ASCII, not Unicode */ 578 unsigned char Service[1]; /* always ASCII, not Unicode */
573 /* STRING NativeFileSystem */ 579 /* STRING NativeFileSystem */
574} TCONX_RSP; 580} __attribute__((packed)) TCONX_RSP;
575 581
576/* tree connect Flags */ 582/* tree connect Flags */
577#define DISCONNECT_TID 0x0001 583#define DISCONNECT_TID 0x0001
578#define TCON_EXTENDED_SECINFO 0x0008 584#define TCON_EXTENDED_SECINFO 0x0008
579/* OptionalSupport bits */ 585/* OptionalSupport bits */
580#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) */
581#define SMB_SHARE_IS_IN_DFS 0x0002 588#define SMB_SHARE_IS_IN_DFS 0x0002
582 589
583typedef struct smb_com_logoff_andx_req { 590typedef struct smb_com_logoff_andx_req {
@@ -586,7 +593,7 @@ typedef struct smb_com_logoff_andx_req {
586 __u8 AndXReserved; 593 __u8 AndXReserved;
587 __u16 AndXOffset; 594 __u16 AndXOffset;
588 __u16 ByteCount; 595 __u16 ByteCount;
589} LOGOFF_ANDX_REQ; 596} __attribute__((packed)) LOGOFF_ANDX_REQ;
590 597
591typedef struct smb_com_logoff_andx_rsp { 598typedef struct smb_com_logoff_andx_rsp {
592 struct smb_hdr hdr; /* wct = 2 */ 599 struct smb_hdr hdr; /* wct = 2 */
@@ -594,36 +601,36 @@ typedef struct smb_com_logoff_andx_rsp {
594 __u8 AndXReserved; 601 __u8 AndXReserved;
595 __u16 AndXOffset; 602 __u16 AndXOffset;
596 __u16 ByteCount; 603 __u16 ByteCount;
597} LOGOFF_ANDX_RSP; 604} __attribute__((packed)) LOGOFF_ANDX_RSP;
598 605
599typedef 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 */
600 struct { 607 struct {
601 struct smb_hdr hdr; /* wct = 0 */ 608 struct smb_hdr hdr; /* wct = 0 */
602 __u16 ByteCount; /* bcc = 0 */ 609 __u16 ByteCount; /* bcc = 0 */
603 } req; 610 } __attribute__((packed)) req;
604 struct { 611 struct {
605 struct smb_hdr hdr; /* wct = 0 */ 612 struct smb_hdr hdr; /* wct = 0 */
606 __u16 ByteCount; /* bcc = 0 */ 613 __u16 ByteCount; /* bcc = 0 */
607 } resp; 614 } __attribute__((packed)) resp;
608} TREE_DISCONNECT; 615} __attribute__((packed)) TREE_DISCONNECT;
609 616
610typedef struct smb_com_close_req { 617typedef struct smb_com_close_req {
611 struct smb_hdr hdr; /* wct = 3 */ 618 struct smb_hdr hdr; /* wct = 3 */
612 __u16 FileID; 619 __u16 FileID;
613 __u32 LastWriteTime; /* should be zero */ 620 __u32 LastWriteTime; /* should be zero */
614 __u16 ByteCount; /* 0 */ 621 __u16 ByteCount; /* 0 */
615} CLOSE_REQ; 622} __attribute__((packed)) CLOSE_REQ;
616 623
617typedef struct smb_com_close_rsp { 624typedef struct smb_com_close_rsp {
618 struct smb_hdr hdr; /* wct = 0 */ 625 struct smb_hdr hdr; /* wct = 0 */
619 __u16 ByteCount; /* bct = 0 */ 626 __u16 ByteCount; /* bct = 0 */
620} CLOSE_RSP; 627} __attribute__((packed)) CLOSE_RSP;
621 628
622typedef struct smb_com_findclose_req { 629typedef struct smb_com_findclose_req {
623 struct smb_hdr hdr; /* wct = 1 */ 630 struct smb_hdr hdr; /* wct = 1 */
624 __u16 FileID; 631 __u16 FileID;
625 __u16 ByteCount; /* 0 */ 632 __u16 ByteCount; /* 0 */
626} FINDCLOSE_REQ; 633} __attribute__((packed)) FINDCLOSE_REQ;
627 634
628/* OpenFlags */ 635/* OpenFlags */
629#define REQ_MORE_INFO 0x00000001 /* legacy (OPEN_AND_X) only */ 636#define REQ_MORE_INFO 0x00000001 /* legacy (OPEN_AND_X) only */
@@ -650,7 +657,7 @@ typedef struct smb_com_open_req { /* also handles create */
650 __u8 SecurityFlags; 657 __u8 SecurityFlags;
651 __le16 ByteCount; 658 __le16 ByteCount;
652 char fileName[1]; 659 char fileName[1];
653} OPEN_REQ; 660} __attribute__((packed)) OPEN_REQ;
654 661
655/* open response: oplock levels */ 662/* open response: oplock levels */
656#define OPLOCK_NONE 0 663#define OPLOCK_NONE 0
@@ -680,7 +687,7 @@ typedef struct smb_com_open_rsp {
680 __le16 DeviceState; 687 __le16 DeviceState;
681 __u8 DirectoryFlag; 688 __u8 DirectoryFlag;
682 __u16 ByteCount; /* bct = 0 */ 689 __u16 ByteCount; /* bct = 0 */
683} OPEN_RSP; 690} __attribute__((packed)) OPEN_RSP;
684 691
685/* format of legacy open request */ 692/* format of legacy open request */
686typedef struct smb_com_openx_req { 693typedef struct smb_com_openx_req {
@@ -699,7 +706,7 @@ typedef struct smb_com_openx_req {
699 __le32 Reserved; 706 __le32 Reserved;
700 __le16 ByteCount; /* file name follows */ 707 __le16 ByteCount; /* file name follows */
701 char fileName[1]; 708 char fileName[1];
702} OPENX_REQ; 709} __attribute__((packed)) OPENX_REQ;
703 710
704typedef struct smb_com_openx_rsp { 711typedef struct smb_com_openx_rsp {
705 struct smb_hdr hdr; /* wct = 15 */ 712 struct smb_hdr hdr; /* wct = 15 */
@@ -717,7 +724,7 @@ typedef struct smb_com_openx_rsp {
717 __u32 FileId; 724 __u32 FileId;
718 __u16 Reserved; 725 __u16 Reserved;
719 __u16 ByteCount; 726 __u16 ByteCount;
720} OPENX_RSP; 727} __attribute__((packed)) OPENX_RSP;
721 728
722/* Legacy write request for older servers */ 729/* Legacy write request for older servers */
723typedef struct smb_com_writex_req { 730typedef struct smb_com_writex_req {
@@ -736,7 +743,7 @@ typedef struct smb_com_writex_req {
736 __le16 ByteCount; 743 __le16 ByteCount;
737 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ 744 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
738 char Data[0]; 745 char Data[0];
739} WRITEX_REQ; 746} __attribute__((packed)) WRITEX_REQ;
740 747
741typedef struct smb_com_write_req { 748typedef struct smb_com_write_req {
742 struct smb_hdr hdr; /* wct = 14 */ 749 struct smb_hdr hdr; /* wct = 14 */
@@ -755,7 +762,7 @@ typedef struct smb_com_write_req {
755 __le16 ByteCount; 762 __le16 ByteCount;
756 __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 */
757 char Data[0]; 764 char Data[0];
758} WRITE_REQ; 765} __attribute__((packed)) WRITE_REQ;
759 766
760typedef struct smb_com_write_rsp { 767typedef struct smb_com_write_rsp {
761 struct smb_hdr hdr; /* wct = 6 */ 768 struct smb_hdr hdr; /* wct = 6 */
@@ -767,7 +774,7 @@ typedef struct smb_com_write_rsp {
767 __le16 CountHigh; 774 __le16 CountHigh;
768 __u16 Reserved; 775 __u16 Reserved;
769 __u16 ByteCount; 776 __u16 ByteCount;
770} WRITE_RSP; 777} __attribute__((packed)) WRITE_RSP;
771 778
772/* legacy read request for older servers */ 779/* legacy read request for older servers */
773typedef struct smb_com_readx_req { 780typedef struct smb_com_readx_req {
@@ -782,7 +789,7 @@ typedef struct smb_com_readx_req {
782 __le32 Reserved; 789 __le32 Reserved;
783 __le16 Remaining; 790 __le16 Remaining;
784 __le16 ByteCount; 791 __le16 ByteCount;
785} READX_REQ; 792} __attribute__((packed)) READX_REQ;
786 793
787typedef struct smb_com_read_req { 794typedef struct smb_com_read_req {
788 struct smb_hdr hdr; /* wct = 12 */ 795 struct smb_hdr hdr; /* wct = 12 */
@@ -797,7 +804,7 @@ typedef struct smb_com_read_req {
797 __le16 Remaining; 804 __le16 Remaining;
798 __le32 OffsetHigh; 805 __le32 OffsetHigh;
799 __le16 ByteCount; 806 __le16 ByteCount;
800} READ_REQ; 807} __attribute__((packed)) READ_REQ;
801 808
802typedef struct smb_com_read_rsp { 809typedef struct smb_com_read_rsp {
803 struct smb_hdr hdr; /* wct = 12 */ 810 struct smb_hdr hdr; /* wct = 12 */
@@ -814,7 +821,7 @@ typedef struct smb_com_read_rsp {
814 __u16 ByteCount; 821 __u16 ByteCount;
815 __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 */
816 char Data[1]; 823 char Data[1];
817} READ_RSP; 824} __attribute__((packed)) READ_RSP;
818 825
819typedef struct locking_andx_range { 826typedef struct locking_andx_range {
820 __le16 Pid; 827 __le16 Pid;
@@ -823,7 +830,7 @@ typedef struct locking_andx_range {
823 __le32 OffsetLow; 830 __le32 OffsetLow;
824 __le32 LengthHigh; 831 __le32 LengthHigh;
825 __le32 LengthLow; 832 __le32 LengthLow;
826} LOCKING_ANDX_RANGE; 833} __attribute__((packed)) LOCKING_ANDX_RANGE;
827 834
828#define LOCKING_ANDX_SHARED_LOCK 0x01 835#define LOCKING_ANDX_SHARED_LOCK 0x01
829#define LOCKING_ANDX_OPLOCK_RELEASE 0x02 836#define LOCKING_ANDX_OPLOCK_RELEASE 0x02
@@ -844,7 +851,7 @@ typedef struct smb_com_lock_req {
844 __le16 NumberOfLocks; 851 __le16 NumberOfLocks;
845 __le16 ByteCount; 852 __le16 ByteCount;
846 LOCKING_ANDX_RANGE Locks[1]; 853 LOCKING_ANDX_RANGE Locks[1];
847} LOCK_REQ; 854} __attribute__((packed)) LOCK_REQ;
848 855
849 856
850typedef struct cifs_posix_lock { 857typedef struct cifs_posix_lock {
@@ -854,7 +861,7 @@ typedef struct cifs_posix_lock {
854 __le64 start; 861 __le64 start;
855 __le64 length; 862 __le64 length;
856 /* BB what about additional owner info to identify network client */ 863 /* BB what about additional owner info to identify network client */
857} CIFS_POSIX_LOCK; 864} __attribute__((packed)) CIFS_POSIX_LOCK;
858 865
859typedef struct smb_com_lock_rsp { 866typedef struct smb_com_lock_rsp {
860 struct smb_hdr hdr; /* wct = 2 */ 867 struct smb_hdr hdr; /* wct = 2 */
@@ -862,7 +869,7 @@ typedef struct smb_com_lock_rsp {
862 __u8 AndXReserved; 869 __u8 AndXReserved;
863 __le16 AndXOffset; 870 __le16 AndXOffset;
864 __u16 ByteCount; 871 __u16 ByteCount;
865} LOCK_RSP; 872} __attribute__((packed)) LOCK_RSP;
866 873
867typedef struct smb_com_rename_req { 874typedef struct smb_com_rename_req {
868 struct smb_hdr hdr; /* wct = 1 */ 875 struct smb_hdr hdr; /* wct = 1 */
@@ -872,7 +879,7 @@ typedef struct smb_com_rename_req {
872 unsigned char OldFileName[1]; 879 unsigned char OldFileName[1];
873 /* followed by __u8 BufferFormat2 */ 880 /* followed by __u8 BufferFormat2 */
874 /* followed by NewFileName */ 881 /* followed by NewFileName */
875} RENAME_REQ; 882} __attribute__((packed)) RENAME_REQ;
876 883
877 /* copy request flags */ 884 /* copy request flags */
878#define COPY_MUST_BE_FILE 0x0001 885#define COPY_MUST_BE_FILE 0x0001
@@ -892,7 +899,7 @@ typedef struct smb_com_copy_req {
892 unsigned char OldFileName[1]; 899 unsigned char OldFileName[1];
893 /* followed by __u8 BufferFormat2 */ 900 /* followed by __u8 BufferFormat2 */
894 /* followed by NewFileName string */ 901 /* followed by NewFileName string */
895} COPY_REQ; 902} __attribute__((packed)) COPY_REQ;
896 903
897typedef struct smb_com_copy_rsp { 904typedef struct smb_com_copy_rsp {
898 struct smb_hdr hdr; /* wct = 1 */ 905 struct smb_hdr hdr; /* wct = 1 */
@@ -900,7 +907,7 @@ typedef struct smb_com_copy_rsp {
900 __u16 ByteCount; /* may be zero */ 907 __u16 ByteCount; /* may be zero */
901 __u8 BufferFormat; /* 0x04 - only present if errored file follows */ 908 __u8 BufferFormat; /* 0x04 - only present if errored file follows */
902 unsigned char ErrorFileName[1]; /* only present if error in copy */ 909 unsigned char ErrorFileName[1]; /* only present if error in copy */
903} COPY_RSP; 910} __attribute__((packed)) COPY_RSP;
904 911
905#define CREATE_HARD_LINK 0x103 912#define CREATE_HARD_LINK 0x103
906#define MOVEFILE_COPY_ALLOWED 0x0002 913#define MOVEFILE_COPY_ALLOWED 0x0002
@@ -916,12 +923,12 @@ typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */
916 unsigned char OldFileName[1]; 923 unsigned char OldFileName[1];
917 /* followed by __u8 BufferFormat2 */ 924 /* followed by __u8 BufferFormat2 */
918 /* followed by NewFileName */ 925 /* followed by NewFileName */
919} NT_RENAME_REQ; 926} __attribute__((packed)) NT_RENAME_REQ;
920 927
921typedef struct smb_com_rename_rsp { 928typedef struct smb_com_rename_rsp {
922 struct smb_hdr hdr; /* wct = 0 */ 929 struct smb_hdr hdr; /* wct = 0 */
923 __u16 ByteCount; /* bct = 0 */ 930 __u16 ByteCount; /* bct = 0 */
924} RENAME_RSP; 931} __attribute__((packed)) RENAME_RSP;
925 932
926typedef struct smb_com_delete_file_req { 933typedef struct smb_com_delete_file_req {
927 struct smb_hdr hdr; /* wct = 1 */ 934 struct smb_hdr hdr; /* wct = 1 */
@@ -929,43 +936,43 @@ typedef struct smb_com_delete_file_req {
929 __le16 ByteCount; 936 __le16 ByteCount;
930 __u8 BufferFormat; /* 4 = ASCII */ 937 __u8 BufferFormat; /* 4 = ASCII */
931 unsigned char fileName[1]; 938 unsigned char fileName[1];
932} DELETE_FILE_REQ; 939} __attribute__((packed)) DELETE_FILE_REQ;
933 940
934typedef struct smb_com_delete_file_rsp { 941typedef struct smb_com_delete_file_rsp {
935 struct smb_hdr hdr; /* wct = 0 */ 942 struct smb_hdr hdr; /* wct = 0 */
936 __u16 ByteCount; /* bct = 0 */ 943 __u16 ByteCount; /* bct = 0 */
937} DELETE_FILE_RSP; 944} __attribute__((packed)) DELETE_FILE_RSP;
938 945
939typedef struct smb_com_delete_directory_req { 946typedef struct smb_com_delete_directory_req {
940 struct smb_hdr hdr; /* wct = 0 */ 947 struct smb_hdr hdr; /* wct = 0 */
941 __le16 ByteCount; 948 __le16 ByteCount;
942 __u8 BufferFormat; /* 4 = ASCII */ 949 __u8 BufferFormat; /* 4 = ASCII */
943 unsigned char DirName[1]; 950 unsigned char DirName[1];
944} DELETE_DIRECTORY_REQ; 951} __attribute__((packed)) DELETE_DIRECTORY_REQ;
945 952
946typedef struct smb_com_delete_directory_rsp { 953typedef struct smb_com_delete_directory_rsp {
947 struct smb_hdr hdr; /* wct = 0 */ 954 struct smb_hdr hdr; /* wct = 0 */
948 __u16 ByteCount; /* bct = 0 */ 955 __u16 ByteCount; /* bct = 0 */
949} DELETE_DIRECTORY_RSP; 956} __attribute__((packed)) DELETE_DIRECTORY_RSP;
950 957
951typedef struct smb_com_create_directory_req { 958typedef struct smb_com_create_directory_req {
952 struct smb_hdr hdr; /* wct = 0 */ 959 struct smb_hdr hdr; /* wct = 0 */
953 __le16 ByteCount; 960 __le16 ByteCount;
954 __u8 BufferFormat; /* 4 = ASCII */ 961 __u8 BufferFormat; /* 4 = ASCII */
955 unsigned char DirName[1]; 962 unsigned char DirName[1];
956} CREATE_DIRECTORY_REQ; 963} __attribute__((packed)) CREATE_DIRECTORY_REQ;
957 964
958typedef struct smb_com_create_directory_rsp { 965typedef struct smb_com_create_directory_rsp {
959 struct smb_hdr hdr; /* wct = 0 */ 966 struct smb_hdr hdr; /* wct = 0 */
960 __u16 ByteCount; /* bct = 0 */ 967 __u16 ByteCount; /* bct = 0 */
961} CREATE_DIRECTORY_RSP; 968} __attribute__((packed)) CREATE_DIRECTORY_RSP;
962 969
963typedef struct smb_com_query_information_req { 970typedef struct smb_com_query_information_req {
964 struct smb_hdr hdr; /* wct = 0 */ 971 struct smb_hdr hdr; /* wct = 0 */
965 __le16 ByteCount; /* 1 + namelen + 1 */ 972 __le16 ByteCount; /* 1 + namelen + 1 */
966 __u8 BufferFormat; /* 4 = ASCII */ 973 __u8 BufferFormat; /* 4 = ASCII */
967 unsigned char FileName[1]; 974 unsigned char FileName[1];
968} QUERY_INFORMATION_REQ; 975} __attribute__((packed)) QUERY_INFORMATION_REQ;
969 976
970typedef struct smb_com_query_information_rsp { 977typedef struct smb_com_query_information_rsp {
971 struct smb_hdr hdr; /* wct = 10 */ 978 struct smb_hdr hdr; /* wct = 10 */
@@ -974,7 +981,7 @@ typedef struct smb_com_query_information_rsp {
974 __le32 size; 981 __le32 size;
975 __u16 reserved[5]; 982 __u16 reserved[5];
976 __le16 ByteCount; /* bcc = 0 */ 983 __le16 ByteCount; /* bcc = 0 */
977} QUERY_INFORMATION_RSP; 984} __attribute__((packed)) QUERY_INFORMATION_RSP;
978 985
979typedef struct smb_com_setattr_req { 986typedef struct smb_com_setattr_req {
980 struct smb_hdr hdr; /* wct = 8 */ 987 struct smb_hdr hdr; /* wct = 8 */
@@ -985,12 +992,12 @@ typedef struct smb_com_setattr_req {
985 __u16 ByteCount; 992 __u16 ByteCount;
986 __u8 BufferFormat; /* 4 = ASCII */ 993 __u8 BufferFormat; /* 4 = ASCII */
987 unsigned char fileName[1]; 994 unsigned char fileName[1];
988} SETATTR_REQ; 995} __attribute__((packed)) SETATTR_REQ;
989 996
990typedef struct smb_com_setattr_rsp { 997typedef struct smb_com_setattr_rsp {
991 struct smb_hdr hdr; /* wct = 0 */ 998 struct smb_hdr hdr; /* wct = 0 */
992 __u16 ByteCount; /* bct = 0 */ 999 __u16 ByteCount; /* bct = 0 */
993} SETATTR_RSP; 1000} __attribute__((packed)) SETATTR_RSP;
994 1001
995/* empty wct response to setattr */ 1002/* empty wct response to setattr */
996 1003
@@ -1020,7 +1027,7 @@ typedef struct smb_com_transaction_ioctl_req {
1020 __le16 ByteCount; 1027 __le16 ByteCount;
1021 __u8 Pad[3]; 1028 __u8 Pad[3];
1022 __u8 Data[1]; 1029 __u8 Data[1];
1023} TRANSACT_IOCTL_REQ; 1030} __attribute__((packed)) TRANSACT_IOCTL_REQ;
1024 1031
1025typedef struct smb_com_transaction_ioctl_rsp { 1032typedef struct smb_com_transaction_ioctl_rsp {
1026 struct smb_hdr hdr; /* wct = 19 */ 1033 struct smb_hdr hdr; /* wct = 19 */
@@ -1037,7 +1044,7 @@ typedef struct smb_com_transaction_ioctl_rsp {
1037 __le16 ReturnedDataLen; 1044 __le16 ReturnedDataLen;
1038 __u16 ByteCount; 1045 __u16 ByteCount;
1039 __u8 Pad[3]; 1046 __u8 Pad[3];
1040} TRANSACT_IOCTL_RSP; 1047} __attribute__((packed)) TRANSACT_IOCTL_RSP;
1041 1048
1042typedef struct smb_com_transaction_change_notify_req { 1049typedef struct smb_com_transaction_change_notify_req {
1043 struct smb_hdr hdr; /* wct = 23 */ 1050 struct smb_hdr hdr; /* wct = 23 */
@@ -1061,7 +1068,7 @@ typedef struct smb_com_transaction_change_notify_req {
1061 __le16 ByteCount; 1068 __le16 ByteCount;
1062/* __u8 Pad[3];*/ 1069/* __u8 Pad[3];*/
1063/* __u8 Data[1];*/ 1070/* __u8 Data[1];*/
1064} TRANSACT_CHANGE_NOTIFY_REQ; 1071} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ;
1065 1072
1066typedef struct smb_com_transaction_change_notify_rsp { 1073typedef struct smb_com_transaction_change_notify_rsp {
1067 struct smb_hdr hdr; /* wct = 18 */ 1074 struct smb_hdr hdr; /* wct = 18 */
@@ -1077,7 +1084,7 @@ typedef struct smb_com_transaction_change_notify_rsp {
1077 __u8 SetupCount; /* 0 */ 1084 __u8 SetupCount; /* 0 */
1078 __u16 ByteCount; 1085 __u16 ByteCount;
1079 /* __u8 Pad[3]; */ 1086 /* __u8 Pad[3]; */
1080} TRANSACT_CHANGE_NOTIFY_RSP; 1087} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_RSP;
1081/* Completion Filter flags for Notify */ 1088/* Completion Filter flags for Notify */
1082#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 1089#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
1083#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 1090#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
@@ -1108,7 +1115,7 @@ struct file_notify_information {
1108 __le32 Action; 1115 __le32 Action;
1109 __le32 FileNameLength; 1116 __le32 FileNameLength;
1110 __u8 FileName[0]; 1117 __u8 FileName[0];
1111}; 1118} __attribute__((packed));
1112 1119
1113struct reparse_data { 1120struct reparse_data {
1114 __u32 ReparseTag; 1121 __u32 ReparseTag;
@@ -1119,7 +1126,7 @@ struct reparse_data {
1119 __u16 TargetNameOffset; 1126 __u16 TargetNameOffset;
1120 __u16 TargetNameLen; 1127 __u16 TargetNameLen;
1121 char LinkNamesBuf[1]; 1128 char LinkNamesBuf[1];
1122}; 1129} __attribute__((packed));
1123 1130
1124struct cifs_quota_data { 1131struct cifs_quota_data {
1125 __u32 rsrvd1; /* 0 */ 1132 __u32 rsrvd1; /* 0 */
@@ -1129,7 +1136,7 @@ struct cifs_quota_data {
1129 __u64 soft_limit; 1136 __u64 soft_limit;
1130 __u64 hard_limit; 1137 __u64 hard_limit;
1131 char sid[1]; /* variable size? */ 1138 char sid[1]; /* variable size? */
1132}; 1139} __attribute__((packed));
1133 1140
1134/* quota sub commands */ 1141/* quota sub commands */
1135#define QUOTA_LIST_CONTINUE 0 1142#define QUOTA_LIST_CONTINUE 0
@@ -1155,12 +1162,12 @@ struct trans2_req {
1155 __u8 Reserved3; 1162 __u8 Reserved3;
1156 __le16 SubCommand; /* 1st setup word - SetupCount words follow */ 1163 __le16 SubCommand; /* 1st setup word - SetupCount words follow */
1157 __le16 ByteCount; 1164 __le16 ByteCount;
1158}; 1165} __attribute__((packed));
1159 1166
1160struct smb_t2_req { 1167struct smb_t2_req {
1161 struct smb_hdr hdr; 1168 struct smb_hdr hdr;
1162 struct trans2_req t2_req; 1169 struct trans2_req t2_req;
1163}; 1170} __attribute__((packed));
1164 1171
1165struct trans2_resp { 1172struct trans2_resp {
1166 /* struct smb_hdr hdr precedes. Note wct = 10 + setup count */ 1173 /* struct smb_hdr hdr precedes. Note wct = 10 + setup count */
@@ -1179,12 +1186,12 @@ struct trans2_resp {
1179 __u16 ByteCount; 1186 __u16 ByteCount;
1180 __u16 Reserved2;*/ 1187 __u16 Reserved2;*/
1181 /* data area follows */ 1188 /* data area follows */
1182}; 1189} __attribute__((packed));
1183 1190
1184struct smb_t2_rsp { 1191struct smb_t2_rsp {
1185 struct smb_hdr hdr; 1192 struct smb_hdr hdr;
1186 struct trans2_resp t2_rsp; 1193 struct trans2_resp t2_rsp;
1187}; 1194} __attribute__((packed));
1188 1195
1189/* PathInfo/FileInfo infolevels */ 1196/* PathInfo/FileInfo infolevels */
1190#define SMB_INFO_STANDARD 1 1197#define SMB_INFO_STANDARD 1
@@ -1271,14 +1278,14 @@ typedef struct smb_com_transaction2_qpi_req {
1271 __le16 InformationLevel; 1278 __le16 InformationLevel;
1272 __u32 Reserved4; 1279 __u32 Reserved4;
1273 char FileName[1]; 1280 char FileName[1];
1274} TRANSACTION2_QPI_REQ; 1281} __attribute__((packed)) TRANSACTION2_QPI_REQ;
1275 1282
1276typedef struct smb_com_transaction2_qpi_rsp { 1283typedef struct smb_com_transaction2_qpi_rsp {
1277 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1284 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1278 struct trans2_resp t2; 1285 struct trans2_resp t2;
1279 __u16 ByteCount; 1286 __u16 ByteCount;
1280 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ 1287 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */
1281} TRANSACTION2_QPI_RSP; 1288} __attribute__((packed)) TRANSACTION2_QPI_RSP;
1282 1289
1283typedef struct smb_com_transaction2_spi_req { 1290typedef struct smb_com_transaction2_spi_req {
1284 struct smb_hdr hdr; /* wct = 15 */ 1291 struct smb_hdr hdr; /* wct = 15 */
@@ -1304,21 +1311,21 @@ typedef struct smb_com_transaction2_spi_req {
1304 __le16 InformationLevel; 1311 __le16 InformationLevel;
1305 __u32 Reserved4; 1312 __u32 Reserved4;
1306 char FileName[1]; 1313 char FileName[1];
1307} TRANSACTION2_SPI_REQ; 1314} __attribute__((packed)) TRANSACTION2_SPI_REQ;
1308 1315
1309typedef struct smb_com_transaction2_spi_rsp { 1316typedef struct smb_com_transaction2_spi_rsp {
1310 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1317 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1311 struct trans2_resp t2; 1318 struct trans2_resp t2;
1312 __u16 ByteCount; 1319 __u16 ByteCount;
1313 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */ 1320 __u16 Reserved2; /* parameter word reserved - present for infolevels > 100 */
1314} TRANSACTION2_SPI_RSP; 1321} __attribute__((packed)) TRANSACTION2_SPI_RSP;
1315 1322
1316struct set_file_rename { 1323struct set_file_rename {
1317 __le32 overwrite; /* 1 = overwrite dest */ 1324 __le32 overwrite; /* 1 = overwrite dest */
1318 __u32 root_fid; /* zero */ 1325 __u32 root_fid; /* zero */
1319 __le32 target_name_len; 1326 __le32 target_name_len;
1320 char target_name[0]; /* Must be unicode */ 1327 char target_name[0]; /* Must be unicode */
1321}; 1328} __attribute__((packed));
1322 1329
1323struct smb_com_transaction2_sfi_req { 1330struct smb_com_transaction2_sfi_req {
1324 struct smb_hdr hdr; /* wct = 15 */ 1331 struct smb_hdr hdr; /* wct = 15 */
@@ -1344,7 +1351,7 @@ struct smb_com_transaction2_sfi_req {
1344 __u16 Fid; 1351 __u16 Fid;
1345 __le16 InformationLevel; 1352 __le16 InformationLevel;
1346 __u16 Reserved4; 1353 __u16 Reserved4;
1347}; 1354} __attribute__((packed));
1348 1355
1349struct smb_com_transaction2_sfi_rsp { 1356struct smb_com_transaction2_sfi_rsp {
1350 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1357 struct smb_hdr hdr; /* wct = 10 + SetupCount */
@@ -1352,7 +1359,7 @@ struct smb_com_transaction2_sfi_rsp {
1352 __u16 ByteCount; 1359 __u16 ByteCount;
1353 __u16 Reserved2; /* parameter word reserved - 1360 __u16 Reserved2; /* parameter word reserved -
1354 present for infolevels > 100 */ 1361 present for infolevels > 100 */
1355}; 1362} __attribute__((packed));
1356 1363
1357struct smb_t2_qfi_req { 1364struct smb_t2_qfi_req {
1358 struct smb_hdr hdr; 1365 struct smb_hdr hdr;
@@ -1360,7 +1367,7 @@ struct smb_t2_qfi_req {
1360 __u8 Pad; 1367 __u8 Pad;
1361 __u16 Fid; 1368 __u16 Fid;
1362 __le16 InformationLevel; 1369 __le16 InformationLevel;
1363}; 1370} __attribute__((packed));
1364 1371
1365struct smb_t2_qfi_rsp { 1372struct smb_t2_qfi_rsp {
1366 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1373 struct smb_hdr hdr; /* wct = 10 + SetupCount */
@@ -1368,7 +1375,7 @@ struct smb_t2_qfi_rsp {
1368 __u16 ByteCount; 1375 __u16 ByteCount;
1369 __u16 Reserved2; /* parameter word reserved - 1376 __u16 Reserved2; /* parameter word reserved -
1370 present for infolevels > 100 */ 1377 present for infolevels > 100 */
1371}; 1378} __attribute__((packed));
1372 1379
1373/* 1380/*
1374 * Flags on T2 FINDFIRST and FINDNEXT 1381 * Flags on T2 FINDFIRST and FINDNEXT
@@ -1410,13 +1417,13 @@ typedef struct smb_com_transaction2_ffirst_req {
1410 __le16 InformationLevel; 1417 __le16 InformationLevel;
1411 __le32 SearchStorageType; 1418 __le32 SearchStorageType;
1412 char FileName[1]; 1419 char FileName[1];
1413} TRANSACTION2_FFIRST_REQ; 1420} __attribute__((packed)) TRANSACTION2_FFIRST_REQ;
1414 1421
1415typedef struct smb_com_transaction2_ffirst_rsp { 1422typedef struct smb_com_transaction2_ffirst_rsp {
1416 struct smb_hdr hdr; /* wct = 10 */ 1423 struct smb_hdr hdr; /* wct = 10 */
1417 struct trans2_resp t2; 1424 struct trans2_resp t2;
1418 __u16 ByteCount; 1425 __u16 ByteCount;
1419} TRANSACTION2_FFIRST_RSP; 1426} __attribute__((packed)) TRANSACTION2_FFIRST_RSP;
1420 1427
1421typedef struct smb_com_transaction2_ffirst_rsp_parms { 1428typedef struct smb_com_transaction2_ffirst_rsp_parms {
1422 __u16 SearchHandle; 1429 __u16 SearchHandle;
@@ -1424,7 +1431,7 @@ typedef struct smb_com_transaction2_ffirst_rsp_parms {
1424 __le16 EndofSearch; 1431 __le16 EndofSearch;
1425 __le16 EAErrorOffset; 1432 __le16 EAErrorOffset;
1426 __le16 LastNameOffset; 1433 __le16 LastNameOffset;
1427} T2_FFIRST_RSP_PARMS; 1434} __attribute__((packed)) T2_FFIRST_RSP_PARMS;
1428 1435
1429typedef struct smb_com_transaction2_fnext_req { 1436typedef struct smb_com_transaction2_fnext_req {
1430 struct smb_hdr hdr; /* wct = 15 */ 1437 struct smb_hdr hdr; /* wct = 15 */
@@ -1452,20 +1459,20 @@ typedef struct smb_com_transaction2_fnext_req {
1452 __u32 ResumeKey; 1459 __u32 ResumeKey;
1453 __le16 SearchFlags; 1460 __le16 SearchFlags;
1454 char ResumeFileName[1]; 1461 char ResumeFileName[1];
1455} TRANSACTION2_FNEXT_REQ; 1462} __attribute__((packed)) TRANSACTION2_FNEXT_REQ;
1456 1463
1457typedef struct smb_com_transaction2_fnext_rsp { 1464typedef struct smb_com_transaction2_fnext_rsp {
1458 struct smb_hdr hdr; /* wct = 10 */ 1465 struct smb_hdr hdr; /* wct = 10 */
1459 struct trans2_resp t2; 1466 struct trans2_resp t2;
1460 __u16 ByteCount; 1467 __u16 ByteCount;
1461} TRANSACTION2_FNEXT_RSP; 1468} __attribute__((packed)) TRANSACTION2_FNEXT_RSP;
1462 1469
1463typedef struct smb_com_transaction2_fnext_rsp_parms { 1470typedef struct smb_com_transaction2_fnext_rsp_parms {
1464 __le16 SearchCount; 1471 __le16 SearchCount;
1465 __le16 EndofSearch; 1472 __le16 EndofSearch;
1466 __le16 EAErrorOffset; 1473 __le16 EAErrorOffset;
1467 __le16 LastNameOffset; 1474 __le16 LastNameOffset;
1468} T2_FNEXT_RSP_PARMS; 1475} __attribute__((packed)) T2_FNEXT_RSP_PARMS;
1469 1476
1470/* QFSInfo Levels */ 1477/* QFSInfo Levels */
1471#define SMB_INFO_ALLOCATION 1 1478#define SMB_INFO_ALLOCATION 1
@@ -1502,14 +1509,14 @@ typedef struct smb_com_transaction2_qfsi_req {
1502 __le16 ByteCount; 1509 __le16 ByteCount;
1503 __u8 Pad; 1510 __u8 Pad;
1504 __le16 InformationLevel; 1511 __le16 InformationLevel;
1505} TRANSACTION2_QFSI_REQ; 1512} __attribute__((packed)) TRANSACTION2_QFSI_REQ;
1506 1513
1507typedef struct smb_com_transaction_qfsi_rsp { 1514typedef struct smb_com_transaction_qfsi_rsp {
1508 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1515 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1509 struct trans2_resp t2; 1516 struct trans2_resp t2;
1510 __u16 ByteCount; 1517 __u16 ByteCount;
1511 __u8 Pad; /* may be three bytes *//* followed by data area */ 1518 __u8 Pad; /* may be three bytes *//* followed by data area */
1512} TRANSACTION2_QFSI_RSP; 1519} __attribute__((packed)) TRANSACTION2_QFSI_RSP;
1513 1520
1514 1521
1515/* SETFSInfo Levels */ 1522/* SETFSInfo Levels */
@@ -1539,13 +1546,13 @@ typedef struct smb_com_transaction2_setfsi_req {
1539 __le16 ClientUnixMajor; /* Data start. */ 1546 __le16 ClientUnixMajor; /* Data start. */
1540 __le16 ClientUnixMinor; 1547 __le16 ClientUnixMinor;
1541 __le64 ClientUnixCap; /* Data end */ 1548 __le64 ClientUnixCap; /* Data end */
1542} TRANSACTION2_SETFSI_REQ; 1549} __attribute__((packed)) TRANSACTION2_SETFSI_REQ;
1543 1550
1544typedef struct smb_com_transaction2_setfsi_rsp { 1551typedef struct smb_com_transaction2_setfsi_rsp {
1545 struct smb_hdr hdr; /* wct = 10 */ 1552 struct smb_hdr hdr; /* wct = 10 */
1546 struct trans2_resp t2; 1553 struct trans2_resp t2;
1547 __u16 ByteCount; 1554 __u16 ByteCount;
1548} TRANSACTION2_SETFSI_RSP; 1555} __attribute__((packed)) TRANSACTION2_SETFSI_RSP;
1549 1556
1550 1557
1551typedef struct smb_com_transaction2_get_dfs_refer_req { 1558typedef struct smb_com_transaction2_get_dfs_refer_req {
@@ -1570,7 +1577,7 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
1570 __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 */
1571 __le16 MaxReferralLevel; 1578 __le16 MaxReferralLevel;
1572 char RequestFileName[1]; 1579 char RequestFileName[1];
1573} TRANSACTION2_GET_DFS_REFER_REQ; 1580} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
1574 1581
1575typedef struct dfs_referral_level_3 { 1582typedef struct dfs_referral_level_3 {
1576 __le16 VersionNumber; 1583 __le16 VersionNumber;
@@ -1582,7 +1589,7 @@ typedef struct dfs_referral_level_3 {
1582 __le16 DfsPathOffset; 1589 __le16 DfsPathOffset;
1583 __le16 DfsAlternatePathOffset; 1590 __le16 DfsAlternatePathOffset;
1584 __le16 NetworkAddressOffset; 1591 __le16 NetworkAddressOffset;
1585} REFERRAL3; 1592} __attribute__((packed)) REFERRAL3;
1586 1593
1587typedef struct smb_com_transaction_get_dfs_refer_rsp { 1594typedef struct smb_com_transaction_get_dfs_refer_rsp {
1588 struct smb_hdr hdr; /* wct = 10 */ 1595 struct smb_hdr hdr; /* wct = 10 */
@@ -1595,7 +1602,7 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
1595 __u16 Pad2; 1602 __u16 Pad2;
1596 REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ 1603 REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */
1597 /* followed by the strings pointed to by the referral structures */ 1604 /* followed by the strings pointed to by the referral structures */
1598} TRANSACTION2_GET_DFS_REFER_RSP; 1605} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_RSP;
1599 1606
1600/* DFS Flags */ 1607/* DFS Flags */
1601#define DFSREF_REFERRAL_SERVER 0x0001 1608#define DFSREF_REFERRAL_SERVER 0x0001
@@ -1649,7 +1656,7 @@ struct serverInfo {
1649 unsigned char versionMinor; 1656 unsigned char versionMinor;
1650 unsigned long type; 1657 unsigned long type;
1651 unsigned int commentOffset; 1658 unsigned int commentOffset;
1652}; 1659} __attribute__((packed));
1653 1660
1654/* 1661/*
1655 * 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
@@ -1661,27 +1668,27 @@ struct shareInfo {
1661 char pad; 1668 char pad;
1662 unsigned short type; 1669 unsigned short type;
1663 unsigned int commentOffset; 1670 unsigned int commentOffset;
1664}; 1671} __attribute__((packed));
1665 1672
1666struct aliasInfo { 1673struct aliasInfo {
1667 char aliasName[9]; 1674 char aliasName[9];
1668 char pad; 1675 char pad;
1669 unsigned int commentOffset; 1676 unsigned int commentOffset;
1670 unsigned char type[2]; 1677 unsigned char type[2];
1671}; 1678} __attribute__((packed));
1672 1679
1673struct aliasInfo92 { 1680struct aliasInfo92 {
1674 int aliasNameOffset; 1681 int aliasNameOffset;
1675 int serverNameOffset; 1682 int serverNameOffset;
1676 int shareNameOffset; 1683 int shareNameOffset;
1677}; 1684} __attribute__((packed));
1678 1685
1679typedef struct { 1686typedef struct {
1680 __le64 TotalAllocationUnits; 1687 __le64 TotalAllocationUnits;
1681 __le64 FreeAllocationUnits; 1688 __le64 FreeAllocationUnits;
1682 __le32 SectorsPerAllocationUnit; 1689 __le32 SectorsPerAllocationUnit;
1683 __le32 BytesPerSector; 1690 __le32 BytesPerSector;
1684} FILE_SYSTEM_INFO; /* size info, level 0x103 */ 1691} __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */
1685 1692
1686typedef struct { 1693typedef struct {
1687 __le32 fsid; 1694 __le32 fsid;
@@ -1689,13 +1696,13 @@ typedef struct {
1689 __le32 TotalAllocationUnits; 1696 __le32 TotalAllocationUnits;
1690 __le32 FreeAllocationUnits; 1697 __le32 FreeAllocationUnits;
1691 __le16 BytesPerSector; 1698 __le16 BytesPerSector;
1692} FILE_SYSTEM_ALLOC_INFO; 1699} __attribute__((packed)) FILE_SYSTEM_ALLOC_INFO;
1693 1700
1694typedef struct { 1701typedef struct {
1695 __le16 MajorVersionNumber; 1702 __le16 MajorVersionNumber;
1696 __le16 MinorVersionNumber; 1703 __le16 MinorVersionNumber;
1697 __le64 Capability; 1704 __le64 Capability;
1698} FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ 1705} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */
1699 1706
1700/* Version numbers for CIFS UNIX major and minor. */ 1707/* Version numbers for CIFS UNIX major and minor. */
1701#define CIFS_UNIX_MAJOR_VERSION 1 1708#define CIFS_UNIX_MAJOR_VERSION 1
@@ -1730,7 +1737,7 @@ typedef struct {
1730 __le64 FileSysIdentifier; /* fsid */ 1737 __le64 FileSysIdentifier; /* fsid */
1731 /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */ 1738 /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
1732 /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */ 1739 /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */
1733} FILE_SYSTEM_POSIX_INFO; 1740} __attribute__((packed)) FILE_SYSTEM_POSIX_INFO;
1734 1741
1735/* DeviceType Flags */ 1742/* DeviceType Flags */
1736#define FILE_DEVICE_CD_ROM 0x00000002 1743#define FILE_DEVICE_CD_ROM 0x00000002
@@ -1755,14 +1762,14 @@ typedef struct {
1755typedef struct { 1762typedef struct {
1756 __le32 DeviceType; 1763 __le32 DeviceType;
1757 __le32 DeviceCharacteristics; 1764 __le32 DeviceCharacteristics;
1758} FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ 1765} __attribute__((packed)) FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */
1759 1766
1760typedef struct { 1767typedef struct {
1761 __le32 Attributes; 1768 __le32 Attributes;
1762 __le32 MaxPathNameComponentLength; 1769 __le32 MaxPathNameComponentLength;
1763 __le32 FileSystemNameLen; 1770 __le32 FileSystemNameLen;
1764 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 */
1765} FILE_SYSTEM_ATTRIBUTE_INFO; 1772} __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO;
1766 1773
1767/******************************************************************************/ 1774/******************************************************************************/
1768/* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */ 1775/* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */
@@ -1789,7 +1796,7 @@ typedef struct { /* data block encoding of response to level 263 QPathInfo */
1789 __le32 AlignmentRequirement; 1796 __le32 AlignmentRequirement;
1790 __le32 FileNameLength; 1797 __le32 FileNameLength;
1791 char FileName[1]; 1798 char FileName[1];
1792} FILE_ALL_INFO; /* level 0x107 QPathInfo */ 1799} __attribute__((packed)) FILE_ALL_INFO; /* level 0x107 QPathInfo */
1793 1800
1794/* defines for enumerating possible values of the Unix type field below */ 1801/* defines for enumerating possible values of the Unix type field below */
1795#define UNIX_FILE 0 1802#define UNIX_FILE 0
@@ -1813,11 +1820,11 @@ typedef struct {
1813 __u64 UniqueId; 1820 __u64 UniqueId;
1814 __le64 Permissions; 1821 __le64 Permissions;
1815 __le64 Nlinks; 1822 __le64 Nlinks;
1816} FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */ 1823} __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */
1817 1824
1818typedef struct { 1825typedef struct {
1819 char LinkDest[1]; 1826 char LinkDest[1];
1820} FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */ 1827} __attribute__((packed)) FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */
1821 1828
1822/* The following three structures are needed only for 1829/* The following three structures are needed only for
1823 setting time to NT4 and some older servers via 1830 setting time to NT4 and some older servers via
@@ -1826,13 +1833,13 @@ typedef struct {
1826 __u16 Day:5; 1833 __u16 Day:5;
1827 __u16 Month:4; 1834 __u16 Month:4;
1828 __u16 Year:7; 1835 __u16 Year:7;
1829} SMB_DATE; 1836} __attribute__((packed)) SMB_DATE;
1830 1837
1831typedef struct { 1838typedef struct {
1832 __u16 TwoSeconds:5; 1839 __u16 TwoSeconds:5;
1833 __u16 Minutes:6; 1840 __u16 Minutes:6;
1834 __u16 Hours:5; 1841 __u16 Hours:5;
1835} SMB_TIME; 1842} __attribute__((packed)) SMB_TIME;
1836 1843
1837typedef struct { 1844typedef struct {
1838 __le16 CreationDate; /* SMB Date see above */ 1845 __le16 CreationDate; /* SMB Date see above */
@@ -1845,7 +1852,7 @@ typedef struct {
1845 __le32 AllocationSize; 1852 __le32 AllocationSize;
1846 __le16 Attributes; /* verify not u32 */ 1853 __le16 Attributes; /* verify not u32 */
1847 __le32 EASize; 1854 __le32 EASize;
1848} FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */ 1855} __attribute__((packed)) FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */
1849 1856
1850typedef struct { 1857typedef struct {
1851 __le64 CreationTime; 1858 __le64 CreationTime;
@@ -1854,19 +1861,19 @@ typedef struct {
1854 __le64 ChangeTime; 1861 __le64 ChangeTime;
1855 __le32 Attributes; 1862 __le32 Attributes;
1856 __u32 Pad; 1863 __u32 Pad;
1857} FILE_BASIC_INFO; /* size info, level 0x101 */ 1864} __attribute__((packed)) FILE_BASIC_INFO; /* size info, level 0x101 */
1858 1865
1859struct file_allocation_info { 1866struct file_allocation_info {
1860 __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */ 1867 __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */
1861}; /* 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 */
1862 1869
1863struct file_end_of_file_info { 1870struct file_end_of_file_info {
1864 __le64 FileSize; /* offset to end of file */ 1871 __le64 FileSize; /* offset to end of file */
1865}; /* size info, level 0x104 for set, 0x106 for query */ 1872} __attribute__((packed)); /* size info, level 0x104 for set, 0x106 for query */
1866 1873
1867struct file_alt_name_info { 1874struct file_alt_name_info {
1868 __u8 alt_name[1]; 1875 __u8 alt_name[1];
1869}; /* level 0x0108 */ 1876} __attribute__((packed)); /* level 0x0108 */
1870 1877
1871struct file_stream_info { 1878struct file_stream_info {
1872 __le32 number_of_streams; /* BB check sizes and verify location */ 1879 __le32 number_of_streams; /* BB check sizes and verify location */
@@ -1883,7 +1890,7 @@ struct file_compression_info {
1883 __u8 ch_shift; 1890 __u8 ch_shift;
1884 __u8 cl_shift; 1891 __u8 cl_shift;
1885 __u8 pad[3]; 1892 __u8 pad[3];
1886}; /* level 0x10b */ 1893} __attribute__((packed)); /* level 0x10b */
1887 1894
1888/* POSIX ACL set/query path info structures */ 1895/* POSIX ACL set/query path info structures */
1889#define CIFS_ACL_VERSION 1 1896#define CIFS_ACL_VERSION 1
@@ -1891,7 +1898,7 @@ struct cifs_posix_ace { /* access control entry (ACE) */
1891 __u8 cifs_e_tag; 1898 __u8 cifs_e_tag;
1892 __u8 cifs_e_perm; 1899 __u8 cifs_e_perm;
1893 __le64 cifs_uid; /* or gid */ 1900 __le64 cifs_uid; /* or gid */
1894}; 1901} __attribute__((packed));
1895 1902
1896struct cifs_posix_acl { /* access conrol list (ACL) */ 1903struct cifs_posix_acl { /* access conrol list (ACL) */
1897 __le16 version; 1904 __le16 version;
@@ -1900,7 +1907,7 @@ struct cifs_posix_acl { /* access conrol list (ACL) */
1900 struct cifs_posix_ace ace_array[0]; 1907 struct cifs_posix_ace ace_array[0];
1901 /* followed by 1908 /* followed by
1902 struct cifs_posix_ace default_ace_arraay[] */ 1909 struct cifs_posix_ace default_ace_arraay[] */
1903}; /* level 0x204 */ 1910} __attribute__((packed)); /* level 0x204 */
1904 1911
1905/* types of access control entries already defined in posix_acl.h */ 1912/* types of access control entries already defined in posix_acl.h */
1906/* #define CIFS_POSIX_ACL_USER_OBJ 0x01 1913/* #define CIFS_POSIX_ACL_USER_OBJ 0x01
@@ -1919,15 +1926,15 @@ struct cifs_posix_acl { /* access conrol list (ACL) */
1919 1926
1920struct file_internal_info { 1927struct file_internal_info {
1921 __u64 UniqueId; /* inode number */ 1928 __u64 UniqueId; /* inode number */
1922}; /* level 0x3ee */ 1929} __attribute__((packed)); /* level 0x3ee */
1923struct file_mode_info { 1930struct file_mode_info {
1924 __le32 Mode; 1931 __le32 Mode;
1925}; /* level 0x3f8 */ 1932} __attribute__((packed)); /* level 0x3f8 */
1926 1933
1927struct file_attrib_tag { 1934struct file_attrib_tag {
1928 __le32 Attribute; 1935 __le32 Attribute;
1929 __le32 ReparseTag; 1936 __le32 ReparseTag;
1930}; /* level 0x40b */ 1937} __attribute__((packed)); /* level 0x40b */
1931 1938
1932 1939
1933/********************************************************/ 1940/********************************************************/
@@ -1951,7 +1958,7 @@ typedef struct {
1951 __le64 Permissions; 1958 __le64 Permissions;
1952 __le64 Nlinks; 1959 __le64 Nlinks;
1953 char FileName[1]; 1960 char FileName[1];
1954} FILE_UNIX_INFO; /* level 0x202 */ 1961} __attribute__((packed)) FILE_UNIX_INFO; /* level 0x202 */
1955 1962
1956typedef struct { 1963typedef struct {
1957 __le32 NextEntryOffset; 1964 __le32 NextEntryOffset;
@@ -1965,7 +1972,7 @@ typedef struct {
1965 __le32 ExtFileAttributes; 1972 __le32 ExtFileAttributes;
1966 __le32 FileNameLength; 1973 __le32 FileNameLength;
1967 char FileName[1]; 1974 char FileName[1];
1968} FILE_DIRECTORY_INFO; /* level 0x101 FF response data area */ 1975} __attribute__((packed)) FILE_DIRECTORY_INFO; /* level 0x101 FF response data area */
1969 1976
1970typedef struct { 1977typedef struct {
1971 __le32 NextEntryOffset; 1978 __le32 NextEntryOffset;
@@ -1980,7 +1987,7 @@ typedef struct {
1980 __le32 FileNameLength; 1987 __le32 FileNameLength;
1981 __le32 EaSize; /* length of the xattrs */ 1988 __le32 EaSize; /* length of the xattrs */
1982 char FileName[1]; 1989 char FileName[1];
1983} FILE_FULL_DIRECTORY_INFO; /* level 0x102 FF response data area */ 1990} __attribute__((packed)) FILE_FULL_DIRECTORY_INFO; /* level 0x102 FF response data area */
1984 1991
1985typedef struct { 1992typedef struct {
1986 __le32 NextEntryOffset; 1993 __le32 NextEntryOffset;
@@ -1997,7 +2004,7 @@ typedef struct {
1997 __le32 Reserved; 2004 __le32 Reserved;
1998 __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*/
1999 char FileName[1]; 2006 char FileName[1];
2000} 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 */
2001 2008
2002typedef struct { 2009typedef struct {
2003 __le32 NextEntryOffset; 2010 __le32 NextEntryOffset;
@@ -2015,18 +2022,18 @@ typedef struct {
2015 __u8 Reserved; 2022 __u8 Reserved;
2016 __u8 ShortName[12]; 2023 __u8 ShortName[12];
2017 char FileName[1]; 2024 char FileName[1];
2018} FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */ 2025} __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FF response data area */
2019 2026
2020 2027
2021struct gea { 2028struct gea {
2022 unsigned char name_len; 2029 unsigned char name_len;
2023 char name[1]; 2030 char name[1];
2024}; 2031} __attribute__((packed));
2025 2032
2026struct gealist { 2033struct gealist {
2027 unsigned long list_len; 2034 unsigned long list_len;
2028 struct gea list[1]; 2035 struct gea list[1];
2029}; 2036} __attribute__((packed));
2030 2037
2031struct fea { 2038struct fea {
2032 unsigned char EA_flags; 2039 unsigned char EA_flags;
@@ -2034,21 +2041,21 @@ struct fea {
2034 __le16 value_len; 2041 __le16 value_len;
2035 char name[1]; 2042 char name[1];
2036 /* optionally followed by value */ 2043 /* optionally followed by value */
2037}; 2044} __attribute__((packed));
2038/* flags for _FEA.fEA */ 2045/* flags for _FEA.fEA */
2039#define FEA_NEEDEA 0x80 /* need EA bit */ 2046#define FEA_NEEDEA 0x80 /* need EA bit */
2040 2047
2041struct fealist { 2048struct fealist {
2042 __le32 list_len; 2049 __le32 list_len;
2043 struct fea list[1]; 2050 struct fea list[1];
2044}; 2051} __attribute__((packed));
2045 2052
2046/* used to hold an arbitrary blob of data */ 2053/* used to hold an arbitrary blob of data */
2047struct data_blob { 2054struct data_blob {
2048 __u8 *data; 2055 __u8 *data;
2049 size_t length; 2056 size_t length;
2050 void (*free) (struct data_blob * data_blob); 2057 void (*free) (struct data_blob * data_blob);
2051}; 2058} __attribute__((packed));
2052 2059
2053 2060
2054#ifdef CONFIG_CIFS_POSIX 2061#ifdef CONFIG_CIFS_POSIX
@@ -2151,7 +2158,7 @@ struct xsymlink {
2151 char cr2; /* \n */ 2158 char cr2; /* \n */
2152/* 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 */
2153 char path[1024]; 2160 char path[1024];
2154}; 2161} __attribute__((packed));
2155 2162
2156typedef struct file_xattr_info { 2163typedef struct file_xattr_info {
2157 /* BB do we need another field for flags? BB */ 2164 /* BB do we need another field for flags? BB */
@@ -2159,7 +2166,7 @@ typedef struct file_xattr_info {
2159 __u32 xattr_value_len; 2166 __u32 xattr_value_len;
2160 char xattr_name[0]; 2167 char xattr_name[0];
2161 /* followed by xattr_value[xattr_value_len], no pad */ 2168 /* followed by xattr_value[xattr_value_len], no pad */
2162} FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ 2169} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */
2163 2170
2164 2171
2165/* flags for chattr command */ 2172/* flags for chattr command */
@@ -2185,10 +2192,8 @@ typedef struct file_xattr_info {
2185typedef struct file_chattr_info { 2192typedef struct file_chattr_info {
2186 __le64 mask; /* list of all possible attribute bits */ 2193 __le64 mask; /* list of all possible attribute bits */
2187 __le64 mode; /* list of actual attribute bits on this inode */ 2194 __le64 mode; /* list of actual attribute bits on this inode */
2188} FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */ 2195} __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */
2189 2196
2190#endif 2197#endif
2191 2198
2192#pragma pack() /* resume default structure packing */
2193
2194#endif /* _CIFSPDU_H */ 2199#endif /* _CIFSPDU_H */
diff --git a/fs/cifs/ntlmssp.h b/fs/cifs/ntlmssp.h
index 6facb41117a3..803389b64a2c 100644
--- a/fs/cifs/ntlmssp.h
+++ b/fs/cifs/ntlmssp.h
@@ -19,8 +19,6 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22#pragma pack(1)
23
24#define NTLMSSP_SIGNATURE "NTLMSSP" 22#define NTLMSSP_SIGNATURE "NTLMSSP"
25/* Message Types */ 23/* Message Types */
26#define NtLmNegotiate cpu_to_le32(1) 24#define NtLmNegotiate cpu_to_le32(1)
@@ -63,7 +61,7 @@ typedef struct _SECURITY_BUFFER {
63 __le16 Length; 61 __le16 Length;
64 __le16 MaximumLength; 62 __le16 MaximumLength;
65 __le32 Buffer; /* offset to buffer */ 63 __le32 Buffer; /* offset to buffer */
66} SECURITY_BUFFER; 64} __attribute__((packed)) SECURITY_BUFFER;
67 65
68typedef struct _NEGOTIATE_MESSAGE { 66typedef struct _NEGOTIATE_MESSAGE {
69 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; 67 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)];
@@ -73,7 +71,7 @@ typedef struct _NEGOTIATE_MESSAGE {
73 SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */ 71 SECURITY_BUFFER WorkstationName; /* RFC 1001 and ASCII */
74 char DomainString[0]; 72 char DomainString[0];
75 /* followed by WorkstationString */ 73 /* followed by WorkstationString */
76} NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE; 74} __attribute__((packed)) NEGOTIATE_MESSAGE, *PNEGOTIATE_MESSAGE;
77 75
78typedef struct _CHALLENGE_MESSAGE { 76typedef struct _CHALLENGE_MESSAGE {
79 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; 77 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)];
@@ -83,7 +81,7 @@ typedef struct _CHALLENGE_MESSAGE {
83 __u8 Challenge[CIFS_CRYPTO_KEY_SIZE]; 81 __u8 Challenge[CIFS_CRYPTO_KEY_SIZE];
84 __u8 Reserved[8]; 82 __u8 Reserved[8];
85 SECURITY_BUFFER TargetInfoArray; 83 SECURITY_BUFFER TargetInfoArray;
86} CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE; 84} __attribute__((packed)) CHALLENGE_MESSAGE, *PCHALLENGE_MESSAGE;
87 85
88typedef struct _AUTHENTICATE_MESSAGE { 86typedef struct _AUTHENTICATE_MESSAGE {
89 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)]; 87 __u8 Signature[sizeof (NTLMSSP_SIGNATURE)];
@@ -96,6 +94,4 @@ typedef struct _AUTHENTICATE_MESSAGE {
96 SECURITY_BUFFER SessionKey; 94 SECURITY_BUFFER SessionKey;
97 __le32 NegotiateFlags; 95 __le32 NegotiateFlags;
98 char UserString[0]; 96 char UserString[0];
99} AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE; 97} __attribute__((packed)) AUTHENTICATE_MESSAGE, *PAUTHENTICATE_MESSAGE;
100
101#pragma pack() /* resume default structure packing */
diff --git a/fs/cifs/rfc1002pdu.h b/fs/cifs/rfc1002pdu.h
index 806c0ed06da9..9222033cad8e 100644
--- a/fs/cifs/rfc1002pdu.h
+++ b/fs/cifs/rfc1002pdu.h
@@ -21,8 +21,6 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#pragma pack(1)
25
26/* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */ 24/* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */
27 25
28 /* RFC 1002 session packet types */ 26 /* RFC 1002 session packet types */
@@ -48,17 +46,17 @@ struct rfc1002_session_packet {
48 __u8 calling_len; 46 __u8 calling_len;
49 __u8 calling_name[32]; 47 __u8 calling_name[32];
50 __u8 scope2; /* null */ 48 __u8 scope2; /* null */
51 } session_req; 49 } __attribute__((packed)) session_req;
52 struct { 50 struct {
53 __u32 retarget_ip_addr; 51 __u32 retarget_ip_addr;
54 __u16 port; 52 __u16 port;
55 } retarget_resp; 53 } __attribute__((packed)) retarget_resp;
56 __u8 neg_ses_resp_error_code; 54 __u8 neg_ses_resp_error_code;
57 /* POSITIVE_SESSION_RESPONSE packet does not include trailer. 55 /* POSITIVE_SESSION_RESPONSE packet does not include trailer.
58 SESSION_KEEP_ALIVE packet also does not include a trailer. 56 SESSION_KEEP_ALIVE packet also does not include a trailer.
59 Trailer for the SESSION_MESSAGE packet is SMB/CIFS header */ 57 Trailer for the SESSION_MESSAGE packet is SMB/CIFS header */
60 } trailer; 58 } __attribute__((packed)) trailer;
61}; 59} __attribute__((packed));
62 60
63/* Negative Session Response error codes */ 61/* Negative Session Response error codes */
64#define RFC1002_NOT_LISTENING_CALLED 0x80 /* not listening on called name */ 62#define RFC1002_NOT_LISTENING_CALLED 0x80 /* not listening on called name */
@@ -74,6 +72,3 @@ server netbios name). Currently server names are resolved only via DNS
74(tcp name) or ip address or an /etc/hosts equivalent mapping to ip address.*/ 72(tcp name) or ip address or an /etc/hosts equivalent mapping to ip address.*/
75 73
76#define DEFAULT_CIFS_CALLED_NAME "*SMBSERVER " 74#define DEFAULT_CIFS_CALLED_NAME "*SMBSERVER "
77
78#pragma pack() /* resume default structure packing */
79