Fix XamContent return (!) and vfs use.

Progress on #305.
This commit is contained in:
Ben Vanik 2015-06-28 17:33:06 -07:00
parent 1106029afc
commit b663b615bf
6 changed files with 19 additions and 20 deletions

View File

@ -33,6 +33,7 @@ ContentPackage::ContentPackage(KernelState* kernel_state, std::string root_name,
auto fs = kernel_state_->file_system();
auto device =
std::make_unique<vfs::HostPathDevice>(device_path_, package_path, false);
device->Initialize();
fs->RegisterDevice(std::move(device));
fs->RegisterSymbolicLink(root_name_ + ":", device_path_);
}

View File

@ -177,8 +177,7 @@ X_STATUS XUserModule::GetOptHeader(uint8_t* membase, const xex2_header* header,
break;
default:
// Data stored at offset to header.
field_value = uint32_t((uint8_t*)header - membase) +
opt_header.offset;
field_value = uint32_t((uint8_t*)header - membase) + opt_header.offset;
break;
}
break;

View File

@ -310,8 +310,8 @@ void XamContentCreateCore(PPCContext* ppc_context, KernelState* kernel_state,
}
if (overlapped_ptr) {
kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, disposition,
result, 0);
kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, result,
disposition, 0);
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
} else {
SHIM_SET_RETURN_32(result);

View File

@ -182,8 +182,8 @@ SHIM_CALL XamEnumerate_shim(PPCContext* ppc_context,
auto e = kernel_state->object_table()->LookupObject<XEnumerator>(handle);
if (!e) {
if (overlapped_ptr) {
kernel_state->CompleteOverlappedImmediateEx(overlapped_ptr, 0,
X_ERROR_INVALID_HANDLE, 0);
kernel_state->CompleteOverlappedImmediateEx(
overlapped_ptr, X_ERROR_INVALID_HANDLE, X_ERROR_INVALID_HANDLE, 0);
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
} else {
SHIM_SET_RETURN_32(X_ERROR_INVALID_HANDLE);

View File

@ -19,7 +19,6 @@ Device::Device(const std::string& mount_path) : mount_path_(mount_path) {}
Device::~Device() = default;
void Device::Dump(StringBuffer* string_buffer) {
if (root_entry_) {
root_entry_->Dump(string_buffer, 0);
}
}
@ -31,11 +30,6 @@ Entry* Device::ResolvePath(const char* path) {
XELOGFS("Device::ResolvePath(%s)", path);
if (!root_entry_) {
// No content at all.
return nullptr;
}
// Walk the path, one separator at a time.
auto entry = root_entry_.get();
auto path_parts = xe::split_path(path);

View File

@ -25,10 +25,15 @@ HostPathDevice::HostPathDevice(const std::string& mount_path,
HostPathDevice::~HostPathDevice() = default;
bool HostPathDevice::Initialize() {
if (!filesystem::PathExists(local_path_)) {
if (!xe::filesystem::PathExists(local_path_)) {
if (!read_only_) {
// Create the path.
xe::filesystem::CreateFolder(local_path_);
} else {
XELOGE("Host path does not exist");
return false;
}
}
auto root_entry = new HostPathEntry(this, "", local_path_);
root_entry->attributes_ = kFileAttributeDirectory;
@ -39,7 +44,7 @@ bool HostPathDevice::Initialize() {
}
void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
auto child_infos = filesystem::ListFiles(entry->local_path());
auto child_infos = xe::filesystem::ListFiles(entry->local_path());
for (auto& child_info : child_infos) {
auto child =
new HostPathEntry(this, xe::to_string(child_info.name),
@ -48,7 +53,7 @@ void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
child->access_timestamp_ = child_info.access_timestamp;
child->write_timestamp_ = child_info.write_timestamp;
if (child_info.type == filesystem::FileInfo::Type::kDirectory) {
if (child_info.type == xe::filesystem::FileInfo::Type::kDirectory) {
child->attributes_ = kFileAttributeDirectory;
} else {
child->attributes_ = kFileAttributeNormal;
@ -62,7 +67,7 @@ void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
entry->children_.push_back(std::unique_ptr<Entry>(child));
if (child_info.type == filesystem::FileInfo::Type::kDirectory) {
if (child_info.type == xe::filesystem::FileInfo::Type::kDirectory) {
PopulateEntry(child);
}
}