* [PATCH] filetype: move is_dos_exe into header
@ 2025-12-15 8:38 Ahmad Fatoum
2025-12-15 9:10 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-12-15 8:38 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The MZ magic can occur together with other magic signatures as well,
e.g. in x86 bzImages or in EFI-stubbed ARM/RISC-V kernel images.
Move the check into a header to allow it to be used e.g. from boot entry
providers.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/filetype.c | 5 -----
include/filetype.h | 6 ++++++
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/common/filetype.c b/common/filetype.c
index 3e3e18dae0b3..196591698768 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -288,11 +288,6 @@ enum filetype file_detect_partition_table(const void *_buf, size_t bufsize)
return filetype_unknown;
}
-static bool is_dos_exe(const u8 *buf8)
-{
- return buf8[0] == 'M' && buf8[1] == 'Z';
-}
-
#define CH_TOC_section_name 0x14
enum filetype file_detect_compression_type(const void *_buf, size_t bufsize)
diff --git a/include/filetype.h b/include/filetype.h
index 440eb95bfb0c..283b8fee4c70 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -143,6 +143,12 @@ static inline int is_barebox_head(const char *head)
return is_barebox_arm_head(head) || is_barebox_mips_head(head);
}
+static inline bool is_dos_exe(const void *buf)
+{
+ const u8 *buf8 = buf;
+ return buf8[0] == 'M' && buf8[1] == 'Z';
+}
+
static inline bool is_arm64_linux_bootimage(const void *header)
{
return le32_to_cpup(header + 56) == 0x644d5241;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] filetype: move is_dos_exe into header
2025-12-15 8:38 [PATCH] filetype: move is_dos_exe into header Ahmad Fatoum
@ 2025-12-15 9:10 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-12-15 9:10 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Mon, 15 Dec 2025 09:38:28 +0100, Ahmad Fatoum wrote:
> The MZ magic can occur together with other magic signatures as well,
> e.g. in x86 bzImages or in EFI-stubbed ARM/RISC-V kernel images.
>
> Move the check into a header to allow it to be used e.g. from boot entry
> providers.
>
>
> [...]
Applied, thanks!
[1/1] filetype: move is_dos_exe into header
https://git.pengutronix.de/cgit/barebox/commit/?id=79afef8e1da9 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-15 9:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-15 8:38 [PATCH] filetype: move is_dos_exe into header Ahmad Fatoum
2025-12-15 9:10 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox