mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
Kernel: Replace "folder" => "directory" everywhere
Folders are a GUI concept. File systems have directories.
This commit is contained in:
parent
22611ca136
commit
2da0581fd2
15 changed files with 246 additions and 246 deletions
|
@ -227,9 +227,9 @@ KResult DevFSRootDirectoryInode::traverse_as_directory(Function<bool(FileSystem:
|
|||
callback({ ".", identifier(), 0 });
|
||||
callback({ "..", identifier(), 0 });
|
||||
|
||||
for (auto& folder : m_subfolders) {
|
||||
InodeIdentifier identifier = { fsid(), folder.index() };
|
||||
callback({ folder.name(), identifier, 0 });
|
||||
for (auto& directory : m_subdirectories) {
|
||||
InodeIdentifier identifier = { fsid(), directory.index() };
|
||||
callback({ directory.name(), identifier, 0 });
|
||||
}
|
||||
for (auto& link : m_links) {
|
||||
InodeIdentifier identifier = { fsid(), link.index() };
|
||||
|
@ -245,9 +245,9 @@ KResult DevFSRootDirectoryInode::traverse_as_directory(Function<bool(FileSystem:
|
|||
RefPtr<Inode> DevFSRootDirectoryInode::lookup(StringView name)
|
||||
{
|
||||
Locker locker(m_parent_fs.m_lock);
|
||||
for (auto& subfolder : m_subfolders) {
|
||||
if (subfolder.name() == name)
|
||||
return subfolder;
|
||||
for (auto& subdirectory : m_subdirectories) {
|
||||
if (subdirectory.name() == name)
|
||||
return subdirectory;
|
||||
}
|
||||
for (auto& link : m_links) {
|
||||
if (link.name() == name)
|
||||
|
@ -268,8 +268,8 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(StringView
|
|||
InodeMetadata metadata;
|
||||
metadata.mode = mode;
|
||||
if (metadata.is_directory()) {
|
||||
for (auto& folder : m_subfolders) {
|
||||
if (folder.name() == name)
|
||||
for (auto& directory : m_subdirectories) {
|
||||
if (directory.name() == name)
|
||||
return EEXIST;
|
||||
}
|
||||
if (name != "pts")
|
||||
|
@ -277,11 +277,11 @@ KResultOr<NonnullRefPtr<Inode>> DevFSRootDirectoryInode::create_child(StringView
|
|||
auto new_directory_inode = adopt_ref_if_nonnull(new (nothrow) DevFSPtsDirectoryInode(m_parent_fs));
|
||||
if (!new_directory_inode)
|
||||
return ENOMEM;
|
||||
if (!m_subfolders.try_ensure_capacity(m_subfolders.size() + 1))
|
||||
if (!m_subdirectories.try_ensure_capacity(m_subdirectories.size() + 1))
|
||||
return ENOMEM;
|
||||
if (!m_parent_fs.m_nodes.try_ensure_capacity(m_parent_fs.m_nodes.size() + 1))
|
||||
return ENOMEM;
|
||||
m_subfolders.append(*new_directory_inode);
|
||||
m_subdirectories.append(*new_directory_inode);
|
||||
m_parent_fs.m_nodes.append(*new_directory_inode);
|
||||
return KResult(KSuccess);
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ private:
|
|||
virtual RefPtr<Inode> lookup(StringView name) override;
|
||||
virtual InodeMetadata metadata() const override;
|
||||
|
||||
NonnullRefPtrVector<DevFSDirectoryInode> m_subfolders;
|
||||
NonnullRefPtrVector<DevFSDirectoryInode> m_subdirectories;
|
||||
NonnullRefPtrVector<DevFSLinkInode> m_links;
|
||||
DevFS& m_parent_fs;
|
||||
};
|
||||
|
|
|
@ -32,33 +32,33 @@ UNMAP_AFTER_INIT void ProcFSComponentRegistry::initialize()
|
|||
}
|
||||
|
||||
UNMAP_AFTER_INIT ProcFSComponentRegistry::ProcFSComponentRegistry()
|
||||
: m_root_folder(ProcFSRootDirectory::must_create())
|
||||
: m_root_directory(ProcFSRootDirectory::must_create())
|
||||
{
|
||||
}
|
||||
|
||||
const ProcFSBusDirectory& ProcFSComponentRegistry::buses_folder() const
|
||||
const ProcFSBusDirectory& ProcFSComponentRegistry::buses_directory() const
|
||||
{
|
||||
return *m_root_folder->m_buses_folder;
|
||||
return *m_root_directory->m_buses_directory;
|
||||
}
|
||||
|
||||
void ProcFSComponentRegistry::register_new_bus_folder(ProcFSExposedDirectory& new_bus_folder)
|
||||
void ProcFSComponentRegistry::register_new_bus_directory(ProcFSExposedDirectory& new_bus_directory)
|
||||
{
|
||||
VERIFY(!m_root_folder->m_buses_folder.is_null());
|
||||
m_root_folder->m_buses_folder->m_components.append(new_bus_folder);
|
||||
VERIFY(!m_root_directory->m_buses_directory.is_null());
|
||||
m_root_directory->m_buses_directory->m_components.append(new_bus_directory);
|
||||
}
|
||||
|
||||
void ProcFSComponentRegistry::register_new_process(Process& new_process)
|
||||
{
|
||||
Locker locker(m_lock);
|
||||
m_root_folder->m_process_folders.append(ProcFSProcessDirectory::create(new_process));
|
||||
m_root_directory->m_process_directories.append(ProcFSProcessDirectory::create(new_process));
|
||||
}
|
||||
|
||||
void ProcFSComponentRegistry::unregister_process(Process& deleted_process)
|
||||
{
|
||||
auto process_folder = m_root_folder->process_folder_for(deleted_process).release_nonnull();
|
||||
process_folder->prepare_for_deletion();
|
||||
process_folder->m_list_node.remove();
|
||||
dbgln_if(PROCFS_DEBUG, "ProcFSExposedDirectory ref_count now: {}", process_folder->ref_count());
|
||||
auto process_directory = m_root_directory->process_directory_for(deleted_process).release_nonnull();
|
||||
process_directory->prepare_for_deletion();
|
||||
process_directory->m_list_node.remove();
|
||||
dbgln_if(PROCFS_DEBUG, "ProcFSExposedDirectory ref_count now: {}", process_directory->ref_count());
|
||||
}
|
||||
|
||||
RefPtr<ProcFS> ProcFS::create()
|
||||
|
@ -112,7 +112,7 @@ ProcFSInode::~ProcFSInode()
|
|||
}
|
||||
|
||||
ProcFS::ProcFS()
|
||||
: m_root_inode(ProcFSComponentRegistry::the().root_folder().to_inode(*this))
|
||||
: m_root_inode(ProcFSComponentRegistry::the().root_directory().to_inode(*this))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -25,14 +25,14 @@ UNMAP_AFTER_INIT void SysFSComponentRegistry::initialize()
|
|||
}
|
||||
|
||||
UNMAP_AFTER_INIT SysFSComponentRegistry::SysFSComponentRegistry()
|
||||
: m_root_folder(SysFSRootDirectory::create())
|
||||
: m_root_directory(SysFSRootDirectory::create())
|
||||
{
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void SysFSComponentRegistry::register_new_component(SysFSComponent& component)
|
||||
{
|
||||
Locker locker(m_lock);
|
||||
m_root_folder->m_components.append(component);
|
||||
m_root_directory->m_components.append(component);
|
||||
}
|
||||
|
||||
NonnullRefPtr<SysFSRootDirectory> SysFSRootDirectory::create()
|
||||
|
@ -64,7 +64,7 @@ NonnullRefPtr<SysFS> SysFS::create()
|
|||
}
|
||||
|
||||
SysFS::SysFS()
|
||||
: m_root_inode(SysFSComponentRegistry::the().root_folder().to_inode(*this))
|
||||
: m_root_inode(SysFSComponentRegistry::the().root_directory().to_inode(*this))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ public:
|
|||
SysFSComponentRegistry();
|
||||
void register_new_component(SysFSComponent&);
|
||||
|
||||
SysFSDirectory& root_folder() { return m_root_folder; }
|
||||
SysFSDirectory& root_directory() { return m_root_directory; }
|
||||
Mutex& get_lock() { return m_lock; }
|
||||
|
||||
private:
|
||||
Mutex m_lock;
|
||||
NonnullRefPtr<SysFSRootDirectory> m_root_folder;
|
||||
NonnullRefPtr<SysFSRootDirectory> m_root_directory;
|
||||
};
|
||||
|
||||
class SysFS final : public FileSystem {
|
||||
|
|
|
@ -29,9 +29,9 @@ SysFSComponent::SysFSComponent(StringView name)
|
|||
KResult SysFSDirectory::traverse_as_directory(unsigned fsid, Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
|
||||
{
|
||||
Locker locker(SysFSComponentRegistry::the().get_lock());
|
||||
VERIFY(m_parent_folder);
|
||||
VERIFY(m_parent_directory);
|
||||
callback({ ".", { fsid, component_index() }, 0 });
|
||||
callback({ "..", { fsid, m_parent_folder->component_index() }, 0 });
|
||||
callback({ "..", { fsid, m_parent_directory->component_index() }, 0 });
|
||||
|
||||
for (auto& component : m_components) {
|
||||
InodeIdentifier identifier = { fsid, component.component_index() };
|
||||
|
@ -55,9 +55,9 @@ SysFSDirectory::SysFSDirectory(StringView name)
|
|||
{
|
||||
}
|
||||
|
||||
SysFSDirectory::SysFSDirectory(StringView name, SysFSDirectory const& parent_folder)
|
||||
SysFSDirectory::SysFSDirectory(StringView name, SysFSDirectory const& parent_directory)
|
||||
: SysFSComponent(name)
|
||||
, m_parent_folder(parent_folder)
|
||||
, m_parent_directory(parent_directory)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ public:
|
|||
|
||||
protected:
|
||||
explicit SysFSDirectory(StringView name);
|
||||
SysFSDirectory(StringView name, SysFSDirectory const& parent_folder);
|
||||
SysFSDirectory(StringView name, SysFSDirectory const& parent_directory);
|
||||
NonnullRefPtrVector<SysFSComponent> m_components;
|
||||
RefPtr<SysFSDirectory> m_parent_folder;
|
||||
RefPtr<SysFSDirectory> m_parent_directory;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue