From: relan Date: Tue, 14 Mar 2017 05:15:57 +0000 (+0300) Subject: Repairing: implement invalid node checksum fix. X-Git-Tag: android-x86-9.0-r1~10 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fexternal-exfat.git;a=commitdiff_plain;h=53728e5a79f29de88f834cca381cbbf381589610 Repairing: implement invalid node checksum fix. --- diff --git a/libexfat/exfat.h b/libexfat/exfat.h index d9bbbba..00c903d 100644 --- a/libexfat/exfat.h +++ b/libexfat/exfat.h @@ -236,5 +236,7 @@ void exfat_tzset(void); bool exfat_ask_to_fix(const struct exfat* ef); bool exfat_fix_invalid_vbr_checksum(const struct exfat* ef, void* sector, uint32_t vbr_checksum); +bool exfat_fix_invalid_node_checksum(const struct exfat* ef, + struct exfat_node* node); #endif /* ifndef EXFAT_H_INCLUDED */ diff --git a/libexfat/node.c b/libexfat/node.c index 1ccb1c9..9270ccf 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -223,7 +223,8 @@ static bool check_node(const struct exfat* ef, struct exfat_node* node, exfat_get_name(node, buffer); exfat_error("'%s' has invalid checksum (%#hx != %#hx)", buffer, le16_to_cpu(actual_checksum), le16_to_cpu(meta1->checksum)); - ret = false; + if (!EXFAT_REPAIR(invalid_node_checksum, ef, node)) + ret = false; } /* diff --git a/libexfat/repair.c b/libexfat/repair.c index a7222cd..049ebd7 100644 --- a/libexfat/repair.c +++ b/libexfat/repair.c @@ -76,3 +76,13 @@ bool exfat_fix_invalid_vbr_checksum(const struct exfat* ef, void* sector, exfat_errors_fixed++; return true; } + +bool exfat_fix_invalid_node_checksum(const struct exfat* ef, + struct exfat_node* node) +{ + /* checksum will be rewritten by exfat_flush_node() */ + node->is_dirty = true; + + exfat_errors_fixed++; + return true; +}