mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	Kernel: Rename SysFS related classes in PCI code
Give them names that sound related to SysFS.
This commit is contained in:
		
							parent
							
								
									c74b3a310f
								
							
						
					
					
						commit
						5ec3f5433e
					
				
					 3 changed files with 32 additions and 32 deletions
				
			
		|  | @ -368,45 +368,45 @@ void Capability::write32(u32 field, u32 value) | |||
|     PCI::write32(m_address, m_ptr + field, value); | ||||
| } | ||||
| 
 | ||||
| UNMAP_AFTER_INIT NonnullRefPtr<ExposedDeviceFolder> ExposedDeviceFolder::create(const SysFSDirectory& parent_folder, Address address) | ||||
| UNMAP_AFTER_INIT NonnullRefPtr<PCIDeviceSysFSDirectory> PCIDeviceSysFSDirectory::create(const SysFSDirectory& parent_folder, Address address) | ||||
| { | ||||
|     return adopt_ref(*new (nothrow) ExposedDeviceFolder(parent_folder, address)); | ||||
|     return adopt_ref(*new (nothrow) PCIDeviceSysFSDirectory(parent_folder, address)); | ||||
| } | ||||
| 
 | ||||
| UNMAP_AFTER_INIT ExposedDeviceFolder::ExposedDeviceFolder(const SysFSDirectory& parent_folder, Address address) | ||||
| UNMAP_AFTER_INIT PCIDeviceSysFSDirectory::PCIDeviceSysFSDirectory(const SysFSDirectory& parent_folder, Address address) | ||||
|     : SysFSDirectory(String::formatted("{:04x}:{:04x}:{:02x}.{}", address.seg(), address.bus(), address.device(), address.function()), parent_folder) | ||||
| { | ||||
|     m_components.append(ExposedAttribute::create("vendor", *this, PCI_VENDOR_ID, 2)); | ||||
|     m_components.append(ExposedAttribute::create("device_id", *this, PCI_DEVICE_ID, 2)); | ||||
|     m_components.append(ExposedAttribute::create("class", *this, PCI_CLASS, 1)); | ||||
|     m_components.append(ExposedAttribute::create("subclass", *this, PCI_SUBCLASS, 1)); | ||||
|     m_components.append(ExposedAttribute::create("revision", *this, PCI_REVISION_ID, 1)); | ||||
|     m_components.append(ExposedAttribute::create("progif", *this, PCI_PROG_IF, 1)); | ||||
|     m_components.append(ExposedAttribute::create("subsystem_vendor", *this, PCI_SUBSYSTEM_VENDOR_ID, 2)); | ||||
|     m_components.append(ExposedAttribute::create("subsystem_id", *this, PCI_SUBSYSTEM_ID, 2)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("vendor", *this, PCI_VENDOR_ID, 2)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("device_id", *this, PCI_DEVICE_ID, 2)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("class", *this, PCI_CLASS, 1)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("subclass", *this, PCI_SUBCLASS, 1)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("revision", *this, PCI_REVISION_ID, 1)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("progif", *this, PCI_PROG_IF, 1)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("subsystem_vendor", *this, PCI_SUBSYSTEM_VENDOR_ID, 2)); | ||||
|     m_components.append(PCIDeviceAttributeSysFSComponent::create("subsystem_id", *this, PCI_SUBSYSTEM_ID, 2)); | ||||
| } | ||||
| 
 | ||||
| UNMAP_AFTER_INIT void BusExposedFolder::initialize() | ||||
| UNMAP_AFTER_INIT void PCIBusSysFSDirectory::initialize() | ||||
| { | ||||
|     auto pci_folder = adopt_ref(*new (nothrow) BusExposedFolder()); | ||||
|     auto pci_folder = adopt_ref(*new (nothrow) PCIBusSysFSDirectory()); | ||||
|     SysFSComponentRegistry::the().register_new_component(pci_folder); | ||||
| } | ||||
| 
 | ||||
| UNMAP_AFTER_INIT BusExposedFolder::BusExposedFolder() | ||||
| UNMAP_AFTER_INIT PCIBusSysFSDirectory::PCIBusSysFSDirectory() | ||||
|     : SysFSDirectory("pci", SysFSComponentRegistry::the().root_folder()) | ||||
| { | ||||
|     PCI::enumerate([&](const Address& address, ID) { | ||||
|         auto pci_device = PCI::ExposedDeviceFolder::create(*this, address); | ||||
|         auto pci_device = PCI::PCIDeviceSysFSDirectory::create(*this, address); | ||||
|         m_components.append(pci_device); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtr<ExposedAttribute> ExposedAttribute::create(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width) | ||||
| NonnullRefPtr<PCIDeviceAttributeSysFSComponent> PCIDeviceAttributeSysFSComponent::create(String name, const PCIDeviceSysFSDirectory& device, size_t offset, size_t field_bytes_width) | ||||
| { | ||||
|     return adopt_ref(*new (nothrow) ExposedAttribute(name, device, offset, field_bytes_width)); | ||||
|     return adopt_ref(*new (nothrow) PCIDeviceAttributeSysFSComponent(name, device, offset, field_bytes_width)); | ||||
| } | ||||
| 
 | ||||
| ExposedAttribute::ExposedAttribute(String name, const ExposedDeviceFolder& device, size_t offset, size_t field_bytes_width) | ||||
| PCIDeviceAttributeSysFSComponent::PCIDeviceAttributeSysFSComponent(String name, const PCIDeviceSysFSDirectory& device, size_t offset, size_t field_bytes_width) | ||||
|     : SysFSComponent(name) | ||||
|     , m_device(device) | ||||
|     , m_offset(offset) | ||||
|  | @ -414,7 +414,7 @@ ExposedAttribute::ExposedAttribute(String name, const ExposedDeviceFolder& devic | |||
| { | ||||
| } | ||||
| 
 | ||||
| KResultOr<size_t> ExposedAttribute::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, FileDescription*) const | ||||
| KResultOr<size_t> PCIDeviceAttributeSysFSComponent::read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, FileDescription*) const | ||||
| { | ||||
|     auto blob = try_to_generate_buffer(); | ||||
|     if (!blob) | ||||
|  | @ -429,7 +429,7 @@ KResultOr<size_t> ExposedAttribute::read_bytes(off_t offset, size_t count, UserO | |||
|     return nread; | ||||
| } | ||||
| 
 | ||||
| size_t ExposedAttribute::size() const | ||||
| size_t PCIDeviceAttributeSysFSComponent::size() const | ||||
| { | ||||
|     auto buffer = try_to_generate_buffer(); | ||||
|     if (!buffer) | ||||
|  | @ -437,7 +437,7 @@ size_t ExposedAttribute::size() const | |||
|     return buffer->size(); | ||||
| } | ||||
| 
 | ||||
| OwnPtr<KBuffer> ExposedAttribute::try_to_generate_buffer() const | ||||
| OwnPtr<KBuffer> PCIDeviceAttributeSysFSComponent::try_to_generate_buffer() const | ||||
| { | ||||
|     String value; | ||||
|     switch (m_field_bytes_width) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling