mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:52:44 +00:00 
			
		
		
		
	Kernel+LibPartition: Move GUIDPartitionTable into LibPartition
This commit is contained in:
		
							parent
							
								
									9053d86b82
								
							
						
					
					
						commit
						25de9de7dc
					
				
					 7 changed files with 17 additions and 25 deletions
				
			
		|  | @ -174,6 +174,10 @@ | ||||||
| #cmakedefine01 GLOBAL_DTORS_DEBUG | #cmakedefine01 GLOBAL_DTORS_DEBUG | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | #ifndef GPT_DEBUG | ||||||
|  | #cmakedefine01 GPT_DEBUG | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #ifndef GZIP_DEBUG | #ifndef GZIP_DEBUG | ||||||
| #cmakedefine01 GZIP_DEBUG | #cmakedefine01 GZIP_DEBUG | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -104,7 +104,6 @@ set(KERNEL_SOURCES | ||||||
|     Storage/ATA/ATAPIDiscDevice.cpp |     Storage/ATA/ATAPIDiscDevice.cpp | ||||||
|     Storage/ATA/ATAPort.cpp |     Storage/ATA/ATAPort.cpp | ||||||
|     Storage/Partition/DiskPartition.cpp |     Storage/Partition/DiskPartition.cpp | ||||||
|     Storage/Partition/GUIDPartitionTable.cpp |  | ||||||
|     Storage/NVMe/NVMeController.cpp |     Storage/NVMe/NVMeController.cpp | ||||||
|     Storage/NVMe/NVMeNameSpace.cpp |     Storage/NVMe/NVMeNameSpace.cpp | ||||||
|     Storage/NVMe/NVMeInterruptQueue.cpp |     Storage/NVMe/NVMeInterruptQueue.cpp | ||||||
|  | @ -404,6 +403,7 @@ set(CRYPTO_SOURCES | ||||||
| set(PARTITION_SOURCES | set(PARTITION_SOURCES | ||||||
|     ../Userland/Libraries/LibPartition/DiskPartitionMetadata.cpp |     ../Userland/Libraries/LibPartition/DiskPartitionMetadata.cpp | ||||||
|     ../Userland/Libraries/LibPartition/EBRPartitionTable.cpp |     ../Userland/Libraries/LibPartition/EBRPartitionTable.cpp | ||||||
|  |     ../Userland/Libraries/LibPartition/GUIDPartitionTable.cpp | ||||||
|     ../Userland/Libraries/LibPartition/MBRPartitionTable.cpp |     ../Userland/Libraries/LibPartition/MBRPartitionTable.cpp | ||||||
|     ../Userland/Libraries/LibPartition/PartitionTable.cpp |     ../Userland/Libraries/LibPartition/PartitionTable.cpp | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | @ -107,10 +107,6 @@ | ||||||
| #cmakedefine01 FUTEXQUEUE_DEBUG | #cmakedefine01 FUTEXQUEUE_DEBUG | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef GPT_DEBUG |  | ||||||
| #cmakedefine01 GPT_DEBUG |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #ifndef HPET_COMPARATOR_DEBUG | #ifndef HPET_COMPARATOR_DEBUG | ||||||
| #cmakedefine01 HPET_COMPARATOR_DEBUG | #cmakedefine01 HPET_COMPARATOR_DEBUG | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -21,10 +21,10 @@ | ||||||
| #include <Kernel/Storage/ATA/GenericIDE/ISAController.h> | #include <Kernel/Storage/ATA/GenericIDE/ISAController.h> | ||||||
| #include <Kernel/Storage/ATA/GenericIDE/PCIController.h> | #include <Kernel/Storage/ATA/GenericIDE/PCIController.h> | ||||||
| #include <Kernel/Storage/NVMe/NVMeController.h> | #include <Kernel/Storage/NVMe/NVMeController.h> | ||||||
| #include <Kernel/Storage/Partition/GUIDPartitionTable.h> |  | ||||||
| #include <Kernel/Storage/Ramdisk/Controller.h> | #include <Kernel/Storage/Ramdisk/Controller.h> | ||||||
| #include <Kernel/Storage/StorageManagement.h> | #include <Kernel/Storage/StorageManagement.h> | ||||||
| #include <LibPartition/EBRPartitionTable.h> | #include <LibPartition/EBRPartitionTable.h> | ||||||
|  | #include <LibPartition/GUIDPartitionTable.h> | ||||||
| #include <LibPartition/MBRPartitionTable.h> | #include <LibPartition/MBRPartitionTable.h> | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | @ -140,7 +140,7 @@ UNMAP_AFTER_INIT ErrorOr<NonnullOwnPtr<Partition::PartitionTable>> StorageManage | ||||||
|     if (!ebr_table_or_error.is_error()) { |     if (!ebr_table_or_error.is_error()) { | ||||||
|         return ebr_table_or_error.release_value(); |         return ebr_table_or_error.release_value(); | ||||||
|     } |     } | ||||||
|     return TRY(GUIDPartitionTable::try_to_initialize(device)); |     return TRY(Partition::GUIDPartitionTable::try_to_initialize(device)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions() | UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions() | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| set(SOURCES | set(SOURCES | ||||||
|     DiskPartitionMetadata.cpp |     DiskPartitionMetadata.cpp | ||||||
|     EBRPartitionTable.cpp |     EBRPartitionTable.cpp | ||||||
|  |     GUIDPartitionTable.cpp | ||||||
|     MBRPartitionTable.cpp |     MBRPartitionTable.cpp | ||||||
|     PartitionTable.cpp |     PartitionTable.cpp | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | @ -4,16 +4,13 @@ | ||||||
|  * SPDX-License-Identifier: BSD-2-Clause |  * SPDX-License-Identifier: BSD-2-Clause | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <AK/AllOf.h> | #include <AK/Debug.h> | ||||||
| #include <AK/Array.h> | #include <LibPartition/GUIDPartitionTable.h> | ||||||
| #include <Kernel/Debug.h> |  | ||||||
| #include <Kernel/Storage/Partition/GUIDPartitionTable.h> |  | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Partition { | ||||||
| 
 | 
 | ||||||
| #define GPT_SIGNATURE2 0x54524150 | #define GPT_SIGNATURE2 0x54524150 | ||||||
| #define GPT_SIGNATURE 0x20494645 | #define GPT_SIGNATURE 0x20494645 | ||||||
| #define BytesPerSector 512 |  | ||||||
| 
 | 
 | ||||||
| struct [[gnu::packed]] GPTPartitionEntry { | struct [[gnu::packed]] GPTPartitionEntry { | ||||||
|     u8 partition_guid[16]; |     u8 partition_guid[16]; | ||||||
|  | @ -47,7 +44,7 @@ struct [[gnu::packed]] GUIDPartitionHeader { | ||||||
|     u32 crc32_entries_array; |     u32 crc32_entries_array; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(StorageDevice const& device) | ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize(Kernel::StorageDevice const& device) | ||||||
| { | { | ||||||
|     auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device))); |     auto table = TRY(adopt_nonnull_own_or_enomem(new (nothrow) GUIDPartitionTable(device))); | ||||||
|     if (!table->is_valid()) |     if (!table->is_valid()) | ||||||
|  | @ -55,7 +52,7 @@ ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> GUIDPartitionTable::try_to_initialize | ||||||
|     return table; |     return table; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| GUIDPartitionTable::GUIDPartitionTable(StorageDevice const& device) | GUIDPartitionTable::GUIDPartitionTable(Kernel::StorageDevice const& device) | ||||||
|     : MBRPartitionTable(device) |     : MBRPartitionTable(device) | ||||||
| { | { | ||||||
|     // FIXME: Handle OOM failure here.
 |     // FIXME: Handle OOM failure here.
 | ||||||
|  | @ -6,23 +6,17 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <AK/Error.h> |  | ||||||
| #include <AK/RefPtr.h> |  | ||||||
| #include <AK/Result.h> |  | ||||||
| #include <AK/Types.h> |  | ||||||
| #include <AK/Vector.h> |  | ||||||
| #include <LibPartition/MBRPartitionTable.h> | #include <LibPartition/MBRPartitionTable.h> | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Partition { | ||||||
| 
 | 
 | ||||||
| struct GUIDPartitionHeader; | struct GUIDPartitionHeader; | ||||||
| class GUIDPartitionTable final : public Partition::MBRPartitionTable { | class GUIDPartitionTable final : public MBRPartitionTable { | ||||||
| public: | public: | ||||||
|     virtual ~GUIDPartitionTable() = default; |     virtual ~GUIDPartitionTable() = default; | ||||||
|     ; |  | ||||||
| 
 | 
 | ||||||
|     static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(StorageDevice const&); |     static ErrorOr<NonnullOwnPtr<GUIDPartitionTable>> try_to_initialize(Kernel::StorageDevice const&); | ||||||
|     explicit GUIDPartitionTable(StorageDevice const&); |     explicit GUIDPartitionTable(Kernel::StorageDevice const&); | ||||||
| 
 | 
 | ||||||
|     virtual bool is_valid() const override { return m_valid; }; |     virtual bool is_valid() const override { return m_valid; }; | ||||||
| 
 | 
 | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Samuel Bowman
						Samuel Bowman