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

Unified Diff: src/platform/vboot_reference/cgptlib/cgpt_internal.h

Issue 1922004: cgpt supports GptNextKernelEntry() and GptUpdateKernelEntry() (Closed)
Patch Set: Move cgpt attribute bits to bit [57,48] Created 10 years, 8 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
« no previous file with comments | « src/platform/vboot_reference/cgptlib/cgpt.c ('k') | src/platform/vboot_reference/cgptlib/tests/cgpt_test.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/cgptlib/cgpt_internal.h
diff --git a/src/platform/vboot_reference/cgptlib/cgpt_internal.h b/src/platform/vboot_reference/cgptlib/cgpt_internal.h
index 0f56d44b3e96d73379163742e3b80495904d287a..c65f466b9346b1486902211444ff9b8293aecb94 100644
--- a/src/platform/vboot_reference/cgptlib/cgpt_internal.h
+++ b/src/platform/vboot_reference/cgptlib/cgpt_internal.h
@@ -9,8 +9,6 @@
#include <stdint.h>
#include "cgpt.h"
-/* Internal use only.
- * Don't use them unless you know what you are doing. */
int CheckParameters(GptData *gpt);
uint32_t CheckHeaderSignature(GptData *gpt);
uint32_t CheckRevision(GptData *gpt);
@@ -33,4 +31,52 @@ typedef struct {
uint64_t ending;
} pair_t;
+GptEntry *GetEntry(GptData *gpt, int secondary, int entry_index);
+void SetPriority(GptData *gpt, int secondary, int entry_index, int priority);
+int GetPriority(GptData *gpt, int secondary, int entry_index);
+void SetBad(GptData *gpt, int secondary, int entry_index, int bad);
+int GetBad(GptData *gpt, int secondary, int entry_index);
+void SetTries(GptData *gpt, int secondary, int entry_index, int tries);
+int GetTries(GptData *gpt, int secondary, int entry_index);
+void SetSuccess(GptData *gpt, int secondary, int entry_index, int success);
+int GetSuccess(GptData *gpt, int secondary, int entry_index);
+
+/* If gpt->current_kernel is this value, means either:
+ * 1. an initial value before scanning GPT entries,
+ * 2. after scanning, no any valid kernel is found.
+ */
+#define CGPT_KERNEL_ENTRY_NOT_FOUND (-1)
+
+/* Bit definitions and masks for GPT attributes.
+ *
+ * 63 -- do not automounting
+ * 62 -- hidden
+ * 60 -- read-only
+ * :
+ * 57 -- bad kernel entry
+ * 56 -- success
+ * 55,52 -- tries
+ * 51,48 -- priority
+ * 0 -- system partition
+ */
+#define CGPT_ATTRIBUTE_BAD_OFFSET 57
+#define CGPT_ATTRIBUTE_MAX_BAD (1ULL)
+#define CGPT_ATTRIBUTE_BAD_MASK (CGPT_ATTRIBUTE_MAX_BAD << \
+ CGPT_ATTRIBUTE_BAD_OFFSET)
+
+#define CGPT_ATTRIBUTE_SUCCESS_OFFSET 56
+#define CGPT_ATTRIBUTE_MAX_SUCCESS (1ULL)
+#define CGPT_ATTRIBUTE_SUCCESS_MASK (CGPT_ATTRIBUTE_MAX_SUCCESS << \
+ CGPT_ATTRIBUTE_SUCCESS_OFFSET)
+
+#define CGPT_ATTRIBUTE_TRIES_OFFSET 52
+#define CGPT_ATTRIBUTE_MAX_TRIES (15ULL)
+#define CGPT_ATTRIBUTE_TRIES_MASK (CGPT_ATTRIBUTE_MAX_TRIES << \
+ CGPT_ATTRIBUTE_TRIES_OFFSET)
+
+#define CGPT_ATTRIBUTE_PRIORITY_OFFSET 48
+#define CGPT_ATTRIBUTE_MAX_PRIORITY (15ULL)
+#define CGPT_ATTRIBUTE_PRIORITY_MASK (CGPT_ATTRIBUTE_MAX_PRIORITY << \
+ CGPT_ATTRIBUTE_PRIORITY_OFFSET)
+
#endif /* VBOOT_REFERENCE_CGPT_INTERNAL_H_ */
« no previous file with comments | « src/platform/vboot_reference/cgptlib/cgpt.c ('k') | src/platform/vboot_reference/cgptlib/tests/cgpt_test.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698