Skip to content

Commit eebda1d

Browse files
nehebblogic
authored andcommitted
make_ext4: Add strict prototypes.
Removes some undefined behavior. Signed-off by: Rosen Penev <[email protected]>
1 parent bb9cf91 commit eebda1d

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

allocate.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ struct block_allocation {
3838
};
3939

4040

41-
void block_allocator_init();
42-
void block_allocator_free();
43-
u32 allocate_block();
41+
void block_allocator_init(void);
42+
void block_allocator_free(void);
43+
u32 allocate_block(void);
4444
struct block_allocation *allocate_blocks(u32 len);
4545
int block_allocation_num_regions(struct block_allocation *alloc);
4646
int block_allocation_len(struct block_allocation *alloc);
@@ -58,7 +58,7 @@ void add_directory(u32 inode);
5858
u16 get_directories(int bg);
5959
u16 get_bg_flags(int bg);
6060
void init_unused_inode_tables(void);
61-
u32 allocate_inode();
61+
u32 allocate_inode(void);
6262
void free_alloc(struct block_allocation *alloc);
6363
int reserve_oob_blocks(struct block_allocation *alloc, int blocks);
6464
int advance_blocks(struct block_allocation *alloc, int blocks);
@@ -67,7 +67,7 @@ int last_region(struct block_allocation *alloc);
6767
void rewind_alloc(struct block_allocation *alloc);
6868
void append_region(struct block_allocation *alloc,
6969
u32 block, u32 len, int bg);
70-
struct block_allocation *create_allocation();
70+
struct block_allocation *create_allocation(void);
7171
int append_oob_allocation(struct block_allocation *alloc, u32 len);
7272
void print_blocks(FILE* f, struct block_allocation *alloc);
7373

contents.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries,
103103
len = blocks * info.block_size;
104104

105105
if (dir_inode_num) {
106-
inode_num = allocate_inode(info);
106+
inode_num = allocate_inode();
107107
} else {
108108
dir_inode_num = EXT4_ROOT_INO;
109109
inode_num = EXT4_ROOT_INO;
@@ -171,7 +171,7 @@ u32 make_file(const char *filename, u64 len)
171171
struct ext4_inode *inode;
172172
u32 inode_num;
173173

174-
inode_num = allocate_inode(info);
174+
inode_num = allocate_inode();
175175
if (inode_num == EXT4_ALLOCATE_FAILED) {
176176
error("failed to allocate inode\n");
177177
return EXT4_ALLOCATE_FAILED;
@@ -206,7 +206,7 @@ u32 make_link(const char *link)
206206
u32 inode_num;
207207
u32 len = strlen(link);
208208

209-
inode_num = allocate_inode(info);
209+
inode_num = allocate_inode();
210210
if (inode_num == EXT4_ALLOCATE_FAILED) {
211211
error("failed to allocate inode\n");
212212
return EXT4_ALLOCATE_FAILED;
@@ -247,7 +247,7 @@ u32 make_special(const char *path)
247247
return EXT4_ALLOCATE_FAILED;
248248
}
249249

250-
inode_num = allocate_inode(info);
250+
inode_num = allocate_inode();
251251
if (inode_num == EXT4_ALLOCATE_FAILED) {
252252
error("failed to allocate inode\n");
253253
return EXT4_ALLOCATE_FAILED;

contents.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ u32 make_link(const char *link);
3939
u32 make_special(const char *path);
4040
int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime);
4141
int inode_set_capabilities(u32 inode_num, uint64_t capabilities);
42-
struct block_allocation* get_saved_allocation_chain();
42+
struct block_allocation* get_saved_allocation_chain(void);
4343

4444
#endif

extent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ struct block_allocation* inode_allocate_file_extents(
2525
struct ext4_inode *inode, u64 len, const char *filename);
2626
u8 *inode_allocate_data_extents(struct ext4_inode *inode, u64 len,
2727
u64 backing_len);
28-
void free_extent_blocks();
28+
void free_extent_blocks(void);
2929

3030
#endif

indirect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ u8 *inode_allocate_data_indirect(struct ext4_inode *inode, unsigned long len,
2424
unsigned long backing_len);
2525
void inode_attach_resize(struct ext4_inode *inode,
2626
struct block_allocation *alloc);
27-
void free_indirect_blocks();
27+
void free_indirect_blocks(void);
2828

2929
#endif

make_ext4fs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,12 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
258258
return inode;
259259
}
260260

261-
static u32 compute_block_size()
261+
static u32 compute_block_size(void)
262262
{
263263
return 4096;
264264
}
265265

266-
static u32 compute_journal_blocks()
266+
static u32 compute_journal_blocks(void)
267267
{
268268
u32 journal_blocks = DIV_ROUND_UP(info.len, info.block_size) / 64;
269269
if (journal_blocks < 1024)
@@ -273,17 +273,17 @@ static u32 compute_journal_blocks()
273273
return journal_blocks;
274274
}
275275

276-
static u32 compute_blocks_per_group()
276+
static u32 compute_blocks_per_group(void)
277277
{
278278
return info.block_size * 8;
279279
}
280280

281-
static u32 compute_inodes()
281+
static u32 compute_inodes(void)
282282
{
283283
return DIV_ROUND_UP(info.len, info.block_size) / 4;
284284
}
285285

286-
static u32 compute_inodes_per_group()
286+
static u32 compute_inodes_per_group(void)
287287
{
288288
u32 blocks = DIV_ROUND_UP(info.len, info.block_size);
289289
u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group);
@@ -298,7 +298,7 @@ static u32 compute_inodes_per_group()
298298
return inodes;
299299
}
300300

301-
static u32 compute_bg_desc_reserve_blocks()
301+
static u32 compute_bg_desc_reserve_blocks(void)
302302
{
303303
u32 blocks = DIV_ROUND_UP(info.len, info.block_size);
304304
u32 block_groups = DIV_ROUND_UP(blocks, info.blocks_per_group);

0 commit comments

Comments
 (0)