Changes in uspace/srv/fs/exfat/exfat_fat.c [0dbe5ac:aaa77ba0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_fat.c
r0dbe5ac raaa77ba0 50 50 #include <malloc.h> 51 51 #include <mem.h> 52 #include <str.h> 52 53 53 54 … … 126 127 { 127 128 exfat_cluster_t firstc = nodep->firstc; 128 exfat_cluster_t currc ;129 exfat_cluster_t currc = 0; 129 130 aoff64_t relbn = bn; 130 131 int rc; … … 313 314 clst++) { 314 315 /* Need to rewrite because of multiple exfat_bitmap_get calls */ 315 if ( bitmap_is_free(bs, service_id, clst) == EOK) {316 if (exfat_bitmap_is_free(bs, service_id, clst) == EOK) { 316 317 /* 317 318 * The cluster is free. Put it into our stack … … 322 323 (found == 0) ? EXFAT_CLST_EOF : lifo[found - 1]); 323 324 if (rc != EOK) 324 break;325 goto exit_error; 325 326 found++; 326 rc = bitmap_set_cluster(bs, service_id, clst);327 rc = exfat_bitmap_set_cluster(bs, service_id, clst); 327 328 if (rc != EOK) 328 break;329 goto exit_error; 329 330 330 331 } … … 339 340 } 340 341 342 rc = ENOSPC; 343 344 exit_error: 345 341 346 /* If something wrong - free the clusters */ 342 347 while (found--) { 343 (void) bitmap_clear_cluster(bs, service_id, lifo[found]);348 (void) exfat_bitmap_clear_cluster(bs, service_id, lifo[found]); 344 349 (void) exfat_set_cluster(bs, service_id, lifo[found], 0); 345 350 } … … 347 352 free(lifo); 348 353 fibril_mutex_unlock(&exfat_alloc_lock); 349 return ENOSPC;354 return rc; 350 355 } 351 356 … … 373 378 if (rc != EOK) 374 379 return rc; 375 rc = bitmap_clear_cluster(bs, service_id, firstc);380 rc = exfat_bitmap_clear_cluster(bs, service_id, firstc); 376 381 if (rc != EOK) 377 382 return rc; … … 537 542 int exfat_sanity_check(exfat_bs_t *bs, service_id_t service_id) 538 543 { 539 /* TODO */ 544 if (str_cmp((char const *)bs->oem_name, "EXFAT ")) 545 return ENOTSUP; 546 else if (uint16_t_le2host(bs->signature) != 0xAA55) 547 return ENOTSUP; 548 else if (uint32_t_le2host(bs->fat_sector_count) == 0) 549 return ENOTSUP; 550 else if (uint32_t_le2host(bs->data_clusters) == 0) 551 return ENOTSUP; 552 else if (bs->fat_count != 1) 553 return ENOTSUP; 554 else if ((bs->bytes_per_sector + bs->sec_per_cluster) > 25) { 555 /* exFAT does not support cluster size > 32 Mb */ 556 return ENOTSUP; 557 } 540 558 return EOK; 541 559 }
Note:
See TracChangeset
for help on using the changeset viewer.