Changeset 684b655 in mainline for uspace/srv/fs/fat/fat_fat.c
- Timestamp:
- 2009-09-03T12:48:35Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e402382
- Parents:
- cffce57
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_fat.c
rcffce57 r684b655 114 114 /** Read block from file located on a FAT file system. 115 115 * 116 * @param block Pointer to a block pointer for storing result. 116 117 * @param bs Buffer holding the boot sector of the file system. 117 118 * @param dev_handle Device handle of the file system. … … 121 122 * @param flags Flags passed to libblock. 122 123 * 123 * @return Block structure holding the requested block. 124 */ 125 block_t * 126 _fat_block_get(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t firstc, 127 bn_t bn, int flags) 128 { 129 block_t *b; 124 * @return EOK on success or a negative error code. 125 */ 126 int 127 _fat_block_get(block_t **block, fat_bs_t *bs, dev_handle_t dev_handle, 128 fat_cluster_t firstc, bn_t bn, int flags) 129 { 130 130 unsigned bps; 131 131 unsigned rscnt; /* block address of the first FAT */ … … 150 150 /* root directory special case */ 151 151 assert(bn < rds); 152 rc = block_get( &b, dev_handle, rscnt + bs->fatcnt * sf + bn,152 rc = block_get(block, dev_handle, rscnt + bs->fatcnt * sf + bn, 153 153 flags); 154 assert(rc == EOK); 155 return b; 154 return rc; 156 155 } 157 156 … … 161 160 assert(clusters == max_clusters); 162 161 163 rc = block_get(&b, dev_handle, ssa + 164 (lastc - FAT_CLST_FIRST) * bs->spc + bn % bs->spc, flags); 165 assert(rc == EOK); 166 167 return b; 162 rc = block_get(block, dev_handle, 163 ssa + (lastc - FAT_CLST_FIRST) * bs->spc + bn % bs->spc, flags); 164 165 return rc; 168 166 } 169 167 … … 196 194 int flags = (o % bps == 0) ? 197 195 BLOCK_FLAGS_NOREAD : BLOCK_FLAGS_NONE; 198 b = fat_block_get(bs, nodep, o / bps, flags); 196 rc = fat_block_get(&b, bs, nodep, o / bps, flags); 197 assert(rc == EOK); 199 198 memset(b->data + o % bps, 0, bps - o % bps); 200 199 b->dirty = true; /* need to sync node */ … … 208 207 /* zero out the initial part of the new cluster chain */ 209 208 for (o = boundary; o < pos; o += bps) { 210 b = _fat_block_get(bs, nodep->idx->dev_handle, mcl,209 rc = _fat_block_get(&b, bs, nodep->idx->dev_handle, mcl, 211 210 (o - boundary) / bps, BLOCK_FLAGS_NOREAD); 211 assert(rc == EOK); 212 212 memset(b->data, 0, min(bps, pos - o)); 213 213 b->dirty = true; /* need to sync node */ … … 481 481 482 482 for (i = 0; i < bs->spc; i++) { 483 b = _fat_block_get(bs, dev_handle, c, i, BLOCK_FLAGS_NOREAD); 483 rc = _fat_block_get(&b, bs, dev_handle, c, i, 484 BLOCK_FLAGS_NOREAD); 485 assert(rc == EOK); 484 486 memset(b->data, 0, bps); 485 487 b->dirty = true;
Note:
See TracChangeset
for help on using the changeset viewer.