+ i = ES_INDEX_NAME;Please find the way to access name entries like ep_file, ep_stream
+ while ((ep = exfat_get_validated_dentry(es, i++, TYPE_NAME))) {
without calling exfat_get_validated_dentry().
@@ -590,17 +587,16 @@ int exfat_remove_entries(struct inode *inode, struct exfat_chain *p_dir, voidDitto, You do not need to repeatedly call exfat_get_validated_dentry() for the entries
exfat_update_dir_chksum_with_entry_set(struct exfat_entry_set_cache *es) {
int chksum_type = CS_DIR_ENTRY, i;
- unsigned short chksum = 0;
+ u16 chksum = 0;
struct exfat_dentry *ep;
for (i = 0; i < es->num_entries; i++) {
- ep = exfat_get_dentry_cached(es, i);
+ ep = exfat_get_validated_dentry(es, i, TYPE_ALL);
which got from exfat_get_dentry_set().
/* validiate cached dentries */Why do you unnecessarily check entries with two loops?
- for (i = 1; i < num_entries; i++) {
- ep = exfat_get_dentry_cached(es, i);
- if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode))
- goto free_es;
+ es->ep_stream = exfat_get_validated_dentry(es, ES_INDEX_STREAM, TYPE_STREAM);
+ if (!es->ep_stream)
+ goto free_es;
+
+ if (max_entries == ES_ALL_ENTRIES) {
+ for (i = 0; i < ES_FILE(es).num_ext; i++)
+ if (!exfat_get_validated_dentry(es, ES_INDEX_STREAM + i, TYPE_SECONDARY))
+ goto free_es;
+ for (i = 0; i * EXFAT_FILE_NAME_LEN < ES_STREAM(es).name_len; i++)
+ if (!exfat_get_validated_dentry(es, ES_INDEX_NAME + i, TYPE_NAME))
+ goto free_es;
Please refer to the patch I sent.