Some fs/ cleanup.

This commit is contained in:
Ben Vanik
2014-08-16 21:36:01 -07:00
parent fdab788017
commit 383d3acbb0
11 changed files with 301 additions and 337 deletions

View File

@@ -12,19 +12,19 @@
#include <string>
#include <xenia/common.h>
#include <xenia/core.h>
#include <xenia/xbox.h>
XEDECLARECLASS2(xe, kernel, KernelState);
XEDECLARECLASS2(xe, kernel, XFile);
XEDECLARECLASS2(xe, kernel, XFileInfo);
XEDECLARECLASS2(xe, kernel, XDirectoryInfo);
XEDECLARECLASS2(xe, kernel, XVolumeInfo);
XEDECLARECLASS2(xe, kernel, XFileSystemAttributeInfo);
namespace xe {
namespace kernel {
class KernelState;
class XFile;
class XFileInfo;
class XFileSystemAttributeInfo;
class XDirectoryInfo;
class XVolumeInfo;
} // namespace kernel
} // namespace xe
namespace xe {
namespace kernel {
@@ -32,23 +32,21 @@ namespace fs {
class Device;
class MemoryMapping {
public:
public:
MemoryMapping(uint8_t* address, size_t length);
virtual ~MemoryMapping();
uint8_t* address() const { return address_; }
size_t length() const { return length_; }
private:
uint8_t* address_;
size_t length_;
private:
uint8_t* address_;
size_t length_;
};
class Entry {
public:
public:
enum Type {
kTypeFile,
kTypeDirectory,
@@ -64,32 +62,29 @@ public:
const std::string& name() const { return name_; }
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 QueryDirectory(XDirectoryInfo* out_info, size_t length,
const char* file_name, bool restart) = 0;
virtual bool can_map() { return false; }
virtual MemoryMapping* CreateMemoryMapping(
xe_file_mode file_mode, const size_t offset, const size_t length) {
virtual MemoryMapping* CreateMemoryMapping(xe_file_mode file_mode,
const size_t offset,
const size_t length) {
return NULL;
}
virtual X_STATUS Open(
KernelState* kernel_state,
uint32_t desired_access, bool async,
XFile** out_file) = 0;
virtual X_STATUS Open(KernelState* kernel_state, uint32_t desired_access,
bool async, XFile** out_file) = 0;
private:
Type type_;
Device* device_;
private:
Type type_;
Device* device_;
std::string path_;
std::string absolute_path_;
std::string name_;
};
} // namespace fs
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_FS_ENTRY_H_