|
ReXGlue SDK
|
Public Member Functions | |
| FileObject (std::unique_ptr< filesystem::IFile > file_in, bool synchronous) | |
| ~FileObject () | |
| X_STATUS | ReadScatter (TitleRuntime &runtime, u32 segments_address, u32 length, u64 byte_offset, u32 *out_bytes_read, u32 apc_context) |
| X_STATUS | Read (TitleRuntime &runtime, u32 buffer_address, u32 buffer_length, u64 byte_offset, u32 *out_bytes_read, u32 apc_context, bool notify_completion=true) |
| X_STATUS | Read (u32 buffer_address, u32 buffer_length, u64 byte_offset, u32 *out_bytes_read, u32 apc_context, bool notify_completion=true) override |
| X_STATUS | Write (TitleRuntime &runtime, u32 buffer_address, u32 buffer_length, u64 byte_offset, u32 *out_bytes_written, u32 apc_context) |
| X_STATUS | Write (u32 buffer_address, u32 buffer_length, u64 byte_offset, u32 *out_bytes_written, u32 apc_context) override |
| X_STATUS | QueryDirectory (TitleRuntime &runtime, X_FILE_DIRECTORY_INFORMATION *out_info, size_t length, std::string_view file_name, bool restart) |
| X_STATUS | SetLength (u64 length) |
| X_STATUS | SetAllocation (u64 size) |
| X_STATUS | Rename (filesystem::IFileSystem &file_system, std::string_view path, bool replace_existing, FileObject *root) |
| u64 | Seek (i64 distance, SeekOrigin origin) override |
| X_STATUS | SetLengthToPosition () override |
| void | SetPosition (u64 value) |
| u64 | GetPosition () |
| void | SetFindPattern (std::string_view pattern) override |
| std::optional< filesystem::FileStat > | FindNext () override |
| u64 | GetSize () override |
| std::string | GetAbsolutePath () override |
| void | RegisterIOCompletionPort (TitleRuntime &runtime, u32 key, X_HANDLE port) |
Public Attributes | |
| std::unique_ptr< filesystem::IFile > | file |
| std::unique_ptr< rex::platform::Event > | async_event |
| std::mutex | file_lock |
| std::mutex | completion_port_lock |
| std::vector< std::pair< u32, X_HANDLE > > | completion_ports |
| IObjectTable * | port_table = nullptr |
| PropagateConst< std::unique_ptr< filesystem::IDirectory > > | find |
| bool | is_synchronous = false |
| TitleRuntime * | owner = nullptr |
| rex::kernel::FileObject::FileObject | ( | std::unique_ptr< filesystem::IFile > | file_in, |
| bool | synchronous ) |
| synchronous | True when the file was opened for synchronous IO. |
| rex::kernel::FileObject::~FileObject | ( | ) |
Closes the IO completion port handles the file owns.
|
overridevirtual |
Implements rex::kernel::IOpenedFile.
|
overridevirtual |
Implements rex::kernel::IOpenedFile.
|
overridevirtual |
Implements rex::kernel::IOpenedFile.
| X_STATUS rex::kernel::FileObject::QueryDirectory | ( | TitleRuntime & | runtime, |
| X_FILE_DIRECTORY_INFORMATION * | out_info, | ||
| size_t | length, | ||
| std::string_view | file_name, | ||
| bool | restart ) |
Writes the next directory entry that matches a pattern.
| out_info | Receives the entry. |
| file_name | The pattern, empty to continue the current listing. |
| X_STATUS rex::kernel::FileObject::Read | ( | TitleRuntime & | runtime, |
| u32 | buffer_address, | ||
| u32 | buffer_length, | ||
| u64 | byte_offset, | ||
| u32 * | out_bytes_read, | ||
| u32 | apc_context, | ||
| bool | notify_completion = true ) |
Reads into guest memory and notifies the IO completion ports of the file.
| byte_offset | The file offset, or the maximum value to read at the current position. |
| out_bytes_read | Receives the bytes read, may be null. |
| apc_context | The context reported to the completion ports. |
| notify_completion | False to skip the completion ports and the async event. |
|
inlineoverridevirtual |
Reads into guest memory and notifies the IO completion ports of the file.
| byte_offset | The file offset, or the maximum value to read at the current position. |
| out_bytes_read | Receives the bytes read, may be null. |
| apc_context | The context reported to the completion ports. |
| notify_completion | False to skip the completion ports and the async event. |
Implements rex::kernel::IOpenedFile.
| X_STATUS rex::kernel::FileObject::ReadScatter | ( | TitleRuntime & | runtime, |
| u32 | segments_address, | ||
| u32 | length, | ||
| u64 | byte_offset, | ||
| u32 * | out_bytes_read, | ||
| u32 | apc_context ) |
Reads into the page sized segments of a guest segment array.
| segments_address | The guest address of the segment array. |
| byte_offset | The file offset, or the maximum value to read at the current position. |
| out_bytes_read | Receives the bytes read, may be null. |
| apc_context | The context reported to the completion ports. |
| void rex::kernel::FileObject::RegisterIOCompletionPort | ( | TitleRuntime & | runtime, |
| u32 | key, | ||
| X_HANDLE | port ) |
Associates an IO completion port with the file. The file owns a duplicate of the port handle.
| key | The completion key reported with each notification. |
| port | The handle of the IO completion port. |
| X_STATUS rex::kernel::FileObject::Rename | ( | filesystem::IFileSystem & | file_system, |
| std::string_view | path, | ||
| bool | replace_existing, | ||
| FileObject * | root ) |
Moves the file inside its mount.
| file_system | The file system that serves the file. |
| replace_existing | True to replace a closed file at the new path. |
| root | The directory the new path is relative to, or null. |
|
overridevirtual |
Moves the position of the file.
| distance | The signed byte distance. |
| origin | The origin the distance is measured from. |
Implements rex::kernel::IOpenedFile.
| X_STATUS rex::kernel::FileObject::SetAllocation | ( | u64 | size | ) |
Sets the allocation size of the file, which truncates only a file that is longer.
|
overridevirtual |
Starts a directory listing.
| pattern | The pattern to match, empty for every entry. |
Implements rex::kernel::IOpenedFile.
| X_STATUS rex::kernel::FileObject::SetLength | ( | u64 | length | ) |
|
overridevirtual |
Sets the length of the file to the current position.
Implements rex::kernel::IOpenedFile.
| X_STATUS rex::kernel::FileObject::Write | ( | TitleRuntime & | runtime, |
| u32 | buffer_address, | ||
| u32 | buffer_length, | ||
| u64 | byte_offset, | ||
| u32 * | out_bytes_written, | ||
| u32 | apc_context ) |
Writes from guest memory and notifies the IO completion ports of the file.
| byte_offset | The file offset, or the maximum value to write at the current position. |
| out_bytes_written | Receives the bytes written, may be null. |
| apc_context | The context reported to the completion ports. |
|
inlineoverridevirtual |
Writes from guest memory and notifies the IO completion ports of the file.
| byte_offset | The file offset, or the maximum value to write at the current position. |
| out_bytes_written | Receives the bytes written, may be null. |
| apc_context | The context reported to the completion ports. |
Implements rex::kernel::IOpenedFile.
| std::unique_ptr<rex::platform::Event> rex::kernel::FileObject::async_event |
Auto reset event set when an asynchronous read or write completes, waited on by the handle.
| std::mutex rex::kernel::FileObject::completion_port_lock |
Guards completion_ports and port_table.
| std::vector<std::pair<u32, X_HANDLE> > rex::kernel::FileObject::completion_ports |
Completion key and port handle of each IO completion port the file posts to.
|
mutable |
Guards position_, find and the reads and writes of file.
| PropagateConst<std::unique_ptr<filesystem::IDirectory> > rex::kernel::FileObject::find |
Directory listing a find call is walking, null before the first find.
| TitleRuntime* rex::kernel::FileObject::owner = nullptr |
The runtime the interface Read and Write run in, set when the table creates the file.
| IObjectTable* rex::kernel::FileObject::port_table = nullptr |
Table that owns the handles in completion_ports, set when the first port registers.