Update documentation, fix EXT2 inode selection bug
diff --git a/src/kernel/Jmk b/src/kernel/Jmk
index 0b1eac6..93af5fc 100644
--- a/src/kernel/Jmk
+++ b/src/kernel/Jmk
@@ -77,6 +77,9 @@
@dd bs=4M count=8 if=/dev/zero of=$@
@$(patsubst hd0_%.img,mkfs.%,$@) $@
+fs-info: hd0_$(FS).img
+ tune2fs -l $< | grep -i inode
+
qemu: kernel.elf hd0_$(FS).img
qemu-system-i386 $(QEMUFLAGS) -d cpu_reset -monitor stdio -kernel kernel.elf -no-reboot
diff --git a/src/kernel/dri/fs/ext2/ext2.c b/src/kernel/dri/fs/ext2/ext2.c
index ad416be..78dd24e 100644
--- a/src/kernel/dri/fs/ext2/ext2.c
+++ b/src/kernel/dri/fs/ext2/ext2.c
@@ -288,10 +288,10 @@
{
const uint block_size = ext2_block_size(sb);
- while (index > block_size)
+ while (*index > block_size)
{
- index -= block_size;
- bitmap_block += 1;
+ *index -= block_size;
+ *bitmap_block += 1;
}
return block_size;
@@ -357,7 +357,7 @@
kprintf(DEBUG "buffer[i] = 0x%x, i = %d, index = %d\n",
buffer[i], i, index);
- // __builtin_ffs gives us the index of the least-significant 1
+ // __builtin_ffs gives us 1+the index of the least-significant 1
// bit. Since we take the bitwise inverse this is actuall the
// least significant 0 bit. This is a GCC intrinsic. This works
// particularly well on little-endian systems where the least
@@ -369,7 +369,7 @@
// | this is the MSB
//
// This means that the LSB is also the first bit in the bitset.
- uint trailing = __builtin_ffs(~buffer[i]);
+ uint trailing = __builtin_ffs(~buffer[i]) - 1;
kprintf(DEBUG "Trailing = %d, 0x%x\n", trailing, trailing);