Commit 34f8ef1e authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate TRANSACTION2_FFIRST_{REQ,RESP}, typo fix in CIFSSMBFindSingle()

in CIFSSMBFindSingle() pSMB->TotalParameterCount got wrong value due to typo.
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a059849a
...@@ -1240,43 +1240,43 @@ struct smb_com_transaction2_sfi_rsp { ...@@ -1240,43 +1240,43 @@ struct smb_com_transaction2_sfi_rsp {
typedef struct smb_com_transaction2_ffirst_req { typedef struct smb_com_transaction2_ffirst_req {
struct smb_hdr hdr; /* wct = 15 */ struct smb_hdr hdr; /* wct = 15 */
__u16 TotalParameterCount; __le16 TotalParameterCount;
__u16 TotalDataCount; __le16 TotalDataCount;
__u16 MaxParameterCount; __le16 MaxParameterCount;
__u16 MaxDataCount; __le16 MaxDataCount;
__u8 MaxSetupCount; __u8 MaxSetupCount;
__u8 Reserved; __u8 Reserved;
__u16 Flags; __le16 Flags;
__u32 Timeout; __le32 Timeout;
__u16 Reserved2; __u16 Reserved2;
__u16 ParameterCount; __le16 ParameterCount;
__u16 ParameterOffset; __le16 ParameterOffset;
__u16 DataCount; __le16 DataCount;
__u16 DataOffset; __le16 DataOffset;
__u8 SetupCount; /* one */ __u8 SetupCount; /* one */
__u8 Reserved3; __u8 Reserved3;
__u16 SubCommand; /* TRANS2_FIND_FIRST */ __le16 SubCommand; /* TRANS2_FIND_FIRST */
__u16 ByteCount; __le16 ByteCount;
__u8 Pad; __u8 Pad;
__u16 SearchAttributes; __le16 SearchAttributes;
__u16 SearchCount; __le16 SearchCount;
__u16 SearchFlags; __le16 SearchFlags;
__u16 InformationLevel; __le16 InformationLevel;
__u32 SearchStorageType; __le32 SearchStorageType;
char FileName[1]; char FileName[1];
} TRANSACTION2_FFIRST_REQ; } TRANSACTION2_FFIRST_REQ;
typedef struct smb_com_transaction2_ffirst_rsp { typedef struct smb_com_transaction2_ffirst_rsp {
struct smb_hdr hdr; /* wct = 10 */ struct smb_hdr hdr; /* wct = 10 */
__u16 TotalParameterCount; __le16 TotalParameterCount;
__u16 TotalDataCount; __le16 TotalDataCount;
__u16 Reserved; __u16 Reserved;
__u16 ParameterCount; __le16 ParameterCount;
__u16 ParameterOffset; __le16 ParameterOffset;
__u16 ParameterDisplacement; __le16 ParameterDisplacement;
__u16 DataCount; __le16 DataCount;
__u16 DataOffset; __le16 DataOffset;
__u16 DataDisplacement; __le16 DataDisplacement;
__u8 SetupCount; __u8 SetupCount;
__u8 Reserved1; /* should be zero setup words following */ __u8 Reserved1; /* should be zero setup words following */
__u16 ByteCount; __u16 ByteCount;
......
...@@ -1732,6 +1732,7 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, ...@@ -1732,6 +1732,7 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
int rc = 0; int rc = 0;
int bytes_returned; int bytes_returned;
int name_len; int name_len;
__u16 params, byte_count;
cFYI(1, ("In FindUnique")); cFYI(1, ("In FindUnique"));
findUniqueRetry: findUniqueRetry:
...@@ -1753,7 +1754,7 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, ...@@ -1753,7 +1754,7 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; params = 12 + name_len /* includes null */ ;
pSMB->TotalDataCount = 0; /* no EAs */ pSMB->TotalDataCount = 0; /* no EAs */
pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */
...@@ -1769,8 +1770,8 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, ...@@ -1769,8 +1770,8 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
pSMB->SetupCount = 1; /* one byte, no need to le convert */ pSMB->SetupCount = 1; /* one byte, no need to le convert */
pSMB->Reserved3 = 0; pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST); pSMB->SubCommand = cpu_to_le16(TRANS2_FIND_FIRST);
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; byte_count = params + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalDataCount); pSMB->TotalParameterCount = cpu_to_le16(params);
pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->SearchAttributes = pSMB->SearchAttributes =
cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM | cpu_to_le16(ATTR_READONLY | ATTR_HIDDEN | ATTR_SYSTEM |
...@@ -1779,8 +1780,8 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, ...@@ -1779,8 +1780,8 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
pSMB->SearchFlags = cpu_to_le16(1); pSMB->SearchFlags = cpu_to_le16(1);
pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); pSMB->InformationLevel = cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO);
pSMB->SearchStorageType = 0; /* BB what should we set this to? BB */ pSMB->SearchStorageType = 0; /* BB what should we set this to? BB */
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
...@@ -1813,6 +1814,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -1813,6 +1814,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
int rc = 0; int rc = 0;
int bytes_returned; int bytes_returned;
int name_len; int name_len;
__u16 params, byte_count;
cFYI(1, ("In FindFirst")); cFYI(1, ("In FindFirst"));
findFirstRetry: findFirstRetry:
...@@ -1834,7 +1836,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -1834,7 +1836,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
pSMB->TotalParameterCount = 12 + name_len /* includes null */ ; params = 12 + name_len /* includes null */ ;
pSMB->TotalDataCount = 0; /* no EAs */ pSMB->TotalDataCount = 0; /* no EAs */
pSMB->MaxParameterCount = cpu_to_le16(10); pSMB->MaxParameterCount = cpu_to_le16(10);
pSMB->MaxDataCount = cpu_to_le16((tcon->ses->server->maxBuf - pSMB->MaxDataCount = cpu_to_le16((tcon->ses->server->maxBuf -
...@@ -1844,8 +1846,8 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -1844,8 +1846,8 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; byte_count = params + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); pSMB->TotalParameterCount = cpu_to_le16(params);
pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = cpu_to_le16(offsetof(struct pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
smb_com_transaction2_ffirst_req, SearchAttributes) - 4); smb_com_transaction2_ffirst_req, SearchAttributes) - 4);
...@@ -1870,8 +1872,8 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -1870,8 +1872,8 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
*pUnixFlag = FALSE; *pUnixFlag = FALSE;
} }
pSMB->SearchStorageType = 0; /* BB what should we set this to? It is not clear if it matters BB */ pSMB->SearchStorageType = 0; /* BB what should we set this to? It is not clear if it matters BB */
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment