Adding locks and parents to vfs.

Progress on #305.
This commit is contained in:
Ben Vanik
2015-06-29 05:07:29 -07:00
parent 9a80b5e5be
commit 0104a2290f
16 changed files with 65 additions and 40 deletions

View File

@@ -35,7 +35,7 @@ bool HostPathDevice::Initialize() {
}
}
auto root_entry = new HostPathEntry(this, "", local_path_);
auto root_entry = new HostPathEntry(this, nullptr, "", local_path_);
root_entry->attributes_ = kFileAttributeDirectory;
root_entry_ = std::unique_ptr<Entry>(root_entry);
PopulateEntry(root_entry);
@@ -43,12 +43,12 @@ bool HostPathDevice::Initialize() {
return true;
}
void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
auto child_infos = xe::filesystem::ListFiles(entry->local_path());
void HostPathDevice::PopulateEntry(HostPathEntry* parent_entry) {
auto child_infos = xe::filesystem::ListFiles(parent_entry->local_path());
for (auto& child_info : child_infos) {
auto child =
new HostPathEntry(this, xe::to_string(child_info.name),
xe::join_paths(entry->local_path(), child_info.name));
auto child = new HostPathEntry(
this, parent_entry, xe::to_string(child_info.name),
xe::join_paths(parent_entry->local_path(), child_info.name));
child->create_timestamp_ = child_info.create_timestamp;
child->access_timestamp_ = child_info.access_timestamp;
child->write_timestamp_ = child_info.write_timestamp;
@@ -65,7 +65,7 @@ void HostPathDevice::PopulateEntry(HostPathEntry* entry) {
xe::round_up(child_info.total_size, bytes_per_sector());
}
entry->children_.push_back(std::unique_ptr<Entry>(child));
parent_entry->children_.push_back(std::unique_ptr<Entry>(child));
if (child_info.type == xe::filesystem::FileInfo::Type::kDirectory) {
PopulateEntry(child);