aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/readdir.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-07-16 15:24:37 -0400
committerSteve French <sfrench@us.ibm.com>2011-07-25 17:43:14 -0400
commiteaf35b1ea8c12edc5ba8299a8ecfe1efab85101b (patch)
tree780a33eae1f8775cc180970f22157b6dd8b91902 /fs/cifs/readdir.c
parentf16d59b417d781eb7fe63a561272429b5e098c3a (diff)
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>
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r--fs/cifs/readdir.c66
1 files changed, 9 insertions, 57 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 47bb1b8cd305..36885a368fa8 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -478,66 +478,18 @@ static int is_dir_changed(struct file *file)
478} 478}
479 479
480static int cifs_save_resume_key(const char *current_entry, 480static int cifs_save_resume_key(const char *current_entry,
481 struct cifsFileInfo *cifsFile) 481 struct cifsFileInfo *file_info)
482{ 482{
483 int rc = 0; 483 struct cifs_dirent de;
484 unsigned int len = 0; 484 int rc;
485 __u16 level;
486 char *filename;
487
488 if ((cifsFile == NULL) || (current_entry == NULL))
489 return -EINVAL;
490
491 level = cifsFile->srch_inf.info_level;
492
493 if (level == SMB_FIND_FILE_UNIX) {
494 FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry;
495 485
496 filename = &pFindData->FileName[0]; 486 rc = cifs_fill_dirent(&de, current_entry, file_info->srch_inf.info_level,
497 if (cifsFile->srch_inf.unicode) { 487 file_info->srch_inf.unicode);
498 len = cifs_unicode_bytelen(filename); 488 if (!rc) {
499 } else { 489 file_info->srch_inf.presume_name = de.name;
500 /* BB should we make this strnlen of PATH_MAX? */ 490 file_info->srch_inf.resume_name_len = de.namelen;
501 len = strnlen(filename, PATH_MAX); 491 file_info->srch_inf.resume_key = de.resume_key;
502 }
503 cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
504 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
505 FILE_DIRECTORY_INFO *pFindData =
506 (FILE_DIRECTORY_INFO *)current_entry;
507 filename = &pFindData->FileName[0];
508 len = le32_to_cpu(pFindData->FileNameLength);
509 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
510 } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
511 FILE_FULL_DIRECTORY_INFO *pFindData =
512 (FILE_FULL_DIRECTORY_INFO *)current_entry;
513 filename = &pFindData->FileName[0];
514 len = le32_to_cpu(pFindData->FileNameLength);
515 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
516 } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
517 SEARCH_ID_FULL_DIR_INFO *pFindData =
518 (SEARCH_ID_FULL_DIR_INFO *)current_entry;
519 filename = &pFindData->FileName[0];
520 len = le32_to_cpu(pFindData->FileNameLength);
521 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
522 } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
523 FILE_BOTH_DIRECTORY_INFO *pFindData =
524 (FILE_BOTH_DIRECTORY_INFO *)current_entry;
525 filename = &pFindData->FileName[0];
526 len = le32_to_cpu(pFindData->FileNameLength);
527 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
528 } else if (level == SMB_FIND_FILE_INFO_STANDARD) {
529 FIND_FILE_STANDARD_INFO *pFindData =
530 (FIND_FILE_STANDARD_INFO *)current_entry;
531 filename = &pFindData->FileName[0];
532 /* one byte length, no name conversion */
533 len = (unsigned int)pFindData->FileNameLength;
534 cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
535 } else {
536 cFYI(1, "Unknown findfirst level %d", level);
537 return -EINVAL;
538 } 492 }
539 cifsFile->srch_inf.resume_name_len = len;
540 cifsFile->srch_inf.presume_name = filename;
541 return rc; 493 return rc;
542} 494}
543 495