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


Ignore:
Timestamp:
2008-10-27T15:14:16Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
04619ba
Parents:
9f95a80
Message:

Implementation of fat_node_sync().

File:
1 edited

Legend:

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

    r9f95a80 rbeb17734  
    117117static void fat_node_sync(fat_node_t *node)
    118118{
    119         /* TODO */
     119        block_t *bb, *b;
     120        fat_dentry_t *d;
     121        uint16_t bps;
     122        unsigned dps;
     123       
     124        assert(node->dirty);
     125
     126        bb = block_get(node->idx->dev_handle, BS_BLOCK, BS_SIZE);
     127        bps = uint16_t_le2host(FAT_BS(bb)->bps);
     128        dps = bps / sizeof(fat_dentry_t);
     129       
     130        /* Read the block that contains the dentry of interest. */
     131        b = _fat_block_get(bb->data, node->idx->dev_handle, node->idx->pfc,
     132            (node->idx->pdi * sizeof(fat_dentry_t)) / bps);
     133
     134        d = ((fat_dentry_t *)b->data) + (node->idx->pdi % dps);
     135
     136        d->firstc = host2uint16_t_le(node->firstc);
     137        if (node->type == FAT_FILE)
     138                d->size = host2uint32_t_le(node->size);
     139        /* TODO: update other fields? (e.g time fields, attr field) */
     140       
     141        b->dirty = true;                /* need to sync block */
     142        block_put(b);
     143        block_put(bb);
    120144}
    121145
Note: See TracChangeset for help on using the changeset viewer.