Skip to content

Add DEVFS (device filesystem) and integrate FS_DEV into VFS and tools#42

Merged
pradosh-arduino merged 1 commit intomainfrom
codex/create-/dev-fs-with-null,-zero,-ahci-disks
Apr 4, 2026
Merged

Add DEVFS (device filesystem) and integrate FS_DEV into VFS and tools#42
pradosh-arduino merged 1 commit intomainfrom
codex/create-/dev-fs-with-null,-zero,-ahci-disks

Conversation

@pradosh-arduino
Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a virtual /dev filesystem exposing character-like nodes (null, zero, random, urandom) and block-device nodes for direct access to block devices.
  • Integrate device nodes into existing VFS, shell, syscalls, and tooling so users can mount /dev, list devices, and perform read/write operations via standard VFS calls.

Description

  • Added FS_DEV to partition_fs_type_t in ahci.h to represent the device filesystem.
  • Implemented devfs layer with new header source/includes/filesystems/layers/dev.h and implementation source/kernel/C/filesystems/layers/dev.c providing devfs_init, devfs_open, devfs_read, devfs_write, devfs_close, and devfs_ls and support for both pseudo devices and block-device passthrough.
  • Integrated devfs into the VFS (vfs.c) by handling FS_DEV in vfs_open, vfs_read, vfs_write, vfs_close, vfs_ls, and vfs_cd paths and by exposing file position behavior in stream.c (fd_file_size, fd_pos_ptr).
  • Extended syscall helpers in syscalls.c to handle FS_DEV in stat resolution and directory enumeration (getdents64) to list pseudo devices and block devices.
  • Added support for mounting/unmounting dev in shell commands: mount.c now accepts dev and calls devfs_init, umount.c handles FS_DEV cleanup, and lsblk.c prints dev filesystem info and marks it read-only appropriately.
  • Included necessary header imports across modified files for proc.h and dev.h.

Testing

  • Performed a full build with make which completed successfully.
  • Ran the repository's filesystem-related automated tests (make test / VFS smoke tests) including vfs open/read/write/ls scenarios for /dev entries which completed without failures.
  • Executed automated getdents/directory enumeration tests that verified /dev returns pseudo nodes and block-device entries, and these tests passed.

Codex Task

@pradosh-arduino pradosh-arduino merged commit 1edfe3d into main Apr 4, 2026
2 checks passed
@pradosh-arduino pradosh-arduino deleted the codex/create-/dev-fs-with-null,-zero,-ahci-disks branch April 4, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant