Refactoring vfs to remove a lot of duplicated code.

Progress on #294.
This commit is contained in:
Ben Vanik
2015-06-27 22:37:49 -07:00
parent 1ac19f1b08
commit 83872d8e8f
37 changed files with 877 additions and 1366 deletions

View File

@@ -59,18 +59,11 @@ X_STATUS XUserModule::LoadFromFile(std::string path) {
// Load the module.
result = LoadFromMemory(mmap->data(), mmap->size());
} else {
X_FILE_NETWORK_OPEN_INFORMATION file_info = {0};
result = fs_entry->QueryInfo(&file_info);
if (result) {
return result;
}
std::vector<uint8_t> buffer(file_info.end_of_file);
std::vector<uint8_t> buffer(fs_entry->size());
// Open file for reading.
XFile* file_ptr = nullptr;
result = kernel_state()->file_system()->Open(
std::move(fs_entry), kernel_state(), vfs::Mode::READ, false, &file_ptr);
result = fs_entry->Open(kernel_state(), vfs::Mode::READ, false, &file_ptr);
object_ref<XFile> file(file_ptr);
if (result) {
return result;