Ignore:
File:
1 edited

Legend:

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

    r711e1f32 r50f9c3a  
    4646#include <align.h>
    4747#include <assert.h>
    48 #include <fibril_synch.h>
     48#include <fibril_sync.h>
    4949#include <mem.h>
    5050
     
    247247 */
    248248int
    249 fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, unsigned fatno,
    250     fat_cluster_t clst, fat_cluster_t *value)
     249fat_get_cluster(fat_bs_t *bs, dev_handle_t dev_handle, fat_cluster_t clst,
     250    fat_cluster_t *value)
    251251{
    252252        block_t *b;
    253253        uint16_t bps;
    254254        uint16_t rscnt;
    255         uint16_t sf;
    256255        fat_cluster_t *cp;
    257256        int rc;
     
    259258        bps = uint16_t_le2host(bs->bps);
    260259        rscnt = uint16_t_le2host(bs->rscnt);
    261         sf = uint16_t_le2host(bs->sec_per_fat);
    262 
    263         rc = block_get(&b, dev_handle, rscnt + sf * fatno +
     260
     261        rc = block_get(&b, dev_handle, rscnt +
    264262            (clst * sizeof(fat_cluster_t)) / bps, BLOCK_FLAGS_NONE);
    265263        if (rc != EOK)
     
    400398                         * from the size of the file allocation table.
    401399                         */
    402                         if ((cl - 2) * bs->spc + ssa >= ts) {
     400                        if ((cl >= 2) && ((cl - 2) * bs->spc + ssa >= ts)) {
    403401                                rc = block_put(blk);
    404402                                if (rc != EOK)
     
    482480        while (firstc < FAT_CLST_LAST1) {
    483481                assert(firstc >= FAT_CLST_FIRST && firstc < FAT_CLST_BAD);
    484                 rc = fat_get_cluster(bs, dev_handle, FAT1, firstc, &nextc);
     482                rc = fat_get_cluster(bs, dev_handle, firstc, &nextc);
    485483                if (rc != EOK)
    486484                        return rc;
     
    562560                unsigned fatno;
    563561
    564                 rc = fat_get_cluster(bs, dev_handle, FAT1, lastc, &nextc);
     562                rc = fat_get_cluster(bs, dev_handle, lastc, &nextc);
    565563                if (rc != EOK)
    566564                        return rc;
Note: See TracChangeset for help on using the changeset viewer.