diff mbox series

[U-Boot,v3.1,01/26] fs: fat: guard the content of include/fat.h

Message ID 20180912065541.6251-1-takahiro.akashi@linaro.org
State Superseded
Delegated to: Alexander Graf
Headers show
Series [U-Boot,v3.1,01/26] fs: fat: guard the content of include/fat.h | expand

Commit Message

AKASHI Takahiro Sept. 12, 2018, 6:55 a.m. UTC
From: AKASHI Takahiro <takahiro.akashi@linaro.org>

The whole content of include/fat.h should be guarded with CONFIG_FS_FAT.

This is necessary specifically because fs/fs.c unconditionally includes
fat.h, which refers to a config symbol, CONFIG_FS_FAT_MAX_CLUSTSIZE.
So if CONFIG_FS_FAT, and thus CONFIG_FS_FAT_MAX_CLUSTSIZE, is not
defined, fs/fs.c will fail to compile.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 include/fat.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Alexander Graf Sept. 23, 2018, 2:42 p.m. UTC | #1
On 12.09.18 08:55, Akashi, Takahiro wrote:
> From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> 
> The whole content of include/fat.h should be guarded with CONFIG_FS_FAT.
> 
> This is necessary specifically because fs/fs.c unconditionally includes
> fat.h, which refers to a config symbol, CONFIG_FS_FAT_MAX_CLUSTSIZE.
> So if CONFIG_FS_FAT, and thus CONFIG_FS_FAT_MAX_CLUSTSIZE, is not
> defined, fs/fs.c will fail to compile.

I don't see that define used anywhere outside of FAT code, so I still
don't understand why we need this patch.


Alex
AKASHI Takahiro Sept. 25, 2018, 4:54 a.m. UTC | #2
On Sun, Sep 23, 2018 at 04:42:17PM +0200, Alexander Graf wrote:
> 
> 
> On 12.09.18 08:55, Akashi, Takahiro wrote:
> > From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> > 
> > The whole content of include/fat.h should be guarded with CONFIG_FS_FAT.
> > 
> > This is necessary specifically because fs/fs.c unconditionally includes
> > fat.h, which refers to a config symbol, CONFIG_FS_FAT_MAX_CLUSTSIZE.
> > So if CONFIG_FS_FAT, and thus CONFIG_FS_FAT_MAX_CLUSTSIZE, is not
> > defined, fs/fs.c will fail to compile.
> 
> I don't see that define used anywhere outside of FAT code, so I still
> don't understand why we need this patch.

Try to compile u-boot without CONFIG_FS_FAT.
You will find out what I (and originally Heinrich) meant.

Thanks,
-Takahiro Akashi

> 
> Alex
diff mbox series

Patch

diff --git a/include/fat.h b/include/fat.h
index 09e142368585..8bc280e872ba 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -9,6 +9,9 @@ 
 #ifndef _FAT_H_
 #define _FAT_H_
 
+#include <common.h>
+#ifdef CONFIG_FS_FAT
+
 #include <asm/byteorder.h>
 #include <fs.h>
 
@@ -202,4 +205,5 @@  int fat_opendir(const char *filename, struct fs_dir_stream **dirsp);
 int fat_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp);
 void fat_closedir(struct fs_dir_stream *dirs);
 void fat_close(void);
+#endif /* CONFIG_FS_FAT */
 #endif /* _FAT_H_ */