Changeset dc87ad11 in mainline for uspace/srv/fs/fat/fat_fat.c
- Timestamp:
- 2009-09-03T13:36:31Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cca29e3c
- Parents:
- e402382
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
re402382 rdc87ad11 234 234 * @param dev_handle Device handle for the file system. 235 235 * @param clst Cluster which to get. 236 * 237 * @return Value found in the cluster. 238 */ 239 fat_cluster_t 240 fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t clst) 236 * @param value Output argument holding the value of the cluster. 237 * 238 * @return EOK or a negative error code. 239 */ 240 int 241 fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t clst, 242 fat_cluster_t *value) 241 243 { 242 244 block_t *b; 243 245 uint16_t bps; 244 246 uint16_t rscnt; 245 fat_cluster_t *cp , value;247 fat_cluster_t *cp; 246 248 int rc; 247 249 … … 251 253 rc = block_get(&b, dev_handle, rscnt + 252 254 (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE); 253 assert(rc == EOK); 255 if (rc != EOK) 256 return rc; 254 257 cp = (fat_cluster_t *)b->data + clst % (bps / sizeof(fat_cluster_t)); 255 value = uint16_t_le2host(*cp);258 *value = uint16_t_le2host(*cp); 256 259 rc = block_put(b); 257 assert(rc == EOK); 258 259 return value; 260 261 return rc; 260 262 } 261 263 … … 415 417 unsigned fatno; 416 418 fat_cluster_t nextc; 419 int rc; 417 420 418 421 /* Mark all clusters in the chain as free in all copies of FAT. */ 419 422 while (firstc < FAT_CLST_LAST1) { 420 423 assert(firstc >= FAT_CLST_FIRST && firstc < FAT_CLST_BAD); 421 nextc = fat_get_cluster(bs, dev_handle, firstc); 424 rc = fat_get_cluster(bs, dev_handle, firstc, &nextc); 425 assert(rc == EOK); 422 426 for (fatno = FAT1; fatno < bs->fatcnt; fatno++) 423 427 fat_set_cluster(bs, dev_handle, fatno, firstc, … … 466 470 void fat_chop_clusters(fat_bs_t *bs, fat_node_t *nodep, fat_cluster_t lastc) 467 471 { 472 int rc; 473 468 474 dev_handle_t dev_handle = nodep->idx->dev_handle; 469 475 if (lastc == FAT_CLST_RES0) { … … 476 482 unsigned fatno; 477 483 478 nextc = fat_get_cluster(bs, dev_handle, lastc); 484 rc = fat_get_cluster(bs, dev_handle, lastc, &nextc); 485 assert(rc == EOK); 479 486 480 487 /* Terminate the cluster chain in all copies of FAT. */
Note:
See TracChangeset
for help on using the changeset viewer.