| 169 | } |
| 170 | |
| 171 | static list_part_t *read_part_mac(disk_t *disk_car, const int verbose, const int saveheader) |
| 172 | { |
| 173 | unsigned char buffer[DEFAULT_SECTOR_SIZE]; |
| 174 | list_part_t *new_list_part=NULL; |
| 175 | unsigned int i; |
| 176 | unsigned int limit=1; |
| 177 | screen_buffer_reset(); |
| 178 | if(disk_car->pread(disk_car, &buffer, sizeof(buffer), 0) != sizeof(buffer)) |
| 179 | return NULL; |
| 180 | { |
| 181 | mac_Block0 *maclabel=(mac_Block0*)&buffer; |
| 182 | if (be16(maclabel->sbSig) != BLOCK0_SIGNATURE) |
| 183 | { |
| 184 | screen_buffer_add("Bad MAC partition, invalid block0 signature\n"); |
| 185 | /* continue, even if the first sector have been overwritten by an Intel |
| 186 | partition, the following sectors may be intact */ |
| 187 | } |
| 188 | } |
| 189 | for(i=1;i<=limit;i++) |
| 190 | { |
| 191 | const mac_DPME *dpme=(const mac_DPME *)buffer; |
| 192 | if(disk_car->pread(disk_car, &buffer, sizeof(buffer), (uint64_t)i * PBLOCK_SIZE) != sizeof(buffer)) |
| 193 | return new_list_part; |
| 194 | if(be16(dpme->dpme_signature) != DPME_SIGNATURE) |
| 195 | { |
| 196 | screen_buffer_add("read_part_mac: bad DPME signature\n"); |
| 197 | return new_list_part; |
| 198 | } |
| 199 | else |
| 200 | { |
| 201 | int insert_error=0; |
| 202 | partition_t *new_partition=partition_new(&arch_mac); |
| 203 | new_partition->order=i; |
| 204 | if (strcmp(dpme->dpme_type, "Apple_UNIX_SVR2")==0) |
| 205 | { |
| 206 | if (!strcmp(dpme->dpme_name, "Swap") || !strcmp(dpme->dpme_name, "swap")) |
| 207 | new_partition->part_type_mac=PMAC_SWAP; |
| 208 | else |
| 209 | new_partition->part_type_mac=PMAC_LINUX; |
| 210 | } |
| 211 | else if (strcmp(dpme->dpme_type, "Apple_Bootstrap")==0) |
| 212 | new_partition->part_type_mac=PMAC_NewWorld; |
| 213 | else if (strcmp(dpme->dpme_type, "Apple_Scratch")==0) |
| 214 | new_partition->part_type_mac=PMAC_SWAP; |
| 215 | else if(strcmp(dpme->dpme_type,"Apple_Driver")==0) |
| 216 | new_partition->part_type_mac=PMAC_DRIVER; |
| 217 | else if(strcmp(dpme->dpme_type,"Apple_Driver43")==0) |
| 218 | new_partition->part_type_mac=PMAC_DRIVER43; |
| 219 | else if(strcmp(dpme->dpme_type,"Apple_Driver_ATA")==0) |
| 220 | new_partition->part_type_mac=PMAC_DRIVERATA; |
| 221 | else if(strcmp(dpme->dpme_type,"Apple_Driver_IOKit")==0) |
| 222 | new_partition->part_type_mac=PMAC_DRIVERIO; |
| 223 | else if(strcmp(dpme->dpme_type,"Apple_Free")==0) |
| 224 | new_partition->part_type_mac=PMAC_FREE; |
| 225 | else if(strcmp(dpme->dpme_type,"Apple_FWDriver")==0) |
| 226 | new_partition->part_type_mac=PMAC_FWDRIVER; |
| 227 | else if(strcmp(dpme->dpme_type,"Apple_partition_map")==0) |
| 228 | new_partition->part_type_mac=PMAC_MAP; |
nothing calls this directly
no test coverage detected