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 | 5 |
6 #include "cgptlib.h" | 6 #include "cgptlib.h" |
7 #include "cgptlib_internal.h" | 7 #include "cgptlib_internal.h" |
8 #include "crc32.h" | 8 #include "crc32.h" |
9 #include "gpt.h" | 9 #include "gpt.h" |
10 #include "utility.h" | 10 #include "utility.h" |
11 | 11 |
| 12 /* global types to compare against */ |
| 13 const Guid guid_unused = GPT_ENT_TYPE_UNUSED; |
| 14 const Guid guid_chromeos_kernel = GPT_ENT_TYPE_CHROMEOS_KERNEL; |
| 15 |
12 | 16 |
13 int GptInit(GptData *gpt) { | 17 int GptInit(GptData *gpt) { |
14 int retval; | 18 int retval; |
15 | 19 |
16 gpt->modified = 0; | 20 gpt->modified = 0; |
17 gpt->current_kernel = CGPT_KERNEL_ENTRY_NOT_FOUND; | 21 gpt->current_kernel = CGPT_KERNEL_ENTRY_NOT_FOUND; |
18 gpt->current_priority = 999; | 22 gpt->current_priority = 999; |
19 | 23 |
20 retval = GptSanityCheck(gpt); | 24 retval = GptSanityCheck(gpt); |
21 if (GPT_SUCCESS != retval) | 25 if (GPT_SUCCESS != retval) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 140 |
137 /* Use the repair function to update the other copy of the GPT. | 141 /* Use the repair function to update the other copy of the GPT. |
138 * This is a tad inefficient, but is much faster than the disk I/O | 142 * This is a tad inefficient, but is much faster than the disk I/O |
139 * to update the GPT on disk so it doesn't matter. */ | 143 * to update the GPT on disk so it doesn't matter. */ |
140 gpt->valid_headers = MASK_PRIMARY; | 144 gpt->valid_headers = MASK_PRIMARY; |
141 gpt->valid_entries = MASK_PRIMARY; | 145 gpt->valid_entries = MASK_PRIMARY; |
142 GptRepair(gpt); | 146 GptRepair(gpt); |
143 | 147 |
144 return GPT_SUCCESS; | 148 return GPT_SUCCESS; |
145 } | 149 } |
OLD | NEW |