1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:07:34 +00:00

Kernel: Rename ProcFSComponentsRegistrar => ProcFSComponentRegistry

This matches the formatting used in SysFS.
This commit is contained in:
Andreas Kling 2021-07-11 01:40:26 +02:00
parent c1143e1bae
commit fa9111ac46
9 changed files with 28 additions and 28 deletions

View file

@ -199,8 +199,8 @@ UNMAP_AFTER_INIT ProcFSUSBBusDirectory::ProcFSUSBBusDirectory(const ProcFSBusDir
UNMAP_AFTER_INIT void ProcFSUSBBusDirectory::initialize()
{
auto folder = adopt_ref(*new ProcFSUSBBusDirectory(ProcFSComponentsRegistrar::the().buses_folder()));
ProcFSComponentsRegistrar::the().register_new_bus_folder(folder);
auto folder = adopt_ref(*new ProcFSUSBBusDirectory(ProcFSComponentRegistry::the().buses_folder()));
ProcFSComponentRegistry::the().register_new_bus_folder(folder);
s_procfs_usb_bus_folder = folder;
}

View file

@ -19,42 +19,42 @@
namespace Kernel {
static AK::Singleton<ProcFSComponentsRegistrar> s_the;
static AK::Singleton<ProcFSComponentRegistry> s_the;
ProcFSComponentsRegistrar& ProcFSComponentsRegistrar::the()
ProcFSComponentRegistry& ProcFSComponentRegistry::the()
{
return *s_the;
}
UNMAP_AFTER_INIT void ProcFSComponentsRegistrar::initialize()
UNMAP_AFTER_INIT void ProcFSComponentRegistry::initialize()
{
VERIFY(!s_the.is_initialized());
s_the.ensure_instance();
}
UNMAP_AFTER_INIT ProcFSComponentsRegistrar::ProcFSComponentsRegistrar()
UNMAP_AFTER_INIT ProcFSComponentRegistry::ProcFSComponentRegistry()
: m_root_folder(ProcFSRootDirectory::must_create())
{
}
const ProcFSBusDirectory& ProcFSComponentsRegistrar::buses_folder() const
const ProcFSBusDirectory& ProcFSComponentRegistry::buses_folder() const
{
return *m_root_folder->m_buses_folder;
}
void ProcFSComponentsRegistrar::register_new_bus_folder(ProcFSExposedDirectory& new_bus_folder)
void ProcFSComponentRegistry::register_new_bus_folder(ProcFSExposedDirectory& new_bus_folder)
{
VERIFY(!m_root_folder->m_buses_folder.is_null());
m_root_folder->m_buses_folder->m_components.append(new_bus_folder);
}
void ProcFSComponentsRegistrar::register_new_process(Process& new_process)
void ProcFSComponentRegistry::register_new_process(Process& new_process)
{
Locker locker(m_lock);
m_root_folder->m_process_folders.append(ProcFSProcessDirectory::create(new_process));
}
void ProcFSComponentsRegistrar::unregister_process(Process& deleted_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();
@ -115,7 +115,7 @@ ProcFSInode::~ProcFSInode()
}
ProcFS::ProcFS()
: m_root_inode(ProcFSComponentsRegistrar::the().root_folder().to_inode(*this))
: m_root_inode(ProcFSComponentRegistry::the().root_folder().to_inode(*this))
{
}

View file

@ -867,7 +867,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<ProcFSRootDirectory> ProcFSRootDirectory::must_cr
KResult ProcFSRootDirectory::traverse_as_directory(unsigned fsid, Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
{
Locker locker(ProcFSComponentsRegistrar::the().get_lock());
Locker locker(ProcFSComponentRegistry::the().get_lock());
callback({ ".", { fsid, component_index() }, 0 });
callback({ "..", { fsid, 0 }, 0 });

View file

@ -135,7 +135,7 @@ void Process::register_new(Process& process)
RefPtr<Process> new_process = process;
ScopedSpinLock lock(g_processes_lock);
g_processes->prepend(process);
ProcFSComponentsRegistrar::the().register_new_process(process);
ProcFSComponentRegistry::the().register_new_process(process);
}
RefPtr<Process> Process::create_user_process(RefPtr<Thread>& first_thread, const String& path, uid_t uid, gid_t gid, ProcessID parent_pid, int& error, Vector<String>&& arguments, Vector<String>&& environment, TTY* tty)
@ -576,7 +576,7 @@ void Process::finalize()
// If we don't do it here, we can't drop the object later, and we can't
// do this from the destructor because the state of the object doesn't
// allow us to take references anymore.
ProcFSComponentsRegistrar::the().unregister_process(*this);
ProcFSComponentRegistry::the().unregister_process(*this);
m_dead = true;
@ -728,7 +728,7 @@ void Process::FileDescriptionAndFlags::clear()
void Process::FileDescriptionAndFlags::refresh_inode_index()
{
// FIXME: Verify Process::m_fds_lock is locked!
m_global_procfs_inode_index = ProcFSComponentsRegistrar::the().allocate_inode_index();
m_global_procfs_inode_index = ProcFSComponentRegistry::the().allocate_inode_index();
}
void Process::FileDescriptionAndFlags::set(NonnullRefPtr<FileDescription>&& description, u32 flags)
@ -736,7 +736,7 @@ void Process::FileDescriptionAndFlags::set(NonnullRefPtr<FileDescription>&& desc
// FIXME: Verify Process::m_fds_lock is locked!
m_description = move(description);
m_flags = flags;
m_global_procfs_inode_index = ProcFSComponentsRegistrar::the().allocate_inode_index();
m_global_procfs_inode_index = ProcFSComponentRegistry::the().allocate_inode_index();
}
Custody& Process::root_directory()

View file

@ -26,7 +26,7 @@ static size_t s_allocate_inode_index()
return s_next_inode_index.value();
}
InodeIndex ProcFSComponentsRegistrar::allocate_inode_index() const
InodeIndex ProcFSComponentRegistry::allocate_inode_index() const
{
return s_allocate_inode_index();
}
@ -242,7 +242,7 @@ RefPtr<ProcFSExposedComponent> ProcFSExposedDirectory::lookup(StringView name)
KResult ProcFSExposedDirectory::traverse_as_directory(unsigned fsid, Function<bool(FileSystem::DirectoryEntryView const&)> callback) const
{
Locker locker(ProcFSComponentsRegistrar::the().get_lock());
Locker locker(ProcFSComponentRegistry::the().get_lock());
auto parent_folder = m_parent_folder.strong_ref();
if (parent_folder.is_null())
return KResult(EINVAL);

View file

@ -28,15 +28,15 @@ class ProcFSRootDirectory;
class ProcFSBusDirectory;
class ProcFSSystemBoolean;
class ProcFSComponentsRegistrar {
class ProcFSComponentRegistry {
public:
static ProcFSComponentsRegistrar& the();
static ProcFSComponentRegistry& the();
static void initialize();
InodeIndex allocate_inode_index() const;
ProcFSComponentsRegistrar();
ProcFSComponentRegistry();
void register_new_bus_folder(ProcFSExposedDirectory&);
const ProcFSBusDirectory& buses_folder() const;
@ -92,7 +92,7 @@ class ProcFSExposedDirectory
: public ProcFSExposedComponent
, public Weakable<ProcFSExposedDirectory> {
friend class ProcFSProcessDirectory;
friend class ProcFSComponentsRegistrar;
friend class ProcFSComponentRegistry;
public:
virtual KResultOr<size_t> entries_count() const override { return m_components.size(); };
@ -135,7 +135,7 @@ class ProcFSProcessInformation;
class ProcFSProcessDirectory final
: public ProcFSExposedDirectory {
friend class ProcFSComponentsRegistrar;
friend class ProcFSComponentRegistry;
friend class ProcFSRootDirectory;
friend class ProcFSProcessInformation;
friend class ProcFSProcessPledge;
@ -170,7 +170,7 @@ private:
class ProcFSRootDirectory;
class ProcFSBusDirectory : public ProcFSExposedDirectory {
friend class ProcFSComponentsRegistrar;
friend class ProcFSComponentRegistry;
public:
static NonnullRefPtr<ProcFSBusDirectory> must_create(const ProcFSRootDirectory& parent_folder);
@ -180,7 +180,7 @@ private:
};
class ProcFSRootDirectory final : public ProcFSExposedDirectory {
friend class ProcFSComponentsRegistrar;
friend class ProcFSComponentRegistry;
public:
virtual RefPtr<ProcFSExposedComponent> lookup(StringView name) override;

View file

@ -583,7 +583,7 @@ NonnullRefPtr<ProcFSProcessDirectory> ProcFSProcessDirectory::create(const Proce
}
ProcFSProcessDirectory::ProcFSProcessDirectory(const Process& process)
: ProcFSExposedDirectory(String::formatted("{:d}", process.pid().value()), ProcFSComponentsRegistrar::the().root_folder())
: ProcFSExposedDirectory(String::formatted("{:d}", process.pid().value()), ProcFSComponentRegistry::the().root_folder())
, m_associated_process(process)
{
}

View file

@ -67,7 +67,7 @@ Thread::Thread(NonnullRefPtr<Process> process, NonnullOwnPtr<Region> kernel_stac
, m_fpu_state(fpu_state)
, m_name(m_process->name())
, m_block_timer(block_timer)
, m_global_procfs_inode_index(ProcFSComponentsRegistrar::the().allocate_inode_index())
, m_global_procfs_inode_index(ProcFSComponentRegistry::the().allocate_inode_index())
{
bool is_first_thread = m_process->add_thread(*this);
if (is_first_thread) {

View file

@ -144,7 +144,7 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init()
// Initialize the PCI Bus as early as possible, for early boot (PCI based) serial logging
SysFSComponentRegistry::initialize();
ProcFSComponentsRegistrar::initialize();
ProcFSComponentRegistry::initialize();
PCI::initialize();
PCISerialDevice::detect();