Changes in uspace/srv/fs/fat/fat_fat.c [db4ec8d:dba4a23] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
rdb4ec8d rdba4a23 424 424 for (c = 0; c < BPS(bs) / sizeof(fat_cluster_t); c++, cl++) { 425 425 /* 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. 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. 432 430 */ 433 if ((cl >= FAT_CLST_FIRST) &&434 CLBN2PBN(bs, cl, SPC(bs) - 1) >= TS(bs)) {431 if ((cl >= 2) && 432 ((cl - 2) * SPC(bs) + SSA(bs) >= TS(bs))) { 435 433 rc = block_put(blk); 436 434 if (rc != EOK) … … 545 543 dev_handle_t dev_handle = nodep->idx->dev_handle; 546 544 fat_cluster_t lastc; 545 uint16_t numc; 547 546 uint8_t fatno; 548 547 int rc; 549 548 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 */ 549 if (nodep->lastc_cached_valid) { 550 lastc = nodep->lastc_cached_value; 551 nodep->lastc_cached_valid = false; 554 552 } else { 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; 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; 563 563 } 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 }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; 571 571 } 572 572
Note:
See TracChangeset
for help on using the changeset viewer.