Changeset 6da81e0 in mainline for uspace/srv/fs/fat/fat_fat.c


Ignore:
Timestamp:
2010-07-28T10:12:43Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dba4a23
Parents:
7a23d60
Message:

Modify _fat_block_get() to return the "current" cluster number to the caller.

File:
1 edited

Legend:

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

    r7a23d60 r6da81e0  
    160160fall_through:
    161161        return _fat_block_get(block, bs, nodep->idx->dev_handle, nodep->firstc,
    162             bn, flags);
     162            NULL, bn, flags);
    163163}
    164164
     
    168168 * @param bs            Buffer holding the boot sector of the file system.
    169169 * @param dev_handle    Device handle of the file system.
    170  * @param firstc        First cluster used by the file. Can be zero if the file
     170 * @param fcl           First cluster used by the file. Can be zero if the file
    171171 *                      is empty.
     172 * @param clp           If not NULL, address where the cluster containing bn
     173 *                      will be stored.
     174 *                      stored
    172175 * @param bn            Block number.
    173176 * @param flags         Flags passed to libblock.
     
    177180int
    178181_fat_block_get(block_t **block, fat_bs_t *bs, dev_handle_t dev_handle,
    179     fat_cluster_t firstc, aoff64_t bn, int flags)
     182    fat_cluster_t fcl, fat_cluster_t *clp, aoff64_t bn, int flags)
    180183{
    181184        uint16_t clusters;
    182185        unsigned max_clusters;
    183         fat_cluster_t lastc;
     186        fat_cluster_t c;
    184187        int rc;
    185188
     
    187190         * This function can only operate on non-zero length files.
    188191         */
    189         if (firstc == FAT_CLST_RES0)
     192        if (fcl == FAT_CLST_RES0)
    190193                return ELIMIT;
    191194
    192         if (firstc == FAT_CLST_ROOT) {
     195        if (fcl == FAT_CLST_ROOT) {
    193196                /* root directory special case */
    194197                assert(bn < RDS(bs));
     
    199202
    200203        max_clusters = bn / SPC(bs);
    201         rc = fat_cluster_walk(bs, dev_handle, firstc, &lastc, &clusters,
    202             max_clusters);
     204        rc = fat_cluster_walk(bs, dev_handle, fcl, &c, &clusters, max_clusters);
    203205        if (rc != EOK)
    204206                return rc;
    205207        assert(clusters == max_clusters);
    206208
    207         rc = block_get(block, dev_handle, CLBN2PBN(bs, lastc, bn), flags);
     209        rc = block_get(block, dev_handle, CLBN2PBN(bs, c, bn), flags);
     210
     211        if (clp)
     212                *clp = c;
    208213
    209214        return rc;
     
    251256        for (o = boundary; o < pos; o += BPS(bs)) {
    252257                rc = _fat_block_get(&b, bs, nodep->idx->dev_handle, mcl,
    253                     (o - boundary) / BPS(bs), BLOCK_FLAGS_NOREAD);
     258                    NULL, (o - boundary) / BPS(bs), BLOCK_FLAGS_NOREAD);
    254259                if (rc != EOK)
    255260                        return rc;
     
    606611
    607612        for (i = 0; i < SPC(bs); i++) {
    608                 rc = _fat_block_get(&b, bs, dev_handle, c, i,
     613                rc = _fat_block_get(&b, bs, dev_handle, c, NULL, i,
    609614                    BLOCK_FLAGS_NOREAD);
    610615                if (rc != EOK)
Note: See TracChangeset for help on using the changeset viewer.