Changeset ae3d4f8 in mainline for uspace/lib/ext4/libext4_superblock.c


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

superblock update after block (de)allocation

File:
1 edited

Legend:

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

    r528e5b3 rae3d4f8  
    6565}
    6666
     67void ext4_superblock_set_free_blocks_count(ext4_superblock_t *sb, uint64_t count)
     68{
     69        sb->free_blocks_count_lo = host2uint32_t_le((count << 32) >> 32);
     70        sb->free_blocks_count_hi = host2uint32_t_le(count >> 32);
     71}
     72
    6773uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *sb)
    6874{
     
    268274        return EOK;
    269275}
     276
     277int ext4_superblock_write_direct(service_id_t service_id,
     278                ext4_superblock_t *sb)
     279{
     280        int rc;
     281        uint32_t phys_block_size;
     282        uint64_t first_block;
     283        uint32_t block_count;
     284
     285        rc = block_get_bsize(service_id, &phys_block_size);
     286        if (rc != EOK) {
     287                // TODO error
     288                return rc;
     289        }
     290
     291        first_block = EXT4_SUPERBLOCK_OFFSET / phys_block_size;
     292        block_count = EXT4_SUPERBLOCK_SIZE / phys_block_size;
     293
     294        if (EXT4_SUPERBLOCK_SIZE % phys_block_size) {
     295                block_count++;
     296        }
     297
     298        return block_write_direct(service_id, first_block, block_count, sb);
     299
     300}
     301
    270302
    271303int ext4_superblock_check_sanity(ext4_superblock_t *sb)
Note: See TracChangeset for help on using the changeset viewer.