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.h284
1 files changed, 149 insertions, 135 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 802d27d98e2d..9044d9886f0d 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -144,7 +144,7 @@
144#define SMBOPEN_OAPPEND 0x0001 144#define SMBOPEN_OAPPEND 0x0001
145 145
146/* 146/*
147 * SMB flag definitions 147 * SMB flag definitions
148 */ 148 */
149#define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock smb */ 149#define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock smb */
150#define SMBFLG_RCV_POSTED 0x02 /* obsolete */ 150#define SMBFLG_RCV_POSTED 0x02 /* obsolete */
@@ -157,9 +157,9 @@
157#define SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */ 157#define SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */
158 158
159/* 159/*
160 * SMB flag2 definitions 160 * SMB flag2 definitions
161 */ 161 */
162#define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3) 162#define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3)
163 path names in response */ 163 path names in response */
164#define SMBFLG2_KNOWS_EAS cpu_to_le16(2) 164#define SMBFLG2_KNOWS_EAS cpu_to_le16(2)
165#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) 165#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4)
@@ -260,7 +260,7 @@
260#define ATTR_SPARSE 0x0200 260#define ATTR_SPARSE 0x0200
261#define ATTR_REPARSE 0x0400 261#define ATTR_REPARSE 0x0400
262#define ATTR_COMPRESSED 0x0800 262#define ATTR_COMPRESSED 0x0800
263#define ATTR_OFFLINE 0x1000 /* ie file not immediately available - 263#define ATTR_OFFLINE 0x1000 /* ie file not immediately available -
264 on offline storage */ 264 on offline storage */
265#define ATTR_NOT_CONTENT_INDEXED 0x2000 265#define ATTR_NOT_CONTENT_INDEXED 0x2000
266#define ATTR_ENCRYPTED 0x4000 266#define ATTR_ENCRYPTED 0x4000
@@ -300,7 +300,7 @@
300#define CREATE_DELETE_ON_CLOSE 0x00001000 300#define CREATE_DELETE_ON_CLOSE 0x00001000
301#define CREATE_OPEN_BY_ID 0x00002000 301#define CREATE_OPEN_BY_ID 0x00002000
302#define OPEN_REPARSE_POINT 0x00200000 302#define OPEN_REPARSE_POINT 0x00200000
303#define CREATE_OPTIONS_MASK 0x007FFFFF 303#define CREATE_OPTIONS_MASK 0x007FFFFF
304#define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ 304#define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */
305 305
306/* ImpersonationLevel flags */ 306/* ImpersonationLevel flags */
@@ -366,17 +366,19 @@ struct smb_hdr {
366#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) 366#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 )
367 367
368/* 368/*
369 * Computer Name Length 369 * Computer Name Length (since Netbios name was length 16 with last byte 0x20)
370 * No longer as important, now that TCP names are more commonly used to
371 * resolve hosts.
370 */ 372 */
371#define CNLEN 15 373#define CNLEN 15
372 374
373/* 375/*
374 * Share Name Length @S8A 376 * Share Name Length (SNLEN)
375 * Note: This length is limited by the SMB used to get @S8A 377 * Note: This length was limited by the SMB used to get
376 * the Share info. NetShareEnum only returns 13 @S8A 378 * the Share info. NetShareEnum only returned 13
377 * chars, including the null termination. @S8A 379 * chars, including the null termination.
380 * This was removed because it no longer is limiting.
378 */ 381 */
379#define SNLEN 12 /*@S8A */
380 382
381/* 383/*
382 * Comment Length 384 * Comment Length
@@ -394,8 +396,8 @@ struct smb_hdr {
394 * 396 *
395 * The Naming convention is the lower case version of the 397 * The Naming convention is the lower case version of the
396 * smb command code name for the struct and this is typedef to the 398 * smb command code name for the struct and this is typedef to the
397 * uppercase version of the same name with the prefix SMB_ removed 399 * uppercase version of the same name with the prefix SMB_ removed
398 * for brevity. Although typedefs are not commonly used for 400 * for brevity. Although typedefs are not commonly used for
399 * structure definitions in the Linux kernel, their use in the 401 * structure definitions in the Linux kernel, their use in the
400 * CIFS standards document, which this code is based on, may 402 * CIFS standards document, which this code is based on, may
401 * make this one of the cases where typedefs for structures make 403 * make this one of the cases where typedefs for structures make
@@ -403,7 +405,7 @@ struct smb_hdr {
403 * Typedefs can always be removed later if they are too distracting 405 * Typedefs can always be removed later if they are too distracting
404 * and they are only used for the CIFSs PDUs themselves, not 406 * and they are only used for the CIFSs PDUs themselves, not
405 * internal cifs vfs structures 407 * internal cifs vfs structures
406 * 408 *
407 */ 409 */
408 410
409typedef struct negotiate_req { 411typedef struct negotiate_req {
@@ -511,7 +513,7 @@ typedef union smb_com_session_setup_andx {
511 unsigned char SecurityBlob[1]; /* followed by */ 513 unsigned char SecurityBlob[1]; /* followed by */
512 /* STRING NativeOS */ 514 /* STRING NativeOS */
513 /* STRING NativeLanMan */ 515 /* STRING NativeLanMan */
514 } __attribute__((packed)) req; /* NTLM request format (with 516 } __attribute__((packed)) req; /* NTLM request format (with
515 extended security */ 517 extended security */
516 518
517 struct { /* request format */ 519 struct { /* request format */
@@ -549,7 +551,7 @@ typedef union smb_com_session_setup_andx {
549/* unsigned char * NativeOS; */ 551/* unsigned char * NativeOS; */
550/* unsigned char * NativeLanMan; */ 552/* unsigned char * NativeLanMan; */
551/* unsigned char * PrimaryDomain; */ 553/* unsigned char * PrimaryDomain; */
552 } __attribute__((packed)) resp; /* NTLM response 554 } __attribute__((packed)) resp; /* NTLM response
553 (with or without extended sec) */ 555 (with or without extended sec) */
554 556
555 struct { /* request format */ 557 struct { /* request format */
@@ -618,7 +620,7 @@ struct ntlmv2_resp {
618#define CAP_NT_SMBS 0x00000010 620#define CAP_NT_SMBS 0x00000010
619#define CAP_STATUS32 0x00000040 621#define CAP_STATUS32 0x00000040
620#define CAP_LEVEL_II_OPLOCKS 0x00000080 622#define CAP_LEVEL_II_OPLOCKS 0x00000080
621#define CAP_NT_FIND 0x00000200 /* reserved should be zero 623#define CAP_NT_FIND 0x00000200 /* reserved should be zero
622 (because NT_SMBs implies the same thing?) */ 624 (because NT_SMBs implies the same thing?) */
623#define CAP_BULK_TRANSFER 0x20000000 625#define CAP_BULK_TRANSFER 0x20000000
624#define CAP_EXTENDED_SECURITY 0x80000000 626#define CAP_EXTENDED_SECURITY 0x80000000
@@ -676,7 +678,7 @@ typedef struct smb_com_logoff_andx_rsp {
676 __u16 ByteCount; 678 __u16 ByteCount;
677} __attribute__((packed)) LOGOFF_ANDX_RSP; 679} __attribute__((packed)) LOGOFF_ANDX_RSP;
678 680
679typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on 681typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on
680 tree_connect PDU to effect disconnect */ 682 tree_connect PDU to effect disconnect */
681 /* tdis is probably simplest SMB PDU */ 683 /* tdis is probably simplest SMB PDU */
682 struct { 684 struct {
@@ -800,27 +802,28 @@ typedef struct smb_com_openx_rsp {
800 __u32 FileId; 802 __u32 FileId;
801 __u16 Reserved; 803 __u16 Reserved;
802 __u16 ByteCount; 804 __u16 ByteCount;
803} __attribute__((packed)) OPENX_RSP; 805} __attribute__((packed)) OPENX_RSP;
804 806
805/* For encoding of POSIX Open Request - see trans2 function 0x209 data struct */ 807/* For encoding of POSIX Open Request - see trans2 function 0x209 data struct */
806 808
807/* Legacy write request for older servers */ 809/* Legacy write request for older servers */
808typedef struct smb_com_writex_req { 810typedef struct smb_com_writex_req {
809 struct smb_hdr hdr; /* wct = 12 */ 811 struct smb_hdr hdr; /* wct = 12 */
810 __u8 AndXCommand; 812 __u8 AndXCommand;
811 __u8 AndXReserved; 813 __u8 AndXReserved;
812 __le16 AndXOffset; 814 __le16 AndXOffset;
813 __u16 Fid; 815 __u16 Fid;
814 __le32 OffsetLow; 816 __le32 OffsetLow;
815 __u32 Reserved; /* Timeout */ 817 __u32 Reserved; /* Timeout */
816 __le16 WriteMode; /* 1 = write through */ 818 __le16 WriteMode; /* 1 = write through */
817 __le16 Remaining; 819 __le16 Remaining;
818 __le16 Reserved2; 820 __le16 Reserved2;
819 __le16 DataLengthLow; 821 __le16 DataLengthLow;
820 __le16 DataOffset; 822 __le16 DataOffset;
821 __le16 ByteCount; 823 __le16 ByteCount;
822 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ 824 __u8 Pad; /* BB check for whether padded to DWORD
823 char Data[0]; 825 boundary and optimum performance here */
826 char Data[0];
824} __attribute__((packed)) WRITEX_REQ; 827} __attribute__((packed)) WRITEX_REQ;
825 828
826typedef struct smb_com_write_req { 829typedef struct smb_com_write_req {
@@ -838,7 +841,8 @@ typedef struct smb_com_write_req {
838 __le16 DataOffset; 841 __le16 DataOffset;
839 __le32 OffsetHigh; 842 __le32 OffsetHigh;
840 __le16 ByteCount; 843 __le16 ByteCount;
841 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ 844 __u8 Pad; /* BB check for whether padded to DWORD
845 boundary and optimum performance here */
842 char Data[0]; 846 char Data[0];
843} __attribute__((packed)) WRITE_REQ; 847} __attribute__((packed)) WRITE_REQ;
844 848
@@ -856,17 +860,17 @@ typedef struct smb_com_write_rsp {
856 860
857/* legacy read request for older servers */ 861/* legacy read request for older servers */
858typedef struct smb_com_readx_req { 862typedef struct smb_com_readx_req {
859 struct smb_hdr hdr; /* wct = 10 */ 863 struct smb_hdr hdr; /* wct = 10 */
860 __u8 AndXCommand; 864 __u8 AndXCommand;
861 __u8 AndXReserved; 865 __u8 AndXReserved;
862 __le16 AndXOffset; 866 __le16 AndXOffset;
863 __u16 Fid; 867 __u16 Fid;
864 __le32 OffsetLow; 868 __le32 OffsetLow;
865 __le16 MaxCount; 869 __le16 MaxCount;
866 __le16 MinCount; /* obsolete */ 870 __le16 MinCount; /* obsolete */
867 __le32 Reserved; 871 __le32 Reserved;
868 __le16 Remaining; 872 __le16 Remaining;
869 __le16 ByteCount; 873 __le16 ByteCount;
870} __attribute__((packed)) READX_REQ; 874} __attribute__((packed)) READX_REQ;
871 875
872typedef struct smb_com_read_req { 876typedef struct smb_com_read_req {
@@ -897,7 +901,8 @@ typedef struct smb_com_read_rsp {
897 __le16 DataLengthHigh; 901 __le16 DataLengthHigh;
898 __u64 Reserved2; 902 __u64 Reserved2;
899 __u16 ByteCount; 903 __u16 ByteCount;
900 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ 904 __u8 Pad; /* BB check for whether padded to DWORD
905 boundary and optimum performance here */
901 char Data[1]; 906 char Data[1];
902} __attribute__((packed)) READ_RSP; 907} __attribute__((packed)) READ_RSP;
903 908
@@ -968,7 +973,7 @@ typedef struct smb_com_rename_req {
968#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */ 973#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */
969#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */ 974#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */
970#define COPY_VERIFY_WRITES 0x0010 975#define COPY_VERIFY_WRITES 0x0010
971#define COPY_TREE 0x0020 976#define COPY_TREE 0x0020
972 977
973typedef struct smb_com_copy_req { 978typedef struct smb_com_copy_req {
974 struct smb_hdr hdr; /* wct = 3 */ 979 struct smb_hdr hdr; /* wct = 3 */
@@ -976,7 +981,7 @@ typedef struct smb_com_copy_req {
976 __le16 OpenFunction; 981 __le16 OpenFunction;
977 __le16 Flags; 982 __le16 Flags;
978 __le16 ByteCount; 983 __le16 ByteCount;
979 __u8 BufferFormat; /* 4 = ASCII or Unicode */ 984 __u8 BufferFormat; /* 4 = ASCII or Unicode */
980 unsigned char OldFileName[1]; 985 unsigned char OldFileName[1];
981 /* followed by __u8 BufferFormat2 */ 986 /* followed by __u8 BufferFormat2 */
982 /* followed by NewFileName string */ 987 /* followed by NewFileName string */
@@ -1084,28 +1089,28 @@ typedef struct smb_com_setattr_rsp {
1084 1089
1085/*******************************************************/ 1090/*******************************************************/
1086/* NT Transact structure defintions follow */ 1091/* NT Transact structure defintions follow */
1087/* Currently only ioctl, acl (get security descriptor) */ 1092/* Currently only ioctl, acl (get security descriptor) */
1088/* and notify are implemented */ 1093/* and notify are implemented */
1089/*******************************************************/ 1094/*******************************************************/
1090typedef struct smb_com_ntransact_req { 1095typedef struct smb_com_ntransact_req {
1091 struct smb_hdr hdr; /* wct >= 19 */ 1096 struct smb_hdr hdr; /* wct >= 19 */
1092 __u8 MaxSetupCount; 1097 __u8 MaxSetupCount;
1093 __u16 Reserved; 1098 __u16 Reserved;
1094 __le32 TotalParameterCount; 1099 __le32 TotalParameterCount;
1095 __le32 TotalDataCount; 1100 __le32 TotalDataCount;
1096 __le32 MaxParameterCount; 1101 __le32 MaxParameterCount;
1097 __le32 MaxDataCount; 1102 __le32 MaxDataCount;
1098 __le32 ParameterCount; 1103 __le32 ParameterCount;
1099 __le32 ParameterOffset; 1104 __le32 ParameterOffset;
1100 __le32 DataCount; 1105 __le32 DataCount;
1101 __le32 DataOffset; 1106 __le32 DataOffset;
1102 __u8 SetupCount; /* four setup words follow subcommand */ 1107 __u8 SetupCount; /* four setup words follow subcommand */
1103 /* SNIA spec incorrectly included spurious pad here */ 1108 /* SNIA spec incorrectly included spurious pad here */
1104 __le16 SubCommand; /* 2 = IOCTL/FSCTL */ 1109 __le16 SubCommand; /* 2 = IOCTL/FSCTL */
1105 /* SetupCount words follow then */ 1110 /* SetupCount words follow then */
1106 __le16 ByteCount; 1111 __le16 ByteCount;
1107 __u8 Pad[3]; 1112 __u8 Pad[3];
1108 __u8 Parms[0]; 1113 __u8 Parms[0];
1109} __attribute__((packed)) NTRANSACT_REQ; 1114} __attribute__((packed)) NTRANSACT_REQ;
1110 1115
1111typedef struct smb_com_ntransact_rsp { 1116typedef struct smb_com_ntransact_rsp {
@@ -1121,7 +1126,7 @@ typedef struct smb_com_ntransact_rsp {
1121 __le32 DataDisplacement; 1126 __le32 DataDisplacement;
1122 __u8 SetupCount; /* 0 */ 1127 __u8 SetupCount; /* 0 */
1123 __u16 ByteCount; 1128 __u16 ByteCount;
1124 /* __u8 Pad[3]; */ 1129 /* __u8 Pad[3]; */
1125 /* parms and data follow */ 1130 /* parms and data follow */
1126} __attribute__((packed)) NTRANSACT_RSP; 1131} __attribute__((packed)) NTRANSACT_RSP;
1127 1132
@@ -1216,7 +1221,7 @@ typedef struct smb_com_transaction_change_notify_req {
1216/* __u8 Data[1];*/ 1221/* __u8 Data[1];*/
1217} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ; 1222} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ;
1218 1223
1219/* BB eventually change to use generic ntransact rsp struct 1224/* BB eventually change to use generic ntransact rsp struct
1220 and validation routine */ 1225 and validation routine */
1221typedef struct smb_com_transaction_change_notify_rsp { 1226typedef struct smb_com_transaction_change_notify_rsp {
1222 struct smb_hdr hdr; /* wct = 18 */ 1227 struct smb_hdr hdr; /* wct = 18 */
@@ -1263,7 +1268,7 @@ struct file_notify_information {
1263 __le32 Action; 1268 __le32 Action;
1264 __le32 FileNameLength; 1269 __le32 FileNameLength;
1265 __u8 FileName[0]; 1270 __u8 FileName[0];
1266} __attribute__((packed)); 1271} __attribute__((packed));
1267 1272
1268struct reparse_data { 1273struct reparse_data {
1269 __u32 ReparseTag; 1274 __u32 ReparseTag;
@@ -1332,7 +1337,7 @@ struct trans2_resp {
1332 __u8 Reserved1; 1337 __u8 Reserved1;
1333 /* SetupWords[SetupCount]; 1338 /* SetupWords[SetupCount];
1334 __u16 ByteCount; 1339 __u16 ByteCount;
1335 __u16 Reserved2;*/ 1340 __u16 Reserved2;*/
1336 /* data area follows */ 1341 /* data area follows */
1337} __attribute__((packed)); 1342} __attribute__((packed));
1338 1343
@@ -1371,9 +1376,9 @@ struct smb_t2_rsp {
1371#define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee 1376#define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee
1372#define SMB_QUERY_FILE_ACCESS_INFO 0x3f0 1377#define SMB_QUERY_FILE_ACCESS_INFO 0x3f0
1373#define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */ 1378#define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */
1374#define SMB_QUERY_FILE_POSITION_INFO 0x3f6 1379#define SMB_QUERY_FILE_POSITION_INFO 0x3f6
1375#define SMB_QUERY_FILE_MODE_INFO 0x3f8 1380#define SMB_QUERY_FILE_MODE_INFO 0x3f8
1376#define SMB_QUERY_FILE_ALGN_INFO 0x3f9 1381#define SMB_QUERY_FILE_ALGN_INFO 0x3f9
1377 1382
1378 1383
1379#define SMB_SET_FILE_BASIC_INFO 0x101 1384#define SMB_SET_FILE_BASIC_INFO 0x101
@@ -1507,35 +1512,35 @@ struct smb_com_transaction2_sfi_req {
1507 __u16 Pad1; 1512 __u16 Pad1;
1508 __u16 Fid; 1513 __u16 Fid;
1509 __le16 InformationLevel; 1514 __le16 InformationLevel;
1510 __u16 Reserved4; 1515 __u16 Reserved4;
1511} __attribute__((packed)); 1516} __attribute__((packed));
1512 1517
1513struct smb_com_transaction2_sfi_rsp { 1518struct smb_com_transaction2_sfi_rsp {
1514 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1519 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1515 struct trans2_resp t2; 1520 struct trans2_resp t2;
1516 __u16 ByteCount; 1521 __u16 ByteCount;
1517 __u16 Reserved2; /* parameter word reserved - 1522 __u16 Reserved2; /* parameter word reserved -
1518 present for infolevels > 100 */ 1523 present for infolevels > 100 */
1519} __attribute__((packed)); 1524} __attribute__((packed));
1520 1525
1521struct smb_t2_qfi_req { 1526struct smb_t2_qfi_req {
1522 struct smb_hdr hdr; 1527 struct smb_hdr hdr;
1523 struct trans2_req t2; 1528 struct trans2_req t2;
1524 __u8 Pad; 1529 __u8 Pad;
1525 __u16 Fid; 1530 __u16 Fid;
1526 __le16 InformationLevel; 1531 __le16 InformationLevel;
1527} __attribute__((packed)); 1532} __attribute__((packed));
1528 1533
1529struct smb_t2_qfi_rsp { 1534struct smb_t2_qfi_rsp {
1530 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1535 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1531 struct trans2_resp t2; 1536 struct trans2_resp t2;
1532 __u16 ByteCount; 1537 __u16 ByteCount;
1533 __u16 Reserved2; /* parameter word reserved - 1538 __u16 Reserved2; /* parameter word reserved -
1534 present for infolevels > 100 */ 1539 present for infolevels > 100 */
1535} __attribute__((packed)); 1540} __attribute__((packed));
1536 1541
1537/* 1542/*
1538 * Flags on T2 FINDFIRST and FINDNEXT 1543 * Flags on T2 FINDFIRST and FINDNEXT
1539 */ 1544 */
1540#define CIFS_SEARCH_CLOSE_ALWAYS 0x0001 1545#define CIFS_SEARCH_CLOSE_ALWAYS 0x0001
1541#define CIFS_SEARCH_CLOSE_AT_END 0x0002 1546#define CIFS_SEARCH_CLOSE_AT_END 0x0002
@@ -1744,7 +1749,9 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
1744 __u8 Reserved3; 1749 __u8 Reserved3;
1745 __le16 SubCommand; /* one setup word */ 1750 __le16 SubCommand; /* one setup word */
1746 __le16 ByteCount; 1751 __le16 ByteCount;
1747 __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ 1752 __u8 Pad[3]; /* Win2K has sent 0x0F01 (max response length
1753 perhaps?) followed by one byte pad - doesn't
1754 seem to matter though */
1748 __le16 MaxReferralLevel; 1755 __le16 MaxReferralLevel;
1749 char RequestFileName[1]; 1756 char RequestFileName[1];
1750} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; 1757} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
@@ -1753,7 +1760,10 @@ typedef struct dfs_referral_level_3 {
1753 __le16 VersionNumber; 1760 __le16 VersionNumber;
1754 __le16 ReferralSize; 1761 __le16 ReferralSize;
1755 __le16 ServerType; /* 0x0001 = CIFS server */ 1762 __le16 ServerType; /* 0x0001 = CIFS server */
1756 __le16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ 1763 __le16 ReferralFlags; /* or proximity - not clear which since it is
1764 always set to zero - SNIA spec says 0x01
1765 means strip off PathConsumed chars before
1766 submitting RequestFileName to remote node */
1757 __le16 TimeToLive; 1767 __le16 TimeToLive;
1758 __le16 Proximity; 1768 __le16 Proximity;
1759 __le16 DfsPathOffset; 1769 __le16 DfsPathOffset;
@@ -1779,11 +1789,13 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
1779#define DFSREF_STORAGE_SERVER 0x0002 1789#define DFSREF_STORAGE_SERVER 0x0002
1780 1790
1781/* IOCTL information */ 1791/* IOCTL information */
1782/* List of ioctl function codes that look to be of interest to remote clients like this. */ 1792/*
1783/* Need to do some experimentation to make sure they all work remotely. */ 1793 * List of ioctl function codes that look to be of interest to remote clients
1784/* Some of the following such as the encryption/compression ones would be */ 1794 * like this one. Need to do some experimentation to make sure they all work
1785/* invoked from tools via a specialized hook into the VFS rather than via the */ 1795 * remotely. Some of the following, such as the encryption/compression ones
1786/* standard vfs entry points */ 1796 * would be invoked from tools via a specialized hook into the VFS rather
1797 * than via the standard vfs entry points
1798 */
1787#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 1799#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
1788#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 1800#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
1789#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 1801#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008
@@ -1812,7 +1824,7 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
1812/* 1824/*
1813 ************************************************************************ 1825 ************************************************************************
1814 * All structs for everything above the SMB PDUs themselves 1826 * All structs for everything above the SMB PDUs themselves
1815 * (such as the T2 level specific data) go here 1827 * (such as the T2 level specific data) go here
1816 ************************************************************************ 1828 ************************************************************************
1817 */ 1829 */
1818 1830
@@ -1858,7 +1870,7 @@ typedef struct {
1858 __le64 FreeAllocationUnits; 1870 __le64 FreeAllocationUnits;
1859 __le32 SectorsPerAllocationUnit; 1871 __le32 SectorsPerAllocationUnit;
1860 __le32 BytesPerSector; 1872 __le32 BytesPerSector;
1861} __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */ 1873} __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */
1862 1874
1863typedef struct { 1875typedef struct {
1864 __le32 fsid; 1876 __le32 fsid;
@@ -1872,7 +1884,7 @@ typedef struct {
1872 __le16 MajorVersionNumber; 1884 __le16 MajorVersionNumber;
1873 __le16 MinorVersionNumber; 1885 __le16 MinorVersionNumber;
1874 __le64 Capability; 1886 __le64 Capability;
1875} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ 1887} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extension level 0x200*/
1876 1888
1877/* Version numbers for CIFS UNIX major and minor. */ 1889/* Version numbers for CIFS UNIX major and minor. */
1878#define CIFS_UNIX_MAJOR_VERSION 1 1890#define CIFS_UNIX_MAJOR_VERSION 1
@@ -1888,7 +1900,7 @@ typedef struct {
1888 calls including posix open 1900 calls including posix open
1889 and posix unlink */ 1901 and posix unlink */
1890#define CIFS_UNIX_LARGE_READ_CAP 0x00000040 /* support reads >128K (up 1902#define CIFS_UNIX_LARGE_READ_CAP 0x00000040 /* support reads >128K (up
1891 to 0xFFFF00 */ 1903 to 0xFFFF00 */
1892#define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080 1904#define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080
1893 1905
1894#ifdef CONFIG_CIFS_POSIX 1906#ifdef CONFIG_CIFS_POSIX
@@ -1898,8 +1910,8 @@ typedef struct {
1898 as non-posix handles (can affect write behavior with byte range locks. 1910 as non-posix handles (can affect write behavior with byte range locks.
1899 We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */ 1911 We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
1900/* #define CIFS_UNIX_CAP_MASK 0x000000fb */ 1912/* #define CIFS_UNIX_CAP_MASK 0x000000fb */
1901#define CIFS_UNIX_CAP_MASK 0x000000db 1913#define CIFS_UNIX_CAP_MASK 0x000000db
1902#else 1914#else
1903#define CIFS_UNIX_CAP_MASK 0x00000013 1915#define CIFS_UNIX_CAP_MASK 0x00000013
1904#endif /* CONFIG_CIFS_POSIX */ 1916#endif /* CONFIG_CIFS_POSIX */
1905 1917
@@ -1909,10 +1921,10 @@ typedef struct {
1909typedef struct { 1921typedef struct {
1910 /* For undefined recommended transfer size return -1 in that field */ 1922 /* For undefined recommended transfer size return -1 in that field */
1911 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ 1923 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */
1912 __le32 BlockSize; 1924 __le32 BlockSize;
1913 /* The next three fields are in terms of the block size. 1925 /* The next three fields are in terms of the block size.
1914 (above). If block size is unknown, 4096 would be a 1926 (above). If block size is unknown, 4096 would be a
1915 reasonable block size for a server to report. 1927 reasonable block size for a server to report.
1916 Note that returning the blocks/blocksavail removes need 1928 Note that returning the blocks/blocksavail removes need
1917 to make a second call (to QFSInfo level 0x103 to get this info. 1929 to make a second call (to QFSInfo level 0x103 to get this info.
1918 UserBlockAvail is typically less than or equal to BlocksAvail, 1930 UserBlockAvail is typically less than or equal to BlocksAvail,
@@ -2067,9 +2079,9 @@ struct file_alt_name_info {
2067 2079
2068struct file_stream_info { 2080struct file_stream_info {
2069 __le32 number_of_streams; /* BB check sizes and verify location */ 2081 __le32 number_of_streams; /* BB check sizes and verify location */
2070 /* followed by info on streams themselves 2082 /* followed by info on streams themselves
2071 u64 size; 2083 u64 size;
2072 u64 allocation_size 2084 u64 allocation_size
2073 stream info */ 2085 stream info */
2074}; /* level 0x109 */ 2086}; /* level 0x109 */
2075 2087
@@ -2088,7 +2100,7 @@ struct cifs_posix_ace { /* access control entry (ACE) */
2088 __u8 cifs_e_tag; 2100 __u8 cifs_e_tag;
2089 __u8 cifs_e_perm; 2101 __u8 cifs_e_perm;
2090 __le64 cifs_uid; /* or gid */ 2102 __le64 cifs_uid; /* or gid */
2091} __attribute__((packed)); 2103} __attribute__((packed));
2092 2104
2093struct cifs_posix_acl { /* access conrol list (ACL) */ 2105struct cifs_posix_acl { /* access conrol list (ACL) */
2094 __le16 version; 2106 __le16 version;
@@ -2159,7 +2171,7 @@ struct file_attrib_tag {
2159 2171
2160 2172
2161/********************************************************/ 2173/********************************************************/
2162/* FindFirst/FindNext transact2 data buffer formats */ 2174/* FindFirst/FindNext transact2 data buffer formats */
2163/********************************************************/ 2175/********************************************************/
2164 2176
2165typedef struct { 2177typedef struct {
@@ -2237,7 +2249,7 @@ typedef struct {
2237 __le64 EndOfFile; 2249 __le64 EndOfFile;
2238 __le64 AllocationSize; 2250 __le64 AllocationSize;
2239 __le32 ExtFileAttributes; 2251 __le32 ExtFileAttributes;
2240 __le32 FileNameLength; 2252 __le32 FileNameLength;
2241 __le32 EaSize; /* length of the xattrs */ 2253 __le32 EaSize; /* length of the xattrs */
2242 __u8 ShortNameLength; 2254 __u8 ShortNameLength;
2243 __u8 Reserved; 2255 __u8 Reserved;
@@ -2264,7 +2276,7 @@ typedef struct {
2264struct win_dev { 2276struct win_dev {
2265 unsigned char type[8]; /* IntxCHR or IntxBLK */ 2277 unsigned char type[8]; /* IntxCHR or IntxBLK */
2266 __le64 major; 2278 __le64 major;
2267 __le64 minor; 2279 __le64 minor;
2268} __attribute__((packed)); 2280} __attribute__((packed));
2269 2281
2270struct gea { 2282struct gea {
@@ -2296,36 +2308,36 @@ struct fealist {
2296struct data_blob { 2308struct data_blob {
2297 __u8 *data; 2309 __u8 *data;
2298 size_t length; 2310 size_t length;
2299 void (*free) (struct data_blob * data_blob); 2311 void (*free) (struct data_blob *data_blob);
2300} __attribute__((packed)); 2312} __attribute__((packed));
2301 2313
2302 2314
2303#ifdef CONFIG_CIFS_POSIX 2315#ifdef CONFIG_CIFS_POSIX
2304/* 2316/*
2305 For better POSIX semantics from Linux client, (even better 2317 For better POSIX semantics from Linux client, (even better
2306 than the existing CIFS Unix Extensions) we need updated PDUs for: 2318 than the existing CIFS Unix Extensions) we need updated PDUs for:
2307 2319
2308 1) PosixCreateX - to set and return the mode, inode#, device info and 2320 1) PosixCreateX - to set and return the mode, inode#, device info and
2309 perhaps add a CreateDevice - to create Pipes and other special .inodes 2321 perhaps add a CreateDevice - to create Pipes and other special .inodes
2310 Also note POSIX open flags 2322 Also note POSIX open flags
2311 2) Close - to return the last write time to do cache across close 2323 2) Close - to return the last write time to do cache across close
2312 more safely 2324 more safely
2313 3) FindFirst return unique inode number - what about resume key, two 2325 3) FindFirst return unique inode number - what about resume key, two
2314 forms short (matches readdir) and full (enough info to cache inodes) 2326 forms short (matches readdir) and full (enough info to cache inodes)
2315 4) Mkdir - set mode 2327 4) Mkdir - set mode
2316 2328
2317 And under consideration: 2329 And under consideration:
2318 5) FindClose2 (return nanosecond timestamp ??) 2330 5) FindClose2 (return nanosecond timestamp ??)
2319 6) Use nanosecond timestamps throughout all time fields if 2331 6) Use nanosecond timestamps throughout all time fields if
2320 corresponding attribute flag is set 2332 corresponding attribute flag is set
2321 7) sendfile - handle based copy 2333 7) sendfile - handle based copy
2322 8) Direct i/o 2334 8) Direct i/o
2323 9) Misc fcntls? 2335 9) Misc fcntls?
2324 2336
2325 what about fixing 64 bit alignment 2337 what about fixing 64 bit alignment
2326 2338
2327 There are also various legacy SMB/CIFS requests used as is 2339 There are also various legacy SMB/CIFS requests used as is
2328 2340
2329 From existing Lanman and NTLM dialects: 2341 From existing Lanman and NTLM dialects:
2330 -------------------------------------- 2342 --------------------------------------
2331 NEGOTIATE 2343 NEGOTIATE
@@ -2346,48 +2358,48 @@ struct data_blob {
2346 (BB verify that never need to set allocation size) 2358 (BB verify that never need to set allocation size)
2347 SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via 2359 SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via
2348 Unix ext?) 2360 Unix ext?)
2349 2361
2350 COPY (note support for copy across directories) - FUTURE, OPTIONAL 2362 COPY (note support for copy across directories) - FUTURE, OPTIONAL
2351 setting/getting OS/2 EAs - FUTURE (BB can this handle 2363 setting/getting OS/2 EAs - FUTURE (BB can this handle
2352 setting Linux xattrs perfectly) - OPTIONAL 2364 setting Linux xattrs perfectly) - OPTIONAL
2353 dnotify - FUTURE, OPTIONAL 2365 dnotify - FUTURE, OPTIONAL
2354 quota - FUTURE, OPTIONAL 2366 quota - FUTURE, OPTIONAL
2355 2367
2356 Note that various requests implemented for NT interop such as 2368 Note that various requests implemented for NT interop such as
2357 NT_TRANSACT (IOCTL) QueryReparseInfo 2369 NT_TRANSACT (IOCTL) QueryReparseInfo
2358 are unneeded to servers compliant with the CIFS POSIX extensions 2370 are unneeded to servers compliant with the CIFS POSIX extensions
2359 2371
2360 From CIFS Unix Extensions: 2372 From CIFS Unix Extensions:
2361 ------------------------- 2373 -------------------------
2362 T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks 2374 T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
2363 T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2) 2375 T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2)
2364 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK) 2376 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK)
2365 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields 2377 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) BB check for missing
2366 Actually need QUERY_FILE_UNIX_INFO since has inode num 2378 inode fields
2367 BB what about a) blksize/blkbits/blocks 2379 Actually a need QUERY_FILE_UNIX_INFO
2380 since has inode num
2381 BB what about a) blksize/blkbits/blocks
2368 b) i_version 2382 b) i_version
2369 c) i_rdev 2383 c) i_rdev
2370 d) notify mask? 2384 d) notify mask?
2371 e) generation 2385 e) generation
2372 f) size_seqcount 2386 f) size_seqcount
2373 T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX 2387 T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
2374 TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended 2388 TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended
2375 T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL 2389 T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
2376
2377
2378 */ 2390 */
2379 2391
2380/* xsymlink is a symlink format (used by MacOS) that can be used 2392/* xsymlink is a symlink format (used by MacOS) that can be used
2381 to save symlink info in a regular file when 2393 to save symlink info in a regular file when
2382 mounted to operating systems that do not 2394 mounted to operating systems that do not
2383 support the cifs Unix extensions or EAs (for xattr 2395 support the cifs Unix extensions or EAs (for xattr
2384 based symlinks). For such a file to be recognized 2396 based symlinks). For such a file to be recognized
2385 as containing symlink data: 2397 as containing symlink data:
2386 2398
2387 1) file size must be 1067, 2399 1) file size must be 1067,
2388 2) signature must begin file data, 2400 2) signature must begin file data,
2389 3) length field must be set to ASCII representation 2401 3) length field must be set to ASCII representation
2390 of a number which is less than or equal to 1024, 2402 of a number which is less than or equal to 1024,
2391 4) md5 must match that of the path data */ 2403 4) md5 must match that of the path data */
2392 2404
2393struct xsymlink { 2405struct xsymlink {
@@ -2398,10 +2410,10 @@ struct xsymlink {
2398 char length[4]; 2410 char length[4];
2399 char cr1; /* \n */ 2411 char cr1; /* \n */
2400/* md5 of valid subset of path ie path[0] through path[length-1] */ 2412/* md5 of valid subset of path ie path[0] through path[length-1] */
2401 __u8 md5[32]; 2413 __u8 md5[32];
2402 char cr2; /* \n */ 2414 char cr2; /* \n */
2403/* if room left, then end with \n then 0x20s by convention but not required */ 2415/* if room left, then end with \n then 0x20s by convention but not required */
2404 char path[1024]; 2416 char path[1024];
2405} __attribute__((packed)); 2417} __attribute__((packed));
2406 2418
2407typedef struct file_xattr_info { 2419typedef struct file_xattr_info {
@@ -2410,7 +2422,8 @@ typedef struct file_xattr_info {
2410 __u32 xattr_value_len; 2422 __u32 xattr_value_len;
2411 char xattr_name[0]; 2423 char xattr_name[0];
2412 /* followed by xattr_value[xattr_value_len], no pad */ 2424 /* followed by xattr_value[xattr_value_len], no pad */
2413} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ 2425} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute info
2426 level 0x205 */
2414 2427
2415 2428
2416/* flags for chattr command */ 2429/* flags for chattr command */
@@ -2436,8 +2449,9 @@ typedef struct file_xattr_info {
2436typedef struct file_chattr_info { 2449typedef struct file_chattr_info {
2437 __le64 mask; /* list of all possible attribute bits */ 2450 __le64 mask; /* list of all possible attribute bits */
2438 __le64 mode; /* list of actual attribute bits on this inode */ 2451 __le64 mode; /* list of actual attribute bits on this inode */
2439} __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */ 2452} __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes
2453 (chattr, chflags) level 0x206 */
2440 2454
2441#endif 2455#endif
2442 2456
2443#endif /* _CIFSPDU_H */ 2457#endif /* _CIFSPDU_H */