uyjulian
Developer
Let's talk a bit about filesystems and some surrounding information about porting them...
I wrote pfsfuse, which basically allows you to mount PS2 formatted hard drives in operating systems that support the FUSE (Filesystem in USErspace) interface, and access the files like any other file system.
Compared to using in-kernel filesystems, writing a FUSE interface is an easy way to write a filesystem interface without needing to go low level or deal with the changing kernel API/ABI. However, some performance is left on the table.
How pfsfuse is basically written is it integrates iomanX, pfs, and apa drivers from ps2sdk (just like pfsshell) and the rest of the functions like the ATAD functions, threading functions, etc. are translated to the host system by a shim library.
I'd like to eventually also do the same for the memory card filesystem and the FAT filesystems in ps2sdk, so that it is possible to debug those filesystems more easily and also use code quality tools like clang-analyzer, american fuzzy lop, Valgrind, etc. to find issues like null pointer access and buffer overflows.
This same interface may also be useful for the DVRP, where its filesystem is exposed in the interface. So you can record TV and use the filesystem at the same time (compared to just raw block access, where it's only safe for one driver to access the filesystem at the same time...)
A comparison between how POSIX treats file systems and how PS2 / iomanX treats file systems...
* Where file systems are mounted
POSIX: File systems can be mounted in directories and sub-directories
iomanX: File systems can only be mounted in "XXXY:" where XXX is a variable length string and Y is an integer
* How file systems are mounted
POSIX: Filesystem can be mounted based on a block device, either automatically (e.g. fstab) or manually (mount helper program)
iomanX: Filesystem driver dependent. Some are mounted using the "mount" function, while others auto-mount when a device is plugged in.
* How block devices are exposed
POSIX: Block devices are usually exposed under /dev
iomanX: Some devices have their own block-size access devctls e.g. "hdd0:".
BDM: A callback/event based system, not exposed as a filesystem
* Where filesystem drivers are resident
POSIX: on the application processor (e.g. EE), in either kernel space or user space
iomanX: on the I/O processor (e.g. IOP), always in kernel space
* API surface area
POSIX/FUSE: 42 functions (see https://libfuse.github.io/doxygen/structfuse__operations.html )
iomanX: 27 functions (see https://github.com/ps2dev/ps2sdk/bl...3cbbd37dd21cd/iop/kernel/include/iomanX.h#L58 )
* Notable exclusions
POSIX/FUSE: "mount" function (the mount helper and filesystem driver programs are the same and should be used), "devctl" function
iomanX: copy_file_range, mmap, openat (and its series of functions)
As you can see, iomanX runs on the slower processor with less RAM, has inconsistencies on how devices/filesystems are exposed, and has a limited API surface.
Meanwhile, POSIX runs on the faster processor with more RAM, is more consistent on how devices/filesystems are exposed, and has a more complete API surface.
So in that case, after looking at these facts and the PS2 Linux kernel being worked on, I don't think it would be worth my time to not only write a FUSE-to-iomanX layer (basically what pfsfuse is doing but the roles are reversed), but debug it and iron out the issues, which would probably have only myself looking at it, but in the Linux kernel, a lot of companies are looking at the code and have even wrote automated tests for it.
Now, if I did decide to write a FUSE-to-iomanX layer, it could be useful for read-only filesystems.
GRUB supports a lot of filesystems: https://www.gnu.org/software/grub/manual/grub/grub.html#Features
It also has a FUSE interface for using those filesystems drivers in the FUSE interface: https://www.gnu.org/software/grub/manual/grub/grub.html#Invoking-grub_002dmount
I don't believe a FUSE shim layer has been writen for using Linux, FreeBSD, OpenBSD, or Windows NT kernel file system drivers.
I wrote pfsfuse, which basically allows you to mount PS2 formatted hard drives in operating systems that support the FUSE (Filesystem in USErspace) interface, and access the files like any other file system.
Compared to using in-kernel filesystems, writing a FUSE interface is an easy way to write a filesystem interface without needing to go low level or deal with the changing kernel API/ABI. However, some performance is left on the table.
How pfsfuse is basically written is it integrates iomanX, pfs, and apa drivers from ps2sdk (just like pfsshell) and the rest of the functions like the ATAD functions, threading functions, etc. are translated to the host system by a shim library.
I'd like to eventually also do the same for the memory card filesystem and the FAT filesystems in ps2sdk, so that it is possible to debug those filesystems more easily and also use code quality tools like clang-analyzer, american fuzzy lop, Valgrind, etc. to find issues like null pointer access and buffer overflows.
This same interface may also be useful for the DVRP, where its filesystem is exposed in the interface. So you can record TV and use the filesystem at the same time (compared to just raw block access, where it's only safe for one driver to access the filesystem at the same time...)
A comparison between how POSIX treats file systems and how PS2 / iomanX treats file systems...
* Where file systems are mounted
POSIX: File systems can be mounted in directories and sub-directories
iomanX: File systems can only be mounted in "XXXY:" where XXX is a variable length string and Y is an integer
* How file systems are mounted
POSIX: Filesystem can be mounted based on a block device, either automatically (e.g. fstab) or manually (mount helper program)
iomanX: Filesystem driver dependent. Some are mounted using the "mount" function, while others auto-mount when a device is plugged in.
* How block devices are exposed
POSIX: Block devices are usually exposed under /dev
iomanX: Some devices have their own block-size access devctls e.g. "hdd0:".
BDM: A callback/event based system, not exposed as a filesystem
* Where filesystem drivers are resident
POSIX: on the application processor (e.g. EE), in either kernel space or user space
iomanX: on the I/O processor (e.g. IOP), always in kernel space
* API surface area
POSIX/FUSE: 42 functions (see https://libfuse.github.io/doxygen/structfuse__operations.html )
iomanX: 27 functions (see https://github.com/ps2dev/ps2sdk/bl...3cbbd37dd21cd/iop/kernel/include/iomanX.h#L58 )
* Notable exclusions
POSIX/FUSE: "mount" function (the mount helper and filesystem driver programs are the same and should be used), "devctl" function
iomanX: copy_file_range, mmap, openat (and its series of functions)
As you can see, iomanX runs on the slower processor with less RAM, has inconsistencies on how devices/filesystems are exposed, and has a limited API surface.
Meanwhile, POSIX runs on the faster processor with more RAM, is more consistent on how devices/filesystems are exposed, and has a more complete API surface.
So in that case, after looking at these facts and the PS2 Linux kernel being worked on, I don't think it would be worth my time to not only write a FUSE-to-iomanX layer (basically what pfsfuse is doing but the roles are reversed), but debug it and iron out the issues, which would probably have only myself looking at it, but in the Linux kernel, a lot of companies are looking at the code and have even wrote automated tests for it.
Now, if I did decide to write a FUSE-to-iomanX layer, it could be useful for read-only filesystems.
GRUB supports a lot of filesystems: https://www.gnu.org/software/grub/manual/grub/grub.html#Features
It also has a FUSE interface for using those filesystems drivers in the FUSE interface: https://www.gnu.org/software/grub/manual/grub/grub.html#Invoking-grub_002dmount
I don't believe a FUSE shim layer has been writen for using Linux, FreeBSD, OpenBSD, or Windows NT kernel file system drivers.