summaryrefslogtreecommitdiff
path: root/include/fat.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2017-09-09 13:15:53 -0400
committerTom Rini <trini@konsulko.com>2017-09-15 09:03:10 -0400
commitc6e3baa565bc3b5828cf0d67ca6429dbe5f8687c (patch)
tree5a13890bd687be572ae652124b99b016af93af43 /include/fat.h
parent45449980f80169214633f2649a27c791d0104e9d (diff)
fs/fat: introduce new director iterators
Untangle directory traversal into a simple iterator, to replace the existing multi-purpose do_fat_read_at() + get_dentfromdir(). Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Ɓukasz Majewski <lukma@denx.de>
Diffstat (limited to 'include/fat.h')
-rw-r--r--include/fat.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/fat.h b/include/fat.h
index b671ee8f81..21bb6666cf 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -175,8 +175,15 @@ typedef struct {
int data_begin; /* The sector of the first cluster, can be negative */
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 */
} fsdata;
+/* TODO clean up places that are open-coding this: */
+static inline u32 clust_to_sect(fsdata *fsdata, u32 clust)
+{
+ return fsdata->data_begin + clust * fsdata->clust_size;
+}
+
typedef int (file_detectfs_func)(void);
typedef int (file_ls_func)(const char *dir);
typedef int (file_read_func)(const char *filename, void *buffer,