diff options
author | Helge Deller <deller@localhost> | 2022-08-08 14:52:19 +0000 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2022-08-08 16:59:10 +0200 |
commit | 7f95144a400309f1481a1843d29df2c6d8a64307 (patch) | |
tree | 03401a8638e893c040bd9840f7059237d381de1f | |
parent | ba13c3e6a3cfeb78767691ba3f7d87616e664474 (diff) | |
download | palo-7f95144a400309f1481a1843d29df2c6d8a64307.tar.gz |
ipl/ext2: Fix block calculation and close file handle
I missed one block offset calculation in ext3_extent_load_find().
In addition, close the ext2 file handle in ext2_close() when finished.
Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r-- | ipl/ext2.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -44,7 +44,7 @@ static char iblkbuf[EXT2_MAX_BLOCK_SIZE]; static int cached_diblkno = -1; static char diblkbuf[EXT2_MAX_BLOCK_SIZE]; static long dev = -1; -static long partition_offset; +static __u64 partition_offset; struct ext2_inode *fd2inode[MAX_FD]; @@ -389,7 +389,7 @@ static struct ext2_inode *ext2_iget(int ino) * EXT2_INODE_SIZE(&sb)); #ifdef DEBUG printf("ext2_iget: reading %ld bytes at offset %lld " - "(%ld + (%d * %d) + ((%d) %% %d) * %d) " + "(%lld + (%d * %d) + ((%d) %% %d) * %d) " "(inode %d -> table %d)\n", sizeof(struct ext2_inode), offset, partition_offset, ext2_gds(group)->bg_inode_table, ext2_blocksize, @@ -519,7 +519,7 @@ static int ext3_extent_load_find(struct ext2_inode *ip, int leaf, int d, printf("load extent tree[%d] block at %d\n", d, leaf); if (cons_read(dev, hdr, EXT2_MAX_BLOCK_SIZE, - leaf * ext2_blocksize) != + mul_blocksize(leaf, ext2_blocksize)) != EXT2_MAX_BLOCK_SIZE) { printf("ext3_extent_load_find: read error\n"); return -1; @@ -1035,4 +1035,6 @@ void ext2_close(int fd) /* blah, hack, don't close the root inode ever */ if (&inode_table[fd].inode != root_inode) ext2_iput(&inode_table[fd].inode); + + fileio_close(fd); } |