@@ -44,7 +44,7 @@ static void exfat_get_uniname_from_ext_entry(struct super_block *sb,
44
44
* Third entry : first file-name entry
45
45
* So, the index of first file-name dentry should start from 2.
46
46
*/
47
- for (i = 2 ; i < es .num_entries ; i ++ ) {
47
+ for (i = ES_IDX_FIRST_FILENAME ; i < es .num_entries ; i ++ ) {
48
48
struct exfat_dentry * ep = exfat_get_dentry_cached (& es , i );
49
49
50
50
/* end of name entry */
@@ -336,7 +336,7 @@ int exfat_calc_num_entries(struct exfat_uni_name *p_uniname)
336
336
return - EINVAL ;
337
337
338
338
/* 1 file entry + 1 stream entry + name entries */
339
- return (( len - 1 ) / EXFAT_FILE_NAME_LEN + 3 );
339
+ return ES_ENTRY_NUM ( len );
340
340
}
341
341
342
342
unsigned int exfat_get_entry_type (struct exfat_dentry * ep )
@@ -591,13 +591,13 @@ void exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es)
591
591
unsigned short chksum = 0 ;
592
592
struct exfat_dentry * ep ;
593
593
594
- for (i = 0 ; i < es -> num_entries ; i ++ ) {
594
+ for (i = ES_IDX_FILE ; i < es -> num_entries ; i ++ ) {
595
595
ep = exfat_get_dentry_cached (es , i );
596
596
chksum = exfat_calc_chksum16 (ep , DENTRY_SIZE , chksum ,
597
597
chksum_type );
598
598
chksum_type = CS_DEFAULT ;
599
599
}
600
- ep = exfat_get_dentry_cached (es , 0 );
600
+ ep = exfat_get_dentry_cached (es , ES_IDX_FILE );
601
601
ep -> dentry .file .checksum = cpu_to_le16 (chksum );
602
602
es -> modified = true;
603
603
}
@@ -858,7 +858,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es,
858
858
return - EIO ;
859
859
es -> bh [es -> num_bh ++ ] = bh ;
860
860
861
- ep = exfat_get_dentry_cached (es , 0 );
861
+ ep = exfat_get_dentry_cached (es , ES_IDX_FILE );
862
862
if (!exfat_validate_entry (exfat_get_entry_type (ep ), & mode ))
863
863
goto put_es ;
864
864
@@ -895,7 +895,7 @@ int exfat_get_dentry_set(struct exfat_entry_set_cache *es,
895
895
}
896
896
897
897
/* validate cached dentries */
898
- for (i = 1 ; i < num_entries ; i ++ ) {
898
+ for (i = ES_IDX_STREAM ; i < num_entries ; i ++ ) {
899
899
ep = exfat_get_dentry_cached (es , i );
900
900
if (!exfat_validate_entry (exfat_get_entry_type (ep ), & mode ))
901
901
goto put_es ;
0 commit comments