Moving mmap to poly, cleaning up devices.

This commit is contained in:
Ben Vanik
2014-08-17 12:57:02 -07:00
parent 24fe169f36
commit 854bcdb60a
37 changed files with 568 additions and 653 deletions

View File

@@ -9,44 +9,35 @@
#include <xenia/kernel/fs/devices/host_path_file.h>
#include <xenia/kernel/fs/device.h>
#include <xenia/kernel/fs/devices/host_path_entry.h>
#include <xenia/kernel/fs/device.h>
namespace xe {
namespace kernel {
namespace fs {
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::fs;
HostPathFile::HostPathFile(KernelState* kernel_state, Mode mode,
HostPathEntry* entry, HANDLE file_handle)
: entry_(entry),
file_handle_(file_handle),
XFile(kernel_state, mode) {}
HostPathFile::~HostPathFile() { CloseHandle(file_handle_); }
HostPathFile::HostPathFile(
KernelState* kernel_state, uint32_t desired_access,
HostPathEntry* entry, HANDLE file_handle) :
entry_(entry), file_handle_(file_handle),
XFile(kernel_state, desired_access) {
}
HostPathFile::~HostPathFile() {
CloseHandle(file_handle_);
}
const std::string& HostPathFile::path() const {
return entry_->path();
}
const std::string& HostPathFile::path() const { return entry_->path(); }
const std::string& HostPathFile::absolute_path() const {
return entry_->absolute_path();
}
const std::string& HostPathFile::name() const {
return entry_->name();
}
const std::string& HostPathFile::name() const { return entry_->name(); }
X_STATUS HostPathFile::QueryInfo(XFileInfo* out_info) {
return entry_->QueryInfo(out_info);
}
X_STATUS HostPathFile::QueryDirectory(XDirectoryInfo* out_info,
size_t length, const char* file_name, bool restart) {
X_STATUS HostPathFile::QueryDirectory(XDirectoryInfo* out_info, size_t length,
const char* file_name, bool restart) {
return entry_->QueryDirectory(out_info, length, file_name, restart);
}
@@ -54,19 +45,19 @@ X_STATUS HostPathFile::QueryVolume(XVolumeInfo* out_info, size_t length) {
return entry_->device()->QueryVolume(out_info, length);
}
X_STATUS HostPathFile::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
X_STATUS HostPathFile::QueryFileSystemAttributes(
XFileSystemAttributeInfo* out_info, size_t length) {
return entry_->device()->QueryFileSystemAttributes(out_info, length);
}
X_STATUS HostPathFile::ReadSync(
void* buffer, size_t buffer_length, size_t byte_offset,
size_t* out_bytes_read) {
X_STATUS HostPathFile::ReadSync(void* buffer, size_t buffer_length,
size_t byte_offset, size_t* out_bytes_read) {
OVERLAPPED overlapped;
overlapped.Pointer = (PVOID)byte_offset;
overlapped.hEvent = NULL;
DWORD bytes_read = 0;
BOOL read = ReadFile(
file_handle_, buffer, (DWORD)buffer_length, &bytes_read, &overlapped);
BOOL read = ReadFile(file_handle_, buffer, (DWORD)buffer_length, &bytes_read,
&overlapped);
if (read) {
*out_bytes_read = bytes_read;
return X_STATUS_SUCCESS;
@@ -74,3 +65,7 @@ X_STATUS HostPathFile::ReadSync(
return X_STATUS_END_OF_FILE;
}
}
} // namespace fs
} // namespace kernel
} // namespace xe