From c0a5a67387c4eec3db3bad4da77ba5126faf03c4 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Fri, 17 Jul 2009 22:28:49 +0000 Subject: Commit FS#9545, storage cleanup and multi-driver support git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21933 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/disk.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'firmware/common/disk.c') diff --git a/firmware/common/disk.c b/firmware/common/disk.c index cc0f0d657d..abeadb5c23 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -44,8 +44,8 @@ 12-15: nr of sectors in partition */ -#define BYTES2INT32(array,pos) \ - ((long)array[pos] | ((long)array[pos+1] << 8 ) | \ +#define BYTES2INT32(array,pos) \ + ((long)array[pos] | ((long)array[pos+1] << 8 ) | \ ((long)array[pos+2] << 16 ) | ((long)array[pos+3] << 24 )) static const unsigned char fat_partition_types[] = { @@ -58,18 +58,18 @@ static const unsigned char fat_partition_types[] = { #endif }; -static struct partinfo part[8]; /* space for 4 partitions on 2 drives */ +static struct partinfo part[NUM_DRIVES*4]; /* space for 4 partitions on 2 drives */ static int vol_drive[NUM_VOLUMES]; /* mounted to which drive (-1 if none) */ #ifdef MAX_LOG_SECTOR_SIZE int disk_sector_multiplier = 1; #endif -struct partinfo* disk_init(IF_MV_NONVOID(int drive)) +struct partinfo* disk_init(IF_MD_NONVOID(int drive)) { int i; unsigned char sector[512]; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE /* For each drive, start at a different position, in order not to destroy the first entry of drive 0. That one is needed to calculate config sector position. */ @@ -115,7 +115,7 @@ struct partinfo* disk_partinfo(int partition) int disk_mount_all(void) { - int mounted; + int mounted=0; int i; #ifdef HAVE_HOTSWAP @@ -126,13 +126,19 @@ int disk_mount_all(void) for (i=0; i