source: mainline/uspace/lib/ext4/libext4_block_group.h@ ae3d4f8

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since ae3d4f8 was 12b4a7f, checked in by Frantisek Princ <frantisek.princ@…>, 14 years ago

functional truncate operation (only to lower size actually), except extent files

  • Property mode set to 100644
File size: 3.7 KB
RevLine 
[eb91db7]1/*
2 * Copyright (c) 2011 Frantisek Princ
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libext4
30 * @{
31 */
32
33#ifndef LIBEXT4_LIBEXT4_BLOCK_GROUP_H_
34#define LIBEXT4_LIBEXT4_BLOCK_GROUP_H_
35
[3711e7e]36#include <libblock.h>
[6c501f8]37#include <sys/types.h>
[3711e7e]38#include "libext4_block_group.h"
[6c501f8]39/*
40 * Structure of a blocks group descriptor
41 */
42typedef struct ext4_block_group {
[9c0c0e1]43 uint32_t block_bitmap_lo; // Blocks bitmap block
44 uint32_t inode_bitmap_lo; // Inodes bitmap block
[3712434]45 uint32_t inode_table_first_block_lo; // Inodes table block
[9c0c0e1]46 uint16_t free_blocks_count_lo; // Free blocks count
47 uint16_t free_inodes_count_lo; // Free inodes count
48 uint16_t used_dirs_count_lo; // Directories count
49 uint16_t flags; // EXT4_BG_flags (INODE_UNINIT, etc)
50 uint32_t reserved[2]; // Likely block/inode bitmap checksum
51 uint16_t itable_unused_lo; // Unused inodes count
52 uint16_t checksum; // crc16(sb_uuid+group+desc)
[c25e39b]53 /* -------------- */
[9c0c0e1]54 uint32_t block_bitmap_hi; // Blocks bitmap block MSB
55 uint32_t inode_bitmap_hi; // Inodes bitmap block MSB
[3712434]56 uint32_t inode_table_first_block_hi; // Inodes table block MSB
[9c0c0e1]57 uint16_t free_blocks_count_hi; // Free blocks count MSB
58 uint16_t free_inodes_count_hi; // Free inodes count MSB
59 uint16_t used_dirs_count_hi; // Directories count MSB
60 uint16_t itable_unused_hi; // Unused inodes count MSB
61 uint32_t reserved2[3]; // Padding
[3711e7e]62} ext4_block_group_t;
63
64typedef struct ext4_block_group_ref {
65 block_t *block; // Reference to a block containing this block group descr
66 ext4_block_group_t *block_group;
[12b4a7f]67 bool dirty;
[3711e7e]68} ext4_block_group_ref_t;
69
[c25e39b]70#define EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE 32
[3711e7e]71
[3712434]72extern uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *);
73extern uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *);
[3711e7e]74extern uint64_t ext4_block_group_get_inode_table_first_block(ext4_block_group_t *);
[3712434]75extern uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *);
[052e82d]76extern void ext4_block_group_set_free_blocks_count(ext4_block_group_t *, uint32_t);
[3712434]77extern uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *);
78extern uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *);
79extern uint16_t ext4_block_group_get_flags(ext4_block_group_t *);
80extern uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *);
81extern uint16_t ext4_block_group_get_checksum(ext4_block_group_t *);
[eb91db7]82
83#endif
84
85/**
86 * @}
87 */
Note: See TracBrowser for help on using the repository browser.