Changeset 5446bee0 in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2008-04-09T00:58:38Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3d99f68
Parents:
79dbc3e
Message:

BPS read from FAT bootsector is little-endian. It must converted to host
endianity before being used.

File:
1 edited

Legend:

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

    r79dbc3e r5446bee0  
    114114        char name[FAT_NAME_LEN + 1 + FAT_EXT_LEN + 1];
    115115        unsigned i, j;
     116        unsigned bps;           /* bytes per sector */
    116117        unsigned dps;           /* dentries per sector */
    117118        unsigned blocks;
     
    119120        block_t *bb;
    120121        block_t *b;
    121         fat_bs_t *bs;
    122122
    123123        bb = block_get(parentp->dev_handle, BS_BLOCK);
    124124        if (!bb)
    125125                return NULL;
    126         bs = (fat_bs_t *)bb->data;
    127         dps = bs->bps / sizeof(fat_dentry_t);
    128         blocks = parentp->size / bs->bps + (parentp->size % bs->bps != 0);
     126        bps = uint16_t_le2host(((fat_bs_t *)bb->data)->bps);
    129127        block_put(bb);
     128        dps = bps / sizeof(fat_dentry_t);
     129        blocks = parentp->size / bps + (parentp->size % bps != 0);
    130130        for (i = 0; i < blocks; i++) {
    131131                unsigned dentries;
Note: See TracChangeset for help on using the changeset viewer.