spl: fat/fs: Add option to include/exclude FAT write build in SPL
authorTien Fong Chee <tien.fong.chee@intel.com>
Wed, 23 Jan 2019 06:20:04 +0000 (14:20 +0800)
committerTom Rini <trini@konsulko.com>
Fri, 1 Feb 2019 14:12:48 +0000 (09:12 -0500)
Most of the time SPL only needs very simple FAT reading, so having
CONFIG_IS_ENABLED(FAT_WRITE) to exclude it from SPL build would help
to save 64KiB default max clustersize from memory.

Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
common/spl/Kconfig
fs/fat/Makefile
fs/fat/fat.c
fs/fs.c

index ab47c05c92575583a49b8d910cf31b58c95f56c5..eac50ac7f759dcf135c1c587cb96dfaa3e53cc1e 100644 (file)
@@ -404,6 +404,13 @@ config SPL_FS_FAT
          filesystem from within SPL. Support for the underlying block
          device (e.g. MMC or USB) must be enabled separately.
 
+config SPL_FAT_WRITE
+       bool "Support write for FAT filesystems"
+       help
+         Enable write support for FAT and VFAT filesystems with SPL.
+         Support for the underlying block device (e.g. MMC or USB) must be
+         enabled separately.
+
 config SPL_FPGA_SUPPORT
        bool "Support FPGAs"
        help
index e64b61a0b430613f74586631e2c13a764cf5d811..f84efaccc75eba51b2be17d223b4aac4e134fcd8 100644 (file)
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-$(CONFIG_FS_FAT)   := fat.o
-obj-$(CONFIG_FAT_WRITE):= fat_write.o
+obj-$(CONFIG_$(SPL_)FS_FAT) = fat.o
+obj-$(CONFIG_$(SPL_)FAT_WRITE) = fat_write.o
index 179bf4f3d89de7d0c7bfc3e500224b7245fcacdb..dac86ea5163c486a3561fc400c6f554a805da764 100644 (file)
@@ -145,7 +145,8 @@ static void get_name(dir_entry *dirent, char *s_name)
 }
 
 static int flush_dirty_fat_buffer(fsdata *mydata);
-#if !defined(CONFIG_FAT_WRITE)
+
+#if !CONFIG_IS_ENABLED(FAT_WRITE)
 /* Stub for read only operation */
 int flush_dirty_fat_buffer(fsdata *mydata)
 {
diff --git a/fs/fs.c b/fs/fs.c
index 7fd22101efe657b72b48c472a4d9dd100c4aedc9..1a6a64ea7f97b1256773a9a880afeec990cfc541 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -168,7 +168,7 @@ static struct fstype_info fstypes[] = {
                .exists = fat_exists,
                .size = fat_size,
                .read = fat_read_file,
-#ifdef CONFIG_FAT_WRITE
+#if CONFIG_IS_ENABLED(FAT_WRITE)
                .write = file_fat_write,
                .unlink = fat_unlink,
                .mkdir = fat_mkdir,