Removing unneeded fs entry type.
This commit is contained in:
parent
78451a4e9e
commit
cc6d03ab2c
|
@ -61,11 +61,7 @@ std::unique_ptr<Entry> DiscImageDevice::ResolvePath(const char* path) {
|
|||
}
|
||||
}
|
||||
|
||||
Entry::Type type = gdfx_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY
|
||||
? Entry::Type::DIRECTORY
|
||||
: Entry::Type::FILE;
|
||||
return std::make_unique<DiscImageEntry>(type, this, path, mmap_.get(),
|
||||
gdfx_entry);
|
||||
return std::make_unique<DiscImageEntry>(this, path, mmap_.get(), gdfx_entry);
|
||||
}
|
||||
|
||||
} // namespace fs
|
||||
|
|
|
@ -26,9 +26,9 @@ class DiscImageMemoryMapping : public MemoryMapping {
|
|||
~DiscImageMemoryMapping() override = default;
|
||||
};
|
||||
|
||||
DiscImageEntry::DiscImageEntry(Type type, Device* device, const char* path,
|
||||
DiscImageEntry::DiscImageEntry(Device* device, const char* path,
|
||||
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry)
|
||||
: Entry(type, device, path),
|
||||
: Entry(device, path),
|
||||
mmap_(mmap),
|
||||
gdfx_entry_(gdfx_entry),
|
||||
gdfx_entry_iterator_(gdfx_entry->children.end()) {}
|
||||
|
|
|
@ -24,8 +24,8 @@ class GDFXEntry;
|
|||
|
||||
class DiscImageEntry : public Entry {
|
||||
public:
|
||||
DiscImageEntry(Type type, Device* device, const char* path,
|
||||
poly::MappedMemory* mmap, GDFXEntry* gdfx_entry);
|
||||
DiscImageEntry(Device* device, const char* path, poly::MappedMemory* mmap,
|
||||
GDFXEntry* gdfx_entry);
|
||||
~DiscImageEntry() override;
|
||||
|
||||
poly::MappedMemory* mmap() const { return mmap_; }
|
||||
|
|
|
@ -37,8 +37,7 @@ std::unique_ptr<Entry> HostPathDevice::ResolvePath(const char* path) {
|
|||
// TODO(benvanik): fail if does not exit
|
||||
// TODO(benvanik): switch based on type
|
||||
|
||||
auto type = Entry::Type::FILE;
|
||||
return std::make_unique<HostPathEntry>(type, this, path, full_path);
|
||||
return std::make_unique<HostPathEntry>(this, path, full_path);
|
||||
}
|
||||
|
||||
} // namespace fs
|
||||
|
|
|
@ -25,9 +25,9 @@ class HostPathMemoryMapping : public MemoryMapping {
|
|||
std::unique_ptr<poly::MappedMemory> mmap_;
|
||||
};
|
||||
|
||||
HostPathEntry::HostPathEntry(Type type, Device* device, const char* path,
|
||||
HostPathEntry::HostPathEntry(Device* device, const char* path,
|
||||
const std::wstring& local_path)
|
||||
: Entry(type, device, path),
|
||||
: Entry(device, path),
|
||||
local_path_(local_path),
|
||||
find_file_(INVALID_HANDLE_VALUE) {}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace fs {
|
|||
|
||||
class HostPathEntry : public Entry {
|
||||
public:
|
||||
HostPathEntry(Type type, Device* device, const char* path,
|
||||
HostPathEntry(Device* device, const char* path,
|
||||
const std::wstring& local_path);
|
||||
~HostPathEntry() override;
|
||||
|
||||
|
|
|
@ -62,10 +62,7 @@ std::unique_ptr<Entry> STFSContainerDevice::ResolvePath(const char* path) {
|
|||
}
|
||||
}
|
||||
|
||||
Entry::Type type = stfs_entry->attributes & X_FILE_ATTRIBUTE_DIRECTORY
|
||||
? Entry::Type::DIRECTORY
|
||||
: Entry::Type::FILE;
|
||||
return std::make_unique<STFSContainerEntry>(type, this, path, mmap_.get(),
|
||||
return std::make_unique<STFSContainerEntry>(this, path, mmap_.get(),
|
||||
stfs_entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,10 @@ namespace xe {
|
|||
namespace kernel {
|
||||
namespace fs {
|
||||
|
||||
STFSContainerEntry::STFSContainerEntry(Type type, Device* device,
|
||||
const char* path,
|
||||
STFSContainerEntry::STFSContainerEntry(Device* device, const char* path,
|
||||
poly::MappedMemory* mmap,
|
||||
STFSEntry* stfs_entry)
|
||||
: Entry(type, device, path),
|
||||
: Entry(device, path),
|
||||
mmap_(mmap),
|
||||
stfs_entry_(stfs_entry),
|
||||
stfs_entry_iterator_(stfs_entry->children.end()) {}
|
||||
|
|
|
@ -24,8 +24,8 @@ class STFSEntry;
|
|||
|
||||
class STFSContainerEntry : public Entry {
|
||||
public:
|
||||
STFSContainerEntry(Type type, Device* device, const char* path,
|
||||
poly::MappedMemory* mmap, STFSEntry* stfs_entry);
|
||||
STFSContainerEntry(Device* device, const char* path, poly::MappedMemory* mmap,
|
||||
STFSEntry* stfs_entry);
|
||||
~STFSContainerEntry() override;
|
||||
|
||||
poly::MappedMemory* mmap() const { return mmap_; }
|
||||
|
|
|
@ -19,8 +19,8 @@ MemoryMapping::MemoryMapping(uint8_t* address, size_t length)
|
|||
|
||||
MemoryMapping::~MemoryMapping() {}
|
||||
|
||||
Entry::Entry(Type type, Device* device, const std::string& path)
|
||||
: type_(type), device_(device), path_(path) {
|
||||
Entry::Entry(Device* device, const std::string& path)
|
||||
: device_(device), path_(path) {
|
||||
assert_not_null(device);
|
||||
absolute_path_ = device->path() + path;
|
||||
// TODO(benvanik): last index of \, unless \ at end, then before that
|
||||
|
|
|
@ -53,15 +53,9 @@ class MemoryMapping {
|
|||
|
||||
class Entry {
|
||||
public:
|
||||
enum class Type {
|
||||
FILE,
|
||||
DIRECTORY,
|
||||
};
|
||||
|
||||
Entry(Type type, Device* device, const std::string& path);
|
||||
Entry(Device* device, const std::string& path);
|
||||
virtual ~Entry();
|
||||
|
||||
Type type() const { return type_; }
|
||||
Device* device() const { return device_; }
|
||||
const std::string& path() const { return path_; }
|
||||
const std::string& absolute_path() const { return absolute_path_; }
|
||||
|
@ -82,7 +76,6 @@ class Entry {
|
|||
XFile** out_file) = 0;
|
||||
|
||||
private:
|
||||
Type type_;
|
||||
Device* device_;
|
||||
std::string path_;
|
||||
std::string absolute_path_;
|
||||
|
|
|
@ -41,10 +41,6 @@ X_STATUS XUserModule::LoadFromFile(const char* path) {
|
|||
XELOGE("File not found: %s", path);
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
if (fs_entry->type() != fs::Entry::Type::FILE) {
|
||||
XELOGE("Invalid file type: %s", path);
|
||||
return X_STATUS_NO_SUCH_FILE;
|
||||
}
|
||||
|
||||
// If the FS supports mapping, map the file in and load from that.
|
||||
if (fs_entry->can_map()) {
|
||||
|
|
|
@ -469,7 +469,7 @@ SHIM_CALL NtQueryFullAttributesFile_shim(PPCContext* ppc_state,
|
|||
// Resolve the file using the virtual file system.
|
||||
FileSystem* fs = state->file_system();
|
||||
auto entry = fs->ResolvePath(object_name);
|
||||
if (entry && entry->type() == Entry::Type::FILE) {
|
||||
if (entry) {
|
||||
// Found.
|
||||
XFileInfo file_info;
|
||||
result = entry->QueryInfo(&file_info);
|
||||
|
|
Loading…
Reference in New Issue