diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-18 21:50:54 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-18 21:50:54 +0000 |
commit | 335ab26d25339b7ae7714bcade3379bf1633e382 (patch) | |
tree | e2704c24c297fa540ebe2911a8f9fa42f7eb9cd0 | |
parent | d669040b8118fb7fb901be63a7ad15f2d114be76 (diff) |
The contents of the Apple_Patches partition is none of our business.
Stop pretending we care or know what's in there. Remove 'debugging'
mode command to examine the partition contents and the supporting
code.
ok deraadt@ jasper@
-rw-r--r-- | sbin/pdisk/dump.c | 92 | ||||
-rw-r--r-- | sbin/pdisk/dump.h | 3 | ||||
-rw-r--r-- | sbin/pdisk/pdisk.c | 25 |
3 files changed, 3 insertions, 117 deletions
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c index db4aa4361e9..6954de6290b 100644 --- a/sbin/pdisk/dump.c +++ b/sbin/pdisk/dump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.c,v 1.36 2016/01/18 17:57:35 krw Exp $ */ +/* $OpenBSD: dump.c,v 1.37 2016/01/18 21:50:53 krw Exp $ */ /* * dump.c - dumping partition maps @@ -43,26 +43,6 @@ #define get_align_long(x) (*(x)) -struct patchdescriptor { - unsigned long patchSig; - unsigned short majorVers; - unsigned short minorVers; - unsigned long flags; - unsigned long patchOffset; - unsigned long patchSize; - unsigned long patchCRC; - unsigned long patchDescriptorLen; - unsigned char patchName[33]; - unsigned char patchVendor[1]; -}; - -struct patchlist { - unsigned short numPatchBlocks; /* number of disk blocks to hold the - * patch list */ - unsigned short numPatches; /* number of patches in list */ - struct patchdescriptor thePatch[1]; -}; - const char *kStringEmpty = ""; const char *kStringNot = " not"; @@ -475,76 +455,6 @@ full_dump_block_zero(struct partition_map_header * map) ((unsigned short *) &m[i].ddBlock)) * 2); } - -void -display_patches(struct partition_map * entry) -{ - static unsigned char *patch_block; - struct patchdescriptor *q; - struct patchlist *p; - unsigned char *next, *s; - long long offset; - int i; - - offset = entry->data->dpme_pblock_start; - offset = ((long long) entry->data->dpme_pblock_start) * - entry->the_map->logical_block; - if (patch_block == NULL) { - patch_block = malloc(DEV_BSIZE); - if (patch_block == NULL) { - warn("can't allocate memory for patch block buffer"); - return; - } - } - if (read_file_media(entry->the_map->fd, (long long) offset, DEV_BSIZE, - (char *) patch_block) == 0) { - warn("Can't read patch block"); - return; - } - p = (struct patchlist *) patch_block; - if (p->numPatchBlocks != 1) { - i = p->numPatchBlocks; - free(patch_block); - patch_block = reallocarray(NULL, i, DEV_BSIZE); - if (patch_block == NULL) { - warn("can't allocate memory for patch blocks buffer"); - return; - } - s = patch_block + DEV_BSIZE * i; - while (i > 0) { - s -= DEV_BSIZE; - i -= 1; - if (read_file_media(entry->the_map->fd, offset + i, - DEV_BSIZE, (char *)s) == 0) { - warn("Can't read patch block %d", i); - return; - } - } - p = (struct patchlist *) patch_block; - } - printf("Patch list (%d entries)\n", p->numPatches); - q = p->thePatch; - for (i = 0; i < p->numPatches; i++) { - printf("%2d signature: '%.4s'\n", i + 1, (char *) &q->patchSig); - printf(" version: %d.%d\n", q->majorVers, q->minorVers); - printf(" flags: 0x%lx\n", q->flags); - printf(" offset: %ld\n", q->patchOffset); - printf(" size: %ld\n", q->patchSize); - printf(" CRC: 0x%lx\n", q->patchCRC); - printf(" name: '%.*s'\n", q->patchName[0], - &q->patchName[1]); - printf(" vendor: '%.*s'\n", q->patchVendor[0], - &q->patchVendor[1]); - next = ((unsigned char *) q) + q->patchDescriptorLen; - s = &q->patchVendor[q->patchVendor[0] + 1]; - if (next > s) { - printf("remainder of entry -"); - dump_block(s, next - s); - } - q = (struct patchdescriptor *) next; - } -} - int get_max_type_string_length(struct partition_map_header * map) { diff --git a/sbin/pdisk/dump.h b/sbin/pdisk/dump.h index c87602573ae..6e6f4bba5d8 100644 --- a/sbin/pdisk/dump.h +++ b/sbin/pdisk/dump.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dump.h,v 1.10 2016/01/17 23:18:19 krw Exp $ */ +/* $OpenBSD: dump.h,v 1.11 2016/01/18 21:50:53 krw Exp $ */ /* * dump.h - dumping partition maps @@ -32,7 +32,6 @@ #include "partition_map.h" -void display_patches(struct partition_map *); int dump(char *); void dump_block(unsigned char *, int); void dump_partition_map(struct partition_map_header *, int); diff --git a/sbin/pdisk/pdisk.c b/sbin/pdisk/pdisk.c index 7560e574d7d..2e51e9b4c36 100644 --- a/sbin/pdisk/pdisk.c +++ b/sbin/pdisk/pdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pdisk.c,v 1.48 2016/01/18 17:57:35 krw Exp $ */ +/* $OpenBSD: pdisk.c,v 1.49 2016/01/18 21:50:53 krw Exp $ */ /* * pdisk - an editor for Apple format partition tables @@ -56,7 +56,6 @@ void do_create_partition(struct partition_map_header *, int); void do_delete_partition(struct partition_map_header *); void do_display_block(struct partition_map_header *, char *); void do_display_entry(struct partition_map_header *); -void do_examine_patch_partition(struct partition_map_header *); int do_expert (struct partition_map_header *, char *); void do_rename_partition(struct partition_map_header *); void do_change_type(struct partition_map_header *); @@ -553,7 +552,6 @@ do_expert(struct partition_map_header * map, char *name) } printf(" f full display of nth entry\n"); printf(" v validate map\n"); - printf(" e examine patch partition\n"); printf(" q return to main edit menu\n"); printf(" Q quit editing\n"); break; @@ -592,10 +590,6 @@ do_expert(struct partition_map_header * map, char *name) case 'v': validate_map(map); break; - case 'E': - case 'e': - do_examine_patch_partition(map); - break; default: bad_input("No such command (%c)", command); break; @@ -712,23 +706,6 @@ do_display_entry(struct partition_map_header * map) } -void -do_examine_patch_partition(struct partition_map_header * map) -{ - struct partition_map *entry; - - if (map == NULL) { - bad_input("No partition map exists"); - return; - } - entry = find_entry_by_type(kPatchType, map); - if (entry == NULL) { - printf("No patch partition\n"); - } else { - display_patches(entry); - } -} - __dead static void usage(void) { |