summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-11-07 17:15:28 -0500
committerSolomon Peachy <pizza@shaftnet.org>2024-11-09 16:32:40 -0500
commitbc6c189dcb5f43ace776ca2a781fd647c14fca56 (patch)
treecfcc4a582ac3283d299fd969ad8cbe5956881696
parent7ecab006c054d963f74f628390f8140fd8f64d50 (diff)
downloadrockbox-bc6c189dcb.tar.gz
rockbox-bc6c189dcb.zip
storage: rename MAX_LOG_SECTOR_SIZE to MAX_VIRT_SECTOR_SIZE
Change-Id: I34f00748c1b0935d65af5f0fc6bdd13356ff31e1
-rw-r--r--apps/debug_menu.c2
-rw-r--r--firmware/common/disk.c22
-rw-r--r--firmware/drivers/ata-common.c8
-rw-r--r--firmware/drivers/fat.c18
-rw-r--r--firmware/export/config/creativezenxfi3.h2
-rw-r--r--firmware/export/config/creativezenxfistyle.h2
-rw-r--r--firmware/export/config/ipod6g.h2
-rw-r--r--firmware/export/config/ipodvideo.h2
-rw-r--r--firmware/export/config/sansafuzeplus.h2
-rw-r--r--firmware/export/config/sonynwze360.h2
-rw-r--r--firmware/export/config/sonynwze370.h2
-rw-r--r--firmware/export/disk.h2
-rw-r--r--firmware/export/fat.h4
-rw-r--r--firmware/include/fs_defines.h4
-rw-r--r--firmware/usbstack/usb_storage.c2
15 files changed, 38 insertions, 38 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 0c4cc386aa..dfc81232c7 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1452,7 +1452,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
simplelist_addline("Size: %llu MB", (uint64_t)total_sectors);
simplelist_addline("Logical sector size: %lu B", sector_size);
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
simplelist_addline("Sector multiplier: %u", disk_get_sector_multiplier());
#endif
diff --git a/firmware/common/disk.c b/firmware/common/disk.c
index 6aadf8a950..73ed22d27b 100644
--- a/firmware/common/disk.c
+++ b/firmware/common/disk.c
@@ -110,7 +110,7 @@ static void init_volume(struct volumeinfo *vi, int drive, int part)
vi->partition = part;
}
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
static uint16_t disk_sector_multiplier[NUM_DRIVES] =
{ [0 ... NUM_DRIVES-1] = 1 };
@@ -124,7 +124,7 @@ int disk_get_sector_multiplier(IF_MD_NONVOID(int drive))
disk_reader_unlock();
return multiplier;
}
-#endif /* MAX_LOG_SECTOR_SIZE */
+#endif /* MAX_VIRT_SECTOR_SIZE */
#if (CONFIG_STORAGE & STORAGE_ATA) // XXX make this more generic?
static uint16_t disk_log_sector_size[NUM_DRIVES] =
@@ -163,13 +163,13 @@ bool disk_init(IF_MD_NONVOID(int drive))
struct storage_info *info = (struct storage_info*) sector;
storage_get_info(IF_MD_DRV(drive), info);
disk_writer_lock();
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
disk_log_sector_size[IF_MD_DRV(drive)] = info->sector_size;
#endif
disk_writer_unlock();
-#ifdef MAX_LOG_SECTOR_SIZE
- if (info->sector_size > MAX_LOG_SECTOR_SIZE || info->sector_size > DC_CACHE_BUFSIZE) {
+#ifdef MAX_VIRT_SECTOR_SIZE
+ if (info->sector_size > MAX_VIRT_SECTOR_SIZE || info->sector_size > DC_CACHE_BUFSIZE) {
panicf("Unsupported logical sector size: %d",
info->sector_size);
}
@@ -374,7 +374,7 @@ int disk_mount(int drive)
}
struct partinfo *pinfo = &part[IF_MD_DRV(drive)*4];
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
disk_sector_multiplier[IF_MD_DRV(drive)] = 1;
#endif
@@ -383,7 +383,7 @@ int disk_mount(int drive)
if (!fat_mount(IF_MV(volume,) IF_MD(drive,) 0))
{
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
disk_sector_multiplier[drive] = fat_get_bytes_per_sector(IF_MV(volume)) / LOG_SECTOR_SIZE(drive);
#endif
mounted = 1;
@@ -402,8 +402,8 @@ int disk_mount(int drive)
DEBUGF("Trying to mount partition %d.\n", i);
-#ifdef MAX_LOG_SECTOR_SIZE
- for (int j = 1; j <= (MAX_LOG_SECTOR_SIZE/LOG_SECTOR_SIZE(drive)); j <<= 1)
+#ifdef MAX_VIRT_SECTOR_SIZE
+ for (int j = 1; j <= (MAX_VIRT_SECTOR_SIZE/LOG_SECTOR_SIZE(drive)); j <<= 1)
{
if (!fat_mount(IF_MV(volume,) IF_MD(drive,) pinfo[i].start * j))
{
@@ -417,7 +417,7 @@ int disk_mount(int drive)
break;
}
}
-#else /* ndef MAX_LOG_SECTOR_SIZE */
+#else /* ndef MAX_VIRT_SECTOR_SIZE */
if (!fat_mount(IF_MV(volume,) IF_MD(drive,) pinfo[i].start))
{
mounted++;
@@ -425,7 +425,7 @@ int disk_mount(int drive)
volume_onmount_internal(IF_MV(volume));
volume = get_free_volume(); /* prepare next entry */
}
-#endif /* MAX_LOG_SECTOR_SIZE */
+#endif /* MAX_VIRT_SECTOR_SIZE */
}
}
diff --git a/firmware/drivers/ata-common.c b/firmware/drivers/ata-common.c
index fa908127b4..cd905f2da9 100644
--- a/firmware/drivers/ata-common.c
+++ b/firmware/drivers/ata-common.c
@@ -22,10 +22,10 @@
#ifdef MAX_PHYS_SECTOR_SIZE
-#ifdef MAX_LOG_SECTOR_SIZE
-#define __MAX_LOG_SECTOR_SIZE MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
+#define __MAX_VIRT_SECTOR_SIZE MAX_VIRT_SECTOR_SIZE
#else
-#define __MAX_LOG_SECTOR_SIZE SECTOR_SIZE
+#define __MAX_VIRT_SECTOR_SIZE SECTOR_SIZE
#endif
struct sector_cache_entry {
@@ -226,7 +226,7 @@ static int ata_get_phys_sector_mult(void)
sector 1 then assume the drive supports "512e" and will handle
it better than us, so ignore the large physical sectors.
*/
- char throwaway[__MAX_LOG_SECTOR_SIZE];
+ char throwaway[__MAX_VIRT_SECTOR_SIZE];
rc = ata_transfer_sectors(1, 1, &throwaway, false);
if (rc == 0)
phys_sector_mult = 1;
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index e16463ab8c..9963919441 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -163,7 +163,7 @@ union raw_dirent
#define FAT_NTRES_LC_NAME 0x08
#define FAT_NTRES_LC_EXT 0x10
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
#define LOG_SECTOR_SIZE(bpb) fat_bpb->sector_size
#else
#define LOG_SECTOR_SIZE(bpb) SECTOR_SIZE
@@ -272,14 +272,14 @@ static struct bpb
int BPB_FN_DECL(update_fat_entry, unsigned long, unsigned long);
void BPB_FN_DECL(fat_recalc_free_internal);
#endif /* HAVE_FAT16SUPPORT */
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
uint16_t sector_size;
#endif
} fat_bpbs[NUM_VOLUMES]; /* mounted partition info */
#ifdef STORAGE_NEEDS_BOUNCE_BUFFER
-#ifdef MAX_LOG_SECTOR_SIZE
-#define BOUNCE_SECTOR_SIZE MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
+#define BOUNCE_SECTOR_SIZE MAX_VIRT_SECTOR_SIZE
#else
#define BOUNCE_SECTOR_SIZE SECTOR_SIZE
#endif
@@ -1999,7 +1999,7 @@ static int free_cluster_chain(struct bpb *fat_bpb, long startcluster)
int fat_file_sector_size(const struct fat_file *file)
{
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
const struct bpb *fat_bpb = FAT_BPB(file->volume);
#endif
@@ -2769,7 +2769,7 @@ int fat_readdir(struct fat_filestr *dirstr, struct fat_dirscan_info *scan,
scan->entries = 0;
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
struct fat_file *file = dirstr->fatfilep;
const struct bpb *fat_bpb = FAT_BPB(file->volume);
#endif
@@ -2917,7 +2917,7 @@ int fat_mount(IF_MV(int volume,) IF_MD(int drive,) unsigned long startsector)
fat_bpb->drive = drive;
#endif
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
fat_bpb->sector_size = disk_get_log_sector_size(IF_MD(drive));
#endif
@@ -2959,7 +2959,7 @@ int fat_unmount(IF_MV_NONVOID(int volume))
/** Debug screen stuff **/
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
/* This isn't necessarily the same as storage's logical sector size;
we can have situations where the filesystem (and partition table)
uses a larger "virtual sector" than the underlying storage device */
@@ -2973,7 +2973,7 @@ int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume))
return bytes;
}
-#endif /* MAX_LOG_SECTOR_SIZE */
+#endif /* MAX_VIRT_SECTOR_SIZE */
unsigned int fat_get_cluster_size(IF_MV_NONVOID(int volume))
{
diff --git a/firmware/export/config/creativezenxfi3.h b/firmware/export/config/creativezenxfi3.h
index 5ff5d889c7..138ff8bb6e 100644
--- a/firmware/export/config/creativezenxfi3.h
+++ b/firmware/export/config/creativezenxfi3.h
@@ -197,7 +197,7 @@
/* The fuze+ actually interesting partition table does not use 512-byte sector
* (usually 2048 logical sector size) */
-#define MAX_LOG_SECTOR_SIZE 2048
+#define MAX_VIRT_SECTOR_SIZE 2048
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
diff --git a/firmware/export/config/creativezenxfistyle.h b/firmware/export/config/creativezenxfistyle.h
index 665f1c1ae5..2e62ba3b9f 100644
--- a/firmware/export/config/creativezenxfistyle.h
+++ b/firmware/export/config/creativezenxfistyle.h
@@ -187,7 +187,7 @@
/* The ZEN X-Fi Style actually interesting partition table does not use 512-byte sector
* (usually 2048 logical sector size) */
-#define MAX_LOG_SECTOR_SIZE 2048
+#define MAX_VIRT_SECTOR_SIZE 2048
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
diff --git a/firmware/export/config/ipod6g.h b/firmware/export/config/ipod6g.h
index 2b3e4c3d3e..2a218e4ee1 100644
--- a/firmware/export/config/ipod6g.h
+++ b/firmware/export/config/ipod6g.h
@@ -192,7 +192,7 @@
#define HAVE_ATA_SMART
/* define this if the device has larger sectors when accessed via USB */
-#define MAX_LOG_SECTOR_SIZE 4096
+#define MAX_VIRT_SECTOR_SIZE 4096
/* This is the minimum access size for the device, even if it's larger than the logical sector size */
#define MAX_PHYS_SECTOR_SIZE 4096
diff --git a/firmware/export/config/ipodvideo.h b/firmware/export/config/ipodvideo.h
index 64200f4e61..a9d7314068 100644
--- a/firmware/export/config/ipodvideo.h
+++ b/firmware/export/config/ipodvideo.h
@@ -215,7 +215,7 @@
/* define this if the device has larger sectors when accessed via USB */
/* (only relevant in disk.c, fat.c now always supports large virtual sectors) */
-#define MAX_LOG_SECTOR_SIZE 2048
+#define MAX_VIRT_SECTOR_SIZE 2048
/* define this if the hard drive uses large physical sectors (ATA-7 feature) */
/* and doesn't handle them in the drive firmware */
diff --git a/firmware/export/config/sansafuzeplus.h b/firmware/export/config/sansafuzeplus.h
index c96131e37d..029f267128 100644
--- a/firmware/export/config/sansafuzeplus.h
+++ b/firmware/export/config/sansafuzeplus.h
@@ -198,7 +198,7 @@
/* The fuze+ actually interesting partition table does not use 512-byte sector
* (usually 2048 logical sector size) */
-#define MAX_LOG_SECTOR_SIZE 2048
+#define MAX_VIRT_SECTOR_SIZE 2048
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
diff --git a/firmware/export/config/sonynwze360.h b/firmware/export/config/sonynwze360.h
index 40b0a4feb7..baa3934395 100644
--- a/firmware/export/config/sonynwze360.h
+++ b/firmware/export/config/sonynwze360.h
@@ -168,7 +168,7 @@
/* The fuze+ actually interesting partition table does not use 512-byte sector
* (usually 2048 logical sector size) */
-#define MAX_LOG_SECTOR_SIZE 2048
+#define MAX_VIRT_SECTOR_SIZE 2048
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
diff --git a/firmware/export/config/sonynwze370.h b/firmware/export/config/sonynwze370.h
index 3ed2880d35..5e70bab01c 100644
--- a/firmware/export/config/sonynwze370.h
+++ b/firmware/export/config/sonynwze370.h
@@ -168,7 +168,7 @@
/* The fuze+ actually interesting partition table does not use 512-byte sector
* (usually 2048 logical sector size) */
-#define MAX_LOG_SECTOR_SIZE 2048
+#define MAX_VIRT_SECTOR_SIZE 2048
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
diff --git a/firmware/export/disk.h b/firmware/export/disk.h
index 4f11438b1b..c2bbd8b1a2 100644
--- a/firmware/export/disk.h
+++ b/firmware/export/disk.h
@@ -48,7 +48,7 @@ int disk_unmount_all(void);
int disk_unmount(int drive);
/* Used when the drive's logical sector size is smaller than the sector size used by the partition table and filesystem. Notably needed for ipod 5.5G/6G. */
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
int disk_get_sector_multiplier(IF_MD_NONVOID(int drive));
#endif
/* The size of the drive's smallest addressible unit */
diff --git a/firmware/export/fat.h b/firmware/export/fat.h
index 61fe53d1cb..36e29e73d9 100644
--- a/firmware/export/fat.h
+++ b/firmware/export/fat.h
@@ -170,9 +170,9 @@ int fat_mount(IF_MV(int volume,) IF_MD(int drive,) unsigned long startsector);
int fat_unmount(IF_MV_NONVOID(int volume));
/** Debug screen stuff **/
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
int fat_get_bytes_per_sector(IF_MV_NONVOID(int volume));
-#endif /* MAX_LOG_SECTOR_SIZE */
+#endif /* MAX_VIRT_SECTOR_SIZE */
unsigned int fat_get_cluster_size(IF_MV_NONVOID(int volume));
void fat_recalc_free(IF_MV_NONVOID(int volume));
bool fat_size(IF_MV(int volume,) sector_t *size, sector_t *free);
diff --git a/firmware/include/fs_defines.h b/firmware/include/fs_defines.h
index 1c8c3afe2b..04e2b001a9 100644
--- a/firmware/include/fs_defines.h
+++ b/firmware/include/fs_defines.h
@@ -108,8 +108,8 @@
#endif
/* this _could_ be larger than a sector if that would ever be useful */
-#ifdef MAX_LOG_SECTOR_SIZE
-#define DC_CACHE_BUFSIZE MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
+#define DC_CACHE_BUFSIZE MAX_VIRT_SECTOR_SIZE
#else
#define DC_CACHE_BUFSIZE SECTOR_SIZE
#endif
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index 617988b19f..550c262ee3 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -793,7 +793,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
lun_present = false;
unsigned int block_size_mult = 1; /* Number of LOGICAL storage device blocks in each USB block */
-#ifdef MAX_LOG_SECTOR_SIZE
+#ifdef MAX_VIRT_SECTOR_SIZE
block_size_mult = disk_get_sector_multiplier(IF_MD(lun));
#endif