Commit bc837c2a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate T2_F{FIRST,NEXT|_RSP_PARMS

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 93729827
...@@ -1284,10 +1284,10 @@ typedef struct smb_com_transaction2_ffirst_rsp { ...@@ -1284,10 +1284,10 @@ typedef struct smb_com_transaction2_ffirst_rsp {
typedef struct smb_com_transaction2_ffirst_rsp_parms { typedef struct smb_com_transaction2_ffirst_rsp_parms {
__u16 SearchHandle; __u16 SearchHandle;
__u16 SearchCount; __le16 SearchCount;
__u16 EndofSearch; __le16 EndofSearch;
__u16 EAErrorOffset; __le16 EAErrorOffset;
__u16 LastNameOffset; __le16 LastNameOffset;
} T2_FFIRST_RSP_PARMS; } T2_FFIRST_RSP_PARMS;
typedef struct smb_com_transaction2_fnext_req { typedef struct smb_com_transaction2_fnext_req {
...@@ -1335,10 +1335,10 @@ typedef struct smb_com_transaction2_fnext_rsp { ...@@ -1335,10 +1335,10 @@ typedef struct smb_com_transaction2_fnext_rsp {
} TRANSACTION2_FNEXT_RSP; } TRANSACTION2_FNEXT_RSP;
typedef struct smb_com_transaction2_fnext_rsp_parms { typedef struct smb_com_transaction2_fnext_rsp_parms {
__u16 SearchCount; __le16 SearchCount;
__u16 EndofSearch; __le16 EndofSearch;
__u16 EAErrorOffset; __le16 EAErrorOffset;
__u16 LastNameOffset; __le16 LastNameOffset;
} T2_FNEXT_RSP_PARMS; } T2_FNEXT_RSP_PARMS;
/* QFSInfo Levels */ /* QFSInfo Levels */
......
...@@ -1890,11 +1890,6 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -1890,11 +1890,6 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
(char *) &pSMBr->hdr.Protocol + (char *) &pSMBr->hdr.Protocol +
le16_to_cpu(pSMBr->ParameterOffset), le16_to_cpu(pSMBr->ParameterOffset),
sizeof (T2_FFIRST_RSP_PARMS)); sizeof (T2_FFIRST_RSP_PARMS));
/* search handle can stay LE and EAoffset not needed so not converted */
findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch);
findParms->LastNameOffset =
le16_to_cpu(findParms->LastNameOffset);
findParms->SearchCount = le16_to_cpu(findParms->SearchCount);
response_data = response_data =
(char *) &pSMBr->hdr.Protocol + (char *) &pSMBr->hdr.Protocol +
le16_to_cpu(pSMBr->DataOffset); le16_to_cpu(pSMBr->DataOffset);
...@@ -1998,10 +1993,6 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -1998,10 +1993,6 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
(char *) &pSMBr->hdr.Protocol + (char *) &pSMBr->hdr.Protocol +
le16_to_cpu(pSMBr->ParameterOffset), le16_to_cpu(pSMBr->ParameterOffset),
sizeof (T2_FNEXT_RSP_PARMS)); sizeof (T2_FNEXT_RSP_PARMS));
findParms->EndofSearch = le16_to_cpu(findParms->EndofSearch);
findParms->LastNameOffset =
le16_to_cpu(findParms->LastNameOffset);
findParms->SearchCount = le16_to_cpu(findParms->SearchCount);
response_data = response_data =
(char *) &pSMBr->hdr.Protocol + (char *) &pSMBr->hdr.Protocol +
le16_to_cpu(pSMBr->DataOffset); le16_to_cpu(pSMBr->DataOffset);
......
...@@ -1745,10 +1745,12 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1745,10 +1745,12 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
rc = CIFSFindFirst(xid, pTcon, full_path, pfindData, rc = CIFSFindFirst(xid, pTcon, full_path, pfindData,
&findParms, cifs_sb->local_nls, &findParms, cifs_sb->local_nls,
&Unicode, &UnixSearch); &Unicode, &UnixSearch);
cFYI(1, ("Count: %d End: %d ", findParms.SearchCount, cFYI(1, ("Count: %d End: %d ",
findParms.EndofSearch)); le16_to_cpu(findParms.SearchCount),
le16_to_cpu(findParms.EndofSearch)));
if (rc == 0) { if (rc == 0) {
__u16 count = le16_to_cpu(findParms.SearchCount);
searchHandle = findParms.SearchHandle; searchHandle = findParms.SearchHandle;
if(file->private_data == NULL) if(file->private_data == NULL)
file->private_data = file->private_data =
...@@ -1769,7 +1771,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1769,7 +1771,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
renew_parental_timestamps(file->f_dentry); renew_parental_timestamps(file->f_dentry);
lastFindData = lastFindData =
(FILE_DIRECTORY_INFO *) ((char *) pfindData + (FILE_DIRECTORY_INFO *) ((char *) pfindData +
findParms.LastNameOffset); le16_to_cpu(findParms.LastNameOffset));
if((char *)lastFindData > (char *)pfindData + bufsize) { if((char *)lastFindData > (char *)pfindData + bufsize) {
cFYI(1,("last search entry past end of packet")); cFYI(1,("last search entry past end of packet"));
rc = -EIO; rc = -EIO;
...@@ -1832,7 +1834,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1832,7 +1834,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
pfindDataUnix->FileName, pfindDataUnix->FileName,
cifsFile->resume_name_length); cifsFile->resume_name_length);
} }
for (i = 2; i < (unsigned int)findParms.SearchCount + 2; i++) { for (i = 2; i < count + 2; i++) {
if (UnixSearch == FALSE) { if (UnixSearch == FALSE) {
__u32 len = le32_to_cpu(pfindData->FileNameLength); __u32 len = le32_to_cpu(pfindData->FileNameLength);
if (Unicode == TRUE) if (Unicode == TRUE)
...@@ -1914,7 +1916,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1914,7 +1916,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
} /* end for loop */ } /* end for loop */
if ((findParms.EndofSearch != 0) && cifsFile) { if ((findParms.EndofSearch != 0) && cifsFile) {
cifsFile->endOfSearch = TRUE; cifsFile->endOfSearch = TRUE;
if(findParms.SearchCount == 2) if(findParms.SearchCount == cpu_to_le16(2))
cifsFile->emptyDir = TRUE; cifsFile->emptyDir = TRUE;
} }
} else { } else {
...@@ -1945,13 +1947,14 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1945,13 +1947,14 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
cifsFile->resume_key, cifsFile->resume_key,
&Unicode, &UnixSearch); &Unicode, &UnixSearch);
cFYI(1,("Count: %d End: %d ", cFYI(1,("Count: %d End: %d ",
findNextParms.SearchCount, le16_to_cpu(findNextParms.SearchCount),
findNextParms.EndofSearch)); le16_to_cpu(findNextParms.EndofSearch)));
if ((rc == 0) && (findNextParms.SearchCount != 0)) { if ((rc == 0) && (findNextParms.SearchCount != 0)) {
/* BB save off resume key, key name and name length */ /* BB save off resume key, key name and name length */
__u16 count = le16_to_cpu(findNextParms.SearchCount);
lastFindData = lastFindData =
(FILE_DIRECTORY_INFO *) ((char *) pfindData (FILE_DIRECTORY_INFO *) ((char *) pfindData
+ findNextParms.LastNameOffset); + le16_to_cpu(findNextParms.LastNameOffset));
if((char *)lastFindData > (char *)pfindData + bufsize) { if((char *)lastFindData > (char *)pfindData + bufsize) {
cFYI(1,("last search entry past end of packet")); cFYI(1,("last search entry past end of packet"));
rc = -EIO; rc = -EIO;
...@@ -2028,7 +2031,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -2028,7 +2031,7 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
cifsFile->resume_name_length); cifsFile->resume_name_length);
} }
for (i = 0; i < findNextParms.SearchCount; i++) { for (i = 0; i < count; i++) {
__u32 len = le32_to_cpu(pfindData-> __u32 len = le32_to_cpu(pfindData->
FileNameLength); FileNameLength);
if (UnixSearch == FALSE) { if (UnixSearch == FALSE) {
......
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