clang-format on most of kernel/

This commit is contained in:
Ben Vanik
2014-08-17 13:13:03 -07:00
parent 854bcdb60a
commit 1c4dcd5e0e
76 changed files with 2075 additions and 3169 deletions

View File

@@ -14,7 +14,6 @@
#include <xenia/xbox.h>
namespace xe {
namespace kernel {
@@ -22,14 +21,14 @@ class XAsyncRequest;
class XEvent;
class XFileInfo {
public:
public:
// FILE_NETWORK_OPEN_INFORMATION
uint64_t creation_time;
uint64_t last_access_time;
uint64_t last_write_time;
uint64_t change_time;
uint64_t allocation_size;
uint64_t file_length;
uint64_t creation_time;
uint64_t last_access_time;
uint64_t last_write_time;
uint64_t change_time;
uint64_t allocation_size;
uint64_t file_length;
X_FILE_ATTRIBUTES attributes;
void Write(uint8_t* base, uint32_t p) {
@@ -40,24 +39,24 @@ public:
poly::store_and_swap<uint64_t>(base + p + 32, allocation_size);
poly::store_and_swap<uint64_t>(base + p + 40, file_length);
poly::store_and_swap<uint32_t>(base + p + 48, attributes);
poly::store_and_swap<uint32_t>(base + p + 52, 0); // pad
poly::store_and_swap<uint32_t>(base + p + 52, 0); // pad
}
};
class XDirectoryInfo {
public:
public:
// FILE_DIRECTORY_INFORMATION
uint32_t next_entry_offset;
uint32_t file_index;
uint64_t creation_time;
uint64_t last_access_time;
uint64_t last_write_time;
uint64_t change_time;
uint64_t end_of_file;
uint64_t allocation_size;
uint32_t next_entry_offset;
uint32_t file_index;
uint64_t creation_time;
uint64_t last_access_time;
uint64_t last_write_time;
uint64_t change_time;
uint64_t end_of_file;
uint64_t allocation_size;
X_FILE_ATTRIBUTES attributes;
uint32_t file_name_length;
char file_name[1];
uint32_t file_name_length;
char file_name[1];
void Write(uint8_t* base, uint32_t p) {
uint8_t* dst = base + p;
@@ -75,7 +74,8 @@ public:
poly::store_and_swap<uint64_t>(dst + 48, info->allocation_size);
poly::store_and_swap<uint32_t>(dst + 56, info->attributes);
poly::store_and_swap<uint32_t>(dst + 60, info->file_name_length);
xe_copy_memory(dst + 64, info->file_name_length, info->file_name, info->file_name_length);
xe_copy_memory(dst + 64, info->file_name_length, info->file_name,
info->file_name_length);
dst += info->next_entry_offset;
src += info->next_entry_offset;
} while (info->next_entry_offset != 0);
@@ -85,13 +85,13 @@ static_assert_size(XDirectoryInfo, 72);
// http://msdn.microsoft.com/en-us/library/windows/hardware/ff540287(v=vs.85).aspx
class XVolumeInfo {
public:
public:
// FILE_FS_VOLUME_INFORMATION
uint64_t creation_time;
uint32_t serial_number;
uint32_t label_length;
uint32_t supports_objects;
char label[1];
uint64_t creation_time;
uint32_t serial_number;
uint32_t label_length;
uint32_t supports_objects;
char label[1];
void Write(uint8_t* base, uint32_t p) {
uint8_t* dst = base + p;
@@ -99,32 +99,35 @@ public:
poly::store_and_swap<uint32_t>(dst + 8, this->serial_number);
poly::store_and_swap<uint32_t>(dst + 12, this->label_length);
poly::store_and_swap<uint32_t>(dst + 16, this->supports_objects);
xe_copy_memory(dst + 20, this->label_length, this->label, this->label_length);
xe_copy_memory(dst + 20, this->label_length, this->label,
this->label_length);
}
};
static_assert_size(XVolumeInfo, 24);
// http://msdn.microsoft.com/en-us/library/windows/hardware/ff540251(v=vs.85).aspx
class XFileSystemAttributeInfo {
public:
public:
// FILE_FS_ATTRIBUTE_INFORMATION
uint32_t attributes;
int32_t maximum_component_name_length;
uint32_t fs_name_length;
char fs_name[1];
uint32_t attributes;
int32_t maximum_component_name_length;
uint32_t fs_name_length;
char fs_name[1];
void Write(uint8_t* base, uint32_t p) {
uint8_t* dst = base + p;
poly::store_and_swap<uint32_t>(dst + 0, this->attributes);
poly::store_and_swap<uint32_t>(dst + 4, this->maximum_component_name_length);
poly::store_and_swap<uint32_t>(dst + 4,
this->maximum_component_name_length);
poly::store_and_swap<uint32_t>(dst + 8, this->fs_name_length);
xe_copy_memory(dst + 12, this->fs_name_length, this->fs_name, this->fs_name_length);
xe_copy_memory(dst + 12, this->fs_name_length, this->fs_name,
this->fs_name_length);
}
};
static_assert_size(XFileSystemAttributeInfo, 16);
class XFile : public XObject {
public:
public:
virtual ~XFile();
virtual const std::string& path() const = 0;
@@ -148,24 +151,21 @@ public:
virtual void* GetWaitHandle();
protected:
protected:
XFile(KernelState* kernel_state, fs::Mode mode);
virtual X_STATUS ReadSync(
void* buffer, size_t buffer_length, size_t byte_offset,
size_t* out_bytes_read) = 0;
virtual X_STATUS ReadSync(void* buffer, size_t buffer_length,
size_t byte_offset, size_t* out_bytes_read) = 0;
private:
fs::Mode mode_;
XEvent* async_event_;
private:
fs::Mode mode_;
XEvent* async_event_;
// TODO(benvanik): create flags, open state, etc.
size_t position_;
size_t position_;
};
} // namespace kernel
} // namespace xe
#endif // XENIA_KERNEL_XBOXKRNL_XFILE_H_