From 63a2e138f3f5f8d4fa731a06dc2b0e3ab4eab3bc Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 19 Apr 2020 17:33:06 +0200 Subject: Applied tidy command... Idk why I forgot it for several commits :D --- src/kernel/fs/ext2.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'src/kernel/fs/ext2.c') diff --git a/src/kernel/fs/ext2.c b/src/kernel/fs/ext2.c index bc17db6..41c2a3d 100644 --- a/src/kernel/fs/ext2.c +++ b/src/kernel/fs/ext2.c @@ -570,7 +570,9 @@ void set_disk_block_number(ext2_fs_t *ext2fs, inode_t *inode, uint32_t inode_idx } b = a - p; if (b <= 0) { - if(!alloc_inode_metadata_block(&(inode->blocks[EXT2_DIRECT_BLOCKS]), ext2fs, inode, inode_idx, NULL, 0)); + if (!alloc_inode_metadata_block(&(inode->blocks[EXT2_DIRECT_BLOCKS]), ext2fs, inode, + inode_idx, NULL, 0)) + ; read_disk_block(ext2fs, inode->blocks[EXT2_DIRECT_BLOCKS], (void *)tmp); ((unsigned int *)tmp)[a] = disk_block; write_disk_block(ext2fs, inode->blocks[EXT2_DIRECT_BLOCKS], (void *)tmp); @@ -581,9 +583,13 @@ void set_disk_block_number(ext2_fs_t *ext2fs, inode_t *inode, uint32_t inode_idx if (c <= 0) { c = b / p; d = b - c * p; - if(!alloc_inode_metadata_block(&(inode->blocks[EXT2_DIRECT_BLOCKS + 1]), ext2fs, inode, inode_idx, NULL, 0)); + if (!alloc_inode_metadata_block(&(inode->blocks[EXT2_DIRECT_BLOCKS + 1]), ext2fs, + inode, inode_idx, NULL, 0)) + ; read_disk_block(ext2fs, inode->blocks[EXT2_DIRECT_BLOCKS + 1], (void *)tmp); - if(!alloc_inode_metadata_block(&(tmp[c]), ext2fs, inode, inode_idx, (void*)tmp, inode->blocks[EXT2_DIRECT_BLOCKS + 1])); + if (!alloc_inode_metadata_block(&(tmp[c]), ext2fs, inode, inode_idx, (void *)tmp, + inode->blocks[EXT2_DIRECT_BLOCKS + 1])) + ; unsigned int temp = tmp[c]; read_disk_block(ext2fs, temp, (void *)tmp); tmp[d] = disk_block; @@ -595,12 +601,18 @@ void set_disk_block_number(ext2_fs_t *ext2fs, inode_t *inode, uint32_t inode_idx e = c / (p * p); f = (c - e * p * p) / p; g = (c - e * p * p - f * p); - if(!alloc_inode_metadata_block(&(inode->blocks[EXT2_DIRECT_BLOCKS + 2]), ext2fs, inode, inode_idx, NULL, 0)); + if (!alloc_inode_metadata_block(&(inode->blocks[EXT2_DIRECT_BLOCKS + 2]), ext2fs, + inode, inode_idx, NULL, 0)) + ; read_disk_block(ext2fs, inode->blocks[EXT2_DIRECT_BLOCKS + 2], (void *)tmp); - if(!alloc_inode_metadata_block(&(tmp[e]), ext2fs, inode, inode_idx, (void*)tmp, inode->blocks[EXT2_DIRECT_BLOCKS + 2])); + if (!alloc_inode_metadata_block(&(tmp[e]), ext2fs, inode, inode_idx, (void *)tmp, + inode->blocks[EXT2_DIRECT_BLOCKS + 2])) + ; unsigned int temp = tmp[e]; read_disk_block(ext2fs, tmp[e], (void *)tmp); - if(!alloc_inode_metadata_block(&(tmp[f]), ext2fs, inode, inode_idx, (void*)tmp, temp)); + if (!alloc_inode_metadata_block(&(tmp[f]), ext2fs, inode, inode_idx, (void *)tmp, + temp)) + ; temp = tmp[f]; read_disk_block(ext2fs, tmp[f], (void *)tmp); tmp[g] = disk_block; @@ -784,4 +796,4 @@ void ext2_init(char *device_path, char *mountpoint) inode_t *root_inode = kcalloc(sizeof(inode_t), 1); read_inode_metadata(ext2fs, root_inode, ROOT_INODE_NUMBER); vfs_mount(mountpoint, get_ext2_root(ext2fs, root_inode)); -} +} \ No newline at end of file -- cgit v1.2.3