]> git.sur5r.net Git - u-boot/blobdiff - include/fat.h
efi_loader: correcty determine total device path length
[u-boot] / include / fat.h
index 83cd90017e56a069eb9a72a4ba5c372ee1790de3..fa956441c659504d247d0a9ff9860946c7fac479 100644 (file)
@@ -13,7 +13,6 @@
 #include <asm/byteorder.h>
 #include <fs.h>
 
-#define CONFIG_SUPPORT_VFAT
 /* Maximum Long File Name length supported here is 128 UTF-16 code units */
 #define VFAT_MAXLEN_BYTES      256 /* Maximum LFN buffer in bytes */
 #define VFAT_MAXSEQ            9   /* Up to 9 of 13 2-byte UTF-16 entries */
@@ -128,10 +127,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 +176,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);