Update documentation, fix EXT2 inode selection bug
diff --git a/doc/Makefile b/doc/Makefile
index 6f05775..869b207 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -17,11 +17,6 @@
 watch:
 	sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
-dox: doxygen
-doxygen:
-	doxygen lisp.doxyfile
-	doxygen kernel.doxyfile
-
 # Catch-all target: route all unknown targets to Sphinx using the new
 # "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
 %: Makefile
diff --git a/doc/architecture.rst b/doc/architecture.rst
index b946a54..5cdc414 100644
--- a/doc/architecture.rst
+++ b/doc/architecture.rst
@@ -42,11 +42,8 @@
 ~~~~~~~~~~~~~~~~~~
 
 PCI device drivers must register a ``struct pci_device_driver`` in order to
-interface with a certain device (or class of devices). The relevant fields of
-``struct pci_device_driver`` are shown here:
-
-.. doxygenstruct:: pci_device_driver
-    :project: Kernel
+interface with a certain device (or class of devices). See
+``include/kernel/dri/pci/pci.h`` for details.
 
 A PCI device driver must pass an instance of this structure to
 ``pci_register_device_driver`` (in ``include/kernel/dri/pci/pci.h``. If
diff --git a/doc/build.rst b/doc/build.rst
index 3826238..3150dc7 100644
--- a/doc/build.rst
+++ b/doc/build.rst
@@ -37,3 +37,18 @@
 
 There are some additional dependencies for building a GRUB ISO but I don't
 remember them at the time of writing.
+
+Common Issues
+-------------
+
+If when launching Bluejay in QEMU with ``make qemu`` you see the message ::
+
+    [ DEBUG ] mb.mods_addr = <whatever>, 0x<whatever>
+
+Followed by a page fault (``#PF``), your QEMU is out of date. You can either run
+the GRUB ISO (with ``make qemu-iso``), which is slower, or upgrade your QEMU to
+at least version 6.0.
+
+This is because prior to 6.0 QEMU's integrated bootloader did not support
+multiboot modules. This message is caused by the kernel attempting to read a
+module that was loaded incorrectly.
diff --git a/doc/conf.py b/doc/conf.py
index 39e52ea..0a41b0a 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -16,11 +16,6 @@
 	'breathe'
 ]
 
-breathe_projects = {
-	'Kernel': '_dox_kernel/xml',
-	'Lisp': '_dox_lisp/xml'
-}
-
 breathe_default_project = 'Kernel'
 
 templates_path = ['_templates']
@@ -30,6 +25,3 @@
 html_theme = 'sphinx_rtd_theme'
 
 html_static_path = ['_static']
-
-def setup(app):
-	app.add_stylesheet('custom.css')
diff --git a/doc/filesystem.rst b/doc/filesystem.rst
index df5373e..3632c6f 100644
--- a/doc/filesystem.rst
+++ b/doc/filesystem.rst
@@ -21,3 +21,30 @@
 very low-level API for dealing with files -- including the usual read(),
 write(), readdir(), etc -- but this should not be used for much longer. A high
 level API utilizing file descriptors will be implemented to make this simpler.
+
+Filesystem Drivers
+------------------
+
+The current filesystem driver(s) available in Bluejay are:
+
+- ``ext2``
+    - Read-only support, write support is in progress
+
+Creating a Virtual Drive in QEMU
+--------------------------------
+
+By default ``make qemu`` will load ``hd0_$(FS).img`` as the virtual hard drive
+for Bluejay. ``FS`` defaults to ``ext2`` but can be set in your ``Jmk.options``
+to any value. If this file does not exist it will be created using
+``mkfs.$(FS)``, ie ``mkfs.ext2`` by default. The default size of the file system
+is 35 megabytes, although you can create one of any size manually if you want.
+35 megabytes is plenty for testing though.
+
+The ``make mount`` command will mount the current virtual hard drive in
+``$(ROOT)/mnt`` (where ``$(ROOT)`` is the root directory of the Bluejay sources,
+not ``/``). This command requires superuser privileges. If you want to give your
+(host) user account write permissions use ``chown -R user:group /path/to/mnt``
+where ``user`` and ``group`` are the user and group you want to own the files.
+
+Currently Bluejay ignores file permissions so it doesn't matter who you set the
+owner to.
diff --git a/doc/index.rst b/doc/index.rst
index ca3da7b..90900ce 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -14,9 +14,7 @@
    architecture
    filesystem
    lisp-std
-   lisp-api
    logging
-   kernel-api
 
 Bluejay is an operating system inspired by UNIX and early Lisp machines.
 Currently it only targets x86. There are no plans to port to other platforms.
diff --git a/doc/kernel-api.rst b/doc/kernel-api.rst
deleted file mode 100644
index e609259..0000000
--- a/doc/kernel-api.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-Kernel API Docs
-===============
-
-.. doxygenindex::
-	:project: Kernel
diff --git a/doc/lisp-api.rst b/doc/lisp-api.rst
deleted file mode 100644
index d9c9abf..0000000
--- a/doc/lisp-api.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-Lisp C API Docs
-===============
-
-.. doxygenindex::
-	:project: Lisp
-
diff --git a/doc/make.bat b/doc/make.bat
deleted file mode 100644
index 2119f51..0000000
--- a/doc/make.bat
+++ /dev/null
@@ -1,35 +0,0 @@
-@ECHO OFF

-

-pushd %~dp0

-

-REM Command file for Sphinx documentation

-

-if "%SPHINXBUILD%" == "" (

-	set SPHINXBUILD=sphinx-build

-)

-set SOURCEDIR=.

-set BUILDDIR=_build

-

-if "%1" == "" goto help

-

-%SPHINXBUILD% >NUL 2>NUL

-if errorlevel 9009 (

-	echo.

-	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx

-	echo.installed, then set the SPHINXBUILD environment variable to point

-	echo.to the full path of the 'sphinx-build' executable. Alternatively you

-	echo.may add the Sphinx directory to PATH.

-	echo.

-	echo.If you don't have Sphinx installed, grab it from

-	echo.http://sphinx-doc.org/

-	exit /b 1

-)

-

-%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

-goto end

-

-:help

-%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

-

-:end

-popd

diff --git a/include/kernel/vfs.h b/include/kernel/vfs.h
index 40a8e87..e7cf8d9 100644
--- a/include/kernel/vfs.h
+++ b/include/kernel/vfs.h
@@ -31,7 +31,8 @@
 
 struct fs_dirent
 {
-	char name[128];
+	// EXT2 supports up to 256 byte file names, so we will do the same
+	char name[256];
 	uint inode;
 };
 
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);