[U-Boot] [PATCH 01/17] fs: fat: extend get_fs_info() for write use

AKASHI Takahiro takahiro.akashi at linaro.org
Fri Jul 20 02:57:07 UTC 2018


get_fs_info() was introduced in major re-work of read operation by Rob.
We want to reuse this function in write operation by extending it with
additional members in fsdata structure.

Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
 fs/fat/fat.c  | 3 +++
 include/fat.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 4efe8a3eda..b48f48a751 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -556,6 +556,9 @@ static int get_fs_info(fsdata *mydata)
 		return ret;
 	}
 
+	mydata->bs_total_sect = bs.total_sect;
+	mydata->bs_fats = bs.fats;
+
 	if (mydata->fatsize == 32) {
 		mydata->fatlength = bs.fat32_length;
 	} else {
diff --git a/include/fat.h b/include/fat.h
index 09e1423685..0c88b59a4a 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -173,6 +173,8 @@ typedef struct {
 	int	fatbufnum;	/* Used by get_fatent, init to -1 */
 	int	rootdir_size;	/* Size of root dir for non-FAT32 */
 	__u32	root_cluster;	/* First cluster of root dir for FAT32 */
+	__u32	bs_total_sect;	/* Boot sector's number of sectors */
+	__u8	bs_fats;	/* Boot sector's number of FATs */
 } fsdata;
 
 static inline u32 clust_to_sect(fsdata *fsdata, u32 clust)
-- 
2.17.0



More information about the U-Boot mailing list