forked from len0rd/rockbox
storage: rename MAX_LOG_SECTOR_SIZE to MAX_VIRT_SECTOR_SIZE
Change-Id: I34f00748c1b0935d65af5f0fc6bdd13356ff31e1
This commit is contained in:
parent
7ecab006c0
commit
bc6c189dcb
15 changed files with 38 additions and 38 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue