path: root/firmware/export/fat.h
diff options
authorJörg Hohensohn <>2004-12-28 22:16:07 +0000
committerJörg Hohensohn <>2004-12-28 22:16:07 +0000
commitda848576312800dc229624e928d132d0702c1854 (patch)
tree38cd01b8a9c1069a1de734e0f7eb478436715573 /firmware/export/fat.h
parentae45d970d874217b779071b414dcd5edbf5647da (diff)
prepared to mount multiple partitions into one logical file system (most useful for Ondio, internal memory + external MMC)
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/fat.h')
1 files changed, 16 insertions, 7 deletions
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index 6f9c9c5d11..7150d2b09f 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -21,6 +21,7 @@
#define FAT_H
#include <stdbool.h>
+#include "ata.h" /* for volume definitions */
#define SECTOR_SIZE 512
@@ -45,6 +46,7 @@ struct fat_direntry
#define FAT_ATTR_VOLUME_ID 0x08
#define FAT_ATTR_ARCHIVE 0x20
+#define FAT_ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
struct fat_file
@@ -57,6 +59,9 @@ struct fat_file
unsigned int direntries; /* number of dir entries used by this file */
unsigned int dircluster; /* first cluster of dir */
bool eof;
+ int volume; /* file resides on which volume */
struct fat_dir
@@ -69,14 +74,16 @@ struct fat_dir
-extern int fat_mount(int startsector);
-extern void fat_size(unsigned int* size, unsigned int* free);
-extern void fat_recalc_free(void);
+extern void fat_init(void);
+extern int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) int startsector);
+extern void fat_size(IF_MV2(int volume,) unsigned int* size, unsigned int* free); // public for info
+extern void fat_recalc_free(IF_MV_NONVOID(int volume)); // public for debug info screen
extern int fat_create_dir(const char* name,
struct fat_dir* newdir,
struct fat_dir* dir);
-extern int fat_startsector(void);
-extern int fat_open(unsigned int cluster,
+extern int fat_startsector(IF_MV_NONVOID(int volume)); // public for config sector
+extern int fat_open(IF_MV2(int volume,)
+ unsigned int cluster,
struct fat_file* ent,
const struct fat_dir* dir);
extern int fat_create_file(const char* name,
@@ -93,9 +100,11 @@ extern int fat_rename(struct fat_file* file,
const unsigned char* newname,
int size, int attr);
-extern int fat_opendir(struct fat_dir *ent, unsigned int currdir,
+extern int fat_opendir(IF_MV2(int volume,)
+ struct fat_dir *ent, unsigned int currdir,
const struct fat_dir *parent_dir);
extern int fat_getnext(struct fat_dir *ent, struct fat_direntry *entry);
-extern int fat_get_cluster_size(void);
+extern int fat_get_cluster_size(IF_MV_NONVOID(int volume));
+extern bool fat_ismounted(int volume);