Moved QueryVolume and QueryFileSystemAttributes to Device from Entry.
This commit is contained in:
parent
bcf75a1b98
commit
44847e9042
|
@ -30,6 +30,9 @@ public:
|
|||
|
||||
virtual Entry* ResolvePath(const char* path) = 0;
|
||||
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length) = 0;
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) = 0;
|
||||
|
||||
protected:
|
||||
char* path_;
|
||||
};
|
||||
|
|
|
@ -96,3 +96,13 @@ Entry* DiscImageDevice::ResolvePath(const char* path) {
|
|||
return new DiscImageEntry(
|
||||
type, this, path, mmap_, gdfx_entry);
|
||||
}
|
||||
|
||||
X_STATUS DiscImageDevice::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
X_STATUS DiscImageDevice::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ public:
|
|||
|
||||
virtual Entry* ResolvePath(const char* path);
|
||||
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length);
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length);
|
||||
|
||||
private:
|
||||
xechar_t* local_path_;
|
||||
xe_mmap_ref mmap_;
|
||||
|
|
|
@ -110,16 +110,6 @@ X_STATUS DiscImageEntry::QueryDirectory(
|
|||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
X_STATUS DiscImageEntry::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
X_STATUS DiscImageEntry::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
MemoryMapping* DiscImageEntry::CreateMemoryMapping(
|
||||
xe_file_mode file_mode, const size_t offset, const size_t length) {
|
||||
if (file_mode & kXEFileModeWrite) {
|
||||
|
|
|
@ -35,8 +35,6 @@ public:
|
|||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
|
||||
size_t length, const char* file_name, bool restart);
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length);
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length);
|
||||
|
||||
virtual bool can_map() { return true; }
|
||||
virtual MemoryMapping* CreateMemoryMapping(
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <xenia/kernel/fs/gdfx.h>
|
||||
#include <xenia/kernel/fs/devices/disc_image_entry.h>
|
||||
|
||||
#include <xenia/kernel/fs/device.h>
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
|
@ -50,11 +51,11 @@ X_STATUS DiscImageFile::QueryDirectory(XDirectoryInfo* out_info,
|
|||
}
|
||||
|
||||
X_STATUS DiscImageFile::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
return entry_->QueryVolume(out_info, length);
|
||||
return entry_->device()->QueryVolume(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS DiscImageFile::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
return entry_->QueryFileSystemAttributes(out_info, length);
|
||||
return entry_->device()->QueryFileSystemAttributes(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS DiscImageFile::ReadSync(
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <xenia/kernel/fs/devices/host_path_entry.h>
|
||||
|
||||
#include <xenia/kernel/objects/xfile.h>
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
|
@ -63,3 +64,40 @@ Entry* HostPathDevice::ResolvePath(const char* path) {
|
|||
HostPathEntry* entry = new HostPathEntry(type, this, path, full_path);
|
||||
return entry;
|
||||
}
|
||||
|
||||
// TODO(gibbed): call into HostPathDevice?
|
||||
X_STATUS HostPathDevice::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
XEASSERTNOTNULL(out_info);
|
||||
const char* name = "test"; // TODO(gibbed): actual value
|
||||
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
size_t name_length = strlen(name);
|
||||
if (((uint8_t*)&out_info->label[0]) + name_length > end) {
|
||||
return X_STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
out_info->creation_time = 0;
|
||||
out_info->serial_number = 12345678;
|
||||
out_info->supports_objects = 0;
|
||||
out_info->label_length = (uint32_t)name_length;
|
||||
memcpy(out_info->label, name, name_length);
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO(gibbed): call into HostPathDevice?
|
||||
X_STATUS HostPathDevice::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
XEASSERTNOTNULL(out_info);
|
||||
const char* name = "test"; // TODO(gibbed): actual value
|
||||
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
size_t name_length = strlen(name);
|
||||
if (((uint8_t*)&out_info->fs_name[0]) + name_length > end) {
|
||||
return X_STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
out_info->attributes = 0;
|
||||
out_info->maximum_component_name_length = 255; // TODO(gibbed): actual value
|
||||
out_info->fs_name_length = (uint32_t)name_length;
|
||||
memcpy(out_info->fs_name, name, name_length);
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ public:
|
|||
|
||||
virtual Entry* ResolvePath(const char* path);
|
||||
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length);
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length);
|
||||
|
||||
private:
|
||||
xechar_t* local_path_;
|
||||
};
|
||||
|
|
|
@ -140,43 +140,6 @@ X_STATUS HostPathEntry::QueryDirectory(
|
|||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO(gibbed): call into HostPathDevice?
|
||||
X_STATUS HostPathEntry::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
XEASSERTNOTNULL(out_info);
|
||||
const char* name = "test"; // TODO(gibbed): actual value
|
||||
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
size_t name_length = strlen(name);
|
||||
if (((uint8_t*)&out_info->label[0]) + name_length > end) {
|
||||
return X_STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
out_info->creation_time = 0;
|
||||
out_info->serial_number = 12345678;
|
||||
out_info->supports_objects = 0;
|
||||
out_info->label_length = (uint32_t)name_length;
|
||||
memcpy(out_info->label, name, name_length);
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO(gibbed): call into HostPathDevice?
|
||||
X_STATUS HostPathEntry::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
XEASSERTNOTNULL(out_info);
|
||||
const char* name = "test"; // TODO(gibbed): actual value
|
||||
|
||||
auto end = (uint8_t*)out_info + length;
|
||||
size_t name_length = strlen(name);
|
||||
if (((uint8_t*)&out_info->fs_name[0]) + name_length > end) {
|
||||
return X_STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
out_info->attributes = 0;
|
||||
out_info->maximum_component_name_length = 255; // TODO(gibbed): actual value
|
||||
out_info->fs_name_length = (uint32_t)name_length;
|
||||
memcpy(out_info->fs_name, name, name_length);
|
||||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
MemoryMapping* HostPathEntry::CreateMemoryMapping(
|
||||
xe_file_mode file_mode, const size_t offset, const size_t length) {
|
||||
xe_mmap_ref mmap = xe_mmap_open(file_mode, local_path_, offset, length);
|
||||
|
|
|
@ -32,8 +32,6 @@ public:
|
|||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
|
||||
size_t length, const char* file_name, bool restart);
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length);
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length);
|
||||
|
||||
virtual bool can_map() { return true; }
|
||||
virtual MemoryMapping* CreateMemoryMapping(
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <xenia/kernel/fs/devices/host_path_entry.h>
|
||||
|
||||
#include <xenia/kernel/fs/device.h>
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
|
@ -50,11 +51,11 @@ X_STATUS HostPathFile::QueryDirectory(XDirectoryInfo* out_info,
|
|||
}
|
||||
|
||||
X_STATUS HostPathFile::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
return entry_->QueryVolume(out_info, length);
|
||||
return entry_->device()->QueryVolume(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS HostPathFile::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
return entry_->QueryFileSystemAttributes(out_info, length);
|
||||
return entry_->device()->QueryFileSystemAttributes(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS HostPathFile::ReadSync(
|
||||
|
|
|
@ -97,3 +97,14 @@ Entry* STFSContainerDevice::ResolvePath(const char* path) {
|
|||
return new STFSContainerEntry(
|
||||
type, this, path, mmap_, stfs_entry);
|
||||
}
|
||||
|
||||
|
||||
X_STATUS STFSContainerDevice::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerDevice::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ public:
|
|||
|
||||
virtual Entry* ResolvePath(const char* path);
|
||||
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length);
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length);
|
||||
|
||||
private:
|
||||
xechar_t* local_path_;
|
||||
xe_mmap_ref mmap_;
|
||||
|
|
|
@ -88,16 +88,6 @@ X_STATUS STFSContainerEntry::QueryDirectory(
|
|||
return X_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerEntry::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerEntry::QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) {
|
||||
XEASSERTALWAYS();
|
||||
return X_STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerEntry::Open(
|
||||
KernelState* kernel_state,
|
||||
uint32_t desired_access, bool async,
|
||||
|
|
|
@ -35,8 +35,6 @@ public:
|
|||
virtual X_STATUS QueryInfo(XFileInfo* out_info);
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
|
||||
size_t length, const char* file_name, bool restart);
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length);
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length);
|
||||
|
||||
virtual X_STATUS Open(
|
||||
KernelState* kernel_state,
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <xenia/kernel/fs/stfs.h>
|
||||
#include <xenia/kernel/fs/devices/stfs_container_entry.h>
|
||||
|
||||
#include <xenia/kernel/fs/device.h>
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::kernel;
|
||||
|
@ -44,17 +45,17 @@ X_STATUS STFSContainerFile::QueryInfo(XFileInfo* out_info) {
|
|||
return entry_->QueryInfo(out_info);
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerFile::QueryVolume(XVolumeInfo* out_info, size_t length) {
|
||||
return entry_->QueryVolume(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerFile::QueryDirectory(XDirectoryInfo* out_info,
|
||||
size_t length, const char* file_name, bool restart) {
|
||||
return entry_->QueryDirectory(out_info, length, file_name, restart);
|
||||
}
|
||||
|
||||
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) {
|
||||
return entry_->QueryFileSystemAttributes(out_info, length);
|
||||
return entry_->device()->QueryFileSystemAttributes(out_info, length);
|
||||
}
|
||||
|
||||
X_STATUS STFSContainerFile::ReadSync(
|
||||
|
|
|
@ -64,8 +64,6 @@ public:
|
|||
virtual X_STATUS QueryInfo(XFileInfo* out_info) = 0;
|
||||
virtual X_STATUS QueryDirectory(XDirectoryInfo* out_info,
|
||||
size_t length, const char* file_name, bool restart) = 0;
|
||||
virtual X_STATUS QueryVolume(XVolumeInfo* out_info, size_t length) = 0;
|
||||
virtual X_STATUS QueryFileSystemAttributes(XFileSystemAttributeInfo* out_info, size_t length) = 0;
|
||||
|
||||
virtual bool can_map() { return false; }
|
||||
virtual MemoryMapping* CreateMemoryMapping(
|
||||
|
|
Loading…
Reference in New Issue