diff options
| author | Rob Clark <[email protected]> | 2017-09-09 13:16:00 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2017-09-15 09:03:15 -0400 |
| commit | 265edc03d5a19550d92cbd6e10631d5a15bdd1d5 (patch) | |
| tree | d1275a8421fe74498d39d61059595c5648845eb2 /include | |
| parent | 21a24c3bf35bac83d66ce4a48eb0c7dd8a7227cb (diff) | |
fs/fat: Clean up open-coded sector <-> cluster conversions
Use the clust_to_sect() helper that was introduced earlier, and add an
inverse sect_to_clust(), plus update the various spots that open-coded
this conversion previously.
Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/fat.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/fat.h b/include/fat.h index 0f589391242..bdeda95e6de 100644 --- a/include/fat.h +++ b/include/fat.h @@ -177,12 +177,16 @@ typedef struct { __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; } +static inline u32 sect_to_clust(fsdata *fsdata, u32 sect) +{ + return (sect - fsdata->data_begin) / fsdata->clust_size; +} + int file_fat_detectfs(void); int fat_exists(const char *filename); int fat_size(const char *filename, loff_t *size); |
