@@ -681,57 +681,49 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
681
681
return rc ;
682
682
}
683
683
684
- static int cifs_filldir (char * pfindEntry , struct file * file , filldir_t filldir ,
685
- void * direntry , char * scratch_buf , unsigned int max_len )
684
+ static int cifs_filldir (char * find_entry , struct file * file , filldir_t filldir ,
685
+ void * dirent , char * scratch_buf , unsigned int max_len )
686
686
{
687
- int rc = 0 ;
688
- struct qstr qstring ;
689
- struct cifsFileInfo * pCifsF ;
690
- u64 inum ;
691
- ino_t ino ;
692
- struct super_block * sb ;
693
- struct cifs_sb_info * cifs_sb ;
694
- struct dentry * tmp_dentry ;
687
+ struct cifsFileInfo * file_info = file -> private_data ;
688
+ struct super_block * sb = file -> f_path .dentry -> d_sb ;
689
+ struct cifs_sb_info * cifs_sb = CIFS_SB (sb );
695
690
struct cifs_fattr fattr ;
691
+ struct dentry * dentry ;
692
+ struct qstr name ;
693
+ int rc = 0 ;
694
+ u64 inum ;
695
+ ino_t ino ;
696
696
697
- /* get filename and len into qstring */
698
- /* get dentry */
699
- /* decide whether to create and populate ionde */
700
- if ((direntry == NULL ) || (file == NULL ))
701
- return - EINVAL ;
702
-
703
- pCifsF = file -> private_data ;
704
-
705
- if ((scratch_buf == NULL ) || (pfindEntry == NULL ) || (pCifsF == NULL ))
706
- return - ENOENT ;
707
-
708
- rc = cifs_entry_is_dot (pfindEntry , pCifsF );
709
697
/* skip . and .. since we added them first */
698
+ rc = cifs_entry_is_dot (find_entry , file_info );
710
699
if (rc != 0 )
711
700
return 0 ;
712
701
713
- sb = file -> f_path .dentry -> d_sb ;
714
- cifs_sb = CIFS_SB (sb );
715
-
716
- qstring .name = scratch_buf ;
717
- rc = cifs_get_name_from_search_buf (& qstring , pfindEntry ,
718
- pCifsF -> srch_inf .info_level ,
719
- pCifsF -> srch_inf .unicode , cifs_sb ,
720
- max_len , & inum /* returned */ );
721
-
702
+ name .name = scratch_buf ;
703
+ rc = cifs_get_name_from_search_buf (& name , find_entry ,
704
+ file_info -> srch_inf .info_level ,
705
+ file_info -> srch_inf .unicode ,
706
+ cifs_sb , max_len , & inum );
722
707
if (rc )
723
708
return rc ;
724
709
725
- if (pCifsF -> srch_inf .info_level == SMB_FIND_FILE_UNIX )
710
+ switch (file_info -> srch_inf .info_level ) {
711
+ case SMB_FIND_FILE_UNIX :
726
712
cifs_unix_basic_to_fattr (& fattr ,
727
- & ((FILE_UNIX_INFO * ) pfindEntry )-> basic ,
728
- cifs_sb );
729
- else if (pCifsF -> srch_inf .info_level == SMB_FIND_FILE_INFO_STANDARD )
730
- cifs_std_info_to_fattr (& fattr , (FIND_FILE_STANDARD_INFO * )
731
- pfindEntry , cifs_sb );
732
- else
733
- cifs_dir_info_to_fattr (& fattr , (FILE_DIRECTORY_INFO * )
734
- pfindEntry , cifs_sb );
713
+ & ((FILE_UNIX_INFO * )find_entry )-> basic ,
714
+ cifs_sb );
715
+ break ;
716
+ case SMB_FIND_FILE_INFO_STANDARD :
717
+ cifs_std_info_to_fattr (& fattr ,
718
+ (FIND_FILE_STANDARD_INFO * )find_entry ,
719
+ cifs_sb );
720
+ break ;
721
+ default :
722
+ cifs_dir_info_to_fattr (& fattr ,
723
+ (FILE_DIRECTORY_INFO * )find_entry ,
724
+ cifs_sb );
725
+ break ;
726
+ }
735
727
736
728
if (inum && (cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM )) {
737
729
fattr .cf_uniqueid = inum ;
@@ -750,12 +742,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file, filldir_t filldir,
750
742
fattr .cf_flags |= CIFS_FATTR_NEED_REVAL ;
751
743
752
744
ino = cifs_uniqueid_to_ino_t (fattr .cf_uniqueid );
753
- tmp_dentry = cifs_readdir_lookup (file -> f_dentry , & qstring , & fattr );
745
+ dentry = cifs_readdir_lookup (file -> f_dentry , & name , & fattr );
754
746
755
- rc = filldir (direntry , qstring .name , qstring .len , file -> f_pos ,
756
- ino , fattr .cf_dtype );
747
+ rc = filldir (dirent , name .name , name .len , file -> f_pos , ino ,
748
+ fattr .cf_dtype );
757
749
758
- dput (tmp_dentry );
750
+ dput (dentry );
759
751
return rc ;
760
752
}
761
753
0 commit comments