Changes in uspace/srv/fs/fat/fat_fat.c [dba4a23:db4ec8d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
rdba4a23 rdb4ec8d 424 424 for (c = 0; c < BPS(bs) / sizeof(fat_cluster_t); c++, cl++) { 425 425 /* 426 * Check if the cluster is physically there. This check 427 * becomes necessary when the file system is created 428 * with fewer total sectors than how many is inferred 429 * from the size of the file allocation table. 426 * Check if the entire cluster is physically there. 427 * This check becomes necessary when the file system is 428 * created with fewer total sectors than how many is 429 * inferred from the size of the file allocation table 430 * or when the last cluster ends beyond the end of the 431 * device. 430 432 */ 431 if ((cl >= 2) &&432 ((cl - 2) * SPC(bs) + SSA(bs) >= TS(bs))) {433 if ((cl >= FAT_CLST_FIRST) && 434 CLBN2PBN(bs, cl, SPC(bs) - 1) >= TS(bs)) { 433 435 rc = block_put(blk); 434 436 if (rc != EOK) … … 543 545 dev_handle_t dev_handle = nodep->idx->dev_handle; 544 546 fat_cluster_t lastc; 545 uint16_t numc;546 547 uint8_t fatno; 547 548 int rc; 548 549 549 if (nodep->lastc_cached_valid) { 550 lastc = nodep->lastc_cached_value; 551 nodep->lastc_cached_valid = false; 550 if (nodep->firstc == FAT_CLST_RES0) { 551 /* No clusters allocated to the node yet. */ 552 nodep->firstc = mcl; 553 nodep->dirty = true; /* need to sync node */ 552 554 } else { 553 rc = fat_cluster_walk(bs, dev_handle, nodep->firstc, &lastc, 554 &numc, (uint16_t) -1); 555 if (rc != EOK) 556 return rc; 557 558 if (numc == 0) { 559 /* No clusters allocated to the node yet. */ 560 nodep->firstc = mcl; 561 nodep->dirty = true; /* need to sync node */ 562 return EOK; 555 if (nodep->lastc_cached_valid) { 556 lastc = nodep->lastc_cached_value; 557 nodep->lastc_cached_valid = false; 558 } else { 559 rc = fat_cluster_walk(bs, dev_handle, nodep->firstc, 560 &lastc, NULL, (uint16_t) -1); 561 if (rc != EOK) 562 return rc; 563 563 } 564 } 565 566 for (fatno = FAT1; fatno < bs->fatcnt; fatno++) {567 rc = fat_set_cluster(bs, nodep->idx->dev_handle, fatno, lastc,568 mcl);569 if (rc != EOK)570 return rc;564 565 for (fatno = FAT1; fatno < bs->fatcnt; fatno++) { 566 rc = fat_set_cluster(bs, nodep->idx->dev_handle, fatno, 567 lastc, mcl); 568 if (rc != EOK) 569 return rc; 570 } 571 571 } 572 572
Note:
See TracChangeset
for help on using the changeset viewer.