[PATCH 07/13] fs: fat: fix building without CONFIG_FS_FAT_LFN
Sascha Hauer
s.hauer at pengutronix.de
Wed Nov 18 06:51:57 PST 2026
FILINFO only has the lfname and lfsize fields with long file name
support, so the FAT fuzz test, which sets them depending on
IS_ENABLED(CONFIG_FS_FAT_LFN), breaks building FAT without it:
fs/fat/fat.c: error: 'FILINFO' has no member named 'lfname'
Use #ifdef like the rest of the driver does.
Fixes: f585092b1737 ("fs: fat: add fuzz test for FAT filesystem")
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
fs/fat/fat.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 1c5aa257b4..f413c1cd8f 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -454,7 +454,9 @@ static int fuzz_fat(struct block_device *ramdisk)
BYTE buf[512];
UINT br;
int ret, i;
+#ifdef CONFIG_FS_FAT_LFN
char lfname[256];
+#endif
priv.cdev = &ramdisk->cdev;
fat.userdata = &priv;
@@ -475,10 +477,11 @@ static int fuzz_fat(struct block_device *ramdisk)
for (i = 0; i < 64; i++) {
memset(&finfo, 0, sizeof(finfo));
- if (IS_ENABLED(CONFIG_FS_FAT_LFN)) {
- finfo.lfname = lfname;
- finfo.lfsize = sizeof(lfname);
- }
+#ifdef CONFIG_FS_FAT_LFN
+ /* FILINFO only has the fields for long names with LFN */
+ finfo.lfname = lfname;
+ finfo.lfsize = sizeof(lfname);
+#endif
ret = f_readdir(&dir, &finfo);
if (ret || finfo.fname[0] == '\0')
--
2.47.3
More information about the barebox
mailing list