summaryrefslogtreecommitdiff
path: root/fs/fat/fat.c
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2018-09-11 15:58:58 +0900
committerAlexander Graf <agraf@suse.de>2018-09-23 21:55:29 +0200
commitf23101f9513064efa716a132b114b2c2748b7823 (patch)
tree1e697caeeec9755a86e1894c3cb4f5cf3a49e536 /fs/fat/fat.c
parent14d103bb272ef6aa31cd89f3ec9620ff4bd7ed42 (diff)
downloadu-boot-f23101f9513064efa716a132b114b2c2748b7823.tar.gz
u-boot-f23101f9513064efa716a132b114b2c2748b7823.tar.bz2
u-boot-f23101f9513064efa716a132b114b2c2748b7823.zip
fs: fat: extend get_fs_info() for write use
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@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r--fs/fat/fat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 4b722fc5ca..5f921e81e3 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -558,10 +558,17 @@ static int get_fs_info(fsdata *mydata)
if (mydata->fatsize == 32) {
mydata->fatlength = bs.fat32_length;
+ mydata->total_sect = bs.total_sect;
} else {
mydata->fatlength = bs.fat_length;
+ mydata->total_sect = (bs.sectors[1] << 8) + bs.sectors[0];
+ if (!mydata->total_sect)
+ mydata->total_sect = bs.total_sect;
}
+ if (!mydata->total_sect) /* unlikely */
+ mydata->total_sect = (u32)cur_part_info.size;
+ mydata->fats = bs.fats;
mydata->fat_sect = bs.reserved;
mydata->rootdir_sect = mydata->fat_sect + mydata->fatlength * bs.fats;