summaryrefslogtreecommitdiff
path: root/include/fat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/fat.h')
-rw-r--r--include/fat.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/include/fat.h b/include/fat.h
index afb2116..c2465d2 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -33,22 +33,15 @@
/* 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 */
-#define LINEAR_PREFETCH_SIZE (SECTOR_SIZE*2) /* Prefetch buffer size */
-
-#define SECTOR_SIZE FS_BLOCK_SIZE
-
-#define FS_BLOCK_SIZE 512
-
-#if FS_BLOCK_SIZE != SECTOR_SIZE
-#error FS_BLOCK_SIZE != SECTOR_SIZE - This code needs to be fixed!
-#endif
+#define LINEAR_PREFETCH_SIZE (mydata->sect_size*2) /* Prefetch buffer size */
#define MAX_CLUSTSIZE 65536
-#define DIRENTSPERBLOCK (FS_BLOCK_SIZE/sizeof(dir_entry))
-#define DIRENTSPERCLUST ((mydata->clust_size*SECTOR_SIZE)/sizeof(dir_entry))
+#define DIRENTSPERBLOCK (mydata->sect_size / sizeof(dir_entry))
+#define DIRENTSPERCLUST ((mydata->clust_size * mydata->sect_size) / \
+ sizeof(dir_entry))
#define FATBUFBLOCKS 6
-#define FATBUFSIZE (FS_BLOCK_SIZE*FATBUFBLOCKS)
+#define FATBUFSIZE (mydata->sect_size * FATBUFBLOCKS)
#define FAT12BUFSIZE ((FATBUFSIZE*2)/3)
#define FAT16BUFSIZE (FATBUFSIZE/2)
#define FAT32BUFSIZE (FATBUFSIZE/4)
@@ -181,11 +174,12 @@ typedef struct dir_slot {
* (see FAT32 accesses)
*/
typedef struct {
- __u8 fatbuf[FATBUFSIZE]; /* Current FAT buffer */
+ __u8 *fatbuf; /* Current FAT buffer */
int fatsize; /* Size of FAT in bits */
__u16 fatlength; /* Length of FAT in sectors */
__u16 fat_sect; /* Starting sector of the FAT */
__u16 rootdir_sect; /* Start sector of root directory */
+ __u16 sect_size; /* Size of sectors in bytes */
__u16 clust_size; /* Size of clusters in sectors */
short data_begin; /* The sector of the first cluster, can be negative */
int fatbufnum; /* Used by get_fatent, init to -1 */