[RFC PATCH 1/6] block: partitions: efi: Move efi.h header to include/linux/gpt.h

Romain Gantois
2023-12-11T15:12:43Z

The GPT parser located in the block layer defines all of the GPT-specific
data structures and logic that are necessary to parse this kind of
partition table. However, it is also specifically tailored for block
devices.

Assuming that different GPT parsers will be implemented in other kernel
subsystems, it is desirable to create a common set of GPT struct
definitions, macros and helpers, so as to limit code reuse between parsers.

As a first step towards this common codebase, this commit moves the efi.h
header, that contains GPT-specific definitions, to include/linux/gpt.h.

There is no functional change.

Signed-off-by: Romain Gantois <romain.gantois@bootlin.com>
---
MAINTAINERS | 3 ++-
block/partitions/efi.c | 2 +-
block/partitions/msdos.c | 2 +-
block/partitions/efi.h => include/linux/gpt.h | 0
4 files changed, 4 insertions(+), 3 deletions(-)
rename block/partitions/efi.h => include/linux/gpt.h (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 97f51d5ec1cf..22e37e2ea1ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9233,7 +9233,8 @@ GUID PARTITION TABLE (GPT)
M: Davidlohr Bueso <dave@stgolabs.net>
L: linux-efi@vger.kernel.org
S: Maintained
-F: block/partitions/efi.*
+F: block/partitions/efi.c
+F: include/linux/gpt.h

HABANALABS PCI DRIVER
M: Oded Gabbay <ogabbay@kernel.org>
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 5e9be13a56a8..db50c3f2bab3 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -87,8 +87,8 @@
#include <linux/ctype.h>
#include <linux/math64.h>
#include <linux/slab.h>
+#include <linux/gpt.h>
#include "check.h"
-#include "efi.h"

/* This allows a kernel command line option 'gpt' to override
* the test for invalid PMBR. Not __initdata because reloading
diff --git a/block/partitions/msdos.c b/block/partitions/msdos.c
index b5d5c229cc3b..d0376cf27448 100644
--- a/block/partitions/msdos.c
+++ b/block/partitions/msdos.c
@@ -27,9 +27,9 @@
*/
#include <linux/msdos_fs.h>
#include <linux/msdos_partition.h>
+#include <linux/gpt.h>

#include "check.h"
-#include "efi.h"

/*
* Many architectures don't like unaligned accesses, while
diff --git a/block/partitions/efi.h b/include/linux/gpt.h
similarity index 100%
rename from block/partitions/efi.h
rename to include/linux/gpt.h
--
2.43.0