diff options
author | Liav A <liavalb@gmail.com> | 2022-04-22 09:44:31 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-06-17 11:01:27 +0200 |
commit | 290eb53cb531021f41f30cd4abd38f8665d37460 (patch) | |
tree | 05ed20b8c87ec2ff2a175bff0b077eee83bec3a3 /Kernel/Bus | |
parent | cba47509215c2fa7b4cdb08a19ecf31788b9d567 (diff) | |
download | serenity-290eb53cb531021f41f30cd4abd38f8665d37460.zip |
Kernel/SysFS: Stop cluttering the codebase with pieces of SysFS parts
Instead, start to put everything in one place to resemble the directory
structure of the SysFS when actually using it.
Diffstat (limited to 'Kernel/Bus')
-rw-r--r-- | Kernel/Bus/PCI/Initializer.cpp | 2 | ||||
-rw-r--r-- | Kernel/Bus/PCI/SysFSPCI.cpp | 139 | ||||
-rw-r--r-- | Kernel/Bus/PCI/SysFSPCI.h | 56 | ||||
-rw-r--r-- | Kernel/Bus/USB/SysFSUSB.cpp | 223 | ||||
-rw-r--r-- | Kernel/Bus/USB/SysFSUSB.h | 65 | ||||
-rw-r--r-- | Kernel/Bus/USB/USBHub.cpp | 2 | ||||
-rw-r--r-- | Kernel/Bus/USB/USBManagement.cpp | 2 |
7 files changed, 3 insertions, 486 deletions
diff --git a/Kernel/Bus/PCI/Initializer.cpp b/Kernel/Bus/PCI/Initializer.cpp index 159948484e..fd51bdd488 100644 --- a/Kernel/Bus/PCI/Initializer.cpp +++ b/Kernel/Bus/PCI/Initializer.cpp @@ -8,8 +8,8 @@ #include <Kernel/Bus/PCI/API.h> #include <Kernel/Bus/PCI/Access.h> #include <Kernel/Bus/PCI/Initializer.h> -#include <Kernel/Bus/PCI/SysFSPCI.h> #include <Kernel/CommandLine.h> +#include <Kernel/FileSystem/SysFS/Subsystems/Bus/PCI/SysFSPCI.h> #include <Kernel/Firmware/ACPI/Parser.h> #include <Kernel/Panic.h> #include <Kernel/Sections.h> diff --git a/Kernel/Bus/PCI/SysFSPCI.cpp b/Kernel/Bus/PCI/SysFSPCI.cpp deleted file mode 100644 index 069ae33804..0000000000 --- a/Kernel/Bus/PCI/SysFSPCI.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <Kernel/Bus/PCI/API.h> -#include <Kernel/Bus/PCI/Access.h> -#include <Kernel/Bus/PCI/SysFSPCI.h> -#include <Kernel/Debug.h> -#include <Kernel/Sections.h> - -namespace Kernel::PCI { - -UNMAP_AFTER_INIT NonnullRefPtr<PCIDeviceSysFSDirectory> PCIDeviceSysFSDirectory::create(SysFSDirectory const& parent_directory, Address address) -{ - // FIXME: Handle allocation failure gracefully - auto device_name = MUST(KString::formatted("{:04x}:{:02x}:{:02x}.{}", address.domain(), address.bus(), address.device(), address.function())); - return adopt_ref(*new (nothrow) PCIDeviceSysFSDirectory(move(device_name), parent_directory, address)); -} - -UNMAP_AFTER_INIT PCIDeviceSysFSDirectory::PCIDeviceSysFSDirectory(NonnullOwnPtr<KString> device_directory_name, SysFSDirectory const& parent_directory, Address address) - : SysFSDirectory(parent_directory) - , m_address(address) - , m_device_directory_name(move(device_directory_name)) -{ - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::VENDOR_ID, 2)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::DEVICE_ID, 2)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::CLASS, 1)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::SUBCLASS, 1)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::REVISION_ID, 1)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::PROG_IF, 1)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::SUBSYSTEM_VENDOR_ID, 2)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::SUBSYSTEM_ID, 2)); - - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR0, 4)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR1, 4)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR2, 4)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR3, 4)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR4, 4)); - m_components.append(PCIDeviceAttributeSysFSComponent::create(*this, PCI::RegisterOffset::BAR5, 4)); -} - -UNMAP_AFTER_INIT void PCIBusSysFSDirectory::initialize() -{ - auto pci_directory = adopt_ref(*new (nothrow) PCIBusSysFSDirectory()); - SysFSComponentRegistry::the().register_new_bus_directory(pci_directory); -} - -UNMAP_AFTER_INIT PCIBusSysFSDirectory::PCIBusSysFSDirectory() - : SysFSDirectory(SysFSComponentRegistry::the().buses_directory()) -{ - MUST(PCI::enumerate([&](DeviceIdentifier const& device_identifier) { - auto pci_device = PCI::PCIDeviceSysFSDirectory::create(*this, device_identifier.address()); - m_components.append(pci_device); - })); -} - -StringView PCIDeviceAttributeSysFSComponent::name() const -{ - switch (m_offset) { - case PCI::RegisterOffset::VENDOR_ID: - return "vendor"sv; - case PCI::RegisterOffset::DEVICE_ID: - return "device_id"sv; - case PCI::RegisterOffset::CLASS: - return "class"sv; - case PCI::RegisterOffset::SUBCLASS: - return "subclass"sv; - case PCI::RegisterOffset::REVISION_ID: - return "revision"sv; - case PCI::RegisterOffset::PROG_IF: - return "progif"sv; - case PCI::RegisterOffset::SUBSYSTEM_VENDOR_ID: - return "subsystem_vendor"sv; - case PCI::RegisterOffset::SUBSYSTEM_ID: - return "subsystem_id"sv; - case PCI::RegisterOffset::BAR0: - return "bar0"sv; - case PCI::RegisterOffset::BAR1: - return "bar1"sv; - case PCI::RegisterOffset::BAR2: - return "bar2"sv; - case PCI::RegisterOffset::BAR3: - return "bar3"sv; - case PCI::RegisterOffset::BAR4: - return "bar4"sv; - case PCI::RegisterOffset::BAR5: - return "bar5"sv; - default: - VERIFY_NOT_REACHED(); - } -} - -NonnullRefPtr<PCIDeviceAttributeSysFSComponent> PCIDeviceAttributeSysFSComponent::create(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width) -{ - return adopt_ref(*new (nothrow) PCIDeviceAttributeSysFSComponent(device, offset, field_bytes_width)); -} - -PCIDeviceAttributeSysFSComponent::PCIDeviceAttributeSysFSComponent(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width) - : SysFSComponent() - , m_device(device) - , m_offset(offset) - , m_field_bytes_width(field_bytes_width) -{ -} - -ErrorOr<size_t> PCIDeviceAttributeSysFSComponent::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription*) const -{ - auto blob = TRY(try_to_generate_buffer()); - - if ((size_t)offset >= blob->size()) - return 0; - - ssize_t nread = min(static_cast<off_t>(blob->size() - offset), static_cast<off_t>(count)); - TRY(buffer.write(blob->data() + offset, nread)); - return nread; -} - -ErrorOr<NonnullOwnPtr<KBuffer>> PCIDeviceAttributeSysFSComponent::try_to_generate_buffer() const -{ - OwnPtr<KString> value; - switch (m_field_bytes_width) { - case 1: - value = TRY(KString::formatted("{:#x}", PCI::read8(m_device->address(), m_offset))); - break; - case 2: - value = TRY(KString::formatted("{:#x}", PCI::read16(m_device->address(), m_offset))); - break; - case 4: - value = TRY(KString::formatted("{:#x}", PCI::read32(m_device->address(), m_offset))); - break; - default: - VERIFY_NOT_REACHED(); - } - - return KBuffer::try_create_with_bytes(value->view().bytes()); -} -} diff --git a/Kernel/Bus/PCI/SysFSPCI.h b/Kernel/Bus/PCI/SysFSPCI.h deleted file mode 100644 index 80c09e46e5..0000000000 --- a/Kernel/Bus/PCI/SysFSPCI.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <AK/Vector.h> -#include <Kernel/Bus/PCI/Definitions.h> -#include <Kernel/FileSystem/SysFS.h> - -namespace Kernel::PCI { - -class PCIBusSysFSDirectory final : public SysFSDirectory { -public: - static void initialize(); - virtual StringView name() const override { return "pci"sv; } - -private: - PCIBusSysFSDirectory(); -}; - -class PCIDeviceSysFSDirectory final : public SysFSDirectory { -public: - static NonnullRefPtr<PCIDeviceSysFSDirectory> create(SysFSDirectory const&, Address); - Address const& address() const { return m_address; } - - virtual StringView name() const override { return m_device_directory_name->view(); } - -private: - PCIDeviceSysFSDirectory(NonnullOwnPtr<KString> device_directory_name, SysFSDirectory const&, Address); - - Address m_address; - - NonnullOwnPtr<KString> m_device_directory_name; -}; - -class PCIDeviceAttributeSysFSComponent : public SysFSComponent { -public: - static NonnullRefPtr<PCIDeviceAttributeSysFSComponent> create(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width); - - virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override; - virtual ~PCIDeviceAttributeSysFSComponent() {}; - - virtual StringView name() const override; - -protected: - ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer() const; - PCIDeviceAttributeSysFSComponent(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width); - NonnullRefPtr<PCIDeviceSysFSDirectory> m_device; - PCI::RegisterOffset m_offset; - size_t m_field_bytes_width; -}; - -} diff --git a/Kernel/Bus/USB/SysFSUSB.cpp b/Kernel/Bus/USB/SysFSUSB.cpp deleted file mode 100644 index 568bda9b6a..0000000000 --- a/Kernel/Bus/USB/SysFSUSB.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il> - * Copyright (c) 2022, Jesse Buhagiar <jesse.buhagiar@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <AK/JsonArraySerializer.h> -#include <AK/JsonObjectSerializer.h> -#include <Kernel/Bus/USB/SysFSUSB.h> -#include <Kernel/KBufferBuilder.h> - -namespace Kernel::USB { - -static SysFSUSBBusDirectory* s_procfs_usb_bus_directory; - -SysFSUSBDeviceInformation::SysFSUSBDeviceInformation(NonnullOwnPtr<KString> device_name, USB::Device& device) - : SysFSComponent() - , m_device(device) - , m_device_name(move(device_name)) -{ -} - -SysFSUSBDeviceInformation::~SysFSUSBDeviceInformation() = default; - -ErrorOr<void> SysFSUSBDeviceInformation::try_generate(KBufferBuilder& builder) -{ - VERIFY(m_lock.is_locked()); - auto array = TRY(JsonArraySerializer<>::try_create(builder)); - - auto obj = TRY(array.add_object()); - TRY(obj.add("device_address", m_device->address())); - TRY(obj.add("usb_spec_compliance_bcd", m_device->device_descriptor().usb_spec_compliance_bcd)); - TRY(obj.add("device_class", m_device->device_descriptor().device_class)); - TRY(obj.add("device_sub_class", m_device->device_descriptor().device_sub_class)); - TRY(obj.add("device_protocol", m_device->device_descriptor().device_protocol)); - TRY(obj.add("max_packet_size", m_device->device_descriptor().max_packet_size)); - TRY(obj.add("vendor_id", m_device->device_descriptor().vendor_id)); - TRY(obj.add("product_id", m_device->device_descriptor().product_id)); - TRY(obj.add("device_release_bcd", m_device->device_descriptor().device_release_bcd)); - TRY(obj.add("manufacturer_id_descriptor_index", m_device->device_descriptor().manufacturer_id_descriptor_index)); - TRY(obj.add("product_string_descriptor_index", m_device->device_descriptor().product_string_descriptor_index)); - TRY(obj.add("serial_number_descriptor_index", m_device->device_descriptor().serial_number_descriptor_index)); - TRY(obj.add("num_configurations", m_device->device_descriptor().num_configurations)); - TRY(obj.add("length", m_device->device_descriptor().descriptor_header.length)); - TRY(obj.add("descriptor_type", m_device->device_descriptor().descriptor_header.descriptor_type)); - - auto configuration_array = TRY(obj.add_array("configurations")); - for (auto const& configuration : m_device->configurations()) { - auto configuration_object = TRY(configuration_array.add_object()); - auto const& configuration_descriptor = configuration.descriptor(); - TRY(configuration_object.add("length", configuration_descriptor.descriptor_header.length)); - TRY(configuration_object.add("descriptor_type", configuration_descriptor.descriptor_header.descriptor_type)); - TRY(configuration_object.add("total_length", configuration_descriptor.total_length)); - TRY(configuration_object.add("number_of_interfaces", configuration_descriptor.number_of_interfaces)); - TRY(configuration_object.add("attributes_bitmap", configuration_descriptor.attributes_bitmap)); - TRY(configuration_object.add("max_power", configuration_descriptor.max_power_in_ma)); - - auto interface_array = TRY(configuration_object.add_array("interfaces")); - for (auto const& interface : configuration.interfaces()) { - auto interface_object = TRY(interface_array.add_object()); - auto const& interface_descriptor = interface.descriptor(); - TRY(interface_object.add("length", interface_descriptor.descriptor_header.length)); - TRY(interface_object.add("descriptor_type", interface_descriptor.descriptor_header.descriptor_type)); - TRY(interface_object.add("interface_number", interface_descriptor.interface_id)); - TRY(interface_object.add("alternate_setting", interface_descriptor.alternate_setting)); - TRY(interface_object.add("num_endpoints", interface_descriptor.number_of_endpoints)); - TRY(interface_object.add("interface_class_code", interface_descriptor.interface_class_code)); - TRY(interface_object.add("interface_sub_class_code", interface_descriptor.interface_sub_class_code)); - TRY(interface_object.add("interface_protocol", interface_descriptor.interface_protocol)); - TRY(interface_object.add("interface_string_desc_index", interface_descriptor.interface_string_descriptor_index)); - - auto endpoint_array = TRY(interface_object.add_array("endpoints")); - for (auto const& endpoint : interface.endpoints()) { - auto endpoint_object = TRY(endpoint_array.add_object()); - TRY(endpoint_object.add("length", endpoint.descriptor_header.length)); - TRY(endpoint_object.add("descriptor_length", endpoint.descriptor_header.descriptor_type)); - TRY(endpoint_object.add("endpoint_address", endpoint.endpoint_address)); - TRY(endpoint_object.add("attribute_bitmap", endpoint.endpoint_attributes_bitmap)); - TRY(endpoint_object.add("max_packet_size", endpoint.max_packet_size)); - TRY(endpoint_object.add("polling_interval", endpoint.poll_interval_in_frames)); - TRY(endpoint_object.finish()); - } - TRY(endpoint_array.finish()); - TRY(interface_object.finish()); - } - TRY(interface_array.finish()); - TRY(configuration_object.finish()); - } - TRY(configuration_array.finish()); - - TRY(obj.finish()); - TRY(array.finish()); - return {}; -} - -ErrorOr<void> SysFSUSBDeviceInformation::refresh_data(OpenFileDescription& description) const -{ - MutexLocker lock(m_lock); - auto& cached_data = description.data(); - if (!cached_data) { - cached_data = TRY(adopt_nonnull_own_or_enomem(new (nothrow) SysFSInodeData)); - } - auto builder = TRY(KBufferBuilder::try_create()); - TRY(const_cast<SysFSUSBDeviceInformation&>(*this).try_generate(builder)); - auto& typed_cached_data = static_cast<SysFSInodeData&>(*cached_data); - typed_cached_data.buffer = builder.build(); - if (!typed_cached_data.buffer) - return ENOMEM; - return {}; -} - -ErrorOr<size_t> SysFSUSBDeviceInformation::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription* description) const -{ - dbgln_if(PROCFS_DEBUG, "SysFSUSBDeviceInformation @ {}: read_bytes offset: {} count: {}", name(), offset, count); - - VERIFY(offset >= 0); - VERIFY(buffer.user_or_kernel_ptr()); - - if (!description) - return Error::from_errno(EIO); - - MutexLocker locker(m_lock); - - if (!description->data()) { - dbgln("SysFSUSBDeviceInformation: Do not have cached data!"); - return Error::from_errno(EIO); - } - - auto& typed_cached_data = static_cast<SysFSInodeData&>(*description->data()); - auto& data_buffer = typed_cached_data.buffer; - - if (!data_buffer || (size_t)offset >= data_buffer->size()) - return 0; - - ssize_t nread = min(static_cast<off_t>(data_buffer->size() - offset), static_cast<off_t>(count)); - TRY(buffer.write(data_buffer->data() + offset, nread)); - return nread; -} - -ErrorOr<void> SysFSUSBBusDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const -{ - SpinlockLocker lock(m_lock); - // Note: if the parent directory is null, it means something bad happened as this should not happen for the USB directory. - VERIFY(m_parent_directory); - TRY(callback({ ".", { fsid, component_index() }, 0 })); - TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); - - for (auto const& device_node : m_device_nodes) { - InodeIdentifier identifier = { fsid, device_node.component_index() }; - TRY(callback({ device_node.name(), identifier, 0 })); - } - return {}; -} - -RefPtr<SysFSComponent> SysFSUSBBusDirectory::lookup(StringView name) -{ - SpinlockLocker lock(m_lock); - for (auto& device_node : m_device_nodes) { - if (device_node.name() == name) { - return device_node; - } - } - return {}; -} - -RefPtr<SysFSUSBDeviceInformation> SysFSUSBBusDirectory::device_node_for(USB::Device& device) -{ - RefPtr<USB::Device> checked_device = device; - for (auto& device_node : m_device_nodes) { - if (device_node.device().ptr() == checked_device.ptr()) - return device_node; - } - return {}; -} - -void SysFSUSBBusDirectory::plug(USB::Device& new_device) -{ - SpinlockLocker lock(m_lock); - auto device_node = device_node_for(new_device); - VERIFY(!device_node); - auto sysfs_usb_device_or_error = SysFSUSBDeviceInformation::create(new_device); - if (sysfs_usb_device_or_error.is_error()) { - dbgln("Failed to create SysFSUSBDevice for device id {}", new_device.address()); - return; - } - - m_device_nodes.append(sysfs_usb_device_or_error.release_value()); -} - -void SysFSUSBBusDirectory::unplug(USB::Device& deleted_device) -{ - SpinlockLocker lock(m_lock); - auto device_node = device_node_for(deleted_device); - VERIFY(device_node); - device_node->m_list_node.remove(); -} - -SysFSUSBBusDirectory& SysFSUSBBusDirectory::the() -{ - VERIFY(s_procfs_usb_bus_directory); - return *s_procfs_usb_bus_directory; -} - -UNMAP_AFTER_INIT SysFSUSBBusDirectory::SysFSUSBBusDirectory(SysFSBusDirectory& buses_directory) - : SysFSDirectory(buses_directory) -{ -} - -UNMAP_AFTER_INIT void SysFSUSBBusDirectory::initialize() -{ - auto directory = adopt_ref(*new SysFSUSBBusDirectory(SysFSComponentRegistry::the().buses_directory())); - SysFSComponentRegistry::the().register_new_bus_directory(directory); - s_procfs_usb_bus_directory = directory; -} - -ErrorOr<NonnullRefPtr<SysFSUSBDeviceInformation>> SysFSUSBDeviceInformation::create(USB::Device& device) -{ - auto device_name = TRY(KString::number(device.address())); - return adopt_nonnull_ref_or_enomem(new (nothrow) SysFSUSBDeviceInformation(move(device_name), device)); -} - -} diff --git a/Kernel/Bus/USB/SysFSUSB.h b/Kernel/Bus/USB/SysFSUSB.h deleted file mode 100644 index bf7163dd76..0000000000 --- a/Kernel/Bus/USB/SysFSUSB.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <Kernel/Bus/USB/USBDevice.h> -#include <Kernel/FileSystem/SysFS.h> -#include <Kernel/KBufferBuilder.h> -#include <Kernel/Locking/Mutex.h> - -namespace Kernel::USB { - -class SysFSUSBDeviceInformation : public SysFSComponent { - friend class SysFSUSBBusDirectory; - -public: - virtual ~SysFSUSBDeviceInformation() override; - - static ErrorOr<NonnullRefPtr<SysFSUSBDeviceInformation>> create(USB::Device&); - virtual StringView name() const override { return m_device_name->view(); } - - RefPtr<USB::Device> device() const { return m_device; } - -protected: - SysFSUSBDeviceInformation(NonnullOwnPtr<KString> device_name, USB::Device& device); - - virtual ErrorOr<size_t> read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription*) const override; - - IntrusiveListNode<SysFSUSBDeviceInformation, RefPtr<SysFSUSBDeviceInformation>> m_list_node; - - NonnullRefPtr<USB::Device> m_device; - -private: - ErrorOr<void> try_generate(KBufferBuilder&); - virtual ErrorOr<void> refresh_data(OpenFileDescription& description) const override; - mutable Mutex m_lock { "SysFSUSBDeviceInformation" }; - NonnullOwnPtr<KString> m_device_name; -}; - -class SysFSUSBBusDirectory final : public SysFSDirectory { -public: - static void initialize(); - static SysFSUSBBusDirectory& the(); - - virtual StringView name() const override { return "usb"sv; } - - void plug(USB::Device&); - void unplug(USB::Device&); - - virtual ErrorOr<void> traverse_as_directory(FileSystemID, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)>) const override; - virtual RefPtr<SysFSComponent> lookup(StringView name) override; - -private: - explicit SysFSUSBBusDirectory(SysFSBusDirectory&); - - RefPtr<SysFSUSBDeviceInformation> device_node_for(USB::Device& device); - - IntrusiveList<&SysFSUSBDeviceInformation::m_list_node> m_device_nodes; - mutable Spinlock m_lock; -}; - -} diff --git a/Kernel/Bus/USB/USBHub.cpp b/Kernel/Bus/USB/USBHub.cpp index f5684858fc..c2c94df961 100644 --- a/Kernel/Bus/USB/USBHub.cpp +++ b/Kernel/Bus/USB/USBHub.cpp @@ -5,11 +5,11 @@ */ #include <Kernel/Arch/x86/IO.h> -#include <Kernel/Bus/USB/SysFSUSB.h> #include <Kernel/Bus/USB/USBClasses.h> #include <Kernel/Bus/USB/USBController.h> #include <Kernel/Bus/USB/USBHub.h> #include <Kernel/Bus/USB/USBRequest.h> +#include <Kernel/FileSystem/SysFS/Subsystems/Bus/USB/SysFSUSB.h> #include <Kernel/StdLib.h> namespace Kernel::USB { diff --git a/Kernel/Bus/USB/USBManagement.cpp b/Kernel/Bus/USB/USBManagement.cpp index 8b59a1a4e3..5130654fd8 100644 --- a/Kernel/Bus/USB/USBManagement.cpp +++ b/Kernel/Bus/USB/USBManagement.cpp @@ -6,10 +6,10 @@ #include <AK/Singleton.h> #include <Kernel/Bus/PCI/API.h> -#include <Kernel/Bus/USB/SysFSUSB.h> #include <Kernel/Bus/USB/UHCI/UHCIController.h> #include <Kernel/Bus/USB/USBManagement.h> #include <Kernel/CommandLine.h> +#include <Kernel/FileSystem/SysFS/Subsystems/Bus/USB/SysFSUSB.h> #include <Kernel/Sections.h> namespace Kernel::USB { |