[eb91db7] | 1 | /*
|
---|
[d1538a1] | 2 | * Copyright (c) 2011 Martin Sucha
|
---|
[f22d5ef0] | 3 | * Copyright (c) 2012 Frantisek Princ
|
---|
[eb91db7] | 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup libext4
|
---|
| 31 | * @{
|
---|
[9875711] | 32 | */
|
---|
[eb91db7] | 33 |
|
---|
| 34 | #ifndef LIBEXT4_LIBEXT4_SUPERBLOCK_H_
|
---|
| 35 | #define LIBEXT4_LIBEXT4_SUPERBLOCK_H_
|
---|
| 36 |
|
---|
[f73b291] | 37 | #include <block.h>
|
---|
[9875711] | 38 | #include <sys/types.h>
|
---|
[b53a733] | 39 | #include "libext4_types.h"
|
---|
[7bc4508] | 40 |
|
---|
[3712434] | 41 | extern uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 42 | extern void ext4_superblock_set_inodes_count(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 43 | extern uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 44 | extern void ext4_superblock_set_blocks_count(ext4_superblock_t *, uint64_t);
|
---|
[3712434] | 45 | extern uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *);
|
---|
[38542dc] | 46 | extern void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *,
|
---|
| 47 | uint64_t);
|
---|
[3712434] | 48 | extern uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *);
|
---|
[38542dc] | 49 | extern void ext4_superblock_set_free_blocks_count(ext4_superblock_t *,
|
---|
| 50 | uint64_t);
|
---|
[3712434] | 51 | extern uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *);
|
---|
[38542dc] | 52 | extern void ext4_superblock_set_free_inodes_count(ext4_superblock_t *,
|
---|
| 53 | uint32_t);
|
---|
[3712434] | 54 | extern uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *);
|
---|
[fe27eb4] | 55 | extern void ext4_superblock_set_first_data_block(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 56 | extern uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 57 | extern void ext4_superblock_set_log_block_size(ext4_superblock_t *, uint32_t);
|
---|
[01ab41b] | 58 | extern uint32_t ext4_superblock_get_block_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 59 | extern void ext4_superblock_set_block_size(ext4_superblock_t *, uint32_t);
|
---|
[fb04cd90] | 60 | extern uint32_t ext4_superblock_get_log_frag_size(ext4_superblock_t *);
|
---|
| 61 | extern void ext4_superblock_set_log_frag_size(ext4_superblock_t *, uint32_t);
|
---|
| 62 | extern uint32_t ext4_superblock_get_frag_size(ext4_superblock_t *);
|
---|
| 63 | extern void ext4_superblock_set_frag_size(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 64 | extern uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *);
|
---|
[fe27eb4] | 65 | extern void ext4_superblock_set_blocks_per_group(ext4_superblock_t *, uint32_t);
|
---|
[fb04cd90] | 66 | extern uint32_t ext4_superblock_get_frags_per_group(ext4_superblock_t *);
|
---|
| 67 | extern void ext4_superblock_set_frags_per_group(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 68 | extern uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *);
|
---|
[fe27eb4] | 69 | extern void ext4_superblock_set_inodes_per_group(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 70 | extern uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *);
|
---|
[fe27eb4] | 71 | extern void ext4_superblock_set_mount_time(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 72 | extern uint32_t ext4_superblock_get_write_time(ext4_superblock_t *);
|
---|
[fe27eb4] | 73 | extern void ext4_superblock_set_write_time(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 74 | extern uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 75 | extern void ext4_superblock_set_mount_count(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 76 | extern uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 77 | extern void ext4_superblock_set_max_mount_count(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 78 | extern uint16_t ext4_superblock_get_magic(ext4_superblock_t *);
|
---|
[9fc72fb3] | 79 | extern void ext4_superblock_set_magic(ext4_superblock_t *sb, uint16_t magic);
|
---|
[3712434] | 80 | extern uint16_t ext4_superblock_get_state(ext4_superblock_t *);
|
---|
[fe27eb4] | 81 | extern void ext4_superblock_set_state(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 82 | extern uint16_t ext4_superblock_get_errors(ext4_superblock_t *);
|
---|
[fe27eb4] | 83 | extern void ext4_superblock_set_errors(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 84 | extern uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *);
|
---|
[fe27eb4] | 85 | extern void ext4_superblock_set_minor_rev_level(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 86 | extern uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *);
|
---|
[fe27eb4] | 87 | extern void ext4_superblock_set_last_check_time(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 88 | extern uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *);
|
---|
[fe27eb4] | 89 | extern void ext4_superblock_set_check_interval(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 90 | extern uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *);
|
---|
[fe27eb4] | 91 | extern void ext4_superblock_set_creator_os(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 92 | extern uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *);
|
---|
[fe27eb4] | 93 | extern void ext4_superblock_set_rev_level(ext4_superblock_t *, uint32_t);
|
---|
| 94 | extern uint16_t ext4_superblock_get_def_resuid(ext4_superblock_t *);
|
---|
| 95 | extern void ext4_superblock_set_def_resuid(ext4_superblock_t *, uint16_t);
|
---|
| 96 | extern uint16_t ext4_superblock_get_def_resgid(ext4_superblock_t *);
|
---|
| 97 | extern void ext4_superblock_set_def_resgid(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 98 | extern uint32_t ext4_superblock_get_first_inode(ext4_superblock_t *);
|
---|
[fe27eb4] | 99 | extern void ext4_superblock_set_first_inode(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 100 | extern uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 101 | extern void ext4_superblock_set_inode_size(ext4_superblock_t *, uint16_t);
|
---|
[2226cc3] | 102 | extern uint16_t ext4_superblock_get_block_group_index(ext4_superblock_t *);
|
---|
[38542dc] | 103 | extern void ext4_superblock_set_block_group_index(ext4_superblock_t *,
|
---|
| 104 | uint16_t);
|
---|
| 105 | extern uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *);
|
---|
| 106 | extern void ext4_superblock_set_features_compatible(ext4_superblock_t *,
|
---|
| 107 | uint32_t);
|
---|
| 108 | extern uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *);
|
---|
| 109 | extern void ext4_superblock_set_features_incompatible(ext4_superblock_t *,
|
---|
| 110 | uint32_t);
|
---|
| 111 | extern uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *);
|
---|
| 112 | extern void ext4_superblock_set_features_read_only(ext4_superblock_t *,
|
---|
| 113 | uint32_t);
|
---|
[01ab41b] | 114 |
|
---|
[291af81] | 115 | extern const uint8_t * ext4_superblock_get_uuid(ext4_superblock_t *);
|
---|
| 116 | extern void ext4_superblock_set_uuid(ext4_superblock_t *, const uint8_t *);
|
---|
| 117 | extern const char * ext4_superblock_get_volume_name(ext4_superblock_t *);
|
---|
| 118 | extern void ext4_superblock_set_volume_name(ext4_superblock_t *, const char *);
|
---|
| 119 | extern const char * ext4_superblock_get_last_mounted(ext4_superblock_t *);
|
---|
| 120 | extern void ext4_superblock_set_last_mounted(ext4_superblock_t *, const char *);
|
---|
| 121 |
|
---|
[ebcaff4] | 122 | extern uint32_t ext4_superblock_get_last_orphan(ext4_superblock_t *);
|
---|
| 123 | extern void ext4_superblock_set_last_orphan(ext4_superblock_t *, uint32_t);
|
---|
[2226cc3] | 124 | extern const uint32_t * ext4_superblock_get_hash_seed(ext4_superblock_t *);
|
---|
[38542dc] | 125 | extern void ext4_superblock_set_hash_seed(ext4_superblock_t *,
|
---|
| 126 | const uint32_t *);
|
---|
[7eb033ce] | 127 | extern uint8_t ext4_superblock_get_default_hash_version(ext4_superblock_t *);
|
---|
[38542dc] | 128 | extern void ext4_superblock_set_default_hash_version(ext4_superblock_t *,
|
---|
| 129 | uint8_t);
|
---|
[c25e39b] | 130 |
|
---|
| 131 | extern uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 132 | extern void ext4_superblock_set_desc_size(ext4_superblock_t *, uint16_t);
|
---|
[c25e39b] | 133 |
|
---|
[7bc4508] | 134 | extern uint32_t ext4_superblock_get_flags(ext4_superblock_t *);
|
---|
[fe27eb4] | 135 | extern void ext4_superblock_set_flags(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 136 |
|
---|
| 137 | /* More complex superblock functions */
|
---|
[7bc4508] | 138 | extern bool ext4_superblock_has_flag(ext4_superblock_t *, uint32_t);
|
---|
[38542dc] | 139 | extern bool ext4_superblock_has_feature_compatible(ext4_superblock_t *,
|
---|
| 140 | uint32_t);
|
---|
| 141 | extern bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *,
|
---|
| 142 | uint32_t);
|
---|
| 143 | extern bool ext4_superblock_has_feature_read_only(ext4_superblock_t *,
|
---|
| 144 | uint32_t);
|
---|
[01ab41b] | 145 | extern int ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
|
---|
[ae3d4f8] | 146 | extern int ext4_superblock_write_direct(service_id_t, ext4_superblock_t *);
|
---|
[eb94d84] | 147 | extern void ext4_superblock_release(ext4_superblock_t *);
|
---|
[01ab41b] | 148 | extern int ext4_superblock_check_sanity(ext4_superblock_t *);
|
---|
[eb91db7] | 149 |
|
---|
[b12ca16] | 150 | extern uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *);
|
---|
[38542dc] | 151 | extern uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *,
|
---|
| 152 | uint32_t);
|
---|
| 153 | extern uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *,
|
---|
| 154 | uint32_t);
|
---|
[b12ca16] | 155 |
|
---|
[eb91db7] | 156 | #endif
|
---|
| 157 |
|
---|
| 158 | /**
|
---|
| 159 | * @}
|
---|
| 160 | */
|
---|