mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:57:35 +00:00
Kernel: Rename SystemExposedComponent => SysFSComponent
This commit is contained in:
parent
27244eb0ee
commit
517170a986
10 changed files with 32 additions and 32 deletions
|
@ -54,7 +54,7 @@ OwnPtr<KBuffer> ExposedComponent::try_to_generate_buffer() const
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT ExposedComponent::ExposedComponent(String name, PhysicalAddress paddr, size_t table_size)
|
UNMAP_AFTER_INIT ExposedComponent::ExposedComponent(String name, PhysicalAddress paddr, size_t table_size)
|
||||||
: SystemExposedComponent(name)
|
: SysFSComponent(name)
|
||||||
, m_paddr(paddr)
|
, m_paddr(paddr)
|
||||||
, m_length(table_size)
|
, m_length(table_size)
|
||||||
{
|
{
|
||||||
|
@ -69,7 +69,7 @@ UNMAP_AFTER_INIT void ExposedFolder::initialize()
|
||||||
UNMAP_AFTER_INIT ExposedFolder::ExposedFolder()
|
UNMAP_AFTER_INIT ExposedFolder::ExposedFolder()
|
||||||
: SystemExposedFolder("acpi", SysFSComponentRegistry::the().root_folder())
|
: SystemExposedFolder("acpi", SysFSComponentRegistry::the().root_folder())
|
||||||
{
|
{
|
||||||
NonnullRefPtrVector<SystemExposedComponent> components;
|
NonnullRefPtrVector<SysFSComponent> components;
|
||||||
size_t ssdt_count = 0;
|
size_t ssdt_count = 0;
|
||||||
ACPI::Parser::the()->enumerate_static_tables([&](const StringView& signature, PhysicalAddress p_table, size_t length) {
|
ACPI::Parser::the()->enumerate_static_tables([&](const StringView& signature, PhysicalAddress p_table, size_t length) {
|
||||||
if (signature == "SSDT") {
|
if (signature == "SSDT") {
|
||||||
|
|
|
@ -25,7 +25,7 @@ private:
|
||||||
ExposedFolder();
|
ExposedFolder();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExposedComponent : public SystemExposedComponent {
|
class ExposedComponent : public SysFSComponent {
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<ExposedComponent> create(String name, PhysicalAddress, size_t table_size);
|
static NonnullRefPtr<ExposedComponent> create(String name, PhysicalAddress, size_t table_size);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<DMIEntryPointExposedBlob> DMIEntryPointExposedBlo
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT BIOSExposedComponent::BIOSExposedComponent(String name)
|
UNMAP_AFTER_INIT BIOSExposedComponent::BIOSExposedComponent(String name)
|
||||||
: SystemExposedComponent(name)
|
: SysFSComponent(name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace Kernel {
|
||||||
MappedROM map_bios();
|
MappedROM map_bios();
|
||||||
MappedROM map_ebda();
|
MappedROM map_ebda();
|
||||||
|
|
||||||
class BIOSExposedComponent : public SystemExposedComponent {
|
class BIOSExposedComponent : public SysFSComponent {
|
||||||
public:
|
public:
|
||||||
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override;
|
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const override;
|
||||||
|
|
||||||
|
|
|
@ -407,7 +407,7 @@ NonnullRefPtr<ExposedAttribute> ExposedAttribute::create(String name, const Expo
|
||||||
}
|
}
|
||||||
|
|
||||||
ExposedAttribute::ExposedAttribute(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width)
|
ExposedAttribute::ExposedAttribute(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width)
|
||||||
: SystemExposedComponent(name)
|
: SysFSComponent(name)
|
||||||
, m_device(device)
|
, m_device(device)
|
||||||
, m_offset(offset)
|
, m_offset(offset)
|
||||||
, m_field_bytes_width(field_bytes_width)
|
, m_field_bytes_width(field_bytes_width)
|
||||||
|
|
|
@ -33,7 +33,7 @@ private:
|
||||||
Address m_address;
|
Address m_address;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExposedAttribute : public SystemExposedComponent {
|
class ExposedAttribute : public SysFSComponent {
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<ExposedAttribute> create(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width);
|
static NonnullRefPtr<ExposedAttribute> create(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ UNMAP_AFTER_INIT SysFSComponentRegistry::SysFSComponentRegistry()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT void SysFSComponentRegistry::register_new_component(SystemExposedComponent& component)
|
UNMAP_AFTER_INIT void SysFSComponentRegistry::register_new_component(SysFSComponent& component)
|
||||||
{
|
{
|
||||||
Locker locker(m_lock);
|
Locker locker(m_lock);
|
||||||
m_root_folder->m_components.append(component);
|
m_root_folder->m_components.append(component);
|
||||||
|
@ -84,12 +84,12 @@ NonnullRefPtr<Inode> SysFS::root_inode() const
|
||||||
return *m_root_inode;
|
return *m_root_inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
NonnullRefPtr<SysFSInode> SysFSInode::create(SysFS const& fs, SystemExposedComponent const& component)
|
NonnullRefPtr<SysFSInode> SysFSInode::create(SysFS const& fs, SysFSComponent const& component)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new (nothrow) SysFSInode(fs, component));
|
return adopt_ref(*new (nothrow) SysFSInode(fs, component));
|
||||||
}
|
}
|
||||||
|
|
||||||
SysFSInode::SysFSInode(SysFS const& fs, SystemExposedComponent const& component)
|
SysFSInode::SysFSInode(SysFS const& fs, SysFSComponent const& component)
|
||||||
: Inode(const_cast<SysFS&>(fs), component.component_index())
|
: Inode(const_cast<SysFS&>(fs), component.component_index())
|
||||||
, m_associated_component(component)
|
, m_associated_component(component)
|
||||||
{
|
{
|
||||||
|
@ -167,12 +167,12 @@ KResult SysFSInode::truncate(u64)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
NonnullRefPtr<SysFSDirectoryInode> SysFSDirectoryInode::create(SysFS const& sysfs, SystemExposedComponent const& component)
|
NonnullRefPtr<SysFSDirectoryInode> SysFSDirectoryInode::create(SysFS const& sysfs, SysFSComponent const& component)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new (nothrow) SysFSDirectoryInode(sysfs, component));
|
return adopt_ref(*new (nothrow) SysFSDirectoryInode(sysfs, component));
|
||||||
}
|
}
|
||||||
|
|
||||||
SysFSDirectoryInode::SysFSDirectoryInode(SysFS const& fs, SystemExposedComponent const& component)
|
SysFSDirectoryInode::SysFSDirectoryInode(SysFS const& fs, SysFSComponent const& component)
|
||||||
: SysFSInode(fs, component)
|
: SysFSInode(fs, component)
|
||||||
, m_parent_fs(const_cast<SysFS&>(fs))
|
, m_parent_fs(const_cast<SysFS&>(fs))
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ private:
|
||||||
|
|
||||||
class SysFSComponentRegistry {
|
class SysFSComponentRegistry {
|
||||||
friend class SysFS;
|
friend class SysFS;
|
||||||
friend class SystemExposedComponent;
|
friend class SysFSComponent;
|
||||||
friend class SystemExposedFolder;
|
friend class SystemExposedFolder;
|
||||||
friend class SysFSRootFolder;
|
friend class SysFSRootFolder;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
static void initialize();
|
static void initialize();
|
||||||
|
|
||||||
SysFSComponentRegistry();
|
SysFSComponentRegistry();
|
||||||
void register_new_component(SystemExposedComponent&);
|
void register_new_component(SysFSComponent&);
|
||||||
|
|
||||||
NonnullRefPtr<SystemExposedFolder> root_folder() { return m_root_folder; }
|
NonnullRefPtr<SystemExposedFolder> root_folder() { return m_root_folder; }
|
||||||
|
|
||||||
|
@ -77,11 +77,11 @@ class SysFSInode : public Inode {
|
||||||
friend class SysFSDirectoryInode;
|
friend class SysFSDirectoryInode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<SysFSInode> create(SysFS const&, SystemExposedComponent const&);
|
static NonnullRefPtr<SysFSInode> create(SysFS const&, SysFSComponent const&);
|
||||||
StringView name() const { return m_associated_component->name(); }
|
StringView name() const { return m_associated_component->name(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SysFSInode(SysFS const&, SystemExposedComponent const&);
|
SysFSInode(SysFS const&, SysFSComponent const&);
|
||||||
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer& buffer, FileDescription*) const override;
|
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer& buffer, FileDescription*) const override;
|
||||||
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
|
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
|
||||||
virtual RefPtr<Inode> lookup(StringView name) override;
|
virtual RefPtr<Inode> lookup(StringView name) override;
|
||||||
|
@ -96,7 +96,7 @@ protected:
|
||||||
virtual KResult chown(uid_t, gid_t) override;
|
virtual KResult chown(uid_t, gid_t) override;
|
||||||
virtual KResult truncate(u64) override;
|
virtual KResult truncate(u64) override;
|
||||||
|
|
||||||
NonnullRefPtr<SystemExposedComponent> m_associated_component;
|
NonnullRefPtr<SysFSComponent> m_associated_component;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SysFSDirectoryInode : public SysFSInode {
|
class SysFSDirectoryInode : public SysFSInode {
|
||||||
|
@ -104,11 +104,11 @@ class SysFSDirectoryInode : public SysFSInode {
|
||||||
friend class SysFSRootDirectoryInode;
|
friend class SysFSRootDirectoryInode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<SysFSDirectoryInode> create(SysFS const&, SystemExposedComponent const&);
|
static NonnullRefPtr<SysFSDirectoryInode> create(SysFS const&, SysFSComponent const&);
|
||||||
virtual ~SysFSDirectoryInode() override;
|
virtual ~SysFSDirectoryInode() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SysFSDirectoryInode(SysFS const&, SystemExposedComponent const&);
|
SysFSDirectoryInode(SysFS const&, SysFSComponent const&);
|
||||||
// ^Inode
|
// ^Inode
|
||||||
virtual InodeMetadata metadata() const override;
|
virtual InodeMetadata metadata() const override;
|
||||||
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
|
virtual KResult traverse_as_directory(Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
|
||||||
|
|
|
@ -20,7 +20,7 @@ static size_t allocate_inode_index()
|
||||||
return s_next_inode_index.value();
|
return s_next_inode_index.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemExposedComponent::SystemExposedComponent(StringView name)
|
SysFSComponent::SysFSComponent(StringView name)
|
||||||
: m_name(KString::try_create(name).release_nonnull())
|
: m_name(KString::try_create(name).release_nonnull())
|
||||||
, m_component_index(allocate_inode_index())
|
, m_component_index(allocate_inode_index())
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ KResult SystemExposedFolder::traverse_as_directory(unsigned fsid, Function<bool(
|
||||||
return KSuccess;
|
return KSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<SystemExposedComponent> SystemExposedFolder::lookup(StringView name)
|
RefPtr<SysFSComponent> SystemExposedFolder::lookup(StringView name)
|
||||||
{
|
{
|
||||||
for (auto& component : m_components) {
|
for (auto& component : m_components) {
|
||||||
if (component.name() == name) {
|
if (component.name() == name) {
|
||||||
|
@ -51,12 +51,12 @@ RefPtr<SystemExposedComponent> SystemExposedFolder::lookup(StringView name)
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemExposedFolder::SystemExposedFolder(StringView name)
|
SystemExposedFolder::SystemExposedFolder(StringView name)
|
||||||
: SystemExposedComponent(name)
|
: SysFSComponent(name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemExposedFolder::SystemExposedFolder(StringView name, SystemExposedFolder const& parent_folder)
|
SystemExposedFolder::SystemExposedFolder(StringView name, SystemExposedFolder const& parent_folder)
|
||||||
: SystemExposedComponent(name)
|
: SysFSComponent(name)
|
||||||
, m_parent_folder(parent_folder)
|
, m_parent_folder(parent_folder)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ NonnullRefPtr<Inode> SystemExposedFolder::to_inode(SysFS const& sysfs_instance)
|
||||||
return SysFSDirectoryInode::create(sysfs_instance, *this);
|
return SysFSDirectoryInode::create(sysfs_instance, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
NonnullRefPtr<Inode> SystemExposedComponent::to_inode(SysFS const& sysfs_instance) const
|
NonnullRefPtr<Inode> SysFSComponent::to_inode(SysFS const& sysfs_instance) const
|
||||||
{
|
{
|
||||||
return SysFSInode::create(sysfs_instance, *this);
|
return SysFSInode::create(sysfs_instance, *this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
class SysFS;
|
class SysFS;
|
||||||
class SystemExposedComponent : public RefCounted<SystemExposedComponent> {
|
class SysFSComponent : public RefCounted<SysFSComponent> {
|
||||||
public:
|
public:
|
||||||
virtual KResultOr<size_t> entries_count() const { VERIFY_NOT_REACHED(); };
|
virtual KResultOr<size_t> entries_count() const { VERIFY_NOT_REACHED(); };
|
||||||
virtual StringView name() const { return m_name->view(); }
|
virtual StringView name() const { return m_name->view(); }
|
||||||
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const { VERIFY_NOT_REACHED(); }
|
virtual KResultOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, FileDescription*) const { VERIFY_NOT_REACHED(); }
|
||||||
virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const { VERIFY_NOT_REACHED(); }
|
virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const { VERIFY_NOT_REACHED(); }
|
||||||
virtual RefPtr<SystemExposedComponent> lookup(StringView) { VERIFY_NOT_REACHED(); };
|
virtual RefPtr<SysFSComponent> lookup(StringView) { VERIFY_NOT_REACHED(); };
|
||||||
virtual KResultOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, FileDescription*) { return -EROFS; }
|
virtual KResultOr<size_t> write_bytes(off_t, size_t, UserOrKernelBuffer const&, FileDescription*) { return -EROFS; }
|
||||||
virtual size_t size() const { return 0; }
|
virtual size_t size() const { return 0; }
|
||||||
|
|
||||||
|
@ -33,29 +33,29 @@ public:
|
||||||
|
|
||||||
InodeIndex component_index() const { return m_component_index; };
|
InodeIndex component_index() const { return m_component_index; };
|
||||||
|
|
||||||
virtual ~SystemExposedComponent() = default;
|
virtual ~SysFSComponent() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit SystemExposedComponent(StringView name);
|
explicit SysFSComponent(StringView name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NonnullOwnPtr<KString> m_name;
|
NonnullOwnPtr<KString> m_name;
|
||||||
InodeIndex m_component_index {};
|
InodeIndex m_component_index {};
|
||||||
};
|
};
|
||||||
|
|
||||||
class SystemExposedFolder : public SystemExposedComponent {
|
class SystemExposedFolder : public SysFSComponent {
|
||||||
public:
|
public:
|
||||||
virtual KResultOr<size_t> entries_count() const override { return m_components.size(); };
|
virtual KResultOr<size_t> entries_count() const override { return m_components.size(); };
|
||||||
virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
|
virtual KResult traverse_as_directory(unsigned, Function<bool(FileSystem::DirectoryEntryView const&)>) const override;
|
||||||
virtual RefPtr<SystemExposedComponent> lookup(StringView name) override;
|
virtual RefPtr<SysFSComponent> lookup(StringView name) override;
|
||||||
void add_component(SystemExposedComponent const&);
|
void add_component(SysFSComponent const&);
|
||||||
|
|
||||||
virtual NonnullRefPtr<Inode> to_inode(SysFS const& sysfs_instance) const override final;
|
virtual NonnullRefPtr<Inode> to_inode(SysFS const& sysfs_instance) const override final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit SystemExposedFolder(StringView name);
|
explicit SystemExposedFolder(StringView name);
|
||||||
SystemExposedFolder(StringView name, SystemExposedFolder const& parent_folder);
|
SystemExposedFolder(StringView name, SystemExposedFolder const& parent_folder);
|
||||||
NonnullRefPtrVector<SystemExposedComponent> m_components;
|
NonnullRefPtrVector<SysFSComponent> m_components;
|
||||||
RefPtr<SystemExposedFolder> m_parent_folder;
|
RefPtr<SystemExposedFolder> m_parent_folder;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue