Changeset 18626b3 in mainline
- Timestamp:
- 2011-06-02T19:04:25Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6a7e497
- Parents:
- cf5e86e
- Location:
- uspace/lib/ext2
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext2/libext2_block_group.c
rcf5e86e r18626b3 43 43 * @param bg pointer to block group descriptor 44 44 */ 45 inline uint32_text2_block_group_get_block_bitmap_block(ext2_block_group_t *bg)45 uint32_t ext2_block_group_get_block_bitmap_block(ext2_block_group_t *bg) 46 46 { 47 47 return uint32_t_le2host(bg->block_bitmap_block); … … 53 53 * @param bg pointer to block group descriptor 54 54 */ 55 inline uint32_text2_block_group_get_inode_bitmap_block(ext2_block_group_t *bg)55 uint32_t ext2_block_group_get_inode_bitmap_block(ext2_block_group_t *bg) 56 56 { 57 57 return uint32_t_le2host(bg->inode_bitmap_block); … … 63 63 * @param bg pointer to block group descriptor 64 64 */ 65 inline uint32_text2_block_group_get_inode_table_first_block(ext2_block_group_t *bg)65 uint32_t ext2_block_group_get_inode_table_first_block(ext2_block_group_t *bg) 66 66 { 67 67 return uint32_t_le2host(bg->inode_table_first_block); … … 73 73 * @param bg pointer to block group descriptor 74 74 */ 75 inline uint16_text2_block_group_get_free_block_count(ext2_block_group_t *bg)75 uint16_t ext2_block_group_get_free_block_count(ext2_block_group_t *bg) 76 76 { 77 77 return uint16_t_le2host(bg->free_block_count); … … 84 84 * @param val new value 85 85 */ 86 inlinevoid ext2_block_group_set_free_block_count(ext2_block_group_t *bg,86 void ext2_block_group_set_free_block_count(ext2_block_group_t *bg, 87 87 uint16_t val) 88 88 { … … 95 95 * @param bg pointer to block group descriptor 96 96 */ 97 inline uint16_text2_block_group_get_free_inode_count(ext2_block_group_t *bg)97 uint16_t ext2_block_group_get_free_inode_count(ext2_block_group_t *bg) 98 98 { 99 99 return uint16_t_le2host(bg->free_inode_count); … … 105 105 * @param bg pointer to block group descriptor 106 106 */ 107 inline uint16_text2_block_group_get_directory_inode_count(ext2_block_group_t *bg)107 uint16_t ext2_block_group_get_directory_inode_count(ext2_block_group_t *bg) 108 108 { 109 109 return uint16_t_le2host(bg->directory_inode_count); -
uspace/lib/ext2/libext2_block_group.h
rcf5e86e r18626b3 55 55 #define EXT2_BLOCK_GROUP_DESCRIPTOR_SIZE 32 56 56 57 inlineuint32_t ext2_block_group_get_block_bitmap_block(ext2_block_group_t *);58 inlineuint32_t ext2_block_group_get_inode_bitmap_block(ext2_block_group_t *);59 inlineuint32_t ext2_block_group_get_inode_table_first_block(ext2_block_group_t *);60 inlineuint16_t ext2_block_group_get_free_block_count(ext2_block_group_t *);61 inlineuint16_t ext2_block_group_get_free_inode_count(ext2_block_group_t *);62 inlineuint16_t ext2_block_group_get_directory_inode_count(ext2_block_group_t *);57 extern uint32_t ext2_block_group_get_block_bitmap_block(ext2_block_group_t *); 58 extern uint32_t ext2_block_group_get_inode_bitmap_block(ext2_block_group_t *); 59 extern uint32_t ext2_block_group_get_inode_table_first_block(ext2_block_group_t *); 60 extern uint16_t ext2_block_group_get_free_block_count(ext2_block_group_t *); 61 extern uint16_t ext2_block_group_get_free_inode_count(ext2_block_group_t *); 62 extern uint16_t ext2_block_group_get_directory_inode_count(ext2_block_group_t *); 63 63 64 inlinevoid ext2_block_group_set_free_block_count(ext2_block_group_t *, uint16_t);64 extern void ext2_block_group_set_free_block_count(ext2_block_group_t *, uint16_t); 65 65 66 66 #endif -
uspace/lib/ext2/libext2_directory.c
rcf5e86e r18626b3 45 45 * @param de pointer to linked list directory entry 46 46 */ 47 inline uint32_text2_directory_entry_ll_get_inode(ext2_directory_entry_ll_t *de)47 uint32_t ext2_directory_entry_ll_get_inode(ext2_directory_entry_ll_t *de) 48 48 { 49 49 return uint32_t_le2host(de->inode); … … 55 55 * @param de pointer to linked list directory entry 56 56 */ 57 inline uint16_text2_directory_entry_ll_get_entry_length(57 uint16_t ext2_directory_entry_ll_get_entry_length( 58 58 ext2_directory_entry_ll_t *de) 59 59 { … … 66 66 * @param de pointer to linked list directory entry 67 67 */ 68 inline uint16_text2_directory_entry_ll_get_name_length(68 uint16_t ext2_directory_entry_ll_get_name_length( 69 69 ext2_superblock_t *sb, ext2_directory_entry_ll_t *de) 70 70 { -
uspace/lib/ext2/libext2_directory.h
rcf5e86e r18626b3 64 64 65 65 66 inlineuint32_t ext2_directory_entry_ll_get_inode(ext2_directory_entry_ll_t *);67 inlineuint16_t ext2_directory_entry_ll_get_entry_length(66 extern uint32_t ext2_directory_entry_ll_get_inode(ext2_directory_entry_ll_t *); 67 extern uint16_t ext2_directory_entry_ll_get_entry_length( 68 68 ext2_directory_entry_ll_t *); 69 inlineuint16_t ext2_directory_entry_ll_get_name_length(69 extern uint16_t ext2_directory_entry_ll_get_name_length( 70 70 ext2_superblock_t *, ext2_directory_entry_ll_t *); 71 71 -
uspace/lib/ext2/libext2_inode.c
rcf5e86e r18626b3 45 45 * @param inode pointer to inode 46 46 */ 47 inlineuint32_t ext2_inode_get_mode(ext2_superblock_t *sb, ext2_inode_t *inode)47 uint32_t ext2_inode_get_mode(ext2_superblock_t *sb, ext2_inode_t *inode) 48 48 { 49 49 if (ext2_superblock_get_os(sb) == EXT2_SUPERBLOCK_OS_HURD) { … … 61 61 * @param type EXT2_INODE_MODE_TYPE_* constant to check 62 62 */ 63 inlinebool ext2_inode_is_type(ext2_superblock_t *sb, ext2_inode_t *inode, uint32_t type)63 bool ext2_inode_is_type(ext2_superblock_t *sb, ext2_inode_t *inode, uint32_t type) 64 64 { 65 65 uint32_t mode = ext2_inode_get_mode(sb, inode); … … 72 72 * @param inode pointer to inode 73 73 */ 74 inlineuint32_t ext2_inode_get_user_id(ext2_superblock_t *sb, ext2_inode_t *inode)74 uint32_t ext2_inode_get_user_id(ext2_superblock_t *sb, ext2_inode_t *inode) 75 75 { 76 76 uint32_t os = ext2_superblock_get_os(sb); … … 90 90 * @param inode pointer to inode 91 91 */ 92 inlineuint64_t ext2_inode_get_size(ext2_superblock_t *sb, ext2_inode_t *inode)92 uint64_t ext2_inode_get_size(ext2_superblock_t *sb, ext2_inode_t *inode) 93 93 { 94 94 uint32_t major_rev = ext2_superblock_get_rev_major(sb); … … 109 109 * @param inode pointer to inode 110 110 */ 111 inlineuint32_t ext2_inode_get_group_id(ext2_superblock_t *sb, ext2_inode_t *inode)111 uint32_t ext2_inode_get_group_id(ext2_superblock_t *sb, ext2_inode_t *inode) 112 112 { 113 113 uint32_t os = ext2_superblock_get_os(sb); … … 125 125 * @param inode pointer to inode 126 126 */ 127 inlineuint16_t ext2_inode_get_usage_count(ext2_inode_t *inode)127 uint16_t ext2_inode_get_usage_count(ext2_inode_t *inode) 128 128 { 129 129 return uint16_t_le2host(inode->usage_count); … … 137 137 * @param inode pointer to inode 138 138 */ 139 inlineuint32_t ext2_inode_get_reserved_512_blocks(ext2_inode_t *inode)139 uint32_t ext2_inode_get_reserved_512_blocks(ext2_inode_t *inode) 140 140 { 141 141 return uint32_t_le2host(inode->reserved_512_blocks); … … 148 148 * @param inode pointer to inode 149 149 */ 150 inlineuint32_t ext2_inode_get_reserved_blocks(ext2_superblock_t *sb,150 uint32_t ext2_inode_get_reserved_blocks(ext2_superblock_t *sb, 151 151 ext2_inode_t *inode) 152 152 { … … 160 160 * @param inode pointer to inode 161 161 */ 162 inlineuint32_t ext2_inode_get_flags(ext2_inode_t *inode) {162 uint32_t ext2_inode_get_flags(ext2_inode_t *inode) { 163 163 return uint32_t_le2host(inode->flags); 164 164 } … … 170 170 * @param idx Index to block. Valid values are 0 <= idx < 12 171 171 */ 172 inlineuint32_t ext2_inode_get_direct_block(ext2_inode_t *inode, uint8_t idx)172 uint32_t ext2_inode_get_direct_block(ext2_inode_t *inode, uint8_t idx) 173 173 { 174 174 assert(idx < EXT2_INODE_DIRECT_BLOCKS); … … 183 183 * singly-indirect block and 2 is triply-indirect-block 184 184 */ 185 inlineuint32_t ext2_inode_get_indirect_block(ext2_inode_t *inode, uint8_t idx)185 uint32_t ext2_inode_get_indirect_block(ext2_inode_t *inode, uint8_t idx) 186 186 { 187 187 assert(idx < 3); -
uspace/lib/ext2/libext2_inode.h
rcf5e86e r18626b3 83 83 } ext2_inode_ref_t; 84 84 85 inlineuint32_t ext2_inode_get_mode(ext2_superblock_t *, ext2_inode_t *);86 inlinebool ext2_inode_is_type(ext2_superblock_t *, ext2_inode_t *, uint32_t);87 inlineuint32_t ext2_inode_get_user_id(ext2_superblock_t *, ext2_inode_t *);88 inlineuint64_t ext2_inode_get_size(ext2_superblock_t *, ext2_inode_t *);89 inlineuint32_t ext2_inode_get_group_id(ext2_superblock_t *, ext2_inode_t *);90 inlineuint16_t ext2_inode_get_usage_count(ext2_inode_t *);91 inlineuint32_t ext2_inode_get_reserved_512_blocks(ext2_inode_t *);92 inlineuint32_t ext2_inode_get_reserved_blocks(ext2_superblock_t *,85 extern uint32_t ext2_inode_get_mode(ext2_superblock_t *, ext2_inode_t *); 86 extern bool ext2_inode_is_type(ext2_superblock_t *, ext2_inode_t *, uint32_t); 87 extern uint32_t ext2_inode_get_user_id(ext2_superblock_t *, ext2_inode_t *); 88 extern uint64_t ext2_inode_get_size(ext2_superblock_t *, ext2_inode_t *); 89 extern uint32_t ext2_inode_get_group_id(ext2_superblock_t *, ext2_inode_t *); 90 extern uint16_t ext2_inode_get_usage_count(ext2_inode_t *); 91 extern uint32_t ext2_inode_get_reserved_512_blocks(ext2_inode_t *); 92 extern uint32_t ext2_inode_get_reserved_blocks(ext2_superblock_t *, 93 93 ext2_inode_t *); 94 inlineuint32_t ext2_inode_get_flags(ext2_inode_t *);95 inlineuint32_t ext2_inode_get_direct_block(ext2_inode_t *, uint8_t);96 inlineuint32_t ext2_inode_get_indirect_block(ext2_inode_t *, uint8_t level);94 extern uint32_t ext2_inode_get_flags(ext2_inode_t *); 95 extern uint32_t ext2_inode_get_direct_block(ext2_inode_t *, uint8_t); 96 extern uint32_t ext2_inode_get_indirect_block(ext2_inode_t *, uint8_t level); 97 97 98 98 -
uspace/lib/ext2/libext2_superblock.c
rcf5e86e r18626b3 46 46 * @param sb pointer to superblock 47 47 */ 48 inlineuint16_t ext2_superblock_get_magic(ext2_superblock_t *sb)48 uint16_t ext2_superblock_get_magic(ext2_superblock_t *sb) 49 49 { 50 50 return uint16_t_le2host(sb->magic); … … 57 57 * @param sb pointer to superblock 58 58 */ 59 inlineuint32_t ext2_superblock_get_first_block(ext2_superblock_t *sb)59 uint32_t ext2_superblock_get_first_block(ext2_superblock_t *sb) 60 60 { 61 61 return uint32_t_le2host(sb->first_block); … … 68 68 * @param sb pointer to superblock 69 69 */ 70 inlineuint32_t ext2_superblock_get_block_size_log2(ext2_superblock_t *sb)70 uint32_t ext2_superblock_get_block_size_log2(ext2_superblock_t *sb) 71 71 { 72 72 return uint32_t_le2host(sb->block_size_log2); … … 78 78 * @param sb pointer to superblock 79 79 */ 80 inlineuint32_t ext2_superblock_get_block_size(ext2_superblock_t *sb)80 uint32_t ext2_superblock_get_block_size(ext2_superblock_t *sb) 81 81 { 82 82 return 1024 << ext2_superblock_get_block_size_log2(sb); … … 90 90 * @param sb pointer to superblock 91 91 */ 92 in line int32_t ext2_superblock_get_fragment_size_log2(ext2_superblock_t *sb)92 int32_t ext2_superblock_get_fragment_size_log2(ext2_superblock_t *sb) 93 93 { 94 94 return uint32_t_le2host(sb->fragment_size_log2); … … 100 100 * @param sb pointer to superblock 101 101 */ 102 inlineuint32_t ext2_superblock_get_fragment_size(ext2_superblock_t *sb)102 uint32_t ext2_superblock_get_fragment_size(ext2_superblock_t *sb) 103 103 { 104 104 int32_t log = ext2_superblock_get_fragment_size_log2(sb); … … 116 116 * @param sb pointer to superblock 117 117 */ 118 inlineuint32_t ext2_superblock_get_blocks_per_group(ext2_superblock_t *sb)118 uint32_t ext2_superblock_get_blocks_per_group(ext2_superblock_t *sb) 119 119 { 120 120 return uint32_t_le2host(sb->blocks_per_group); … … 126 126 * @param sb pointer to superblock 127 127 */ 128 inlineuint32_t ext2_superblock_get_fragments_per_group(ext2_superblock_t *sb)128 uint32_t ext2_superblock_get_fragments_per_group(ext2_superblock_t *sb) 129 129 { 130 130 return uint32_t_le2host(sb->fragments_per_group); … … 136 136 * @param sb pointer to superblock 137 137 */ 138 inlineuint16_t ext2_superblock_get_state(ext2_superblock_t *sb)138 uint16_t ext2_superblock_get_state(ext2_superblock_t *sb) 139 139 { 140 140 return uint16_t_le2host(sb->state); … … 146 146 * @param sb pointer to superblock 147 147 */ 148 inlineuint16_t ext2_superblock_get_rev_minor(ext2_superblock_t *sb)148 uint16_t ext2_superblock_get_rev_minor(ext2_superblock_t *sb) 149 149 { 150 150 return uint16_t_le2host(sb->rev_minor); … … 156 156 * @param sb pointer to superblock 157 157 */ 158 inlineuint32_t ext2_superblock_get_rev_major(ext2_superblock_t *sb)158 uint32_t ext2_superblock_get_rev_major(ext2_superblock_t *sb) 159 159 { 160 160 return uint32_t_le2host(sb->rev_major); … … 166 166 * @param sb pointer to superblock 167 167 */ 168 inlineuint32_t ext2_superblock_get_first_inode(ext2_superblock_t *sb)168 uint32_t ext2_superblock_get_first_inode(ext2_superblock_t *sb) 169 169 { 170 170 if (ext2_superblock_get_rev_major(sb) == 0) { … … 179 179 * @param sb pointer to superblock 180 180 */ 181 inlineuint16_t ext2_superblock_get_inode_size(ext2_superblock_t *sb)181 uint16_t ext2_superblock_get_inode_size(ext2_superblock_t *sb) 182 182 { 183 183 if (ext2_superblock_get_rev_major(sb) == 0) { … … 192 192 * @param sb pointer to superblock 193 193 */ 194 inline uint32_text2_superblock_get_total_inode_count(ext2_superblock_t *sb)194 uint32_t ext2_superblock_get_total_inode_count(ext2_superblock_t *sb) 195 195 { 196 196 return uint32_t_le2host(sb->total_inode_count); … … 202 202 * @param sb pointer to superblock 203 203 */ 204 inline uint32_text2_superblock_get_total_block_count(ext2_superblock_t *sb)204 uint32_t ext2_superblock_get_total_block_count(ext2_superblock_t *sb) 205 205 { 206 206 return uint32_t_le2host(sb->total_block_count); … … 212 212 * @param sb pointer to superblock 213 213 */ 214 inline uint32_text2_superblock_get_reserved_block_count(ext2_superblock_t *sb)214 uint32_t ext2_superblock_get_reserved_block_count(ext2_superblock_t *sb) 215 215 { 216 216 return uint32_t_le2host(sb->reserved_block_count); … … 222 222 * @param sb pointer to superblock 223 223 */ 224 inline uint32_text2_superblock_get_free_block_count(ext2_superblock_t *sb)224 uint32_t ext2_superblock_get_free_block_count(ext2_superblock_t *sb) 225 225 { 226 226 return uint32_t_le2host(sb->free_block_count); … … 232 232 * @param sb pointer to superblock 233 233 */ 234 inline uint32_text2_superblock_get_free_inode_count(ext2_superblock_t *sb)234 uint32_t ext2_superblock_get_free_inode_count(ext2_superblock_t *sb) 235 235 { 236 236 return uint32_t_le2host(sb->free_inode_count); … … 242 242 * @param sb pointer to superblock 243 243 */ 244 inline uint32_text2_superblock_get_os(ext2_superblock_t *sb)244 uint32_t ext2_superblock_get_os(ext2_superblock_t *sb) 245 245 { 246 246 return uint32_t_le2host(sb->os); … … 252 252 * @param sb pointer to superblock 253 253 */ 254 inline uint32_text2_superblock_get_inodes_per_group(ext2_superblock_t *sb)254 uint32_t ext2_superblock_get_inodes_per_group(ext2_superblock_t *sb) 255 255 { 256 256 return uint32_t_le2host(sb->inodes_per_group); … … 262 262 * @param sb pointer to superblock 263 263 */ 264 inline uint32_text2_superblock_get_features_compatible(ext2_superblock_t *sb)264 uint32_t ext2_superblock_get_features_compatible(ext2_superblock_t *sb) 265 265 { 266 266 return uint32_t_le2host(sb->features_compatible); … … 272 272 * @param sb pointer to superblock 273 273 */ 274 inline uint32_text2_superblock_get_features_incompatible(ext2_superblock_t *sb)274 uint32_t ext2_superblock_get_features_incompatible(ext2_superblock_t *sb) 275 275 { 276 276 return uint32_t_le2host(sb->features_incompatible); … … 282 282 * @param sb pointer to superblock 283 283 */ 284 inline uint32_text2_superblock_get_features_read_only(ext2_superblock_t *sb)284 uint32_t ext2_superblock_get_features_read_only(ext2_superblock_t *sb) 285 285 { 286 286 return uint32_t_le2host(sb->features_read_only); … … 305 305 * @param sb pointer to superblock 306 306 */ 307 inlineuint32_t ext2_superblock_get_block_group_count(ext2_superblock_t *sb)307 uint32_t ext2_superblock_get_block_group_count(ext2_superblock_t *sb) 308 308 { 309 309 /* We add one to the result because e.g. 2/3 = 0, while to store -
uspace/lib/ext2/libext2_superblock.h
rcf5e86e r18626b3 85 85 86 86 87 inlineuint16_t ext2_superblock_get_magic(ext2_superblock_t *);88 inlineuint32_t ext2_superblock_get_first_block(ext2_superblock_t *);89 inlineuint32_t ext2_superblock_get_block_size_log2(ext2_superblock_t *);90 inlineuint32_t ext2_superblock_get_block_size(ext2_superblock_t *);91 inlineint32_t ext2_superblock_get_fragment_size_log2(ext2_superblock_t *);92 inlineuint32_t ext2_superblock_get_fragment_size(ext2_superblock_t *);93 inlineuint32_t ext2_superblock_get_blocks_per_group(ext2_superblock_t *);94 inlineuint32_t ext2_superblock_get_fragments_per_group(ext2_superblock_t *);95 inlineuint16_t ext2_superblock_get_state(ext2_superblock_t *);96 inlineuint16_t ext2_superblock_get_rev_minor(ext2_superblock_t *);97 inlineuint32_t ext2_superblock_get_rev_major(ext2_superblock_t *);98 inlineuint32_t ext2_superblock_get_os(ext2_superblock_t *);99 inlineuint32_t ext2_superblock_get_first_inode(ext2_superblock_t *);100 inlineuint16_t ext2_superblock_get_inode_size(ext2_superblock_t *);101 inlineuint32_t ext2_superblock_get_total_inode_count(ext2_superblock_t *);102 inlineuint32_t ext2_superblock_get_total_block_count(ext2_superblock_t *);103 inlineuint32_t ext2_superblock_get_reserved_block_count(ext2_superblock_t *);104 inlineuint32_t ext2_superblock_get_free_block_count(ext2_superblock_t *);105 inlineuint32_t ext2_superblock_get_free_inode_count(ext2_superblock_t *);106 inlineuint32_t ext2_superblock_get_block_group_count(ext2_superblock_t *);107 inlineuint32_t ext2_superblock_get_inodes_per_group(ext2_superblock_t *);108 inlineuint32_t ext2_superblock_get_features_compatible(ext2_superblock_t *);109 inlineuint32_t ext2_superblock_get_features_incompatible(ext2_superblock_t *);110 inlineuint32_t ext2_superblock_get_features_read_only(ext2_superblock_t *);87 extern uint16_t ext2_superblock_get_magic(ext2_superblock_t *); 88 extern uint32_t ext2_superblock_get_first_block(ext2_superblock_t *); 89 extern uint32_t ext2_superblock_get_block_size_log2(ext2_superblock_t *); 90 extern uint32_t ext2_superblock_get_block_size(ext2_superblock_t *); 91 extern int32_t ext2_superblock_get_fragment_size_log2(ext2_superblock_t *); 92 extern uint32_t ext2_superblock_get_fragment_size(ext2_superblock_t *); 93 extern uint32_t ext2_superblock_get_blocks_per_group(ext2_superblock_t *); 94 extern uint32_t ext2_superblock_get_fragments_per_group(ext2_superblock_t *); 95 extern uint16_t ext2_superblock_get_state(ext2_superblock_t *); 96 extern uint16_t ext2_superblock_get_rev_minor(ext2_superblock_t *); 97 extern uint32_t ext2_superblock_get_rev_major(ext2_superblock_t *); 98 extern uint32_t ext2_superblock_get_os(ext2_superblock_t *); 99 extern uint32_t ext2_superblock_get_first_inode(ext2_superblock_t *); 100 extern uint16_t ext2_superblock_get_inode_size(ext2_superblock_t *); 101 extern uint32_t ext2_superblock_get_total_inode_count(ext2_superblock_t *); 102 extern uint32_t ext2_superblock_get_total_block_count(ext2_superblock_t *); 103 extern uint32_t ext2_superblock_get_reserved_block_count(ext2_superblock_t *); 104 extern uint32_t ext2_superblock_get_free_block_count(ext2_superblock_t *); 105 extern uint32_t ext2_superblock_get_free_inode_count(ext2_superblock_t *); 106 extern uint32_t ext2_superblock_get_block_group_count(ext2_superblock_t *); 107 extern uint32_t ext2_superblock_get_inodes_per_group(ext2_superblock_t *); 108 extern uint32_t ext2_superblock_get_features_compatible(ext2_superblock_t *); 109 extern uint32_t ext2_superblock_get_features_incompatible(ext2_superblock_t *); 110 extern uint32_t ext2_superblock_get_features_read_only(ext2_superblock_t *); 111 111 112 112 extern int ext2_superblock_read_direct(devmap_handle_t, ext2_superblock_t **);
Note:
See TracChangeset
for help on using the changeset viewer.