| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 * | 4 * |
| 5 * Show GPT details. | 5 * Show GPT details. |
| 6 */ | 6 */ |
| 7 #include <getopt.h> | 7 #include <getopt.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include "cgpt.h" | 10 #include "cgpt.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 char buf[BUFFER_SIZE(sizeof(header->signature))]; | 101 char buf[BUFFER_SIZE(sizeof(header->signature))]; |
| 102 RawDump((uint8_t *)header->signature, sizeof(header->signature), buf, 1); | 102 RawDump((uint8_t *)header->signature, sizeof(header->signature), buf, 1); |
| 103 printf("%s", buf); | 103 printf("%s", buf); |
| 104 } | 104 } |
| 105 printf("\n"); | 105 printf("\n"); |
| 106 | 106 |
| 107 printf("%sRev: 0x%08x\n", indent, header->revision); | 107 printf("%sRev: 0x%08x\n", indent, header->revision); |
| 108 printf("%sSize: %d\n", indent, header->size); | 108 printf("%sSize: %d\n", indent, header->size); |
| 109 printf("%sHeader CRC: 0x%08x\n", indent, header->header_crc32); | 109 printf("%sHeader CRC: 0x%08x\n", indent, header->header_crc32); |
| 110 printf("%sMy LBA: %lld\n", indent, (long long)header->my_lba); | 110 printf("%sMy LBA: %lld\n", indent, (long long)header->my_lba); |
| 111 printf("%sAlter LBA: %lld\n", indent, (long long)header->alternate_lba); | |
| 112 printf("%sFirst LBA: %lld\n", indent, (long long)header->first_usable_lba); | 111 printf("%sFirst LBA: %lld\n", indent, (long long)header->first_usable_lba); |
| 113 printf("%sLast LBA: %lld\n", indent, (long long)header->last_usable_lba); | 112 printf("%sLast LBA: %lld\n", indent, (long long)header->last_usable_lba); |
| 114 | 113 |
| 115 { /* For disk guid */ | 114 { /* For disk guid */ |
| 116 char buf[GUID_STRLEN]; | 115 char buf[GUID_STRLEN]; |
| 117 GuidToStr(&header->disk_uuid, buf); | 116 GuidToStr(&header->disk_uuid, buf); |
| 118 printf("%sDisk UUID: %s\n", indent, buf); | 117 printf("%sDisk UUID: %s\n", indent, buf); |
| 119 } | 118 } |
| 120 | 119 |
| 121 printf("%sEntries LBA: %lld\n", indent, (long long)header->entries_lba); | 120 printf("%sEntries LBA: %lld\n", indent, (long long)header->entries_lba); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 "hnv", | 206 "hnv", |
| 208 ARRAY_COUNT(show_options), | 207 ARRAY_COUNT(show_options), |
| 209 show_options, | 208 show_options, |
| 210 show_options_details)) | 209 show_options_details)) |
| 211 return CGPT_FAILED; | 210 return CGPT_FAILED; |
| 212 if (help != NOT_INITED) { | 211 if (help != NOT_INITED) { |
| 213 ShowHelp(); | 212 ShowHelp(); |
| 214 return CGPT_FAILED; | 213 return CGPT_FAILED; |
| 215 } | 214 } |
| 216 | 215 |
| 217 OpenDriveInLastArgument(argc, argv, &drive); | |
| 218 if (CGPT_OK != OpenDriveInLastArgument(argc, argv, &drive)) | 216 if (CGPT_OK != OpenDriveInLastArgument(argc, argv, &drive)) |
| 219 return CGPT_FAILED; | 217 return CGPT_FAILED; |
| 220 | 218 |
| 221 printf(TITLE_FMT, "start", "size", "index", "contents"); | 219 printf(TITLE_FMT, "start", "size", "index", "contents"); |
| 222 printf(GPT_FMT, 0, GPT_PMBR_SECTOR, "", "PMBR"); | 220 printf(GPT_FMT, 0, GPT_PMBR_SECTOR, "", "PMBR"); |
| 223 | 221 |
| 224 if (drive.gpt.valid_headers & MASK_PRIMARY) { | 222 if (drive.gpt.valid_headers & MASK_PRIMARY) { |
| 225 printf(GPT_FMT, (int)GPT_PMBR_SECTOR, | 223 printf(GPT_FMT, (int)GPT_PMBR_SECTOR, |
| 226 (int)GPT_HEADER_SECTOR, "", "Pri GPT header"); | 224 (int)GPT_HEADER_SECTOR, "", "Pri GPT header"); |
| 227 if (verbose) { | 225 if (verbose) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 header = (GptHeader*)drive.gpt.secondary_header; | 281 header = (GptHeader*)drive.gpt.secondary_header; |
| 284 HeaderDetails(header, indent); | 282 HeaderDetails(header, indent); |
| 285 } | 283 } |
| 286 } | 284 } |
| 287 | 285 |
| 288 CheckValid(&drive); | 286 CheckValid(&drive); |
| 289 DriveClose(&drive); | 287 DriveClose(&drive); |
| 290 | 288 |
| 291 return CGPT_OK; | 289 return CGPT_OK; |
| 292 } | 290 } |
| OLD | NEW |