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

Unified Diff: src/platform/vboot_reference/cgptlib/cgpt.c

Issue 1729006: Add helper functions and files for gpt tests. (Closed)
Patch Set: fix for code review 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.h ('k') | src/platform/vboot_reference/cgptlib/gpt.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/cgptlib/cgpt.c
diff --git a/src/platform/vboot_reference/cgptlib/cgpt.c b/src/platform/vboot_reference/cgptlib/cgpt.c
index 4504a618a548a5c109bd7aae2d7b7d5431959565..48654731773c42ab2ea9e4dbeedd90ab6c93f948 100644
--- a/src/platform/vboot_reference/cgptlib/cgpt.c
+++ b/src/platform/vboot_reference/cgptlib/cgpt.c
@@ -4,24 +4,42 @@
*/
#include "cgpt.h"
+#include <string.h>
+#include "gpt.h"
+#include "utility.h"
/* stub code */
static int start[] = { 34, 10034 };
-int GPTInit(GPTData_t *gpt) {
+int GptInit(GptData_t *gpt) {
+ int valid_headers[2] = {1, 1};
+
+ /* check header signature */
+ if (Memcmp(gpt->primary_header, GPT_HEADER_SIGNATURE,
+ GPT_HEADER_SIGNATURE_SIZE))
+ valid_headers[0] = 0;
+ if (Memcmp(gpt->secondary_header, GPT_HEADER_SIGNATURE,
+ GPT_HEADER_SIGNATURE_SIZE))
+ valid_headers[1] = 0;
+
+ if (!valid_headers[0] && !valid_headers[1])
+ return GPT_ERROR_INVALID_HEADERS;
+
gpt->current_kernel = 1;
- return 0;
+ return GPT_SUCCESS;
}
-int GPTNextKernelEntry(GPTData_t *gpt, uint64_t *start_sector, uint64_t *size) {
+int GptNextKernelEntry(GptData_t *gpt, uint64_t *start_sector, uint64_t *size) {
+ /* FIXME: the following code is not really code, just returns anything */
gpt->current_kernel ^= 1;
if (start_sector) *start_sector = start[gpt->current_kernel];
if (size) *size = 10000;
- return 0;
+ return GPT_SUCCESS;
}
-int GPTUpdateKernelEntry(GPTData_t *gpt, uint32_t update_type) {
+int GptUpdateKernelEntry(GptData_t *gpt, uint32_t update_type) {
+ /* FIXME: the following code is not really code, just return anything */
gpt->modified |= (GPT_MODIFIED_HEADER1 | GPT_MODIFIED_ENTRIES1) <<
gpt->current_kernel;
- return 0;
+ return GPT_SUCCESS;
}
« no previous file with comments | « src/platform/vboot_reference/cgptlib/cgpt.h ('k') | src/platform/vboot_reference/cgptlib/gpt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698