X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=ext4_utils%2Fallocate.h;h=4a733d00adf54200193d4430a7536bf4f66d53b9;hb=9458a99b0c69dd65facc6ef975218848e8b1f0b6;hp=fb6e0f753707d8584b14c1d8040359f6596702e2;hpb=107a9f161babc20daf915311146b0e864d3b4157;p=android-x86%2Fsystem-extras.git diff --git a/ext4_utils/allocate.h b/ext4_utils/allocate.h index fb6e0f75..4a733d00 100644 --- a/ext4_utils/allocate.h +++ b/ext4_utils/allocate.h @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -20,9 +20,47 @@ #define EXT4_ALLOCATE_FAILED (u32)(~0) #include "ext4_utils.h" -#include "ext4.h" -struct block_allocation; +struct region { + u32 block; + u32 len; + int bg; + struct region *next; + struct region *prev; +}; + +struct region_list { + struct region *first; + struct region *last; + struct region *iter; + u32 partial_iter; +}; + +struct block_allocation { + struct region_list list; + struct region_list oob_list; + char* filename; + struct block_allocation* next; +}; + +struct block_group_info { + u32 first_block; + int header_blocks; + int data_blocks_used; + int has_superblock; + u8 *bitmaps; + u8 *block_bitmap; + u8 *inode_bitmap; + u8 *inode_table; + u32 free_blocks; + u32 free_inodes; + u32 first_free_inode; + u16 flags; + u16 used_dirs; + int chunk_count; + int max_chunk_count; + struct region *chunks; +}; void block_allocator_init(); void block_allocator_free(); @@ -31,6 +69,7 @@ struct block_allocation *allocate_blocks(u32 len); int block_allocation_num_regions(struct block_allocation *alloc); int block_allocation_len(struct block_allocation *alloc); struct ext4_inode *get_inode(u32 inode); +struct ext4_xattr_header *get_xattr_block_for_inode(struct ext4_inode *inode); void reduce_allocation(struct block_allocation *alloc, u32 len); u32 get_block(struct block_allocation *alloc, u32 block); u32 get_oob_block(struct block_allocation *alloc, u32 block); @@ -41,6 +80,7 @@ u32 get_free_inodes(u32 bg); u32 reserve_inodes(int bg, u32 inodes); void add_directory(u32 inode); u16 get_directories(int bg); +u16 get_bg_flags(int bg); void init_unused_inode_tables(void); u32 allocate_inode(); void free_alloc(struct block_allocation *alloc); @@ -53,5 +93,9 @@ void append_region(struct block_allocation *alloc, u32 block, u32 len, int bg); struct block_allocation *create_allocation(); int append_oob_allocation(struct block_allocation *alloc, u32 len); - +void region_list_append(struct region_list *list, struct region *reg); +void region_list_merge(struct region_list *list1, struct region_list *list2); +void print_blocks(FILE* f, struct block_allocation *alloc, char separator); +void reserve_bg_chunk(int bg, u32 start_block, u32 size); +int reserve_blocks_for_allocation(struct block_allocation *alloc); #endif