| 1 | /*
|
|---|
| 2 | * Copyright (c) 2011 Martin Sucha
|
|---|
| 3 | * Copyright (c) 2012 Frantisek Princ
|
|---|
| 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 | * @{
|
|---|
| 32 | */
|
|---|
| 33 |
|
|---|
| 34 | #ifndef LIBEXT4_LIBEXT4_SUPERBLOCK_H_
|
|---|
| 35 | #define LIBEXT4_LIBEXT4_SUPERBLOCK_H_
|
|---|
| 36 |
|
|---|
| 37 | #include <block.h>
|
|---|
| 38 | #include <sys/types.h>
|
|---|
| 39 | #include "libext4_types.h"
|
|---|
| 40 |
|
|---|
| 41 | extern uint32_t ext4_superblock_get_inodes_count(ext4_superblock_t *);
|
|---|
| 42 | extern void ext4_superblock_set_inodes_count(ext4_superblock_t *, uint32_t);
|
|---|
| 43 | extern uint64_t ext4_superblock_get_blocks_count(ext4_superblock_t *);
|
|---|
| 44 | extern void ext4_superblock_set_blocks_count(ext4_superblock_t *, uint64_t);
|
|---|
| 45 | extern uint64_t ext4_superblock_get_reserved_blocks_count(ext4_superblock_t *);
|
|---|
| 46 | extern void ext4_superblock_set_reserved_blocks_count(ext4_superblock_t *,
|
|---|
| 47 | uint64_t);
|
|---|
| 48 | extern uint64_t ext4_superblock_get_free_blocks_count(ext4_superblock_t *);
|
|---|
| 49 | extern void ext4_superblock_set_free_blocks_count(ext4_superblock_t *,
|
|---|
| 50 | uint64_t);
|
|---|
| 51 | extern uint32_t ext4_superblock_get_free_inodes_count(ext4_superblock_t *);
|
|---|
| 52 | extern void ext4_superblock_set_free_inodes_count(ext4_superblock_t *,
|
|---|
| 53 | uint32_t);
|
|---|
| 54 | extern uint32_t ext4_superblock_get_first_data_block(ext4_superblock_t *);
|
|---|
| 55 | extern void ext4_superblock_set_first_data_block(ext4_superblock_t *, uint32_t);
|
|---|
| 56 | extern uint32_t ext4_superblock_get_log_block_size(ext4_superblock_t *);
|
|---|
| 57 | extern void ext4_superblock_set_log_block_size(ext4_superblock_t *, uint32_t);
|
|---|
| 58 | extern uint32_t ext4_superblock_get_block_size(ext4_superblock_t *);
|
|---|
| 59 | extern void ext4_superblock_set_block_size(ext4_superblock_t *, uint32_t);
|
|---|
| 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);
|
|---|
| 64 | extern uint32_t ext4_superblock_get_blocks_per_group(ext4_superblock_t *);
|
|---|
| 65 | extern void ext4_superblock_set_blocks_per_group(ext4_superblock_t *, uint32_t);
|
|---|
| 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);
|
|---|
| 68 | extern uint32_t ext4_superblock_get_inodes_per_group(ext4_superblock_t *);
|
|---|
| 69 | extern void ext4_superblock_set_inodes_per_group(ext4_superblock_t *, uint32_t);
|
|---|
| 70 | extern uint32_t ext4_superblock_get_mount_time(ext4_superblock_t *);
|
|---|
| 71 | extern void ext4_superblock_set_mount_time(ext4_superblock_t *, uint32_t);
|
|---|
| 72 | extern uint32_t ext4_superblock_get_write_time(ext4_superblock_t *);
|
|---|
| 73 | extern void ext4_superblock_set_write_time(ext4_superblock_t *, uint32_t);
|
|---|
| 74 | extern uint16_t ext4_superblock_get_mount_count(ext4_superblock_t *);
|
|---|
| 75 | extern void ext4_superblock_set_mount_count(ext4_superblock_t *, uint16_t);
|
|---|
| 76 | extern uint16_t ext4_superblock_get_max_mount_count(ext4_superblock_t *);
|
|---|
| 77 | extern void ext4_superblock_set_max_mount_count(ext4_superblock_t *, uint16_t);
|
|---|
| 78 | extern uint16_t ext4_superblock_get_magic(ext4_superblock_t *);
|
|---|
| 79 | extern void ext4_superblock_set_magic(ext4_superblock_t *sb, uint16_t magic);
|
|---|
| 80 | extern uint16_t ext4_superblock_get_state(ext4_superblock_t *);
|
|---|
| 81 | extern void ext4_superblock_set_state(ext4_superblock_t *, uint16_t);
|
|---|
| 82 | extern uint16_t ext4_superblock_get_errors(ext4_superblock_t *);
|
|---|
| 83 | extern void ext4_superblock_set_errors(ext4_superblock_t *, uint16_t);
|
|---|
| 84 | extern uint16_t ext4_superblock_get_minor_rev_level(ext4_superblock_t *);
|
|---|
| 85 | extern void ext4_superblock_set_minor_rev_level(ext4_superblock_t *, uint16_t);
|
|---|
| 86 | extern uint32_t ext4_superblock_get_last_check_time(ext4_superblock_t *);
|
|---|
| 87 | extern void ext4_superblock_set_last_check_time(ext4_superblock_t *, uint32_t);
|
|---|
| 88 | extern uint32_t ext4_superblock_get_check_interval(ext4_superblock_t *);
|
|---|
| 89 | extern void ext4_superblock_set_check_interval(ext4_superblock_t *, uint32_t);
|
|---|
| 90 | extern uint32_t ext4_superblock_get_creator_os(ext4_superblock_t *);
|
|---|
| 91 | extern void ext4_superblock_set_creator_os(ext4_superblock_t *, uint32_t);
|
|---|
| 92 | extern uint32_t ext4_superblock_get_rev_level(ext4_superblock_t *);
|
|---|
| 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);
|
|---|
| 98 | extern uint32_t ext4_superblock_get_first_inode(ext4_superblock_t *);
|
|---|
| 99 | extern void ext4_superblock_set_first_inode(ext4_superblock_t *, uint32_t);
|
|---|
| 100 | extern uint16_t ext4_superblock_get_inode_size(ext4_superblock_t *);
|
|---|
| 101 | extern void ext4_superblock_set_inode_size(ext4_superblock_t *, uint16_t);
|
|---|
| 102 | extern uint16_t ext4_superblock_get_block_group_index(ext4_superblock_t *);
|
|---|
| 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);
|
|---|
| 114 |
|
|---|
| 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 |
|
|---|
| 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);
|
|---|
| 124 | extern const uint32_t * ext4_superblock_get_hash_seed(ext4_superblock_t *);
|
|---|
| 125 | extern void ext4_superblock_set_hash_seed(ext4_superblock_t *,
|
|---|
| 126 | const uint32_t *);
|
|---|
| 127 | extern uint8_t ext4_superblock_get_default_hash_version(ext4_superblock_t *);
|
|---|
| 128 | extern void ext4_superblock_set_default_hash_version(ext4_superblock_t *,
|
|---|
| 129 | uint8_t);
|
|---|
| 130 |
|
|---|
| 131 | extern uint16_t ext4_superblock_get_desc_size(ext4_superblock_t *);
|
|---|
| 132 | extern void ext4_superblock_set_desc_size(ext4_superblock_t *, uint16_t);
|
|---|
| 133 |
|
|---|
| 134 | extern uint32_t ext4_superblock_get_flags(ext4_superblock_t *);
|
|---|
| 135 | extern void ext4_superblock_set_flags(ext4_superblock_t *, uint32_t);
|
|---|
| 136 |
|
|---|
| 137 | /* More complex superblock functions */
|
|---|
| 138 | extern bool ext4_superblock_has_flag(ext4_superblock_t *, uint32_t);
|
|---|
| 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);
|
|---|
| 145 | extern int ext4_superblock_read_direct(service_id_t, ext4_superblock_t **);
|
|---|
| 146 | extern int ext4_superblock_write_direct(service_id_t, ext4_superblock_t *);
|
|---|
| 147 | extern int ext4_superblock_check_sanity(ext4_superblock_t *);
|
|---|
| 148 |
|
|---|
| 149 | extern uint32_t ext4_superblock_get_block_group_count(ext4_superblock_t *);
|
|---|
| 150 | extern uint32_t ext4_superblock_get_blocks_in_group(ext4_superblock_t *,
|
|---|
| 151 | uint32_t);
|
|---|
| 152 | extern uint32_t ext4_superblock_get_inodes_in_group(ext4_superblock_t *,
|
|---|
| 153 | uint32_t);
|
|---|
| 154 |
|
|---|
| 155 | #endif
|
|---|
| 156 |
|
|---|
| 157 | /**
|
|---|
| 158 | * @}
|
|---|
| 159 | */
|
|---|