storage: Support a default virtual sector size

Normally, we figure out the virual sector size from the filesystem info.
However, if there's no filesystem, we fall back to the hardware's
logical sector size.

Some device firmware (eg ipod5g/6g) need their partition tables set up
with larger-than-logical sector sizes; this way we can present the
"correct" sector size to maintain interoperability with the stock
firmware and make it so that the drive can still be properly partitioned
from within rockbox.

This patch adds support for DEFAULT_VIRT_SECTOR_SIZE.  Nothing uses it yet.

Change-Id: Iae746a50ffc37c51abb2c9b82d3c4596f1fa7559
This commit is contained in:
Solomon Peachy 2024-11-09 16:38:28 -05:00
parent c61ad40812
commit 1516c48a37
3 changed files with 24 additions and 0 deletions

View file

@ -50,6 +50,10 @@ 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_VIRT_SECTOR_SIZE
int disk_get_sector_multiplier(IF_MD_NONVOID(int drive));
/* The logical sector size to use when we have no valid paritions */
#ifdef DEFAULT_VIRT_SECTOR_SIZE
void disk_set_sector_multiplier(IF_MD(int drive,) uint16_t mult);
#endif
#endif
#ifdef MAX_VARIABLE_LOG_SECTOR