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 #ifndef VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ | 6 #ifndef VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ |
7 #define VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ | 7 #define VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ |
8 | 8 |
9 #include "sysincludes.h" | 9 #include "sysincludes.h" |
10 #include "cgptlib.h" | 10 #include "cgptlib.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 * | 76 * |
77 * Returns 0 if header is valid, 1 if invalid. */ | 77 * Returns 0 if header is valid, 1 if invalid. */ |
78 int CheckHeader(GptHeader* h, int is_secondary, uint64_t drive_sectors); | 78 int CheckHeader(GptHeader* h, int is_secondary, uint64_t drive_sectors); |
79 | 79 |
80 /* Calculate and return the header CRC. */ | 80 /* Calculate and return the header CRC. */ |
81 uint32_t HeaderCrc(GptHeader* h); | 81 uint32_t HeaderCrc(GptHeader* h); |
82 | 82 |
83 /* Check entries. | 83 /* Check entries. |
84 * | 84 * |
85 * Returns 0 if entries are valid, 1 if invalid. */ | 85 * Returns 0 if entries are valid, 1 if invalid. */ |
86 int CheckEntries(GptEntry* entries, GptHeader* h, uint64_t drive_sectors); | 86 int CheckEntries(GptEntry* entries, GptHeader* h); |
87 | 87 |
88 /* Check GptData, headers, entries. | 88 /* Check GptData, headers, entries. |
89 * | 89 * |
90 * If successful, sets gpt->valid_headers and gpt->valid_entries and returns | 90 * If successful, sets gpt->valid_headers and gpt->valid_entries and returns |
91 * GPT_SUCCESS. | 91 * GPT_SUCCESS. |
92 * | 92 * |
93 * On error, returns a GPT_ERROR_* return code. */ | 93 * On error, returns a GPT_ERROR_* return code. */ |
94 int GptSanityCheck(GptData* gpt); | 94 int GptSanityCheck(GptData* gpt); |
95 | 95 |
96 /* Repairs GPT data by copying from one set of valid headers/entries to the | 96 /* Repairs GPT data by copying from one set of valid headers/entries to the |
97 * other. Assumes GptSanityCheck() has been run to determine which headers | 97 * other. Assumes GptSanityCheck() has been run to determine which headers |
98 * and/or entries are already valid. */ | 98 * and/or entries are already valid. */ |
99 void GptRepair(GptData* gpt); | 99 void GptRepair(GptData* gpt); |
100 | 100 |
101 /* Getters and setters for partition attribute fields. */ | 101 /* Getters and setters for partition attribute fields. */ |
102 int GetEntrySuccessful(const GptEntry* e); | 102 int GetEntrySuccessful(const GptEntry* e); |
103 int GetEntryPriority(const GptEntry* e); | 103 int GetEntryPriority(const GptEntry* e); |
104 int GetEntryTries(const GptEntry* e); | 104 int GetEntryTries(const GptEntry* e); |
105 void SetEntrySuccessful(GptEntry* e, int successful); | 105 void SetEntrySuccessful(GptEntry* e, int successful); |
106 void SetEntryPriority(GptEntry* e, int priority); | 106 void SetEntryPriority(GptEntry* e, int priority); |
107 void SetEntryTries(GptEntry* e, int tries); | 107 void SetEntryTries(GptEntry* e, int tries); |
108 | 108 |
109 /* Return 1 if the entry is unused, 0 if it is used. */ | 109 /* Return 1 if the entry is unused, 0 if it is used. */ |
110 int IsUnusedEntry(const GptEntry* e); | 110 int IsUnusedEntry(const GptEntry* e); |
111 | 111 |
112 /* Returns 1 if the entry is a Chrome OS kernel partition, else 0. */ | 112 /* Returns 1 if the entry is a Chrome OS kernel partition, else 0. */ |
113 int IsKernelEntry(const GptEntry* e); | 113 int IsKernelEntry(const GptEntry* e); |
114 | 114 |
115 #endif /* VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ */ | 115 #endif /* VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ */ |
OLD | NEW |