Changeset 0dbe5ac in mainline for uspace/srv/fs/exfat/exfat_fat.c
- Timestamp:
- 2011-08-26T21:19:24Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5d95f02
- Parents:
- ff0c270
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_fat.c
rff0c270 r0dbe5ac 135 135 if (nodep->fragmented) { 136 136 if (((((nodep->size - 1) / BPS(bs)) / SPC(bs)) == bn / SPC(bs)) && 137 138 139 * This is a request to read a block within the last cluster140 * when fortunately we have the last cluster number cached.141 */137 nodep->lastc_cached_valid) { 138 /* 139 * This is a request to read a block within the last cluster 140 * when fortunately we have the last cluster number cached. 141 */ 142 142 return block_get(block, nodep->idx->service_id, DATA_FS(bs) + 143 143 (nodep->lastc_cached_value-EXFAT_CLST_FIRST)*SPC(bs) + … … 195 195 int rc; 196 196 197 if (fcl < EXFAT_CLST_FIRST || fcl > DATA_CNT(bs) +2)197 if (fcl < EXFAT_CLST_FIRST || fcl > DATA_CNT(bs) + 2) 198 198 return ELIMIT; 199 199 200 200 if (!fragmented) { 201 201 rc = block_get(block, service_id, DATA_FS(bs) + 202 (fcl -EXFAT_CLST_FIRST)*SPC(bs) + bn, flags);202 (fcl - EXFAT_CLST_FIRST)*SPC(bs) + bn, flags); 203 203 } else { 204 204 max_clusters = bn / SPC(bs); … … 209 209 210 210 rc = block_get(block, service_id, DATA_FS(bs) + 211 (c -EXFAT_CLST_FIRST)*SPC(bs) + (bn % SPC(bs)), flags);211 (c - EXFAT_CLST_FIRST) * SPC(bs) + (bn % SPC(bs)), flags); 212 212 213 213 if (clp) … … 310 310 311 311 fibril_mutex_lock(&exfat_alloc_lock); 312 for (clst=EXFAT_CLST_FIRST; clst < DATA_CNT(bs)+2 && found < nclsts; clst++) { 312 for (clst = EXFAT_CLST_FIRST; clst < DATA_CNT(bs) + 2 && found < nclsts; 313 clst++) { 313 314 /* Need to rewrite because of multiple exfat_bitmap_get calls */ 314 if (bitmap_is_free(bs, service_id, clst) ==EOK) {315 316 * The cluster is free. Put it into our stack317 * of found clusters and mark it as non-free.318 */315 if (bitmap_is_free(bs, service_id, clst) == EOK) { 316 /* 317 * The cluster is free. Put it into our stack 318 * of found clusters and mark it as non-free. 319 */ 319 320 lifo[found] = clst; 320 321 rc = exfat_set_cluster(bs, service_id, clst, 321 322 (found == 0) ? EXFAT_CLST_EOF : lifo[found - 1]); 322 323 if (rc != EOK) 323 324 break; … … 339 340 340 341 /* If something wrong - free the clusters */ 341 if (found > 0) { 342 while (found--) { 343 (void) bitmap_clear_cluster(bs, service_id, lifo[found]); 344 (void) exfat_set_cluster(bs, service_id, lifo[found], 0); 345 } 342 while (found--) { 343 (void) bitmap_clear_cluster(bs, service_id, lifo[found]); 344 (void) exfat_set_cluster(bs, service_id, lifo[found], 0); 346 345 } 347 346 … … 490 489 491 490 for (i = 0; i < SPC(bs); i++) { 492 rc = exfat_block_get_by_clst(&b, bs, service_id, false, c, NULL, i,493 BLOCK_FLAGS_NOREAD);491 rc = exfat_block_get_by_clst(&b, bs, service_id, false, c, NULL, 492 i, BLOCK_FLAGS_NOREAD); 494 493 if (rc != EOK) 495 494 return rc; … … 517 516 if (rc != EOK) 518 517 return rc; 519 if (i == blocks -1)520 count = nodep->size - i *BPS(bs);518 if (i == blocks - 1) 519 count = nodep->size - i * BPS(bs); 521 520 memcpy(uctable, b->data, count); 522 521 uctable += count;
Note:
See TracChangeset
for help on using the changeset viewer.