mirror of
https://github.com/IllusionMan1212/vitasdk-odin.git
synced 2026-10-24 02:12:38 +00:00
204 lines
7.6 KiB
Odin
204 lines
7.6 KiB
Odin
package vfs
|
|||
|
|
|
||
|
|
import "core:c"
|
||
|
|
import sce "../common"
|
||
|
|
import sceIo "../Io"
|
||
|
|
|
||
|
|
foreign import vfs "system:SceIofilemgrForDriver_stub"
|
||
|
|
|
||
|
|
foreign vfs {
|
||
|
|
/**
|
||
|
|
* Register a VFS implementation
|
||
|
|
*
|
||
|
|
* @param vfs_info - The VFS Info structure for the VFS. (This pointer should remain persistent until the VFS is deleted)
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
ksceVfsAddVfs :: proc(vfs_info: ^SceVfsInfo) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Unegister a VFS implementation
|
||
|
|
*
|
||
|
|
* @param name - The name of the VFS implementation to unregister
|
||
|
|
* @param vfs_info - The VFS Info structure for the VFS. (This pointer should remain persistent until the VFS is deleted)
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
ksceVfsDeleteVfs :: proc(name: cstring, vfs_info: ^^SceVfsInfo) -> c.int ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Mount a drive
|
||
|
|
*
|
||
|
|
* @param param - The mount parameters
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsMount :: proc(param: ^SceVfsMountParam) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Unmount a drive
|
||
|
|
*
|
||
|
|
* @param param - The unmount parameters
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsUmount :: proc(param: ^SceVfsUmountParam) -> c.int ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Mount a drive via the mount daemon
|
||
|
|
*
|
||
|
|
* @param param - The mount parameters
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsMountForPFS :: proc(param: ^SceVfsMountParam) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Unmount a drive via the mount daemon
|
||
|
|
*
|
||
|
|
* @param param - The unmount parameters
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsUmountForPFS :: proc(param: ^SceVfsUmountParam, unk: c.int, unk2: c.int) -> c.int ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Lock the mnt
|
||
|
|
*
|
||
|
|
* @param mnt - The mountpoint to lock
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsLockMnt :: proc(mnt: ^SceVfsMount) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Unlock the mnt
|
||
|
|
*
|
||
|
|
* @param mnt - The mountpoint to unlock
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsUnlockMnt :: proc(mnt: ^SceVfsMount) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Is the mnt lock held by the current thread ?
|
||
|
|
*
|
||
|
|
* @param mnt - The mount point to query
|
||
|
|
*
|
||
|
|
* @return SCE_TRUE if the lock is held, SCE_FALSE if it is not, and < 0 on error
|
||
|
|
*/
|
||
|
|
vfsIsLockedMnt :: proc(mnt: ^SceVfsMount) -> sce.Bool ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Allocate a new VFS file object
|
||
|
|
*
|
||
|
|
* @param vp - The vnode the file should be referencing
|
||
|
|
* @param file - The pointer reference the file will be returned to
|
||
|
|
* @param name - The name of the file
|
||
|
|
*
|
||
|
|
* @return The UID of the file object on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsAllocateFile :: proc(vp: ^SceVfsVnode, file: ^^SceVfsFile, name: cstring) -> sce.UID ---
|
||
|
|
/**
|
||
|
|
* Free a File object
|
||
|
|
*
|
||
|
|
* @param vp - Vnode for the file handle being freed
|
||
|
|
* @param fd - UID of the file being freed
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsFreeFile :: proc(vp: ^SceVfsVnode, fd: sce.UID) -> c.int ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get a new vnode from the pool
|
||
|
|
*
|
||
|
|
* @param mnt - The mountpoint the vnode will be attached to
|
||
|
|
* @param vops - The vnode vop table for executing VFS Vops
|
||
|
|
* @param unk - Must be 0
|
||
|
|
* @param vpp - The pointer reference to return the vnode to
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsGetNewVnode :: proc(mnt: ^SceVfsMount, vops: ^SceVopTable, unk: c.int, vpp: ^^SceVfsVnode) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Return a vnode to the pool
|
||
|
|
*
|
||
|
|
* @param vp - The vnode to return
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsFreeVnode :: proc(vp: ^SceVfsVnode) -> c.int ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Lock a vnode
|
||
|
|
*
|
||
|
|
* @param vp - Target vnode
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsLockVnode :: proc(vp: ^SceVfsVnode) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Unlock a vnode
|
||
|
|
*
|
||
|
|
* @param vp - Target vnode
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsUnlockVnode :: proc(vp: ^SceVfsVnode) -> c.int ---
|
||
|
|
/**
|
||
|
|
* Does the current thread own the vnode lock
|
||
|
|
*
|
||
|
|
* @param vp - Target vnode
|
||
|
|
*
|
||
|
|
* @return SCE_TRUE if the lock is owned, SCE_FALSE if it is not, and < 0 on error
|
||
|
|
*/
|
||
|
|
vfsIsOwnerVnode :: proc(vp: ^SceVfsVnode) -> sce.Bool ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the name of a vnode
|
||
|
|
*
|
||
|
|
* @param vp - Target vnode
|
||
|
|
* @param name - Buffer for the name
|
||
|
|
* @param n - Buffer size
|
||
|
|
* @param result - Length of the returned name
|
||
|
|
*
|
||
|
|
* @return 0 on success, < 0 on error
|
||
|
|
*/
|
||
|
|
vfsGetVnodeName :: proc(vp: ^SceVfsVnode, name: cstring, n: sce.Size, result: ^sce.Size) -> c.int ---
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @name VFS Vop APIs
|
||
|
|
*
|
||
|
|
* These are relevant when doing operations on vnodes owned by other VFS implementations (block devices, etc.)
|
||
|
|
*/
|
||
|
|
ksceVopOpen :: proc(vp: ^SceVfsVnode, path: ^SceVfsPath, flags: c.int, file: ^SceVfsFile) -> c.int ---
|
||
|
|
ksceVopCreate :: proc(dvp: ^SceVfsVnode, vpp: ^^SceVfsVnode, path: ^SceVfsPath, flags: c.int, mode: c.int) -> c.int ---
|
||
|
|
ksceVopClose :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile) -> c.int ---
|
||
|
|
ksceVopLookup :: proc(dvp: ^SceVfsVnode, vpp: ^^SceVfsVnode, path: ^SceVfsPath, flags: sce.UInt32) -> c.int ---
|
||
|
|
ksceVopRead :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, data: rawptr, nbyte: sce.Size, result: ^sce.Size) -> c.int ---
|
||
|
|
ksceVopWrite :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, data: rawptr, nbyte: sce.Size, result: ^sce.Size) -> c.int ---
|
||
|
|
ksceVopLseek :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, offset: sce.Off, whence: c.int) -> sce.Off ---
|
||
|
|
|
||
|
|
ksceVopIoctl :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, cmd: c.int, in_data: rawptr, in_len: sce.Size, out_data: rawptr, out_len: sce.Size) -> c.int ---
|
||
|
|
ksceVopRemove :: proc(dvp: ^SceVfsVnode, vp: ^SceVfsVnode, path: ^SceVfsPath, flags: sce.UInt32) -> c.int ---
|
||
|
|
ksceVopMkdir :: proc(dvp: ^SceVfsVnode, vpp: ^^SceVfsVnode, path: ^SceVfsPath, mode: c.int) -> c.int ---
|
||
|
|
ksceVopRmdir :: proc(dvp: ^SceVfsVnode, vp: ^SceVfsVnode, path: ^SceVfsPath) -> c.int ---
|
||
|
|
|
||
|
|
ksceVopDopen :: proc(vp: ^SceVfsVnode, path: ^SceVfsPath, file: ^SceVfsFile) -> c.int ---
|
||
|
|
ksceVopDclose :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile) -> c.int ---
|
||
|
|
ksceVopDread :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, dir: ^sceIo.SceIoDirent) -> c.int ---
|
||
|
|
|
||
|
|
ksceVopGetstat :: proc(vp: ^SceVfsVnode, path: ^SceVfsPath, stat: ^sceIo.SceIoStat) -> c.int ---
|
||
|
|
ksceVopChstat :: proc(vp: ^SceVfsVnode, path: ^SceVfsPath, stat: ^sceIo.SceIoStat, bit: c.int) -> c.int ---
|
||
|
|
|
||
|
|
ksceVopRename :: proc(odvp: ^SceVfsVnode, ovp: ^SceVfsVnode, old_path: ^SceVfsPath, ndvp: ^SceVfsVnode, nvpp: ^^SceVfsVnode, new_path: ^SceVfsPath) -> c.int ---
|
||
|
|
ksceVopPread :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, data: rawptr, nbyte: sce.Size, offset: sce.Off, pResult: ^sce.Size) -> c.int ---
|
||
|
|
ksceVopPwrite :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, data: rawptr, nbyte: sce.Size, offset: sce.Off, result: ^sce.Size) -> c.int ---
|
||
|
|
ksceVopInactive :: proc(vp: ^SceVfsVnode) -> c.int ---
|
||
|
|
ksceVopSync :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, flags: c.int) -> c.int ---
|
||
|
|
ksceVopFgetstat :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, stat: ^sceIo.SceIoStat) -> c.int ---
|
||
|
|
ksceVopFchstat :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile, stat: ^sceIo.SceIoStat , bit: c.int) -> c.int ---
|
||
|
|
|
||
|
|
ksceVopLink :: proc(fvp: ^SceVfsVnode, tvp: ^SceVfsVnode) -> c.int ---
|
||
|
|
ksceVopUnlink :: proc(fvp: ^SceVfsVnode, tvp: ^SceVfsVnode) -> c.int ---
|
||
|
|
|
||
|
|
ksceVopWhiteout :: proc(dvp: ^SceVfsVnode, vp: ^SceVfsVnode, old_path: ^SceVfsPath, new_path: ^SceVfsPath) -> c.int ---
|
||
|
|
ksceVopCleanup :: proc(vp: ^SceVfsVnode, file: ^SceVfsFile) -> c.int ---
|
||
|
|
ksceVopZerofill :: proc(vp: ^SceVfsVnode, unk: sce.UInt64, unk1: sce.UInt64, unk2: sce.UInt64) -> c.int ---
|
||
|
|
}
|