Changeset 343ccfd in mainline for uspace/lib/ext4/libext4_extent.c


Ignore:
Timestamp:
2011-11-20T12:56:00Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ebeaaa06
Parents:
fe27eb4
Message:

next bunch of getters and setters added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_extent.c

    rfe27eb4 r343ccfd  
    4444}
    4545
     46void ext4_extent_set_first_block(ext4_extent_t *extent, uint32_t first_block)
     47{
     48        extent->first_block = host2uint32_t_le(first_block);
     49}
     50
    4651uint16_t ext4_extent_get_block_count(ext4_extent_t *extent)
    4752{
    4853        return uint16_t_le2host(extent->block_count);
     54}
     55
     56void ext4_extent_set_block_count(ext4_extent_t *extent, uint16_t block_count)
     57{
     58        extent->block_count = host2uint16_t_le(block_count);
    4959}
    5060
     
    5363        return ((uint64_t)uint16_t_le2host(extent->start_hi)) << 32 |
    5464                        ((uint64_t)uint32_t_le2host(extent->start_lo));
     65}
    5566
     67void ext4_extent_set_start(ext4_extent_t *extent, uint64_t start)
     68{
     69        extent->start_lo = host2uint32_t_le((start << 32) >> 32);
     70        extent->start_hi = host2uint16_t_le((uint16_t)(start >> 32));
    5671}
    5772
     
    6176}
    6277
     78void ext4_extent_index_set_first_block(ext4_extent_index_t *index,
     79                uint32_t first)
     80{
     81        index->first_block = host2uint32_t_le(first);
     82}
     83
    6384uint64_t ext4_extent_index_get_leaf(ext4_extent_index_t *index)
    6485{
    6586        return ((uint64_t)uint16_t_le2host(index->leaf_hi)) << 32 |
    66                                 ((uint64_t)uint32_t_le2host(index->leaf_lo));
     87                ((uint64_t)uint32_t_le2host(index->leaf_lo));
     88}
     89
     90void ext4_extent_index_set_leaf(ext4_extent_index_t *index, uint64_t leaf)
     91{
     92        index->leaf_lo = host2uint32_t_le((leaf << 32) >> 32);
     93        index->leaf_hi = host2uint16_t_le((uint16_t)(leaf >> 32));
    6794}
    6895
     
    7299}
    73100
     101void ext4_extent_header_set_magic(ext4_extent_header_t *header, uint16_t magic)
     102{
     103        header->magic = host2uint16_t_le(magic);
     104}
     105
    74106uint16_t ext4_extent_header_get_entries_count(ext4_extent_header_t *header)
    75107{
    76108        return uint16_t_le2host(header->entries_count);
     109}
     110
     111void ext4_extent_header_set_entries_count(ext4_extent_header_t *header,
     112                uint16_t count)
     113{
     114        header->entries_count = host2uint16_t_le(count);
    77115}
    78116
     
    82120}
    83121
     122void ext4_extent_header_set_max_entries_count(ext4_extent_header_t *header,
     123                uint16_t max_count)
     124{
     125        header->max_entries_count = host2uint16_t_le(max_count);
     126}
     127
    84128uint16_t ext4_extent_header_get_depth(ext4_extent_header_t *header)
    85129{
    86130        return uint16_t_le2host(header->depth);
     131}
     132
     133void ext4_extent_header_set_depth(ext4_extent_header_t *header, uint16_t depth)
     134{
     135        header->depth = host2uint16_t_le(depth);
    87136}
    88137
     
    92141}
    93142
     143void ext4_extent_header_set_generation(ext4_extent_header_t *header,
     144                uint32_t generation)
     145{
     146        header->generation = host2uint32_t_le(generation);
     147}
     148
    94149/**
    95150 * @}
Note: See TracChangeset for help on using the changeset viewer.