Overview
The filesystem API provides functions for file and directory operations on the PlayStation 3. It includes both low-level LV2 syscalls and higher-level wrapper functions.File Operations
sysFsOpen
Open a file.File path (e.g.,
/dev_hdd0/game/data.bin)Open flags (OR combination):
SYS_O_RDONLY- Read onlySYS_O_WRONLY- Write onlySYS_O_RDWR- Read and writeSYS_O_CREAT- Create if doesn’t existSYS_O_TRUNC- Truncate to zero lengthSYS_O_APPEND- Append mode
Pointer to storage for file descriptor
Optional argument (usually NULL)
Size of optional argument (usually 0)
Zero on success, error code otherwise
sysFsClose
Close a file.File descriptor from sysFsOpen
Zero on success, error code otherwise
sysFsRead
Read from a file.File descriptor
Buffer to read into
Number of bytes to read
Pointer to storage for actual bytes read
Zero on success, error code otherwise
sysFsWrite
Write to a file.File descriptor
Buffer to write from
Number of bytes to write
Pointer to storage for actual bytes written
Zero on success, error code otherwise
sysFsLseek
Seek to a position in a file.File descriptor
Offset in bytes
Seek origin:
SEEK_SET, SEEK_CUR, or SEEK_ENDPointer to storage for new file position
Zero on success, error code otherwise
sysFsFsync
Flush file buffers to disk.File descriptor
Zero on success, error code otherwise
File Information
sysFsStat
Get file information by path.File path
Pointer to stat structure to fill
Zero on success, error code otherwise
sysFsFstat
Get file information by descriptor.File descriptor
Pointer to stat structure to fill
Zero on success, error code otherwise
File Manipulation
sysFsUnlink
Delete a file.Path to file to delete
Zero on success, error code otherwise
sysFsChmod
Change file permissions.File path
New permission mode
Zero on success, error code otherwise
Directory Operations
sysFsMkdir
Create a directory.Directory path to create
Directory permissions
Zero on success, error code otherwise
sysFsRmdir
Remove an empty directory.Directory path to remove
Zero on success, error code otherwise
sysFsOpendir
Open a directory for reading.Directory path
Pointer to storage for directory descriptor
Zero on success, error code otherwise
sysFsReaddir
Read a directory entry.Directory descriptor from sysFsOpendir
Pointer to directory entry structure to fill
Pointer to storage for read status (0 = end of directory)
Zero on success, error code otherwise
sysFsClosedir
Close a directory.Directory descriptor
Zero on success, error code otherwise
Data Structures
sysFSStat
File status information.sysFSDirent
Directory entry.Constants
Open Flags
SYS_O_RDONLY(000000) - Read onlySYS_O_WRONLY(000001) - Write onlySYS_O_RDWR(000002) - Read and writeSYS_O_CREAT(000100) - Create file if it doesn’t existSYS_O_EXCL(000200) - Exclusive create (fail if exists)SYS_O_TRUNC(001000) - Truncate to zero lengthSYS_O_APPEND(002000) - Append modeSYS_O_MSELF(010000) - MSELF file
Low-Level LV2 Functions
The following functions provide direct access to LV2 syscalls:sysLv2FsOpen()- Syscall 801sysLv2FsRead()- Syscall 802sysLv2FsWrite()- Syscall 803sysLv2FsClose()- Syscall 804sysLv2FsOpenDir()- Syscall 805sysLv2FsReadDir()- Syscall 806sysLv2FsCloseDir()- Syscall 807sysLv2FsStat()- Syscall 808sysLv2FsFStat()- Syscall 809sysLv2FsMkdir()- Syscall 811sysLv2FsRename()- Syscall 812sysLv2FsRmdir()- Syscall 813sysLv2FsUnlink()- Syscall 814