summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/common/disk.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index 27b79755e7..8135c60bc5 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -46,12 +46,23 @@
46 ((long)array[pos] | ((long)array[pos+1] << 8 ) | \ 46 ((long)array[pos] | ((long)array[pos+1] << 8 ) | \
47 ((long)array[pos+2] << 16 ) | ((long)array[pos+3] << 24 )) 47 ((long)array[pos+2] << 16 ) | ((long)array[pos+3] << 24 ))
48 48
49static const unsigned char fat_partition_types[] = {
50 0x0b, 0x1b, /* FAT32 + hidden variant */
51 0x0c, 0x1c, /* FAT32 (LBA) + hidden variant */
52#ifdef HAVE_FAT16SUPPORT
53 0x04, 0x14, /* FAT16 <= 32MB + hidden variant */
54 0x06, 0x16, /* FAT16 > 32MB + hidden variant */
55 0x0e, 0x1e, /* FAT16 (LBA) + hidden variant */
56#endif
57};
58
49static struct partinfo part[8]; /* space for 4 partitions on 2 drives */ 59static struct partinfo part[8]; /* space for 4 partitions on 2 drives */
50static int vol_drive[NUM_VOLUMES]; /* mounted to which drive (-1 if none) */ 60static int vol_drive[NUM_VOLUMES]; /* mounted to which drive (-1 if none) */
51 61
52#ifdef MAX_LOG_SECTOR_SIZE 62#ifdef MAX_LOG_SECTOR_SIZE
53int disk_sector_multiplier = 1; 63int disk_sector_multiplier = 1;
54#endif 64#endif
65
55struct partinfo* disk_init(IF_MV_NONVOID(int drive)) 66struct partinfo* disk_init(IF_MV_NONVOID(int drive))
56{ 67{
57 int i; 68 int i;
@@ -194,9 +205,13 @@ int disk_mount(int drive)
194#endif 205#endif
195 for (; volume != -1 && i<4; i++) 206 for (; volume != -1 && i<4; i++)
196 { 207 {
208 if (memchr(fat_partition_types, pinfo[i].type,
209 sizeof(fat_partition_types)) == NULL)
210 continue; /* not an accepted partition type */
211
197#ifdef MAX_LOG_SECTOR_SIZE 212#ifdef MAX_LOG_SECTOR_SIZE
198 int j; 213 int j;
199 214
200 for (j = 1; j <= (MAX_LOG_SECTOR_SIZE/SECTOR_SIZE); j <<= 1) 215 for (j = 1; j <= (MAX_LOG_SECTOR_SIZE/SECTOR_SIZE); j <<= 1)
201 { 216 {
202 if (!fat_mount(IF_MV2(volume,) IF_MV2(drive,) pinfo[i].start * j)) 217 if (!fat_mount(IF_MV2(volume,) IF_MV2(drive,) pinfo[i].start * j))