exFAT file system implementation library.
Free exFAT implementation.
- Copyright (C) 2010-2018 Andrew Nayenko
+ Copyright (C) 2010-2023 Andrew Nayenko
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
static void init_node_meta2(struct exfat_node* node,
const struct exfat_entry_meta2* meta2)
{
+ node->valid_size = le64_to_cpu(meta2->valid_size);
node->size = le64_to_cpu(meta2->size);
node->start_cluster = le32_to_cpu(meta2->start_cluster);
node->fptr_cluster = node->start_cluster;
}
static bool check_node(const struct exfat* ef, struct exfat_node* node,
- le16_t actual_checksum, const struct exfat_entry_meta1* meta1,
- const struct exfat_entry_meta2* meta2)
+ le16_t actual_checksum, const struct exfat_entry_meta1* meta1)
{
int cluster_size = CLUSTER_SIZE(*ef->sb);
uint64_t clusters_heap_size =
cannot be greater than file size. See SetFileValidData() function
description in MSDN.
*/
- if (le64_to_cpu(meta2->valid_size) > node->size)
+ if (node->valid_size > node->size)
{
exfat_get_name(node, buffer);
exfat_error("'%s' has valid size (%"PRIu64") greater than size "
- "(%"PRIu64")", buffer, le64_to_cpu(meta2->valid_size),
- node->size);
+ "(%"PRIu64")", buffer, node->valid_size, node->size);
ret = false;
}
init_node_meta2(node, meta2);
init_node_name(node, entries + 2, mandatory_entries - 2);
- if (!check_node(ef, node, exfat_calc_checksum(entries, n), meta1, meta2))
+ if (!check_node(ef, node, exfat_calc_checksum(entries, n), meta1))
return -EIO;
return 0;
NULL, &meta1->atime_tzo);
meta1->adate = edate;
meta1->atime = etime;
- meta2->size = meta2->valid_size = cpu_to_le64(node->size);
+ meta2->valid_size = cpu_to_le64(node->valid_size);
+ meta2->size = cpu_to_le64(node->size);
meta2->start_cluster = cpu_to_le32(node->start_cluster);
meta2->flags = EXFAT_FLAG_ALWAYS1;
/* empty files must not be marked as contiguous */
exfat_put_node(ef, existing);
if (rc != 0)
{
- /* free clusters even if something went wrong; overwise they
+ /* free clusters even if something went wrong; otherwise they
will be just lost */
exfat_cleanup_node(ef, existing);
exfat_put_node(ef, dir);