This exposes some more of the RomFS API to the public facing side allowing file "opening" and directory listing natively without requiring stdio. The main reason for this is to allow reading RomFS files from an arbitary offset without first seeking the file position. As RomFS is read-only this is crucial for contentionless multi-threaded access, but is unfortunately missing from stdio. I kinda just did the directory iteration stuff to round out the API, they both have the added benefit of requiring zero allocation.
The stdio implementation has been updated to use the native APIs as well with a slight caveat when calling romfs_open. It used to return ENOENT if the directory didn't exist but EROFS if the file didn't exist and the O_CREAT flag was set. It now returns EROFS in either case if the O_CREAT flag is set.
I'm happy to write up an example usage for the switchbrew/switch-examples repository.
This exposes some more of the RomFS API to the public facing side allowing file "opening" and directory listing natively without requiring stdio. The main reason for this is to allow reading RomFS files from an arbitary offset without first seeking the file position. As RomFS is read-only this is crucial for contentionless multi-threaded access, but is unfortunately missing from stdio. I kinda just did the directory iteration stuff to round out the API, they both have the added benefit of requiring zero allocation.
The stdio implementation has been updated to use the native APIs as well with a slight caveat when calling
romfs_open
. It used to returnENOENT
if the directory didn't exist butEROFS
if the file didn't exist and theO_CREAT
flag was set. It now returnsEROFS
in either case if theO_CREAT
flag is set.I'm happy to write up an example usage for the switchbrew/switch-examples repository.