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.h297
1 files changed, 161 insertions, 136 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index d619ca7d1416..6a2056e58ceb 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 {
@@ -712,6 +714,7 @@ typedef struct smb_com_findclose_req {
712#define REQ_OPLOCK 0x00000002 714#define REQ_OPLOCK 0x00000002
713#define REQ_BATCHOPLOCK 0x00000004 715#define REQ_BATCHOPLOCK 0x00000004
714#define REQ_OPENDIRONLY 0x00000008 716#define REQ_OPENDIRONLY 0x00000008
717#define REQ_EXTENDED_INFO 0x00000010
715 718
716typedef struct smb_com_open_req { /* also handles create */ 719typedef struct smb_com_open_req { /* also handles create */
717 struct smb_hdr hdr; /* wct = 24 */ 720 struct smb_hdr hdr; /* wct = 24 */
@@ -799,27 +802,28 @@ typedef struct smb_com_openx_rsp {
799 __u32 FileId; 802 __u32 FileId;
800 __u16 Reserved; 803 __u16 Reserved;
801 __u16 ByteCount; 804 __u16 ByteCount;
802} __attribute__((packed)) OPENX_RSP; 805} __attribute__((packed)) OPENX_RSP;
803 806
804/* 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 */
805 808
806/* Legacy write request for older servers */ 809/* Legacy write request for older servers */
807typedef struct smb_com_writex_req { 810typedef struct smb_com_writex_req {
808 struct smb_hdr hdr; /* wct = 12 */ 811 struct smb_hdr hdr; /* wct = 12 */
809 __u8 AndXCommand; 812 __u8 AndXCommand;
810 __u8 AndXReserved; 813 __u8 AndXReserved;
811 __le16 AndXOffset; 814 __le16 AndXOffset;
812 __u16 Fid; 815 __u16 Fid;
813 __le32 OffsetLow; 816 __le32 OffsetLow;
814 __u32 Reserved; /* Timeout */ 817 __u32 Reserved; /* Timeout */
815 __le16 WriteMode; /* 1 = write through */ 818 __le16 WriteMode; /* 1 = write through */
816 __le16 Remaining; 819 __le16 Remaining;
817 __le16 Reserved2; 820 __le16 Reserved2;
818 __le16 DataLengthLow; 821 __le16 DataLengthLow;
819 __le16 DataOffset; 822 __le16 DataOffset;
820 __le16 ByteCount; 823 __le16 ByteCount;
821 __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ 824 __u8 Pad; /* BB check for whether padded to DWORD
822 char Data[0]; 825 boundary and optimum performance here */
826 char Data[0];
823} __attribute__((packed)) WRITEX_REQ; 827} __attribute__((packed)) WRITEX_REQ;
824 828
825typedef struct smb_com_write_req { 829typedef struct smb_com_write_req {
@@ -837,7 +841,8 @@ typedef struct smb_com_write_req {
837 __le16 DataOffset; 841 __le16 DataOffset;
838 __le32 OffsetHigh; 842 __le32 OffsetHigh;
839 __le16 ByteCount; 843 __le16 ByteCount;
840 __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 */
841 char Data[0]; 846 char Data[0];
842} __attribute__((packed)) WRITE_REQ; 847} __attribute__((packed)) WRITE_REQ;
843 848
@@ -855,17 +860,17 @@ typedef struct smb_com_write_rsp {
855 860
856/* legacy read request for older servers */ 861/* legacy read request for older servers */
857typedef struct smb_com_readx_req { 862typedef struct smb_com_readx_req {
858 struct smb_hdr hdr; /* wct = 10 */ 863 struct smb_hdr hdr; /* wct = 10 */
859 __u8 AndXCommand; 864 __u8 AndXCommand;
860 __u8 AndXReserved; 865 __u8 AndXReserved;
861 __le16 AndXOffset; 866 __le16 AndXOffset;
862 __u16 Fid; 867 __u16 Fid;
863 __le32 OffsetLow; 868 __le32 OffsetLow;
864 __le16 MaxCount; 869 __le16 MaxCount;
865 __le16 MinCount; /* obsolete */ 870 __le16 MinCount; /* obsolete */
866 __le32 Reserved; 871 __le32 Reserved;
867 __le16 Remaining; 872 __le16 Remaining;
868 __le16 ByteCount; 873 __le16 ByteCount;
869} __attribute__((packed)) READX_REQ; 874} __attribute__((packed)) READX_REQ;
870 875
871typedef struct smb_com_read_req { 876typedef struct smb_com_read_req {
@@ -896,7 +901,8 @@ typedef struct smb_com_read_rsp {
896 __le16 DataLengthHigh; 901 __le16 DataLengthHigh;
897 __u64 Reserved2; 902 __u64 Reserved2;
898 __u16 ByteCount; 903 __u16 ByteCount;
899 __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 */
900 char Data[1]; 906 char Data[1];
901} __attribute__((packed)) READ_RSP; 907} __attribute__((packed)) READ_RSP;
902 908
@@ -967,7 +973,7 @@ typedef struct smb_com_rename_req {
967#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */ 973#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */
968#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */ 974#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */
969#define COPY_VERIFY_WRITES 0x0010 975#define COPY_VERIFY_WRITES 0x0010
970#define COPY_TREE 0x0020 976#define COPY_TREE 0x0020
971 977
972typedef struct smb_com_copy_req { 978typedef struct smb_com_copy_req {
973 struct smb_hdr hdr; /* wct = 3 */ 979 struct smb_hdr hdr; /* wct = 3 */
@@ -975,7 +981,7 @@ typedef struct smb_com_copy_req {
975 __le16 OpenFunction; 981 __le16 OpenFunction;
976 __le16 Flags; 982 __le16 Flags;
977 __le16 ByteCount; 983 __le16 ByteCount;
978 __u8 BufferFormat; /* 4 = ASCII or Unicode */ 984 __u8 BufferFormat; /* 4 = ASCII or Unicode */
979 unsigned char OldFileName[1]; 985 unsigned char OldFileName[1];
980 /* followed by __u8 BufferFormat2 */ 986 /* followed by __u8 BufferFormat2 */
981 /* followed by NewFileName string */ 987 /* followed by NewFileName string */
@@ -1083,28 +1089,28 @@ typedef struct smb_com_setattr_rsp {
1083 1089
1084/*******************************************************/ 1090/*******************************************************/
1085/* NT Transact structure defintions follow */ 1091/* NT Transact structure defintions follow */
1086/* Currently only ioctl, acl (get security descriptor) */ 1092/* Currently only ioctl, acl (get security descriptor) */
1087/* and notify are implemented */ 1093/* and notify are implemented */
1088/*******************************************************/ 1094/*******************************************************/
1089typedef struct smb_com_ntransact_req { 1095typedef struct smb_com_ntransact_req {
1090 struct smb_hdr hdr; /* wct >= 19 */ 1096 struct smb_hdr hdr; /* wct >= 19 */
1091 __u8 MaxSetupCount; 1097 __u8 MaxSetupCount;
1092 __u16 Reserved; 1098 __u16 Reserved;
1093 __le32 TotalParameterCount; 1099 __le32 TotalParameterCount;
1094 __le32 TotalDataCount; 1100 __le32 TotalDataCount;
1095 __le32 MaxParameterCount; 1101 __le32 MaxParameterCount;
1096 __le32 MaxDataCount; 1102 __le32 MaxDataCount;
1097 __le32 ParameterCount; 1103 __le32 ParameterCount;
1098 __le32 ParameterOffset; 1104 __le32 ParameterOffset;
1099 __le32 DataCount; 1105 __le32 DataCount;
1100 __le32 DataOffset; 1106 __le32 DataOffset;
1101 __u8 SetupCount; /* four setup words follow subcommand */ 1107 __u8 SetupCount; /* four setup words follow subcommand */
1102 /* SNIA spec incorrectly included spurious pad here */ 1108 /* SNIA spec incorrectly included spurious pad here */
1103 __le16 SubCommand; /* 2 = IOCTL/FSCTL */ 1109 __le16 SubCommand; /* 2 = IOCTL/FSCTL */
1104 /* SetupCount words follow then */ 1110 /* SetupCount words follow then */
1105 __le16 ByteCount; 1111 __le16 ByteCount;
1106 __u8 Pad[3]; 1112 __u8 Pad[3];
1107 __u8 Parms[0]; 1113 __u8 Parms[0];
1108} __attribute__((packed)) NTRANSACT_REQ; 1114} __attribute__((packed)) NTRANSACT_REQ;
1109 1115
1110typedef struct smb_com_ntransact_rsp { 1116typedef struct smb_com_ntransact_rsp {
@@ -1120,7 +1126,7 @@ typedef struct smb_com_ntransact_rsp {
1120 __le32 DataDisplacement; 1126 __le32 DataDisplacement;
1121 __u8 SetupCount; /* 0 */ 1127 __u8 SetupCount; /* 0 */
1122 __u16 ByteCount; 1128 __u16 ByteCount;
1123 /* __u8 Pad[3]; */ 1129 /* __u8 Pad[3]; */
1124 /* parms and data follow */ 1130 /* parms and data follow */
1125} __attribute__((packed)) NTRANSACT_RSP; 1131} __attribute__((packed)) NTRANSACT_RSP;
1126 1132
@@ -1215,7 +1221,7 @@ typedef struct smb_com_transaction_change_notify_req {
1215/* __u8 Data[1];*/ 1221/* __u8 Data[1];*/
1216} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ; 1222} __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ;
1217 1223
1218/* BB eventually change to use generic ntransact rsp struct 1224/* BB eventually change to use generic ntransact rsp struct
1219 and validation routine */ 1225 and validation routine */
1220typedef struct smb_com_transaction_change_notify_rsp { 1226typedef struct smb_com_transaction_change_notify_rsp {
1221 struct smb_hdr hdr; /* wct = 18 */ 1227 struct smb_hdr hdr; /* wct = 18 */
@@ -1262,7 +1268,7 @@ struct file_notify_information {
1262 __le32 Action; 1268 __le32 Action;
1263 __le32 FileNameLength; 1269 __le32 FileNameLength;
1264 __u8 FileName[0]; 1270 __u8 FileName[0];
1265} __attribute__((packed)); 1271} __attribute__((packed));
1266 1272
1267struct reparse_data { 1273struct reparse_data {
1268 __u32 ReparseTag; 1274 __u32 ReparseTag;
@@ -1331,7 +1337,7 @@ struct trans2_resp {
1331 __u8 Reserved1; 1337 __u8 Reserved1;
1332 /* SetupWords[SetupCount]; 1338 /* SetupWords[SetupCount];
1333 __u16 ByteCount; 1339 __u16 ByteCount;
1334 __u16 Reserved2;*/ 1340 __u16 Reserved2;*/
1335 /* data area follows */ 1341 /* data area follows */
1336} __attribute__((packed)); 1342} __attribute__((packed));
1337 1343
@@ -1370,9 +1376,9 @@ struct smb_t2_rsp {
1370#define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee 1376#define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee
1371#define SMB_QUERY_FILE_ACCESS_INFO 0x3f0 1377#define SMB_QUERY_FILE_ACCESS_INFO 0x3f0
1372#define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */ 1378#define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */
1373#define SMB_QUERY_FILE_POSITION_INFO 0x3f6 1379#define SMB_QUERY_FILE_POSITION_INFO 0x3f6
1374#define SMB_QUERY_FILE_MODE_INFO 0x3f8 1380#define SMB_QUERY_FILE_MODE_INFO 0x3f8
1375#define SMB_QUERY_FILE_ALGN_INFO 0x3f9 1381#define SMB_QUERY_FILE_ALGN_INFO 0x3f9
1376 1382
1377 1383
1378#define SMB_SET_FILE_BASIC_INFO 0x101 1384#define SMB_SET_FILE_BASIC_INFO 0x101
@@ -1506,35 +1512,35 @@ struct smb_com_transaction2_sfi_req {
1506 __u16 Pad1; 1512 __u16 Pad1;
1507 __u16 Fid; 1513 __u16 Fid;
1508 __le16 InformationLevel; 1514 __le16 InformationLevel;
1509 __u16 Reserved4; 1515 __u16 Reserved4;
1510} __attribute__((packed)); 1516} __attribute__((packed));
1511 1517
1512struct smb_com_transaction2_sfi_rsp { 1518struct smb_com_transaction2_sfi_rsp {
1513 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1519 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1514 struct trans2_resp t2; 1520 struct trans2_resp t2;
1515 __u16 ByteCount; 1521 __u16 ByteCount;
1516 __u16 Reserved2; /* parameter word reserved - 1522 __u16 Reserved2; /* parameter word reserved -
1517 present for infolevels > 100 */ 1523 present for infolevels > 100 */
1518} __attribute__((packed)); 1524} __attribute__((packed));
1519 1525
1520struct smb_t2_qfi_req { 1526struct smb_t2_qfi_req {
1521 struct smb_hdr hdr; 1527 struct smb_hdr hdr;
1522 struct trans2_req t2; 1528 struct trans2_req t2;
1523 __u8 Pad; 1529 __u8 Pad;
1524 __u16 Fid; 1530 __u16 Fid;
1525 __le16 InformationLevel; 1531 __le16 InformationLevel;
1526} __attribute__((packed)); 1532} __attribute__((packed));
1527 1533
1528struct smb_t2_qfi_rsp { 1534struct smb_t2_qfi_rsp {
1529 struct smb_hdr hdr; /* wct = 10 + SetupCount */ 1535 struct smb_hdr hdr; /* wct = 10 + SetupCount */
1530 struct trans2_resp t2; 1536 struct trans2_resp t2;
1531 __u16 ByteCount; 1537 __u16 ByteCount;
1532 __u16 Reserved2; /* parameter word reserved - 1538 __u16 Reserved2; /* parameter word reserved -
1533 present for infolevels > 100 */ 1539 present for infolevels > 100 */
1534} __attribute__((packed)); 1540} __attribute__((packed));
1535 1541
1536/* 1542/*
1537 * Flags on T2 FINDFIRST and FINDNEXT 1543 * Flags on T2 FINDFIRST and FINDNEXT
1538 */ 1544 */
1539#define CIFS_SEARCH_CLOSE_ALWAYS 0x0001 1545#define CIFS_SEARCH_CLOSE_ALWAYS 0x0001
1540#define CIFS_SEARCH_CLOSE_AT_END 0x0002 1546#define CIFS_SEARCH_CLOSE_AT_END 0x0002
@@ -1743,7 +1749,9 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
1743 __u8 Reserved3; 1749 __u8 Reserved3;
1744 __le16 SubCommand; /* one setup word */ 1750 __le16 SubCommand; /* one setup word */
1745 __le16 ByteCount; 1751 __le16 ByteCount;
1746 __u8 Pad[3]; /* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */ 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 */
1747 __le16 MaxReferralLevel; 1755 __le16 MaxReferralLevel;
1748 char RequestFileName[1]; 1756 char RequestFileName[1];
1749} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ; 1757} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
@@ -1752,7 +1760,10 @@ typedef struct dfs_referral_level_3 {
1752 __le16 VersionNumber; 1760 __le16 VersionNumber;
1753 __le16 ReferralSize; 1761 __le16 ReferralSize;
1754 __le16 ServerType; /* 0x0001 = CIFS server */ 1762 __le16 ServerType; /* 0x0001 = CIFS server */
1755 __le16 ReferralFlags; /* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */ 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 */
1756 __le16 TimeToLive; 1767 __le16 TimeToLive;
1757 __le16 Proximity; 1768 __le16 Proximity;
1758 __le16 DfsPathOffset; 1769 __le16 DfsPathOffset;
@@ -1778,11 +1789,13 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
1778#define DFSREF_STORAGE_SERVER 0x0002 1789#define DFSREF_STORAGE_SERVER 0x0002
1779 1790
1780/* IOCTL information */ 1791/* IOCTL information */
1781/* List of ioctl function codes that look to be of interest to remote clients like this. */ 1792/*
1782/* 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
1783/* 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
1784/* 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
1785/* 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 */
1786#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000 1799#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
1787#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004 1800#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
1788#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008 1801#define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008
@@ -1811,7 +1824,7 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
1811/* 1824/*
1812 ************************************************************************ 1825 ************************************************************************
1813 * All structs for everything above the SMB PDUs themselves 1826 * All structs for everything above the SMB PDUs themselves
1814 * (such as the T2 level specific data) go here 1827 * (such as the T2 level specific data) go here
1815 ************************************************************************ 1828 ************************************************************************
1816 */ 1829 */
1817 1830
@@ -1857,7 +1870,7 @@ typedef struct {
1857 __le64 FreeAllocationUnits; 1870 __le64 FreeAllocationUnits;
1858 __le32 SectorsPerAllocationUnit; 1871 __le32 SectorsPerAllocationUnit;
1859 __le32 BytesPerSector; 1872 __le32 BytesPerSector;
1860} __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */ 1873} __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */
1861 1874
1862typedef struct { 1875typedef struct {
1863 __le32 fsid; 1876 __le32 fsid;
@@ -1871,7 +1884,7 @@ typedef struct {
1871 __le16 MajorVersionNumber; 1884 __le16 MajorVersionNumber;
1872 __le16 MinorVersionNumber; 1885 __le16 MinorVersionNumber;
1873 __le64 Capability; 1886 __le64 Capability;
1874} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ 1887} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extension level 0x200*/
1875 1888
1876/* Version numbers for CIFS UNIX major and minor. */ 1889/* Version numbers for CIFS UNIX major and minor. */
1877#define CIFS_UNIX_MAJOR_VERSION 1 1890#define CIFS_UNIX_MAJOR_VERSION 1
@@ -1885,16 +1898,20 @@ typedef struct {
1885#define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Allow POSIX path chars */ 1898#define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Allow POSIX path chars */
1886#define CIFS_UNIX_POSIX_PATH_OPS_CAP 0x00000020 /* Allow new POSIX path based 1899#define CIFS_UNIX_POSIX_PATH_OPS_CAP 0x00000020 /* Allow new POSIX path based
1887 calls including posix open 1900 calls including posix open
1888 and posix unlink */ 1901 and posix unlink */
1902#define CIFS_UNIX_LARGE_READ_CAP 0x00000040 /* support reads >128K (up
1903 to 0xFFFF00 */
1904#define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080
1905
1889#ifdef CONFIG_CIFS_POSIX 1906#ifdef CONFIG_CIFS_POSIX
1890/* Can not set pathnames cap yet until we send new posix create SMB since 1907/* Can not set pathnames cap yet until we send new posix create SMB since
1891 otherwise server can treat such handles opened with older ntcreatex 1908 otherwise server can treat such handles opened with older ntcreatex
1892 (by a new client which knows how to send posix path ops) 1909 (by a new client which knows how to send posix path ops)
1893 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.
1894 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 */
1895/* #define CIFS_UNIX_CAP_MASK 0x0000003b */ 1912/* #define CIFS_UNIX_CAP_MASK 0x000000fb */
1896#define CIFS_UNIX_CAP_MASK 0x0000001b 1913#define CIFS_UNIX_CAP_MASK 0x000000db
1897#else 1914#else
1898#define CIFS_UNIX_CAP_MASK 0x00000013 1915#define CIFS_UNIX_CAP_MASK 0x00000013
1899#endif /* CONFIG_CIFS_POSIX */ 1916#endif /* CONFIG_CIFS_POSIX */
1900 1917
@@ -1904,10 +1921,10 @@ typedef struct {
1904typedef struct { 1921typedef struct {
1905 /* For undefined recommended transfer size return -1 in that field */ 1922 /* For undefined recommended transfer size return -1 in that field */
1906 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ 1923 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */
1907 __le32 BlockSize; 1924 __le32 BlockSize;
1908 /* The next three fields are in terms of the block size. 1925 /* The next three fields are in terms of the block size.
1909 (above). If block size is unknown, 4096 would be a 1926 (above). If block size is unknown, 4096 would be a
1910 reasonable block size for a server to report. 1927 reasonable block size for a server to report.
1911 Note that returning the blocks/blocksavail removes need 1928 Note that returning the blocks/blocksavail removes need
1912 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.
1913 UserBlockAvail is typically less than or equal to BlocksAvail, 1930 UserBlockAvail is typically less than or equal to BlocksAvail,
@@ -2062,9 +2079,9 @@ struct file_alt_name_info {
2062 2079
2063struct file_stream_info { 2080struct file_stream_info {
2064 __le32 number_of_streams; /* BB check sizes and verify location */ 2081 __le32 number_of_streams; /* BB check sizes and verify location */
2065 /* followed by info on streams themselves 2082 /* followed by info on streams themselves
2066 u64 size; 2083 u64 size;
2067 u64 allocation_size 2084 u64 allocation_size
2068 stream info */ 2085 stream info */
2069}; /* level 0x109 */ 2086}; /* level 0x109 */
2070 2087
@@ -2083,7 +2100,7 @@ struct cifs_posix_ace { /* access control entry (ACE) */
2083 __u8 cifs_e_tag; 2100 __u8 cifs_e_tag;
2084 __u8 cifs_e_perm; 2101 __u8 cifs_e_perm;
2085 __le64 cifs_uid; /* or gid */ 2102 __le64 cifs_uid; /* or gid */
2086} __attribute__((packed)); 2103} __attribute__((packed));
2087 2104
2088struct cifs_posix_acl { /* access conrol list (ACL) */ 2105struct cifs_posix_acl { /* access conrol list (ACL) */
2089 __le16 version; 2106 __le16 version;
@@ -2138,6 +2155,12 @@ typedef struct {
2138 /* struct following varies based on requested level */ 2155 /* struct following varies based on requested level */
2139} __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */ 2156} __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */
2140 2157
2158#define SMB_POSIX_UNLINK_FILE_TARGET 0
2159#define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1
2160
2161struct unlink_psx_rq { /* level 0x20a SetPathInfo */
2162 __le16 type;
2163} __attribute__((packed));
2141 2164
2142struct file_internal_info { 2165struct file_internal_info {
2143 __u64 UniqueId; /* inode number */ 2166 __u64 UniqueId; /* inode number */
@@ -2154,7 +2177,7 @@ struct file_attrib_tag {
2154 2177
2155 2178
2156/********************************************************/ 2179/********************************************************/
2157/* FindFirst/FindNext transact2 data buffer formats */ 2180/* FindFirst/FindNext transact2 data buffer formats */
2158/********************************************************/ 2181/********************************************************/
2159 2182
2160typedef struct { 2183typedef struct {
@@ -2232,7 +2255,7 @@ typedef struct {
2232 __le64 EndOfFile; 2255 __le64 EndOfFile;
2233 __le64 AllocationSize; 2256 __le64 AllocationSize;
2234 __le32 ExtFileAttributes; 2257 __le32 ExtFileAttributes;
2235 __le32 FileNameLength; 2258 __le32 FileNameLength;
2236 __le32 EaSize; /* length of the xattrs */ 2259 __le32 EaSize; /* length of the xattrs */
2237 __u8 ShortNameLength; 2260 __u8 ShortNameLength;
2238 __u8 Reserved; 2261 __u8 Reserved;
@@ -2259,7 +2282,7 @@ typedef struct {
2259struct win_dev { 2282struct win_dev {
2260 unsigned char type[8]; /* IntxCHR or IntxBLK */ 2283 unsigned char type[8]; /* IntxCHR or IntxBLK */
2261 __le64 major; 2284 __le64 major;
2262 __le64 minor; 2285 __le64 minor;
2263} __attribute__((packed)); 2286} __attribute__((packed));
2264 2287
2265struct gea { 2288struct gea {
@@ -2291,36 +2314,36 @@ struct fealist {
2291struct data_blob { 2314struct data_blob {
2292 __u8 *data; 2315 __u8 *data;
2293 size_t length; 2316 size_t length;
2294 void (*free) (struct data_blob * data_blob); 2317 void (*free) (struct data_blob *data_blob);
2295} __attribute__((packed)); 2318} __attribute__((packed));
2296 2319
2297 2320
2298#ifdef CONFIG_CIFS_POSIX 2321#ifdef CONFIG_CIFS_POSIX
2299/* 2322/*
2300 For better POSIX semantics from Linux client, (even better 2323 For better POSIX semantics from Linux client, (even better
2301 than the existing CIFS Unix Extensions) we need updated PDUs for: 2324 than the existing CIFS Unix Extensions) we need updated PDUs for:
2302 2325
2303 1) PosixCreateX - to set and return the mode, inode#, device info and 2326 1) PosixCreateX - to set and return the mode, inode#, device info and
2304 perhaps add a CreateDevice - to create Pipes and other special .inodes 2327 perhaps add a CreateDevice - to create Pipes and other special .inodes
2305 Also note POSIX open flags 2328 Also note POSIX open flags
2306 2) Close - to return the last write time to do cache across close 2329 2) Close - to return the last write time to do cache across close
2307 more safely 2330 more safely
2308 3) FindFirst return unique inode number - what about resume key, two 2331 3) FindFirst return unique inode number - what about resume key, two
2309 forms short (matches readdir) and full (enough info to cache inodes) 2332 forms short (matches readdir) and full (enough info to cache inodes)
2310 4) Mkdir - set mode 2333 4) Mkdir - set mode
2311 2334
2312 And under consideration: 2335 And under consideration:
2313 5) FindClose2 (return nanosecond timestamp ??) 2336 5) FindClose2 (return nanosecond timestamp ??)
2314 6) Use nanosecond timestamps throughout all time fields if 2337 6) Use nanosecond timestamps throughout all time fields if
2315 corresponding attribute flag is set 2338 corresponding attribute flag is set
2316 7) sendfile - handle based copy 2339 7) sendfile - handle based copy
2317 8) Direct i/o 2340 8) Direct i/o
2318 9) Misc fcntls? 2341 9) Misc fcntls?
2319 2342
2320 what about fixing 64 bit alignment 2343 what about fixing 64 bit alignment
2321 2344
2322 There are also various legacy SMB/CIFS requests used as is 2345 There are also various legacy SMB/CIFS requests used as is
2323 2346
2324 From existing Lanman and NTLM dialects: 2347 From existing Lanman and NTLM dialects:
2325 -------------------------------------- 2348 --------------------------------------
2326 NEGOTIATE 2349 NEGOTIATE
@@ -2341,48 +2364,48 @@ struct data_blob {
2341 (BB verify that never need to set allocation size) 2364 (BB verify that never need to set allocation size)
2342 SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via 2365 SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via
2343 Unix ext?) 2366 Unix ext?)
2344 2367
2345 COPY (note support for copy across directories) - FUTURE, OPTIONAL 2368 COPY (note support for copy across directories) - FUTURE, OPTIONAL
2346 setting/getting OS/2 EAs - FUTURE (BB can this handle 2369 setting/getting OS/2 EAs - FUTURE (BB can this handle
2347 setting Linux xattrs perfectly) - OPTIONAL 2370 setting Linux xattrs perfectly) - OPTIONAL
2348 dnotify - FUTURE, OPTIONAL 2371 dnotify - FUTURE, OPTIONAL
2349 quota - FUTURE, OPTIONAL 2372 quota - FUTURE, OPTIONAL
2350 2373
2351 Note that various requests implemented for NT interop such as 2374 Note that various requests implemented for NT interop such as
2352 NT_TRANSACT (IOCTL) QueryReparseInfo 2375 NT_TRANSACT (IOCTL) QueryReparseInfo
2353 are unneeded to servers compliant with the CIFS POSIX extensions 2376 are unneeded to servers compliant with the CIFS POSIX extensions
2354 2377
2355 From CIFS Unix Extensions: 2378 From CIFS Unix Extensions:
2356 ------------------------- 2379 -------------------------
2357 T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks 2380 T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
2358 T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2) 2381 T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2)
2359 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK) 2382 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK)
2360 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields 2383 T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) BB check for missing
2361 Actually need QUERY_FILE_UNIX_INFO since has inode num 2384 inode fields
2362 BB what about a) blksize/blkbits/blocks 2385 Actually a need QUERY_FILE_UNIX_INFO
2386 since has inode num
2387 BB what about a) blksize/blkbits/blocks
2363 b) i_version 2388 b) i_version
2364 c) i_rdev 2389 c) i_rdev
2365 d) notify mask? 2390 d) notify mask?
2366 e) generation 2391 e) generation
2367 f) size_seqcount 2392 f) size_seqcount
2368 T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX 2393 T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
2369 TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended 2394 TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended
2370 T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL 2395 T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
2371
2372
2373 */ 2396 */
2374 2397
2375/* xsymlink is a symlink format (used by MacOS) that can be used 2398/* xsymlink is a symlink format (used by MacOS) that can be used
2376 to save symlink info in a regular file when 2399 to save symlink info in a regular file when
2377 mounted to operating systems that do not 2400 mounted to operating systems that do not
2378 support the cifs Unix extensions or EAs (for xattr 2401 support the cifs Unix extensions or EAs (for xattr
2379 based symlinks). For such a file to be recognized 2402 based symlinks). For such a file to be recognized
2380 as containing symlink data: 2403 as containing symlink data:
2381 2404
2382 1) file size must be 1067, 2405 1) file size must be 1067,
2383 2) signature must begin file data, 2406 2) signature must begin file data,
2384 3) length field must be set to ASCII representation 2407 3) length field must be set to ASCII representation
2385 of a number which is less than or equal to 1024, 2408 of a number which is less than or equal to 1024,
2386 4) md5 must match that of the path data */ 2409 4) md5 must match that of the path data */
2387 2410
2388struct xsymlink { 2411struct xsymlink {
@@ -2393,10 +2416,10 @@ struct xsymlink {
2393 char length[4]; 2416 char length[4];
2394 char cr1; /* \n */ 2417 char cr1; /* \n */
2395/* md5 of valid subset of path ie path[0] through path[length-1] */ 2418/* md5 of valid subset of path ie path[0] through path[length-1] */
2396 __u8 md5[32]; 2419 __u8 md5[32];
2397 char cr2; /* \n */ 2420 char cr2; /* \n */
2398/* if room left, then end with \n then 0x20s by convention but not required */ 2421/* if room left, then end with \n then 0x20s by convention but not required */
2399 char path[1024]; 2422 char path[1024];
2400} __attribute__((packed)); 2423} __attribute__((packed));
2401 2424
2402typedef struct file_xattr_info { 2425typedef struct file_xattr_info {
@@ -2405,7 +2428,8 @@ typedef struct file_xattr_info {
2405 __u32 xattr_value_len; 2428 __u32 xattr_value_len;
2406 char xattr_name[0]; 2429 char xattr_name[0];
2407 /* followed by xattr_value[xattr_value_len], no pad */ 2430 /* followed by xattr_value[xattr_value_len], no pad */
2408} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */ 2431} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute info
2432 level 0x205 */
2409 2433
2410 2434
2411/* flags for chattr command */ 2435/* flags for chattr command */
@@ -2431,8 +2455,9 @@ typedef struct file_xattr_info {
2431typedef struct file_chattr_info { 2455typedef struct file_chattr_info {
2432 __le64 mask; /* list of all possible attribute bits */ 2456 __le64 mask; /* list of all possible attribute bits */
2433 __le64 mode; /* list of actual attribute bits on this inode */ 2457 __le64 mode; /* list of actual attribute bits on this inode */
2434} __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes (chattr, chflags) level 0x206 */ 2458} __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes
2459 (chattr, chflags) level 0x206 */
2435 2460
2436#endif 2461#endif
2437 2462
2438#endif /* _CIFSPDU_H */ 2463#endif /* _CIFSPDU_H */