Changeset 23b56ca in mainline


Ignore:
Timestamp:
2008-10-26T17:26:32Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8bc6fcf
Parents:
700eaa9
Message:

Implementation of fat_mark_cluster().

File:
1 edited

Legend:

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

    r700eaa9 r23b56ca  
    214214    fat_cluster_t value)
    215215{
    216         /* TODO */
     216        block_t *bb, *blk;
     217        uint16_t bps;
     218        uint16_t rscnt;
     219        uint16_t sf;
     220        uint8_t fatcnt;
     221        fat_cluster_t *cp;
     222
     223        bb = block_get(dev_handle, BS_BLOCK, BS_SIZE);
     224        bps = uint16_t_le2host(FAT_BS(bb)->bps);
     225        rscnt = uint16_t_le2host(FAT_BS(bb)->rscnt);
     226        sf = uint16_t_le2host(FAT_BS(bb)->sec_per_fat);
     227        fatcnt = FAT_BS(bb)->fatcnt;
     228        block_put(bb);
     229
     230        assert(fatno < fatcnt);
     231        blk = block_get(dev_handle, rscnt + sf * fatno +
     232            (clst * sizeof(fat_cluster_t)) / bps, bps);
     233        cp = (fat_cluster_t *)blk->data + clst % (bps / sizeof(fat_cluster_t));
     234        *cp = host2uint16_t_le(value);
     235        blk->dirty = true;              /* need to sync block */
     236        block_put(blk);
    217237}
    218238
Note: See TracChangeset for help on using the changeset viewer.