2 ===================================================================
3 --- cluster.c (wersja 342)
4 +++ cluster.c (wersja 353)
6 ef->cmap.dirty = false;
9 -static void set_next_cluster(const struct exfat* ef, int contiguous,
10 +static void set_next_cluster(const struct exfat* ef, bool contiguous,
11 cluster_t current, cluster_t next)
17 for (c = first; c < last; c++)
18 - set_next_cluster(ef, 0, c, c + 1);
19 + set_next_cluster(ef, false, c, c + 1);
22 static int shrink_file(struct exfat* ef, struct exfat_node* node,
27 -int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size)
28 +int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size,
31 uint32_t c1 = bytes2clusters(ef, node->size);
32 uint32_t c2 = bytes2clusters(ef, size);
37 - rc = erase_range(ef, node, node->size, size);
42 + rc = erase_range(ef, node, node->size, size);
47 exfat_update_mtime(node);
50 ===================================================================
51 --- node.c (wersja 342)
52 +++ node.c (wersja 353)
54 if (node->flags & EXFAT_ATTRIB_UNLINKED)
56 /* free all clusters and node structure itself */
57 - exfat_truncate(ef, node, 0);
58 + exfat_truncate(ef, node, 0, true);
63 new_size = CLUSTER_SIZE(*ef->sb);
64 if (new_size == dir->size)
66 - rc = exfat_truncate(ef, dir, new_size);
67 + rc = exfat_truncate(ef, dir, new_size, true);
73 return exfat_truncate(ef, dir,
74 DIV_ROUND_UP(asize + difference, CLUSTER_SIZE(*ef->sb))
75 - * CLUSTER_SIZE(*ef->sb));
76 + * CLUSTER_SIZE(*ef->sb), true);
79 static int find_slot(struct exfat* ef, struct exfat_node* dir,
83 /* directories always have at least one cluster */
84 - rc = exfat_truncate(ef, node, CLUSTER_SIZE(*ef->sb));
85 + rc = exfat_truncate(ef, node, CLUSTER_SIZE(*ef->sb), true);
90 ===================================================================
94 const char* bufp = buffer;
95 off_t lsize, loffset, remainder;
97 - if (offset + size > node->size)
98 - if (exfat_truncate(ef, node, offset + size) != 0)
100 + if (offset > node->size)
101 + if (exfat_truncate(ef, node, offset, true) != 0)
103 + if (offset + size > node->size)
104 + if (exfat_truncate(ef, node, offset + size, false) != 0)
110 ===================================================================
111 --- exfat.h (wersja 342)
112 +++ exfat.h (wersja 353)
114 cluster_t exfat_advance_cluster(const struct exfat* ef,
115 struct exfat_node* node, uint32_t count);
116 void exfat_flush_cmap(struct exfat* ef);
117 -int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size);
118 +int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size,
120 uint32_t exfat_count_free_clusters(const struct exfat* ef);
121 int exfat_find_used_sectors(const struct exfat* ef, off_t* a, off_t* b);