From 952620d90566ca9c9be9af19ebdc82f17fbfca74 Mon Sep 17 00:00:00 2001
From: juls0730 <62722391+juls0730@users.noreply.github.com>
Date: Tue, 19 Mar 2024 03:58:47 -0500
Subject: [PATCH] fully functional squashfs driver!! + gen code cleanup
---
Makefile | 4 +-
src/drivers/fs/fat.rs | 150 ++--
src/drivers/fs/initramfs/compressors/gzip.rs | 24 +-
src/drivers/fs/initramfs/mod.rs | 804 +++++++++++++++----
src/drivers/fs/vfs.rs | 86 +-
src/libs/cell/mod.rs | 4 +
src/libs/math.rs | 89 ++
src/libs/mod.rs | 1 +
src/main.rs | 70 +-
9 files changed, 944 insertions(+), 288 deletions(-)
create mode 100644 src/libs/math.rs
diff --git a/Makefile b/Makefile
index d32e509..bdf09c9 100644
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,7 @@ copy-initramfs-files:
echo "Hello World from Initramfs" > ${INITRAMFS_PATH}/example.txt
echo "Second file for testing" > ${INITRAMFS_PATH}/example2.txt
mkdir -p ${INITRAMFS_PATH}/firstdir/seconddirbutlonger/
- echo "Hell yeah, we getting a working initramfs using a custom squashfs driver!!" > ${INITRAMFS_PATH}/firstdir/seconddirbutlonger/yeah.txt
+ echo "Nexted file reads!!" > ${INITRAMFS_PATH}/firstdir/seconddirbutlonger/yeah.txt
compile-initramfs: copy-initramfs-files
# Make squashfs without compression temporaily so I can get it working before I have to write a gzip driver
@@ -100,7 +100,7 @@ endif
python scripts/font.py
mv scripts/font.psf ${INITRAMFS_PATH}/
- # python scripts/initramfs-test.py 1000 ${INITRAMFS_PATH}/
+ python scripts/initramfs-test.py 100 ${INITRAMFS_PATH}/
copy-iso-files:
# Limine files
diff --git a/src/drivers/fs/fat.rs b/src/drivers/fs/fat.rs
index 86a8eea..599fb67 100755
--- a/src/drivers/fs/fat.rs
+++ b/src/drivers/fs/fat.rs
@@ -511,21 +511,18 @@ impl FatFs {
}
impl FsOps for FatFs {
- fn mount(&self, path: &str, data: &mut *mut u8, vfsp: *const super::vfs::Vfs) {
+ fn mount(&mut self, _path: &str, data: &mut *mut u8, _vfsp: *const super::vfs::Vfs) {
// TODO: load the FAT into memory here
*data = core::ptr::addr_of!(*self) as *mut u8;
-
- // *data = unsafe { alloc::alloc::alloc(alloc::alloc::Layout::new::