]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/fat.h
Merge branch 'master' of git://www.denx.de/git/u-boot-imx
[karo-tx-uboot.git] / include / fat.h
index c8eb7ccd2904c2e9977b252f4234d20854e29501..20ca3f3dca7df4476c5e94b9925815ba08bb6378 100644 (file)
 #define VFAT_MAXSEQ            9   /* Up to 9 of 13 2-byte UTF-16 entries */
 #define PREFETCH_BLOCKS                2
 
-#define MAX_CLUSTSIZE  65536
+#ifndef CONFIG_FS_FAT_MAX_CLUSTSIZE
+#define CONFIG_FS_FAT_MAX_CLUSTSIZE 65536
+#endif
+#define MAX_CLUSTSIZE  CONFIG_FS_FAT_MAX_CLUSTSIZE
+
 #define DIRENTSPERBLOCK        (mydata->sect_size / sizeof(dir_entry))
 #define DIRENTSPERCLUST        ((mydata->clust_size * mydata->sect_size) / \
                         sizeof(dir_entry))
 #define START(dent)    (FAT2CPU16((dent)->start) \
                        + (mydata->fatsize != 32 ? 0 : \
                          (FAT2CPU16((dent)->starthi) << 16)))
+#define IS_LAST_CLUST(x, fatsize) ((x) >= ((fatsize) != 32 ? \
+                                       ((fatsize) != 16 ? 0xff8 : 0xfff8) : \
+                                       0xffffff8))
 #define CHECK_CLUST(x, fatsize) ((x) <= 1 || \
-                               (x) >= ((fatsize) != 32 ? 0xfff0 : 0xffffff0))
+                               (x) >= ((fatsize) != 32 ? \
+                                       ((fatsize) != 16 ? 0xff0 : 0xfff0) : \
+                                       0xffffff0))
 
 typedef struct boot_sector {
        __u8    ignored[3];     /* Bootstrap code */
@@ -189,6 +198,7 @@ int file_cd(const char *path);
 int file_fat_detectfs(void);
 int file_fat_ls(const char *dir);
 int fat_exists(const char *filename);
+int fat_size(const char *filename);
 long file_fat_read_at(const char *filename, unsigned long pos, void *buffer,
                      unsigned long maxsize);
 long file_fat_read(const char *filename, void *buffer, unsigned long maxsize);