| 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 #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 <string.h> | 10 #include <string.h> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 if (CGPT_OK != DriveOpen(filename, &drive)) | 165 if (CGPT_OK != DriveOpen(filename, &drive)) |
| 166 return 0; | 166 return 0; |
| 167 | 167 |
| 168 if (GPT_SUCCESS != GptSanityCheck(&drive.gpt)) { | 168 if (GPT_SUCCESS != GptSanityCheck(&drive.gpt)) { |
| 169 (void) DriveClose(&drive, 0); | 169 (void) DriveClose(&drive, 0); |
| 170 return 0; | 170 return 0; |
| 171 } | 171 } |
| 172 | 172 |
| 173 for (i = 0; i < GetNumberOfEntries(&drive.gpt); ++i) { | 173 for (i = 0; i < GetNumberOfEntries(&drive.gpt); ++i) { |
| 174 entry = GetEntry(&drive.gpt, PRIMARY, i); | 174 entry = GetEntry(&drive.gpt, ANY_VALID, i); |
| 175 | 175 |
| 176 if (IsZero(&entry->type)) | 176 if (IsZero(&entry->type)) |
| 177 continue; | 177 continue; |
| 178 | 178 |
| 179 int found = 0; | 179 int found = 0; |
| 180 if ((set_unique && !memcmp(&unique_guid, &entry->unique, sizeof(Guid))) || | 180 if ((set_unique && !memcmp(&unique_guid, &entry->unique, sizeof(Guid))) || |
| 181 (set_type && !memcmp(&type_guid, &entry->type, sizeof(Guid)))) { | 181 (set_type && !memcmp(&type_guid, &entry->type, sizeof(Guid)))) { |
| 182 found = 1; | 182 found = 1; |
| 183 } else if (set_label) { | 183 } else if (set_label) { |
| 184 UTF16ToUTF8(entry->name, sizeof(entry->name) / sizeof(entry->name[0]), | 184 UTF16ToUTF8(entry->name, sizeof(entry->name) / sizeof(entry->name[0]), |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 if (oneonly && hits != 1) { | 377 if (oneonly && hits != 1) { |
| 378 return CGPT_FAILED; | 378 return CGPT_FAILED; |
| 379 } | 379 } |
| 380 | 380 |
| 381 if (match_partnum) { | 381 if (match_partnum) { |
| 382 return CGPT_OK; | 382 return CGPT_OK; |
| 383 } | 383 } |
| 384 | 384 |
| 385 return CGPT_FAILED; | 385 return CGPT_FAILED; |
| 386 } | 386 } |
| OLD | NEW |