summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-12-15 17:07:19 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-12-15 17:07:19 +0000
commit3a6e3c254e5518c110ecaededebc26c5ae431552 (patch)
tree0557d685bd97778bf7d7cda0f9b307af1e20a900
parent39148be8ac62d5e2d43f207dcccf2426eaa97310 (diff)
downloadrockbox-3a6e3c254e5518c110ecaededebc26c5ae431552.zip
rockbox-3a6e3c254e5518c110ecaededebc26c5ae431552.tar.gz
rockbox-3a6e3c254e5518c110ecaededebc26c5ae431552.tar.bz2
rockbox-3a6e3c254e5518c110ecaededebc26c5ae431552.tar.xz
Add support for for per-drive logical sector size. This allows targets to have a different logical sector size for the internal storage and the sd card, like on the fuze+ for example.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31270 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/disk.c16
-rw-r--r--firmware/export/disk.h2
-rw-r--r--firmware/usbstack/usb_storage.c2
3 files changed, 15 insertions, 5 deletions
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index 3c1f01c..a9fd346 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -61,9 +61,18 @@ static int vol_drive[NUM_VOLUMES]; /* mounted to which drive (-1 if none) */
static struct mutex disk_mutex;
#ifdef MAX_LOG_SECTOR_SIZE
-int disk_sector_multiplier = 1;
+static int disk_sector_multiplier[NUM_DRIVES] = {1};
#endif
+int disk_get_sector_multiplier(IF_MD_NONVOID(int drive))
+{
+ #ifdef HAVE_MULTIDRIVE
+ return disk_sector_multiplier[drive];
+ #else
+ return disk_sector_multiplier[0];
+ #endif
+}
+
struct partinfo* disk_init(IF_MD_NONVOID(int drive))
{
int i;
@@ -174,6 +183,7 @@ int disk_mount(int drive)
volume = get_free_volume();
pinfo = disk_init(IF_MD(drive));
+ disk_sector_multiplier[drive] = 1;
if (pinfo == NULL)
{
@@ -206,7 +216,7 @@ int disk_mount(int drive)
vol_drive[volume] = drive; /* remember the drive for this volume */
volume = get_free_volume(); /* prepare next entry */
if (drive == 0)
- disk_sector_multiplier = j;
+ disk_sector_multiplier[drive] = j;
break;
}
}
@@ -226,7 +236,7 @@ int disk_mount(int drive)
if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0))
{
#ifdef MAX_LOG_SECTOR_SIZE
- disk_sector_multiplier = fat_get_bytes_per_sector(IF_MV(volume))/SECTOR_SIZE;
+ disk_sector_multiplier[drive] = fat_get_bytes_per_sector(IF_MV(volume))/SECTOR_SIZE;
#endif
mounted = 1;
vol_drive[volume] = drive; /* remember the drive for this volume */
diff --git a/firmware/export/disk.h b/firmware/export/disk.h
index 347d8b4..ece0e26 100644
--- a/firmware/export/disk.h
+++ b/firmware/export/disk.h
@@ -46,7 +46,7 @@ int disk_unmount(int drive);
/* The number of 512-byte sectors in a "logical" sector. Needed for ipod 5.5G */
#ifdef MAX_LOG_SECTOR_SIZE
-extern int disk_sector_multiplier;
+int disk_get_sector_multiplier(IF_MD_NONVOID(int drive));
#endif
#endif
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index a178f06..64764f1 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -787,7 +787,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
lun_present = false;
#ifdef MAX_LOG_SECTOR_SIZE
- block_size_mult = disk_sector_multiplier;
+ block_size_mult = disk_get_sector_multiplier(lun);
#endif
cur_cmd.tag = cbw->tag;