X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Ffat.h;h=bdeda95e6debebad99523451efdcc14f584d7e44;hb=002e91087c817f8281fccee327e0d8e98c691a2f;hp=83cd90017e56a069eb9a72a4ba5c372ee1790de3;hpb=89191d626793490b579e1d36e7d7a4464a20f9f6;p=oweals%2Fu-boot.git diff --git a/include/fat.h b/include/fat.h index 83cd90017e..bdeda95e6d 100644 --- a/include/fat.h +++ b/include/fat.h @@ -128,10 +128,14 @@ typedef struct volume_info /* Boot sign comes last, 2 bytes */ } volume_info; +/* see dir_entry::lcase: */ +#define CASE_LOWER_BASE 8 /* base (name) is lower case */ +#define CASE_LOWER_EXT 16 /* extension is lower case */ + typedef struct dir_entry { char name[8],ext[3]; /* Name and extension */ __u8 attr; /* Attribute bits */ - __u8 lcase; /* Case for base and extension */ + __u8 lcase; /* Case for name and ext (CASE_LOWER_x) */ __u8 ctime_ms; /* Creation time, milliseconds */ __u16 ctime; /* Creation time */ __u16 cdate; /* Creation date */ @@ -173,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);