mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
cifs: use cifs_dirent in cifs_save_resume_key
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
f16d59b417
commit
eaf35b1ea8
@ -501,7 +501,7 @@ struct cifs_search_info {
|
|||||||
char *ntwrk_buf_start;
|
char *ntwrk_buf_start;
|
||||||
char *srch_entries_start;
|
char *srch_entries_start;
|
||||||
char *last_entry;
|
char *last_entry;
|
||||||
char *presume_name;
|
const char *presume_name;
|
||||||
unsigned int resume_name_len;
|
unsigned int resume_name_len;
|
||||||
bool endOfSearch:1;
|
bool endOfSearch:1;
|
||||||
bool emptyDir:1;
|
bool emptyDir:1;
|
||||||
|
@ -478,66 +478,18 @@ static int is_dir_changed(struct file *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int cifs_save_resume_key(const char *current_entry,
|
static int cifs_save_resume_key(const char *current_entry,
|
||||||
struct cifsFileInfo *cifsFile)
|
struct cifsFileInfo *file_info)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
struct cifs_dirent de;
|
||||||
unsigned int len = 0;
|
int rc;
|
||||||
__u16 level;
|
|
||||||
char *filename;
|
|
||||||
|
|
||||||
if ((cifsFile == NULL) || (current_entry == NULL))
|
rc = cifs_fill_dirent(&de, current_entry, file_info->srch_inf.info_level,
|
||||||
return -EINVAL;
|
file_info->srch_inf.unicode);
|
||||||
|
if (!rc) {
|
||||||
level = cifsFile->srch_inf.info_level;
|
file_info->srch_inf.presume_name = de.name;
|
||||||
|
file_info->srch_inf.resume_name_len = de.namelen;
|
||||||
if (level == SMB_FIND_FILE_UNIX) {
|
file_info->srch_inf.resume_key = de.resume_key;
|
||||||
FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry;
|
|
||||||
|
|
||||||
filename = &pFindData->FileName[0];
|
|
||||||
if (cifsFile->srch_inf.unicode) {
|
|
||||||
len = cifs_unicode_bytelen(filename);
|
|
||||||
} else {
|
|
||||||
/* BB should we make this strnlen of PATH_MAX? */
|
|
||||||
len = strnlen(filename, PATH_MAX);
|
|
||||||
}
|
|
||||||
cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
|
|
||||||
} else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
|
|
||||||
FILE_DIRECTORY_INFO *pFindData =
|
|
||||||
(FILE_DIRECTORY_INFO *)current_entry;
|
|
||||||
filename = &pFindData->FileName[0];
|
|
||||||
len = le32_to_cpu(pFindData->FileNameLength);
|
|
||||||
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
|
|
||||||
} else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
|
|
||||||
FILE_FULL_DIRECTORY_INFO *pFindData =
|
|
||||||
(FILE_FULL_DIRECTORY_INFO *)current_entry;
|
|
||||||
filename = &pFindData->FileName[0];
|
|
||||||
len = le32_to_cpu(pFindData->FileNameLength);
|
|
||||||
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
|
|
||||||
} else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
|
|
||||||
SEARCH_ID_FULL_DIR_INFO *pFindData =
|
|
||||||
(SEARCH_ID_FULL_DIR_INFO *)current_entry;
|
|
||||||
filename = &pFindData->FileName[0];
|
|
||||||
len = le32_to_cpu(pFindData->FileNameLength);
|
|
||||||
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
|
|
||||||
} else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
|
|
||||||
FILE_BOTH_DIRECTORY_INFO *pFindData =
|
|
||||||
(FILE_BOTH_DIRECTORY_INFO *)current_entry;
|
|
||||||
filename = &pFindData->FileName[0];
|
|
||||||
len = le32_to_cpu(pFindData->FileNameLength);
|
|
||||||
cifsFile->srch_inf.resume_key = pFindData->FileIndex;
|
|
||||||
} else if (level == SMB_FIND_FILE_INFO_STANDARD) {
|
|
||||||
FIND_FILE_STANDARD_INFO *pFindData =
|
|
||||||
(FIND_FILE_STANDARD_INFO *)current_entry;
|
|
||||||
filename = &pFindData->FileName[0];
|
|
||||||
/* one byte length, no name conversion */
|
|
||||||
len = (unsigned int)pFindData->FileNameLength;
|
|
||||||
cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
|
|
||||||
} else {
|
|
||||||
cFYI(1, "Unknown findfirst level %d", level);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
cifsFile->srch_inf.resume_name_len = len;
|
|
||||||
cifsFile->srch_inf.presume_name = filename;
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user