[eb91db7] | 1 | /*
|
---|
[f22d5ef0] | 2 | * Copyright (c) 2012 Frantisek Princ
|
---|
[eb91db7] | 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 | * @{
|
---|
[9875711] | 31 | */
|
---|
[eb91db7] | 32 |
|
---|
| 33 | #ifndef LIBEXT4_LIBEXT4_SUPERBLOCK_H_
|
---|
| 34 | #define LIBEXT4_LIBEXT4_SUPERBLOCK_H_
|
---|
| 35 |
|
---|
[01ab41b] | 36 | #include <libblock.h>
|
---|
[9875711] | 37 | #include <sys/types.h>
|
---|
[b53a733] | 38 | #include "libext4_types.h"
|
---|
[7bc4508] | 39 |
|
---|
[3712434] | 40 | extern uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 41 | extern void ext4_superblock_set_inodes_count(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 42 | extern uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 43 | extern void ext4_superblock_set_blocks_count(ext4_superblock_t *, uint64_t);
|
---|
[3712434] | 44 | extern uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *);
|
---|
[38542dc] | 45 | extern void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *,
|
---|
| 46 | uint64_t);
|
---|
[3712434] | 47 | extern uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *);
|
---|
[38542dc] | 48 | extern void ext4_superblock_set_free_blocks_count(ext4_superblock_t *,
|
---|
| 49 | uint64_t);
|
---|
[3712434] | 50 | extern uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *);
|
---|
[38542dc] | 51 | extern void ext4_superblock_set_free_inodes_count(ext4_superblock_t *,
|
---|
| 52 | uint32_t);
|
---|
[3712434] | 53 | extern uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *);
|
---|
[fe27eb4] | 54 | extern void ext4_superblock_set_first_data_block(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 55 | extern uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 56 | extern void ext4_superblock_set_log_block_size(ext4_superblock_t *, uint32_t);
|
---|
[01ab41b] | 57 | extern uint32_t ext4_superblock_get_block_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 58 | extern void ext4_superblock_set_block_size(ext4_superblock_t *, uint32_t);
|
---|
[fb04cd90] | 59 | extern uint32_t ext4_superblock_get_log_frag_size(ext4_superblock_t *);
|
---|
| 60 | extern void ext4_superblock_set_log_frag_size(ext4_superblock_t *, uint32_t);
|
---|
| 61 | extern uint32_t ext4_superblock_get_frag_size(ext4_superblock_t *);
|
---|
| 62 | extern void ext4_superblock_set_frag_size(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 63 | extern uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *);
|
---|
[fe27eb4] | 64 | extern void ext4_superblock_set_blocks_per_group(ext4_superblock_t *, uint32_t);
|
---|
[fb04cd90] | 65 | extern uint32_t ext4_superblock_get_frags_per_group(ext4_superblock_t *);
|
---|
| 66 | extern void ext4_superblock_set_frags_per_group(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 67 | extern uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *);
|
---|
[fe27eb4] | 68 | extern void ext4_superblock_set_inodes_per_group(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 69 | extern uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *);
|
---|
[fe27eb4] | 70 | extern void ext4_superblock_set_mount_time(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 71 | extern uint32_t ext4_superblock_get_write_time(ext4_superblock_t *);
|
---|
[fe27eb4] | 72 | extern void ext4_superblock_set_write_time(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 73 | extern uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 74 | extern void ext4_superblock_set_mount_count(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 75 | extern uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *);
|
---|
[fe27eb4] | 76 | extern void ext4_superblock_set_max_mount_count(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 77 | extern uint16_t ext4_superblock_get_magic(ext4_superblock_t *);
|
---|
[9fc72fb3] | 78 | extern void ext4_superblock_set_magic(ext4_superblock_t *sb, uint16_t magic);
|
---|
[3712434] | 79 | extern uint16_t ext4_superblock_get_state(ext4_superblock_t *);
|
---|
[fe27eb4] | 80 | extern void ext4_superblock_set_state(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 81 | extern uint16_t ext4_superblock_get_errors(ext4_superblock_t *);
|
---|
[fe27eb4] | 82 | extern void ext4_superblock_set_errors(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 83 | extern uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *);
|
---|
[fe27eb4] | 84 | extern void ext4_superblock_set_minor_rev_level(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 85 | extern uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *);
|
---|
[fe27eb4] | 86 | extern void ext4_superblock_set_last_check_time(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 87 | extern uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *);
|
---|
[fe27eb4] | 88 | extern void ext4_superblock_set_check_interval(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 89 | extern uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *);
|
---|
[fe27eb4] | 90 | extern void ext4_superblock_set_creator_os(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 91 | extern uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *);
|
---|
[fe27eb4] | 92 | extern void ext4_superblock_set_rev_level(ext4_superblock_t *, uint32_t);
|
---|
| 93 | extern uint16_t ext4_superblock_get_def_resuid(ext4_superblock_t *);
|
---|
| 94 | extern void ext4_superblock_set_def_resuid(ext4_superblock_t *, uint16_t);
|
---|
| 95 | extern uint16_t ext4_superblock_get_def_resgid(ext4_superblock_t *);
|
---|
| 96 | extern void ext4_superblock_set_def_resgid(ext4_superblock_t *, uint16_t);
|
---|
[3712434] | 97 | extern uint32_t ext4_superblock_get_first_inode(ext4_superblock_t *);
|
---|
[fe27eb4] | 98 | extern void ext4_superblock_set_first_inode(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 99 | extern uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 100 | extern void ext4_superblock_set_inode_size(ext4_superblock_t *, uint16_t);
|
---|
[2226cc3] | 101 | extern uint16_t ext4_superblock_get_block_group_index(ext4_superblock_t *);
|
---|
[38542dc] | 102 | extern void ext4_superblock_set_block_group_index(ext4_superblock_t *,
|
---|
| 103 | uint16_t);
|
---|
| 104 | extern uint32_t ext4_superblock_get_features_compatible(ext4_superblock_t *);
|
---|
| 105 | extern void ext4_superblock_set_features_compatible(ext4_superblock_t *,
|
---|
| 106 | uint32_t);
|
---|
| 107 | extern uint32_t ext4_superblock_get_features_incompatible(ext4_superblock_t *);
|
---|
| 108 | extern void ext4_superblock_set_features_incompatible(ext4_superblock_t *,
|
---|
| 109 | uint32_t);
|
---|
| 110 | extern uint32_t ext4_superblock_get_features_read_only(ext4_superblock_t *);
|
---|
| 111 | extern void ext4_superblock_set_features_read_only(ext4_superblock_t *,
|
---|
| 112 | uint32_t);
|
---|
[01ab41b] | 113 |
|
---|
[291af81] | 114 | extern const uint8_t * ext4_superblock_get_uuid(ext4_superblock_t *);
|
---|
| 115 | extern void ext4_superblock_set_uuid(ext4_superblock_t *, const uint8_t *);
|
---|
| 116 | extern const char * ext4_superblock_get_volume_name(ext4_superblock_t *);
|
---|
| 117 | extern void ext4_superblock_set_volume_name(ext4_superblock_t *, const char *);
|
---|
| 118 | extern const char * ext4_superblock_get_last_mounted(ext4_superblock_t *);
|
---|
| 119 | extern void ext4_superblock_set_last_mounted(ext4_superblock_t *, const char *);
|
---|
| 120 |
|
---|
[ebcaff4] | 121 | extern uint32_t ext4_superblock_get_last_orphan(ext4_superblock_t *);
|
---|
| 122 | extern void ext4_superblock_set_last_orphan(ext4_superblock_t *, uint32_t);
|
---|
[2226cc3] | 123 | extern const uint32_t * ext4_superblock_get_hash_seed(ext4_superblock_t *);
|
---|
[38542dc] | 124 | extern void ext4_superblock_set_hash_seed(ext4_superblock_t *,
|
---|
| 125 | const uint32_t *);
|
---|
[7eb033ce] | 126 | extern uint8_t ext4_superblock_get_default_hash_version(ext4_superblock_t *);
|
---|
[38542dc] | 127 | extern void ext4_superblock_set_default_hash_version(ext4_superblock_t *,
|
---|
| 128 | uint8_t);
|
---|
[c25e39b] | 129 |
|
---|
| 130 | extern uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *);
|
---|
[fe27eb4] | 131 | extern void ext4_superblock_set_desc_size(ext4_superblock_t *, uint16_t);
|
---|
[c25e39b] | 132 |
|
---|
[7bc4508] | 133 | extern uint32_t ext4_superblock_get_flags(ext4_superblock_t *);
|
---|
[fe27eb4] | 134 | extern void ext4_superblock_set_flags(ext4_superblock_t *, uint32_t);
|
---|
[3712434] | 135 |
|
---|
| 136 | /* More complex superblock functions */
|
---|
[7bc4508] | 137 | extern bool ext4_superblock_has_flag(ext4_superblock_t *, uint32_t);
|
---|
[38542dc] | 138 | extern bool ext4_superblock_has_feature_compatible(ext4_superblock_t *,
|
---|
| 139 | uint32_t);
|
---|
| 140 | extern bool ext4_superblock_has_feature_incompatible(ext4_superblock_t *,
|
---|
| 141 | uint32_t);
|
---|
| 142 | extern bool ext4_superblock_has_feature_read_only(ext4_superblock_t *,
|
---|
| 143 | uint32_t);
|
---|
[01ab41b] | 144 | extern int ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
|
---|
[ae3d4f8] | 145 | extern int ext4_superblock_write_direct(service_id_t, ext4_superblock_t *);
|
---|
[01ab41b] | 146 | extern int ext4_superblock_check_sanity(ext4_superblock_t *);
|
---|
[eb91db7] | 147 |
|
---|
[b12ca16] | 148 | extern uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *);
|
---|
[38542dc] | 149 | extern uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *,
|
---|
| 150 | uint32_t);
|
---|
| 151 | extern uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *,
|
---|
| 152 | uint32_t);
|
---|
[b12ca16] | 153 |
|
---|
[eb91db7] | 154 | #endif
|
---|
| 155 |
|
---|
| 156 | /**
|
---|
| 157 | * @}
|
---|
| 158 | */
|
---|