diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-28 22:16:07 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-12-28 22:16:07 +0000 |
commit | da848576312800dc229624e928d132d0702c1854 (patch) | |
tree | 38cd01b8a9c1069a1de734e0f7eb478436715573 /firmware/export | |
parent | ae45d970d874217b779071b414dcd5edbf5647da (diff) |
prepared to mount multiple partitions into one logical file system (most useful for Ondio, internal memory + external MMC)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5514 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/ata.h | 19 | ||||
-rw-r--r-- | firmware/export/disk.h | 4 | ||||
-rw-r--r-- | firmware/export/fat.h | 23 |
3 files changed, 36 insertions, 10 deletions
diff --git a/firmware/export/ata.h b/firmware/export/ata.h index 06de33a8f2..fb604a120d 100644 --- a/firmware/export/ata.h +++ b/firmware/export/ata.h @@ -20,6 +20,21 @@ #define __ATA_H__ #include <stdbool.h> +#include "config.h" /* for HAVE_MULTIVOLUME or not */ + +/* FixMe: These macros are a bit nasty and perhaps misplaced here. + We'll get rid of them once decided on how to proceed with multivolume. */ +#ifdef HAVE_MULTIVOLUME +#define IF_MV(x) x /* optional volume/drive parameter */ +#define IF_MV2(x,y) x,y /* same, for a list of arguments */ +#define IF_MV_NONVOID(x) x /* for prototype with sole volume parameter */ +#define NUM_VOLUMES 2 +#else /* empty definitions if no multi-volume */ +#define IF_MV(x) +#define IF_MV2(x,y) +#define IF_MV_NONVOID(x) void +#define NUM_VOLUMES 1 +#endif /* ata_spindown() time values: @@ -41,8 +56,8 @@ extern bool ata_disk_is_active(void); extern int ata_hard_reset(void); extern int ata_soft_reset(void); extern int ata_init(void); -extern int ata_read_sectors(unsigned long start, int count, void* buf); -extern int ata_write_sectors(unsigned long start, int count, const void* buf); +extern int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); +extern int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); extern void ata_delayed_write(unsigned long sector, const void* buf); extern void ata_flush(void); extern void ata_spin(void); diff --git a/firmware/export/disk.h b/firmware/export/disk.h index 7a9697aa13..70b73c6547 100644 --- a/firmware/export/disk.h +++ b/firmware/export/disk.h @@ -19,6 +19,8 @@ #ifndef _DISK_H_ #define _DISK_H_ +#include "ata.h" /* for volume definitions */ + struct partinfo { unsigned long start; /* first sector (LBA) */ unsigned long size; /* number of sectors */ @@ -30,7 +32,7 @@ struct partinfo { #define PARTITION_TYPE_FAT16 0x06 /* returns a pointer to an array of 8 partinfo structs */ -struct partinfo* disk_init(void); +struct partinfo* disk_init(IF_MV_NONVOID(int volume)); struct partinfo* disk_partinfo(int partition); #endif 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_DIRECTORY 0x10 #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; +#ifdef HAVE_MULTIVOLUME + int volume; /* file resides on which volume */ +#endif }; 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); #endif |