source: mainline/uspace/lib/ext4/libext4_block_group.h@ 052e82d

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

partially functional truncate operation

  • Property mode set to 100644
File size: 3.7 KB
Line 
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
36#include <libblock.h>
37#include <sys/types.h>
38#include "libext4_block_group.h"
39/*
40 * Structure of a blocks group descriptor
41 */
42typedef struct ext4_block_group {
43 uint32_t block_bitmap_lo; // Blocks bitmap block
44 uint32_t inode_bitmap_lo; // Inodes bitmap block
45 uint32_t inode_table_first_block_lo; // Inodes table block
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)
53 /* -------------- */
54 uint32_t block_bitmap_hi; // Blocks bitmap block MSB
55 uint32_t inode_bitmap_hi; // Inodes bitmap block MSB
56 uint32_t inode_table_first_block_hi; // Inodes table block MSB
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
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;
67} ext4_block_group_ref_t;
68
69#define EXT4_BLOCK_MIN_GROUP_DESCRIPTOR_SIZE 32
70
71extern uint64_t ext4_block_group_get_block_bitmap(ext4_block_group_t *);
72extern uint64_t ext4_block_group_get_inode_bitmap(ext4_block_group_t *);
73extern uint64_t ext4_block_group_get_inode_table_first_block(ext4_block_group_t *);
74extern uint32_t ext4_block_group_get_free_blocks_count(ext4_block_group_t *);
75extern void ext4_block_group_set_free_blocks_count(ext4_block_group_t *, uint32_t);
76extern uint32_t ext4_block_group_get_free_inodes_count(ext4_block_group_t *);
77extern uint32_t ext4_block_group_get_used_dirs_count(ext4_block_group_t *);
78extern uint16_t ext4_block_group_get_flags(ext4_block_group_t *);
79extern uint32_t ext4_block_group_get_itable_unused(ext4_block_group_t *);
80extern uint16_t ext4_block_group_get_checksum(ext4_block_group_t *);
81
82#endif
83
84/**
85 * @}
86 */
Note: See TracBrowser for help on using the repository browser.