Changeset 684b655 in mainline for uspace/srv/fs/fat/fat_fat.c


Ignore:
Timestamp:
2009-09-03T12:48:35Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e402382
Parents:
cffce57
Message:

Make _fat_block_get() return an error code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_fat.c

    rcffce57 r684b655  
    114114/** Read block from file located on a FAT file system.
    115115 *
     116 * @param block         Pointer to a block pointer for storing result.
    116117 * @param bs            Buffer holding the boot sector of the file system.
    117118 * @param dev_handle    Device handle of the file system.
     
    121122 * @param flags         Flags passed to libblock.
    122123 *
    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 */
     126int
     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{
    130130        unsigned bps;
    131131        unsigned rscnt;         /* block address of the first FAT */
     
    150150                /* root directory special case */
    151151                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,
    153153                    flags);
    154                 assert(rc == EOK);
    155                 return b;
     154                return rc;
    156155        }
    157156
     
    161160        assert(clusters == max_clusters);
    162161
    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;
    168166}
    169167
     
    196194                int flags = (o % bps == 0) ?
    197195                    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);
    199198                memset(b->data + o % bps, 0, bps - o % bps);
    200199                b->dirty = true;                /* need to sync node */
     
    208207        /* zero out the initial part of the new cluster chain */
    209208        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,
    211210                    (o - boundary) / bps, BLOCK_FLAGS_NOREAD);
     211                assert(rc == EOK);
    212212                memset(b->data, 0, min(bps, pos - o));
    213213                b->dirty = true;                /* need to sync node */
     
    481481       
    482482        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);
    484486                memset(b->data, 0, bps);
    485487                b->dirty = true;
Note: See TracChangeset for help on using the changeset viewer.