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 #include "cgpt.h" | 5 #include "cgpt.h" |
6 | 6 |
7 #define __STDC_FORMAT_MACROS | 7 #define __STDC_FORMAT_MACROS |
8 #include <getopt.h> | 8 #include <getopt.h> |
9 #include <inttypes.h> | 9 #include <inttypes.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 (int)(entry->ending_lba - entry->starting_lba + 1), | 126 (int)(entry->ending_lba - entry->starting_lba + 1), |
127 index+1, contents); | 127 index+1, contents); |
128 if (CGPT_OK == ResolveType(&entry->type, type)) { | 128 if (CGPT_OK == ResolveType(&entry->type, type)) { |
129 printf(PARTITION_MORE, "Type: ", type); | 129 printf(PARTITION_MORE, "Type: ", type); |
130 } else { | 130 } else { |
131 GuidToStr(&entry->type, type, GUID_STRLEN); | 131 GuidToStr(&entry->type, type, GUID_STRLEN); |
132 printf(PARTITION_MORE, "Type: ", type); | 132 printf(PARTITION_MORE, "Type: ", type); |
133 } | 133 } |
134 GuidToStr(&entry->unique, unique, GUID_STRLEN); | 134 GuidToStr(&entry->unique, unique, GUID_STRLEN); |
135 printf(PARTITION_MORE, "UUID: ", unique); | 135 printf(PARTITION_MORE, "UUID: ", unique); |
136 if (!memcmp(&guid_chromeos_kernel, &entry->type, sizeof(Guid))) { | 136 if (GuidEqual(&guid_chromeos_kernel, &entry->type)) { |
137 int tries = (entry->attrs.fields.gpt_att & | 137 int tries = (entry->attrs.fields.gpt_att & |
138 CGPT_ATTRIBUTE_TRIES_MASK) >> | 138 CGPT_ATTRIBUTE_TRIES_MASK) >> |
139 CGPT_ATTRIBUTE_TRIES_OFFSET; | 139 CGPT_ATTRIBUTE_TRIES_OFFSET; |
140 int successful = (entry->attrs.fields.gpt_att & | 140 int successful = (entry->attrs.fields.gpt_att & |
141 CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >> | 141 CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >> |
142 CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET; | 142 CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET; |
143 int priority = (entry->attrs.fields.gpt_att & | 143 int priority = (entry->attrs.fields.gpt_att & |
144 CGPT_ATTRIBUTE_PRIORITY_MASK) >> | 144 CGPT_ATTRIBUTE_PRIORITY_MASK) >> |
145 CGPT_ATTRIBUTE_PRIORITY_OFFSET; | 145 CGPT_ATTRIBUTE_PRIORITY_OFFSET; |
146 require(snprintf(contents, sizeof(contents), | 146 require(snprintf(contents, sizeof(contents), |
(...skipping 22 matching lines...) Expand all Loading... |
169 } | 169 } |
170 | 170 |
171 | 171 |
172 void EntriesDetails(GptData *gpt, const int secondary, int raw) { | 172 void EntriesDetails(GptData *gpt, const int secondary, int raw) { |
173 uint32_t i; | 173 uint32_t i; |
174 | 174 |
175 for (i = 0; i < GetNumberOfEntries(gpt); ++i) { | 175 for (i = 0; i < GetNumberOfEntries(gpt); ++i) { |
176 GptEntry *entry; | 176 GptEntry *entry; |
177 entry = GetEntry(gpt, secondary, i); | 177 entry = GetEntry(gpt, secondary, i); |
178 | 178 |
179 if (!memcmp(&guid_unused, &entry->type, sizeof(Guid))) continue; | 179 if (IsZero(&entry->type)) |
| 180 continue; |
180 | 181 |
181 EntryDetails(entry, i, raw); | 182 EntryDetails(entry, i, raw); |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
185 int cmd_show(int argc, char *argv[]) { | 186 int cmd_show(int argc, char *argv[]) { |
186 struct drive drive; | 187 struct drive drive; |
187 int numeric = 0; | 188 int numeric = 0; |
188 int verbose = 0; | 189 int verbose = 0; |
189 int quick = 0; | 190 int quick = 0; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 HeaderDetails(header, indent, numeric); | 412 HeaderDetails(header, indent, numeric); |
412 } | 413 } |
413 } | 414 } |
414 } | 415 } |
415 | 416 |
416 (void) CheckValid(&drive); | 417 (void) CheckValid(&drive); |
417 (void) DriveClose(&drive, 0); | 418 (void) DriveClose(&drive, 0); |
418 | 419 |
419 return CGPT_OK; | 420 return CGPT_OK; |
420 } | 421 } |
OLD | NEW |