mirror of
https://git.openwrt.org/project/make_ext4fs.git
synced 2024-11-21 06:40:40 -05:00
make_ext4: Add strict prototypes.
Removes some undefined behavior. Signed-off by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
bb9cf91795
commit
eebda1d55d
10
allocate.h
10
allocate.h
@ -38,9 +38,9 @@ struct block_allocation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void block_allocator_init();
|
void block_allocator_init(void);
|
||||||
void block_allocator_free();
|
void block_allocator_free(void);
|
||||||
u32 allocate_block();
|
u32 allocate_block(void);
|
||||||
struct block_allocation *allocate_blocks(u32 len);
|
struct block_allocation *allocate_blocks(u32 len);
|
||||||
int block_allocation_num_regions(struct block_allocation *alloc);
|
int block_allocation_num_regions(struct block_allocation *alloc);
|
||||||
int block_allocation_len(struct block_allocation *alloc);
|
int block_allocation_len(struct block_allocation *alloc);
|
||||||
@ -58,7 +58,7 @@ void add_directory(u32 inode);
|
|||||||
u16 get_directories(int bg);
|
u16 get_directories(int bg);
|
||||||
u16 get_bg_flags(int bg);
|
u16 get_bg_flags(int bg);
|
||||||
void init_unused_inode_tables(void);
|
void init_unused_inode_tables(void);
|
||||||
u32 allocate_inode();
|
u32 allocate_inode(void);
|
||||||
void free_alloc(struct block_allocation *alloc);
|
void free_alloc(struct block_allocation *alloc);
|
||||||
int reserve_oob_blocks(struct block_allocation *alloc, int blocks);
|
int reserve_oob_blocks(struct block_allocation *alloc, int blocks);
|
||||||
int advance_blocks(struct block_allocation *alloc, int blocks);
|
int advance_blocks(struct block_allocation *alloc, int blocks);
|
||||||
@ -67,7 +67,7 @@ int last_region(struct block_allocation *alloc);
|
|||||||
void rewind_alloc(struct block_allocation *alloc);
|
void rewind_alloc(struct block_allocation *alloc);
|
||||||
void append_region(struct block_allocation *alloc,
|
void append_region(struct block_allocation *alloc,
|
||||||
u32 block, u32 len, int bg);
|
u32 block, u32 len, int bg);
|
||||||
struct block_allocation *create_allocation();
|
struct block_allocation *create_allocation(void);
|
||||||
int append_oob_allocation(struct block_allocation *alloc, u32 len);
|
int append_oob_allocation(struct block_allocation *alloc, u32 len);
|
||||||
void print_blocks(FILE* f, struct block_allocation *alloc);
|
void print_blocks(FILE* f, struct block_allocation *alloc);
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries,
|
|||||||
len = blocks * info.block_size;
|
len = blocks * info.block_size;
|
||||||
|
|
||||||
if (dir_inode_num) {
|
if (dir_inode_num) {
|
||||||
inode_num = allocate_inode(info);
|
inode_num = allocate_inode();
|
||||||
} else {
|
} else {
|
||||||
dir_inode_num = EXT4_ROOT_INO;
|
dir_inode_num = EXT4_ROOT_INO;
|
||||||
inode_num = EXT4_ROOT_INO;
|
inode_num = EXT4_ROOT_INO;
|
||||||
@ -171,7 +171,7 @@ u32 make_file(const char *filename, u64 len)
|
|||||||
struct ext4_inode *inode;
|
struct ext4_inode *inode;
|
||||||
u32 inode_num;
|
u32 inode_num;
|
||||||
|
|
||||||
inode_num = allocate_inode(info);
|
inode_num = allocate_inode();
|
||||||
if (inode_num == EXT4_ALLOCATE_FAILED) {
|
if (inode_num == EXT4_ALLOCATE_FAILED) {
|
||||||
error("failed to allocate inode\n");
|
error("failed to allocate inode\n");
|
||||||
return EXT4_ALLOCATE_FAILED;
|
return EXT4_ALLOCATE_FAILED;
|
||||||
@ -206,7 +206,7 @@ u32 make_link(const char *link)
|
|||||||
u32 inode_num;
|
u32 inode_num;
|
||||||
u32 len = strlen(link);
|
u32 len = strlen(link);
|
||||||
|
|
||||||
inode_num = allocate_inode(info);
|
inode_num = allocate_inode();
|
||||||
if (inode_num == EXT4_ALLOCATE_FAILED) {
|
if (inode_num == EXT4_ALLOCATE_FAILED) {
|
||||||
error("failed to allocate inode\n");
|
error("failed to allocate inode\n");
|
||||||
return EXT4_ALLOCATE_FAILED;
|
return EXT4_ALLOCATE_FAILED;
|
||||||
@ -247,7 +247,7 @@ u32 make_special(const char *path)
|
|||||||
return EXT4_ALLOCATE_FAILED;
|
return EXT4_ALLOCATE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
inode_num = allocate_inode(info);
|
inode_num = allocate_inode();
|
||||||
if (inode_num == EXT4_ALLOCATE_FAILED) {
|
if (inode_num == EXT4_ALLOCATE_FAILED) {
|
||||||
error("failed to allocate inode\n");
|
error("failed to allocate inode\n");
|
||||||
return EXT4_ALLOCATE_FAILED;
|
return EXT4_ALLOCATE_FAILED;
|
||||||
|
@ -39,6 +39,6 @@ u32 make_link(const char *link);
|
|||||||
u32 make_special(const char *path);
|
u32 make_special(const char *path);
|
||||||
int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime);
|
int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime);
|
||||||
int inode_set_capabilities(u32 inode_num, uint64_t capabilities);
|
int inode_set_capabilities(u32 inode_num, uint64_t capabilities);
|
||||||
struct block_allocation* get_saved_allocation_chain();
|
struct block_allocation* get_saved_allocation_chain(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
2
extent.h
2
extent.h
@ -25,6 +25,6 @@ struct block_allocation* inode_allocate_file_extents(
|
|||||||
struct ext4_inode *inode, u64 len, const char *filename);
|
struct ext4_inode *inode, u64 len, const char *filename);
|
||||||
u8 *inode_allocate_data_extents(struct ext4_inode *inode, u64 len,
|
u8 *inode_allocate_data_extents(struct ext4_inode *inode, u64 len,
|
||||||
u64 backing_len);
|
u64 backing_len);
|
||||||
void free_extent_blocks();
|
void free_extent_blocks(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,6 +24,6 @@ u8 *inode_allocate_data_indirect(struct ext4_inode *inode, unsigned long len,
|
|||||||
unsigned long backing_len);
|
unsigned long backing_len);
|
||||||
void inode_attach_resize(struct ext4_inode *inode,
|
void inode_attach_resize(struct ext4_inode *inode,
|
||||||
struct block_allocation *alloc);
|
struct block_allocation *alloc);
|
||||||
void free_indirect_blocks();
|
void free_indirect_blocks(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -258,12 +258,12 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
|
|||||||
return inode;
|
return inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 compute_block_size()
|
static u32 compute_block_size(void)
|
||||||
{
|
{
|
||||||
return 4096;
|
return 4096;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 compute_journal_blocks()
|
static u32 compute_journal_blocks(void)
|
||||||
{
|
{
|
||||||
u32 journal_blocks = DIV_ROUND_UP(info.len, info.block_size) / 64;
|
u32 journal_blocks = DIV_ROUND_UP(info.len, info.block_size) / 64;
|
||||||
if (journal_blocks < 1024)
|
if (journal_blocks < 1024)
|
||||||
@ -273,17 +273,17 @@ static u32 compute_journal_blocks()
|
|||||||
return journal_blocks;
|
return journal_blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 compute_blocks_per_group()
|
static u32 compute_blocks_per_group(void)
|
||||||
{
|
{
|
||||||
return info.block_size * 8;
|
return info.block_size * 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 compute_inodes()
|
static u32 compute_inodes(void)
|
||||||
{
|
{
|
||||||
return DIV_ROUND_UP(info.len, info.block_size) / 4;
|
return DIV_ROUND_UP(info.len, info.block_size) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 compute_inodes_per_group()
|
static u32 compute_inodes_per_group(void)
|
||||||
{
|
{
|
||||||
u32 blocks = DIV_ROUND_UP(info.len, info.block_size);
|
u32 blocks = DIV_ROUND_UP(info.len, info.block_size);
|
||||||
u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group);
|
u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group);
|
||||||
@ -298,7 +298,7 @@ static u32 compute_inodes_per_group()
|
|||||||
return inodes;
|
return inodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 compute_bg_desc_reserve_blocks()
|
static u32 compute_bg_desc_reserve_blocks(void)
|
||||||
{
|
{
|
||||||
u32 blocks = DIV_ROUND_UP(info.len, info.block_size);
|
u32 blocks = DIV_ROUND_UP(info.len, info.block_size);
|
||||||
u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group);
|
u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group);
|
||||||
|
Loading…
Reference in New Issue
Block a user