Changes in uspace/srv/fs/exfat/exfat_bitmap.c [e738d56:ff0c270] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_bitmap.c
re738d56 rff0c270 45 45 #include <assert.h> 46 46 #include <fibril_synch.h> 47 #include <malloc.h> 47 48 #include <mem.h> 48 49 49 50 50 int exfat_bitmap_is_free(exfat_bs_t *bs, service_id_t service_id,51 int bitmap_is_free(exfat_bs_t *bs, service_id_t service_id, 51 52 exfat_cluster_t clst) 52 53 { … … 89 90 } 90 91 91 int exfat_bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id,92 int bitmap_set_cluster(exfat_bs_t *bs, service_id_t service_id, 92 93 exfat_cluster_t clst) 93 94 { … … 124 125 } 125 126 126 int exfat_bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id,127 int bitmap_clear_cluster(exfat_bs_t *bs, service_id_t service_id, 127 128 exfat_cluster_t clst) 128 129 { … … 160 161 } 161 162 162 int exfat_bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id,163 int bitmap_set_clusters(exfat_bs_t *bs, service_id_t service_id, 163 164 exfat_cluster_t firstc, exfat_cluster_t count) 164 165 { … … 168 169 169 170 while (clst < firstc + count ) { 170 rc = exfat_bitmap_set_cluster(bs, service_id, clst);171 rc = bitmap_set_cluster(bs, service_id, clst); 171 172 if (rc != EOK) { 172 173 if (clst - firstc > 0) 173 (void) exfat_bitmap_clear_clusters(bs, service_id,174 (void) bitmap_clear_clusters(bs, service_id, 174 175 firstc, clst - firstc); 175 176 return rc; … … 180 181 } 181 182 182 int exfat_bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id,183 int bitmap_clear_clusters(exfat_bs_t *bs, service_id_t service_id, 183 184 exfat_cluster_t firstc, exfat_cluster_t count) 184 185 { … … 188 189 189 190 while (clst < firstc + count) { 190 rc = exfat_bitmap_clear_cluster(bs, service_id, clst);191 rc = bitmap_clear_cluster(bs, service_id, clst); 191 192 if (rc != EOK) 192 193 return rc; … … 196 197 } 197 198 198 int exfat_bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id,199 int bitmap_alloc_clusters(exfat_bs_t *bs, service_id_t service_id, 199 200 exfat_cluster_t *firstc, exfat_cluster_t count) 200 201 { … … 204 205 while (startc < DATA_CNT(bs) + 2) { 205 206 endc = startc; 206 while ( exfat_bitmap_is_free(bs, service_id, endc) == EOK) {207 while (bitmap_is_free(bs, service_id, endc) == EOK) { 207 208 if ((endc - startc) + 1 == count) { 208 209 *firstc = startc; 209 return exfat_bitmap_set_clusters(bs, service_id, startc, count);210 return bitmap_set_clusters(bs, service_id, startc, count); 210 211 } else 211 212 endc++; … … 217 218 218 219 219 int exfat_bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep,220 int bitmap_append_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 220 221 exfat_cluster_t count) 221 222 { 222 223 if (nodep->firstc == 0) { 223 return exfat_bitmap_alloc_clusters(bs, nodep->idx->service_id,224 return bitmap_alloc_clusters(bs, nodep->idx->service_id, 224 225 &nodep->firstc, count); 225 226 } else { … … 228 229 229 230 clst = lastc + 1; 230 while ( exfat_bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) {231 while (bitmap_is_free(bs, nodep->idx->service_id, clst) == EOK) { 231 232 if (clst - lastc == count){ 232 return exfat_bitmap_set_clusters(bs, nodep->idx->service_id,233 return bitmap_set_clusters(bs, nodep->idx->service_id, 233 234 lastc + 1, count); 234 235 } else … … 240 241 241 242 242 int exfat_bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep,243 int bitmap_free_clusters(exfat_bs_t *bs, exfat_node_t *nodep, 243 244 exfat_cluster_t count) 244 245 { … … 247 248 lastc -= count; 248 249 249 return exfat_bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count);250 } 251 252 253 int exfat_bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep)250 return bitmap_clear_clusters(bs, nodep->idx->service_id, lastc + 1, count); 251 } 252 253 254 int bitmap_replicate_clusters(exfat_bs_t *bs, exfat_node_t *nodep) 254 255 { 255 256 int rc;
Note:
See TracChangeset
for help on using the changeset viewer.