path: root/firmware/export/fat.h
diff options
authorMiika Pekkarinen <>2006-12-03 18:12:19 +0000
committerMiika Pekkarinen <>2006-12-03 18:12:19 +0000
commitae66c2b9ee621946d2c7175d94f9adfbd361a699 (patch)
tree1fdd9b8d1fe5fe47af640bdfaaa9533494959fce /firmware/export/fat.h
parent16122759607971444a3fee9071a90b9d7c334cc0 (diff)
Add support (runtime detection) for 2048 bytes/sector filesystem.
Large sectors are enabled for iPod Video (including 5.5G) only. Might still cause FS corruption (however, unlikely), so beware! Based on FS#6169 by Robert Carboneau. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/fat.h')
1 files changed, 11 insertions, 2 deletions
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index 4cdc479844..4110f765a3 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -22,8 +22,16 @@
#include <stdbool.h>
#include "ata.h" /* for volume definitions */
+#include "config.h"
-#define SECTOR_SIZE 512
+/* Some never players (such as iPod 5.5G) might have 2048 bytes per sector. */
+#ifdef IPOD_VIDEO
+#define MAX_SECTOR_SIZE 2048
+#define MAX_SECTOR_SIZE 512
/* Number of bytes reserved for a file name (including the trailing \0).
Since names are stored in the entry as UTF-8, we won't be able to
@@ -78,7 +86,7 @@ struct fat_dir
unsigned int entrycount;
long sector;
struct fat_file file;
- unsigned char sectorcache[3][SECTOR_SIZE];
+ unsigned char sectorcache[3][MAX_SECTOR_SIZE];
@@ -101,6 +109,7 @@ extern int fat_create_file(const char* name,
extern long fat_readwrite(struct fat_file *ent, long sectorcount,
void* buf, bool write );
extern int fat_closewrite(struct fat_file *ent, long size, int attr);
+extern int fat_get_secsize(const struct fat_file *file);
extern int fat_seek(struct fat_file *ent, unsigned long sector );
extern int fat_remove(struct fat_file *ent);
extern int fat_truncate(const struct fat_file *ent);