mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] efi: loader: disk: detect the file system type only once
@ 2026-08-31 14:55 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2026-08-31 14:55 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, Ahmad Fatoum

From: Ahmad Fatoum <a.fatoum@barebox.org>

efi_fs_exists() calls cdev_detect_type() once per file system driver,
reading the first FILE_TYPE_SAFE_BUFSIZE bytes off the device each time.
Run cdev_detect_type() once and then match the result against the drivers.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 efi/loader/protocols/disk.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/efi/loader/protocols/disk.c b/efi/loader/protocols/disk.c
index 5376c9ec9a14..493be8c5aafe 100644
--- a/efi/loader/protocols/disk.c
+++ b/efi/loader/protocols/disk.c
@@ -160,16 +160,14 @@ efi_fs_from_path(struct efi_device_path *full_path)
 
 static bool efi_fs_exists(struct cdev *cdev)
 {
+	enum filetype filetype;
 	struct driver *drv;
 
+	if (cdev_detect_type(cdev, &filetype))
+		return false;
+
 	bus_for_each_driver(&fs_bus, drv) {
-		struct fs_driver *fdrv;
-		enum filetype filetype;
-
-		fdrv = drv_to_fs_driver(drv);
-
-		if (cdev_detect_type(cdev, &filetype) == 0 &&
-		    filetype == fdrv->type)
+		if (drv_to_fs_driver(drv)->type == filetype)
 			return true;
 	}
 
-- 
2.47.3




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-31 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 14:55 [PATCH] efi: loader: disk: detect the file system type only once Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox