vitasdk
Documentation of the vitasdk

Exports for Kernel. More...

Functions

SceUID ksceIoOpen (const char *file, int flags, SceMode mode)
 Open or create a file for reading or writing.
 
int ksceIoClose (SceUID fd)
 Delete a descriptor.
 
int ksceIoRead (SceUID fd, void *data, SceSize size)
 Read input.
 
int ksceIoPread (SceUID fd, void *data, SceSize size, SceOff offset)
 Read input at offset.
 
int ksceIoWrite (SceUID fd, const void *data, SceSize size)
 Write output.
 
int ksceIoPwrite (SceUID fd, const void *data, SceSize size, SceOff offset)
 Write output at offset.
 
SceOff ksceIoLseek (SceUID fd, SceOff offset, int whence)
 Reposition read/write file descriptor offset.
 
int ksceIoRemove (const char *file)
 Remove directory entry.
 
int ksceIoRename (const char *oldname, const char *newname)
 Change the name of a file.
 
int ksceIoSync (const char *device, unsigned int unk)
 Synchronize the file data on the device.
 
int ksceIoSyncByFd (SceUID fd)
 Synchronize the file data for one file.
 

Detailed Description

Exports for Kernel.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceIofilemgrForDriver_stub



Function Documentation

◆ ksceIoOpen()

SceUID ksceIoOpen ( const char *  file,
int  flags,
SceMode  mode 
)

Open or create a file for reading or writing.

Example1: Open a file for reading
if(!(fd = ksceIoOpen("device:/path/to/file", SCE_O_RDONLY, 0777)) {
// error
}
SceUID ksceIoOpen(const char *file, int flags, SceMode mode)
Open or create a file for reading or writing.
@ SCE_O_RDONLY
Read-only.
Definition iofilemgr.h:29
Example2: Open a file for writing, creating it if it doesn't exist
if(!(fd = ksceIoOpen("device:/path/to/file", SCE_O_WRONLY|SCE_O_CREAT, 0777)) {
// error
}
@ SCE_O_WRONLY
Write-only.
Definition iofilemgr.h:30
@ SCE_O_CREAT
Create.
Definition iofilemgr.h:37
Parameters
file- Pointer to a string holding the name of the file to open
flags- Libc styled flags that are or'ed together
mode- File access mode (One or more SceIoMode).
Returns
A non-negative integer is a valid fd, anything else an error

◆ ksceIoClose()

int ksceIoClose ( SceUID  fd)

Delete a descriptor.

int ksceIoClose(SceUID fd)
Delete a descriptor.
Parameters
fd- File descriptor to close
Returns
< 0 on error

◆ ksceIoRead()

int ksceIoRead ( SceUID  fd,
void *  data,
SceSize  size 
)

Read input.

Example:
bytes_read = ksceIoRead(fd, data, 100);
int ksceIoRead(SceUID fd, void *data, SceSize size)
Read input.
Parameters
fd- Opened file descriptor to read from
data- Pointer to the buffer where the read data will be placed
size- Size of the read in bytes
Returns
The number of bytes read

◆ ksceIoPread()

int ksceIoPread ( SceUID  fd,
void *  data,
SceSize  size,
SceOff  offset 
)

Read input at offset.

Example:
bytes_read = ksceIoPread(fd, data, 100, 0x1000);
int ksceIoPread(SceUID fd, void *data, SceSize size, SceOff offset)
Read input at offset.
Parameters
fd- Opened file descriptor to read from
data- Pointer to the buffer where the read data will be placed
size- Size of the read in bytes
offset- Offset to read
Returns
< 0 on error.

◆ ksceIoWrite()

int ksceIoWrite ( SceUID  fd,
const void *  data,
SceSize  size 
)

Write output.

Example:
bytes_written = ksceIoWrite(fd, data, 100);
int ksceIoWrite(SceUID fd, const void *data, SceSize size)
Write output.
Parameters
fd- Opened file descriptor to write to
data- Pointer to the data to write
size- Size of data to write
Returns
The number of bytes written

◆ ksceIoPwrite()

int ksceIoPwrite ( SceUID  fd,
const void *  data,
SceSize  size,
SceOff  offset 
)

Write output at offset.

Example:
bytes_written = ksceIoPwrite(fd, data, 100, 0x1000);
int ksceIoPwrite(SceUID fd, const void *data, SceSize size, SceOff offset)
Write output at offset.
Parameters
fd- Opened file descriptor to write to
data- Pointer to the data to write
size- Size of data to write
offset- Offset to write
Returns
The number of bytes written

◆ ksceIoLseek()

SceOff ksceIoLseek ( SceUID  fd,
SceOff  offset,
int  whence 
)

Reposition read/write file descriptor offset.

Example:
pos = ksceIoLseek(fd, -10, SCE_SEEK_END);
SceOff ksceIoLseek(SceUID fd, SceOff offset, int whence)
Reposition read/write file descriptor offset.
@ SCE_SEEK_END
Starts from the end of the file.
Definition iofilemgr.h:52
Parameters
fd- Opened file descriptor with which to seek
offset- Relative offset from the start position given by whence
whence- One of SceIoSeekMode.
Returns
The position in the file after the seek.

◆ ksceIoRemove()

int ksceIoRemove ( const char *  file)

Remove directory entry.

Parameters
file- Path to the file to remove
Returns
< 0 on error

◆ ksceIoRename()

int ksceIoRename ( const char *  oldname,
const char *  newname 
)

Change the name of a file.

Parameters
oldname- The old filename
newname- The new filename
Returns
< 0 on error.

◆ ksceIoSync()

int ksceIoSync ( const char *  device,
unsigned int  unk 
)

Synchronize the file data on the device.

Parameters
device- The device to synchronize (e.g. msfat0:)
unk- Unknown

◆ ksceIoSyncByFd()

int ksceIoSyncByFd ( SceUID  fd)

Synchronize the file data for one file.

Parameters
fd- Opened file descriptor to sync
Returns
< 0 on error.