Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Unified Diff: src/platform/vboot_reference/vboot_firmware/lib/cgptlib/include/cgptlib.h

Issue 2438005: Much rearranging of cgptlib. Passes all its (new) unit tests. (Closed) Base URL: ssh://gitrw.chromium.org/chromiumos
Patch Set: Pre commit Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/vboot_firmware/lib/cgptlib/include/cgptlib.h
diff --git a/src/platform/vboot_reference/vboot_firmware/lib/cgptlib/include/cgptlib.h b/src/platform/vboot_reference/vboot_firmware/lib/cgptlib/include/cgptlib.h
index 7195ee7a666b9e32d6a7a8d3b0d7cc7883710eec..acf91dc088855b2a2489f49bc48a2b77fa9d936b 100644
--- a/src/platform/vboot_reference/vboot_firmware/lib/cgptlib/include/cgptlib.h
+++ b/src/platform/vboot_reference/vboot_firmware/lib/cgptlib/include/cgptlib.h
@@ -6,7 +6,6 @@
#ifndef VBOOT_REFERENCE_CGPTLIB_H_
#define VBOOT_REFERENCE_CGPTLIB_H_
-#include "gpt.h"
#include <stdint.h>
enum {
@@ -19,8 +18,6 @@ enum {
GPT_ERROR_INVALID_UPDATE_TYPE,
};
-const char *GptError(int errno);
-
/* Bit masks for GptData.modified field. */
#define GPT_MODIFIED_HEADER1 0x01
#define GPT_MODIFIED_HEADER2 0x02
@@ -40,33 +37,6 @@ enum {
* invalid. */
};
-/* Defines ChromeOS-specific limitation on GPT */
-#define MIN_SIZE_OF_HEADER 92
-#define MAX_SIZE_OF_HEADER 512
-#define MIN_SIZE_OF_ENTRY 128
-#define MAX_SIZE_OF_ENTRY 512
-#define SIZE_OF_ENTRY_MULTIPLE 8
-#define MIN_NUMBER_OF_ENTRIES 32
-#define MAX_NUMBER_OF_ENTRIES 512
-#define TOTAL_ENTRIES_SIZE 16384 /* usual case is 128 bytes * 128 entries */
-
-/* Defines GPT sizes */
-#define GPT_PMBR_SECTOR 1 /* size (in sectors) of PMBR */
-#define GPT_HEADER_SECTOR 1
-#define GPT_ENTRIES_SECTORS 32 /* assume sector size if 512 bytes, then
- * (TOTAL_ENTRIES_SIZE / 512) = 32 */
-
-/* alias name of index in internal array for primary and secondary header and
- * entries. */
-enum {
- PRIMARY = 0,
- SECONDARY = 1,
- MASK_NONE = 0,
- MASK_PRIMARY = 1,
- MASK_SECONDARY = 2,
- MASK_BOTH = 3,
-};
-
typedef struct {
/* Fill in the following fields before calling GptInit() */
uint8_t *primary_header; /* GPT primary header, from sector 1 of disk
@@ -91,9 +61,10 @@ typedef struct {
/* Internal variables */
uint32_t valid_headers, valid_entries;
+ int current_priority;
} GptData;
-int GptInit(GptData *gpt);
+int GptInit(GptData* gpt);
/* Initializes the GPT data structure's internal state. The following fields
* must be filled before calling this function:
*
@@ -116,7 +87,7 @@ int GptInit(GptData *gpt);
* GPT_ERROR_INVALID_SECTOR_NUMBER, number of sectors in drive is invalid (too
* small) */
-int GptNextKernelEntry(GptData *gpt, uint64_t *start_sector, uint64_t *size);
+int GptNextKernelEntry(GptData* gpt, uint64_t* start_sector, uint64_t* size);
/* Provides the location of the next kernel partition, in order of decreasing
* priority. On return the start_sector parameter contains the LBA sector
* for the start of the kernel partition, and the size parameter contains the
@@ -126,7 +97,7 @@ int GptNextKernelEntry(GptData *gpt, uint64_t *start_sector, uint64_t *size);
* Returns GPT_SUCCESS if successful, else
* GPT_ERROR_NO_VALID_KERNEL, no avaliable kernel, enters recovery mode */
-int GptUpdateKernelEntry(GptData *gpt, uint32_t update_type);
+int GptUpdateKernelEntry(GptData* gpt, uint32_t update_type);
/* Updates the kernel entry with the specified index, using the specified type
* of update (GPT_UPDATE_ENTRY_*).
*

Powered by Google App Engine
This is Rietveld 408576698