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

@@ -12,39 +12,37 @@
#include <xenia/kernel/fs/stfs.h>
#include <xenia/kernel/fs/devices/stfs_container_file.h>
namespace xe {
namespace kernel {
namespace fs {
using namespace xe;
using namespace xe::kernel;
using namespace xe::kernel::fs;
STFSContainerEntry::STFSContainerEntry(Type type, Device* device,
const char* path,
poly::MappedMemory* mmap,
STFSEntry* stfs_entry)
: stfs_entry_(stfs_entry),
stfs_entry_iterator_(stfs_entry->children.end()),
mmap_(mmap),
Entry(type, device, path) {}
STFSContainerEntry::STFSContainerEntry(
Type type, Device* device, const char* path,
xe_mmap_ref mmap, STFSEntry* stfs_entry) :
stfs_entry_(stfs_entry),
stfs_entry_iterator_(stfs_entry->children.end()),
Entry(type, device, path) {
mmap_ = xe_mmap_retain(mmap);
}
STFSContainerEntry::~STFSContainerEntry() {
xe_mmap_release(mmap_);
}
STFSContainerEntry::~STFSContainerEntry() {}
X_STATUS STFSContainerEntry::QueryInfo(XFileInfo* out_info) {
assert_not_null(out_info);
out_info->creation_time = stfs_entry_->update_timestamp;
out_info->last_access_time = stfs_entry_->access_timestamp;
out_info->last_write_time = stfs_entry_->update_timestamp;
out_info->change_time = stfs_entry_->update_timestamp;
out_info->allocation_size = 4096;
out_info->file_length = stfs_entry_->size;
out_info->attributes = stfs_entry_->attributes;
out_info->creation_time = stfs_entry_->update_timestamp;
out_info->last_access_time = stfs_entry_->access_timestamp;
out_info->last_write_time = stfs_entry_->update_timestamp;
out_info->change_time = stfs_entry_->update_timestamp;
out_info->allocation_size = 4096;
out_info->file_length = stfs_entry_->size;
out_info->attributes = stfs_entry_->attributes;
return X_STATUS_SUCCESS;
}
X_STATUS STFSContainerEntry::QueryDirectory(
XDirectoryInfo* out_info, size_t length, const char* file_name, bool restart) {
X_STATUS STFSContainerEntry::QueryDirectory(XDirectoryInfo* out_info,
size_t length,
const char* file_name,
bool restart) {
assert_not_null(out_info);
if (restart && stfs_entry_iterator_ != stfs_entry_->children.end()) {
@@ -73,24 +71,26 @@ X_STATUS STFSContainerEntry::QueryDirectory(
return X_STATUS_UNSUCCESSFUL;
}
out_info->file_index = 0xCDCDCDCD;
out_info->creation_time = entry->update_timestamp;
out_info->file_index = 0xCDCDCDCD;
out_info->creation_time = entry->update_timestamp;
out_info->last_access_time = entry->access_timestamp;
out_info->last_write_time = entry->update_timestamp;
out_info->change_time = entry->update_timestamp;
out_info->end_of_file = entry->size;
out_info->allocation_size = 4096;
out_info->attributes = entry->attributes;
out_info->last_write_time = entry->update_timestamp;
out_info->change_time = entry->update_timestamp;
out_info->end_of_file = entry->size;
out_info->allocation_size = 4096;
out_info->attributes = entry->attributes;
out_info->file_name_length = static_cast<uint32_t>(entry_name.size());
memcpy(out_info->file_name, entry_name.c_str(), entry_name.size());
return X_STATUS_SUCCESS;
}
X_STATUS STFSContainerEntry::Open(
KernelState* kernel_state,
uint32_t desired_access, bool async,
XFile** out_file) {
*out_file = new STFSContainerFile(kernel_state, desired_access, this);
X_STATUS STFSContainerEntry::Open(KernelState* kernel_state, Mode mode,
bool async, XFile** out_file) {
*out_file = new STFSContainerFile(kernel_state, mode, this);
return X_STATUS_SUCCESS;
}
} // namespace fs
} // namespace kernel
} // namespace xe