Moving mmap to poly, cleaning up devices.
This commit is contained in:
@@ -15,39 +15,31 @@
|
||||
#include <xenia/kernel/fs/devices/stfs_container_entry.h>
|
||||
#include <xenia/kernel/fs/stfs.h>
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
using namespace xe::kernel::fs;
|
||||
namespace xe {
|
||||
namespace kernel {
|
||||
namespace fs {
|
||||
|
||||
STFSContainerFile::STFSContainerFile(KernelState* kernel_state, Mode mode,
|
||||
STFSContainerEntry* entry)
|
||||
: entry_(entry), XFile(kernel_state, mode) {}
|
||||
|
||||
STFSContainerFile::STFSContainerFile(
|
||||
KernelState* kernel_state, uint32_t desired_access,
|
||||
STFSContainerEntry* entry) :
|
||||
entry_(entry),
|
||||
XFile(kernel_state, desired_access) {
|
||||
}
|
||||
STFSContainerFile::~STFSContainerFile() {}
|
||||
|
||||
STFSContainerFile::~STFSContainerFile() {
|
||||
}
|
||||
|
||||
const std::string& STFSContainerFile::path() const {
|
||||
return entry_->path();
|
||||
}
|
||||
const std::string& STFSContainerFile::path() const { return entry_->path(); }
|
||||
|
||||
const std::string& STFSContainerFile::absolute_path() const {
|
||||
return entry_->absolute_path();
|
||||
}
|
||||
|
||||
const std::string& STFSContainerFile::name() const {
|
||||
return entry_->name();
|
||||
}
|
||||
const std::string& STFSContainerFile::name() const { return entry_->name(); }
|
||||
|
||||
X_STATUS STFSContainerFile::QueryInfo(XFileInfo* out_info) {
|
||||
return entry_->QueryInfo(out_info);
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerFile::QueryDirectory(XDirectoryInfo* out_info,
|
||||
size_t length, const char* file_name, bool restart) {
|
||||
size_t length, const char* file_name,
|
||||
bool restart) {
|
||||
return entry_->QueryDirectory(out_info, length, file_name, restart);
|
||||
}
|
||||
|
||||
@@ -55,16 +47,15 @@ X_STATUS STFSContainerFile::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
return entry_->device()->QueryVolume(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerFile::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
X_STATUS STFSContainerFile::QueryFileSystemAttributes(
|
||||
XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
return entry_->device()->QueryFileSystemAttributes(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerFile::ReadSync(
|
||||
void* buffer, size_t buffer_length, size_t byte_offset,
|
||||
size_t* out_bytes_read) {
|
||||
X_STATUS STFSContainerFile::ReadSync(void* buffer, size_t buffer_length,
|
||||
size_t byte_offset,
|
||||
size_t* out_bytes_read) {
|
||||
STFSEntry* stfs_entry = entry_->stfs_entry();
|
||||
xe_mmap_ref mmap = entry_->mmap();
|
||||
uint8_t* map_ptr = xe_mmap_get_addr(mmap);
|
||||
if (byte_offset >= stfs_entry->size) {
|
||||
return X_STATUS_END_OF_FILE;
|
||||
}
|
||||
@@ -87,10 +78,14 @@ X_STATUS STFSContainerFile::ReadSync(
|
||||
offset += byte_offset % 4096;
|
||||
read_length = std::min(read_length, record.length - (byte_offset % 4096));
|
||||
}
|
||||
xe_copy_struct(dest_ptr, map_ptr + offset, read_length);
|
||||
xe_copy_struct(dest_ptr, entry_->mmap()->data() + offset, read_length);
|
||||
dest_ptr += read_length;
|
||||
remaining_length -= read_length;
|
||||
}
|
||||
*out_bytes_read = real_length;
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace fs
|
||||
} // namespace kernel
|
||||
} // namespace xe
|
||||
|
||||
Reference in New Issue
Block a user