]> git.pld-linux.org Git - packages/fuse-exfat.git/blob - exfat-svn-libexfat.patch
- rel 2; tiny fixes from svn
[packages/fuse-exfat.git] / exfat-svn-libexfat.patch
1 Index: cluster.c
2 ===================================================================
3 --- cluster.c   (wersja 342)
4 +++ cluster.c   (wersja 353)
5 @@ -134,7 +134,7 @@
6         ef->cmap.dirty = false;
7  }
8  
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)
12  {
13         off_t fat_offset;
14 @@ -187,7 +187,7 @@
15         cluster_t c;
16  
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);
20  }
21  
22  static int shrink_file(struct exfat* ef, struct exfat_node* node,
23 @@ -344,7 +344,8 @@
24         return 0;
25  }
26  
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,
29 +               bool erase)
30  {
31         uint32_t c1 = bytes2clusters(ef, node->size);
32         uint32_t c2 = bytes2clusters(ef, size);
33 @@ -364,9 +365,12 @@
34         if (rc != 0)
35                 return rc;
36  
37 -       rc = erase_range(ef, node, node->size, size);
38 -       if (rc != 0)
39 -               return rc;
40 +       if (erase)
41 +       {
42 +               rc = erase_range(ef, node, node->size, size);
43 +               if (rc != 0)
44 +                       return rc;
45 +       }
46  
47         exfat_update_mtime(node);
48         node->size = size;
49 Index: node.c
50 ===================================================================
51 --- node.c      (wersja 342)
52 +++ node.c      (wersja 353)
53 @@ -56,7 +56,7 @@
54                 if (node->flags & EXFAT_ATTRIB_UNLINKED)
55                 {
56                         /* free all clusters and node structure itself */
57 -                       exfat_truncate(ef, node, 0);
58 +                       exfat_truncate(ef, node, 0, true);
59                         free(node);
60                 }
61                 if (ef->cmap.dirty)
62 @@ -627,7 +627,7 @@
63                 new_size = CLUSTER_SIZE(*ef->sb);
64         if (new_size == dir->size)
65                 return 0;
66 -       rc = exfat_truncate(ef, dir, new_size);
67 +       rc = exfat_truncate(ef, dir, new_size, true);
68         if (rc != 0)
69                 return rc;
70         return 0;
71 @@ -673,7 +673,7 @@
72  {
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);
77  }
78  
79  static int find_slot(struct exfat* ef, struct exfat_node* dir,
80 @@ -826,7 +826,7 @@
81         if (rc != 0)
82                 return 0;
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);
86         if (rc != 0)
87         {
88                 delete(ef, node);
89 Index: io.c
90 ===================================================================
91 --- io.c        (wersja 342)
92 +++ io.c        (wersja 353)
93 @@ -351,9 +351,12 @@
94         const char* bufp = buffer;
95         off_t lsize, loffset, remainder;
96  
97 -       if (offset + size > node->size)
98 -               if (exfat_truncate(ef, node, offset + size) != 0)
99 -                       return -1;
100 +       if (offset > node->size)
101 +               if (exfat_truncate(ef, node, offset, true) != 0)
102 +                       return -1;
103 +       if (offset + size > node->size)
104 +               if (exfat_truncate(ef, node, offset + size, false) != 0)
105 +                       return -1;
106         if (size == 0)
107                 return 0;
108  
109 Index: exfat.h
110 ===================================================================
111 --- exfat.h     (wersja 342)
112 +++ exfat.h     (wersja 353)
113 @@ -164,7 +164,8 @@
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,
119 +               bool erase);
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);
122  
This page took 0.094336 seconds and 3 git commands to generate.