]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
rootfs-handoff: add ext2 filesystem state verification
authorTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 03:53:01 +0000 (00:53 -0300)
committerTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 03:53:01 +0000 (00:53 -0300)
commitf5e81560bcfc182c391b1672c4eeedaf262f7da1
tree1818dcc722e7cdbc52c27d31c196a47481f98944
parent9ca642b82171ff74f193f3f2e4c1a39446ec83c0
rootfs-handoff: add ext2 filesystem state verification

- Added EFSCK error code to errno.h (102)
- Added ext2_verify_state() function in ext2.c to check filesystem state
- Verifies ext2 superblock fields: s_state (clean/dirty) and s_errors (error policy)
- Returns -EFSCK if filesystem is dirty (needs fsck)
- Returns -EROFS if filesystem has errors configured for read-only mount
- Returns -EINVAL if filesystem has errors configured for panic
- Modified init.c to call ext2_verify_state() before mounting ext2
- Forces read-only mount if filesystem verification fails
- Added TODO comment for remount,rw after verification (requires syscall support)
- This implements the 'Root verification and remount,rw after checks' item from ROOTFS_HANDOFF_PLAN.md

Test Results:
- Smoke test: 131/131 PASS
- Battery test: 157/157 PASS
- Analyzer: PASS
- Zero regressions
include/errno.h
include/ext2.h
src/kernel/ext2.c
src/kernel/init.c