X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Ffat.h;h=bc139f8c88c8c7a785e016aa5f33cbdf936b0f6d;hb=a1f5f4ac20c0947afda93f9b906facfbee2708fe;hp=0f589391242f7b7d5dfe03e56125b1afc685df76;hpb=21a24c3bf35bac83d66ce4a48eb0c7dd8a7227cb;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/fat.h b/include/fat.h index 0f58939..bc139f8 100644 --- a/include/fat.h +++ b/include/fat.h @@ -1,10 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * R/O (V)FAT 12/16/32 filesystem implementation by Marcus Sundberg * * 2002-07-28 - rjones@nexus-tech.net - ported to ppcboot v1.1.6 * 2003-03-10 - kharris@nexus-tech.net - ported to u-boot - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _FAT_H_ @@ -13,7 +12,6 @@ #include #include -#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 */ @@ -175,14 +173,20 @@ typedef struct { 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 */ + u32 total_sect; /* Number of sectors */ + int fats; /* Number of FATs */ } 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, int 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); @@ -199,5 +203,7 @@ int fat_read_file(const char *filename, void *buf, loff_t offset, loff_t len, int fat_opendir(const char *filename, struct fs_dir_stream **dirsp); int fat_readdir(struct fs_dir_stream *dirs, struct fs_dirent **dentp); void fat_closedir(struct fs_dir_stream *dirs); +int fat_unlink(const char *filename); +int fat_mkdir(const char *dirname); void fat_close(void); #endif /* _FAT_H_ */