From 7aebd908b0c046bb2729e2139e7c9295d81a1fbc Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 25 Jul 2020 00:09:10 +0200 Subject: Yet another fix --- src/features/fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/features/fs.c') diff --git a/src/features/fs.c b/src/features/fs.c index 65bbe8d..d505e31 100644 --- a/src/features/fs.c +++ b/src/features/fs.c @@ -67,7 +67,8 @@ void *read_file(struct inode *in) int indirect; - // Single indirect pointer + // Singly indirect pointer + // TODO: Support doubly and triply pointers if (num_blocks > 12) indirect = in->block[12]; @@ -79,7 +80,7 @@ void *read_file(struct inode *in) data = buffer_read(blocknum); memcpy((u32 *)((u32)buf + i * BLOCK_SIZE), data, BLOCK_SIZE); } else { - blocknum = read_indirect(indirect, i - 13); + blocknum = read_indirect(indirect, i - 12); data = buffer_read(blocknum); memcpy((u32 *)((u32)buf + (i - 1) * BLOCK_SIZE), data, BLOCK_SIZE); } -- cgit v1.2.3