A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

disk: Minor cleanups with respect to virtual<->logical sector mapping

Change-Id: Ib20c73c8afe6cf71165600ace1b2ca4b10de2ae8

+8 -9
+7 -8
firmware/common/disk.c
··· 111 111 } 112 112 113 113 #ifdef MAX_VIRT_SECTOR_SIZE 114 - static uint16_t disk_sector_multiplier[NUM_DRIVES] = 114 + static uint8_t disk_sector_multiplier[NUM_DRIVES] = 115 115 { [0 ... NUM_DRIVES-1] = 1 }; 116 116 117 117 int disk_get_sector_multiplier(IF_MD_NONVOID(int drive)) ··· 126 126 } 127 127 128 128 #ifdef DEFAULT_VIRT_SECTOR_SIZE 129 - void disk_set_sector_multiplier(IF_MD(int drive,) uint16_t mult) 129 + void disk_set_sector_multiplier(IF_MD(int drive,) int mult) 130 130 { 131 131 if (!CHECK_DRV(drive)) 132 132 return; ··· 247 247 unsigned char* ptr = sector; 248 248 249 249 #ifdef DEFAULT_VIRT_SECTOR_SIZE 250 - sector_t try_gpt[4] = { 1, num_sectors - 1, 251 - DEFAULT_VIRT_SECTOR_SIZE / sector_size, 250 + const sector_t try_gpt[4] = { 1, num_sectors - 1, 251 + (DEFAULT_VIRT_SECTOR_SIZE / sector_size), 252 252 (num_sectors / (DEFAULT_VIRT_SECTOR_SIZE / sector_size)) - 1 253 253 }; 254 254 ··· 263 263 part_entries = 1; 264 264 #ifdef MAX_VIRT_SECTOR_SIZE 265 265 if (i >= 2) 266 - disk_sector_multiplier[IF_MD_DRV(drive)] = try_gpt[2]; // XXX use this later? 266 + disk_sector_multiplier[IF_MD_DRV(drive)] = try_gpt[2]; 267 267 #endif 268 268 break; 269 269 } ··· 411 411 return 0; 412 412 } 413 413 414 - struct partinfo *pinfo = &part[IF_MD_DRV(drive)*4]; 414 + struct partinfo *pinfo = &part[IF_MD_DRV(drive)*MAX_PARTITIONS_PER_DRIVE]; 415 415 #ifdef MAX_VIRT_SECTOR_SIZE 416 416 disk_sector_multiplier[IF_MD_DRV(drive)] = 1; 417 417 #endif ··· 479 479 pinfo[i].type = PARTITION_TYPE_FAT32_LBA; 480 480 // XXX write the sector back.? 481 481 } 482 - 483 482 } 484 483 #endif /* MAX_VIRT_SECTOR_SIZE */ 485 484 } 486 485 487 486 #if defined(MAX_VIRT_SECTOR_SIZE) && defined(MAX_PHYS_SECTOR_SIZE) 488 487 if (mounted) 489 - ata_set_phys_sector_mult(disk_sector_multiplier[drive]); 488 + ata_set_phys_sector_mult(disk_sector_multiplier[IF_MD_DRV(drive)]); 490 489 #endif 491 490 } 492 491
+1 -1
firmware/export/disk.h
··· 52 52 int disk_get_sector_multiplier(IF_MD_NONVOID(int drive)); 53 53 /* The logical sector size to use when we have no valid paritions */ 54 54 #ifdef DEFAULT_VIRT_SECTOR_SIZE 55 - void disk_set_sector_multiplier(IF_MD(int drive,) uint16_t mult); 55 + void disk_set_sector_multiplier(IF_MD(int drive,) int mult); 56 56 #endif 57 57 #endif 58 58