mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	Kernel/Net: Generate interface name near construction point
This change allows the Kernel to actually construct other interfaces besides the E1000 type. This solves a breakage that was introduced recently because of move semantics. A couple of points on this patch: 1. In current situation, we can waste time to create a KString and throw it for nothing. This patch ensures we only create it near construction point so we know we actually need it. 2. It's very likely to assume that non-x86 machines will expose network device with a device tree (or with ACPI). The raspberry pi machine is a good example of that. Therefore, each driver should explicitly ask the correct interface name generation method, and this patch simplifies this pattern greatly, especially in a case where the same network device can appear as a PCI device or as device in another bus type on the same platform target. For example, the (in)famous ne2000 device can be used either as a PCI device or as an ISA device, depending on the model. 3. In my opinion, it seems much more readable to construct the name near calling point of the object constructor than to just pass it with move semantics.
This commit is contained in:
		
							parent
							
								
									4f9aefadef
								
							
						
					
					
						commit
						64aaf263a2
					
				
					 12 changed files with 55 additions and 26 deletions
				
			
		|  | @ -20,7 +20,7 @@ class E1000NetworkAdapter : public NetworkAdapter | |||
|     , public PCI::Device | ||||
|     , public IRQHandler { | ||||
| public: | ||||
|     static RefPtr<E1000NetworkAdapter> try_to_initialize(PCI::DeviceIdentifier const&, NonnullOwnPtr<KString>); | ||||
|     static RefPtr<E1000NetworkAdapter> try_to_initialize(PCI::DeviceIdentifier const&); | ||||
| 
 | ||||
|     virtual bool initialize(); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A