Changeset 383ddd6 in mainline for uspace/srv/fs/fat/fat_fat.c


Ignore:
Timestamp:
2010-01-20T20:33:55Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
975e7e9
Parents:
6c01702 (diff), 3c081d0e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r6c01702 r383ddd6  
    247247 */
    248248int
    249 fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t clst,
    250     fat_cluster_t *value)
     249fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, unsigned fatno,
     250    fat_cluster_t clst, fat_cluster_t *value)
    251251{
    252252        block_t *b;
    253253        uint16_t bps;
    254254        uint16_t rscnt;
     255        uint16_t sf;
    255256        fat_cluster_t *cp;
    256257        int rc;
     
    258259        bps = uint16_t_le2host(bs->bps);
    259260        rscnt = uint16_t_le2host(bs->rscnt);
    260 
    261         rc = block_get(&b, dev_handle, rscnt +
     261        sf = uint16_t_le2host(bs->sec_per_fat);
     262
     263        rc = block_get(&b, dev_handle, rscnt + sf * fatno +
    262264            (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE);
    263265        if (rc != EOK)
     
    398400                         * from the size of the file allocation table.
    399401                         */
    400                         if ((cl - 2) * bs->spc + ssa >= ts) {
     402                        if ((cl >= 2) && ((cl - 2) * bs->spc + ssa >= ts)) {
    401403                                rc = block_put(blk);
    402404                                if (rc != EOK)
     
    480482        while (firstc < FAT_CLST_LAST1) {
    481483                assert(firstc >= FAT_CLST_FIRST && firstc < FAT_CLST_BAD);
    482                 rc = fat_get_cluster(bs, dev_handle, firstc, &nextc);
     484                rc = fat_get_cluster(bs, dev_handle, FAT1, firstc, &nextc);
    483485                if (rc != EOK)
    484486                        return rc;
     
    560562                unsigned fatno;
    561563
    562                 rc = fat_get_cluster(bs, dev_handle, lastc, &nextc);
     564                rc = fat_get_cluster(bs, dev_handle, FAT1, lastc, &nextc);
    563565                if (rc != EOK)
    564566                        return rc;
Note: See TracChangeset for help on using the changeset viewer.