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