diff options
author | Dan Ehrenberg <dehrenberg@chromium.org> | 2014-11-21 15:44:05 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-12 21:37:58 +0000 |
commit | 32a999d2c0e5bf8a1c0f6141d3db77a1dcc6f5af (patch) | |
tree | 8861b996d0698c355c021754a005b24e5e947e4e /firmware | |
parent | b3d38f5c620da89662deb1a08971c5025d6c1132 (diff) | |
download | vboot-32a999d2c0e5bf8a1c0f6141d3db77a1dcc6f5af.tar.gz |
vboot: Move IsEntryUnused to gpt_misc
Over in depthcharge, IsEntryUnused will be useful for presenting the
partition table to the kernel. This patch moves that function to
gpt_misc.[ch] for export to depthcharge.
TEST=Booted a kernel on NAND with all this compiled in
TEST=make runtests passed
BRANCH=none
BUG=none
Signed-off-by: Dan Ehrenberg <dehrenberg@google.com>
Change-Id: I56445d1a420fec4d8385ddffc5469b7d77eab576
Reviewed-on: https://chromium-review.googlesource.com/231455
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Daniel Ehrenberg <dehrenberg@chromium.org>
Tested-by: Daniel Ehrenberg <dehrenberg@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/include/gpt_misc.h | 6 | ||||
-rw-r--r-- | firmware/lib/cgptlib/cgptlib_internal.c | 6 | ||||
-rw-r--r-- | firmware/lib/cgptlib/include/cgptlib_internal.h | 5 | ||||
-rw-r--r-- | firmware/lib/gpt_misc.c | 5 |
4 files changed, 11 insertions, 11 deletions
diff --git a/firmware/include/gpt_misc.h b/firmware/include/gpt_misc.h index e15f7dc8..06180696 100644 --- a/firmware/include/gpt_misc.h +++ b/firmware/include/gpt_misc.h @@ -6,6 +6,7 @@ #ifndef VBOOT_REFERENCE_CGPT_MISC_H_ #define VBOOT_REFERENCE_CGPT_MISC_H_ +#include "gpt.h" #include "vboot_api.h" enum { @@ -148,4 +149,9 @@ int AllocAndReadGptData(VbExDiskHandle_t disk_handle, GptData *gptdata); */ int WriteAndFreeGptData(VbExDiskHandle_t disk_handle, GptData *gptdata); +/** + * Return 1 if the entry is unused, 0 if it is used. + */ +int IsUnusedEntry(const GptEntry *e); + #endif /* VBOOT_REFERENCE_CGPT_MISC_H_ */ diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c index e7bb2e60..5e2889c6 100644 --- a/firmware/lib/cgptlib/cgptlib_internal.c +++ b/firmware/lib/cgptlib/cgptlib_internal.c @@ -141,12 +141,6 @@ int CheckHeader(GptHeader *h, int is_secondary, return 0; } -int IsUnusedEntry(const GptEntry *e) -{ - static Guid zero = {{{0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}}}}; - return !Memcmp(&zero, (const uint8_t*)(&e->type), sizeof(zero)); -} - int IsKernelEntry(const GptEntry *e) { static Guid chromeos_kernel = GPT_ENT_TYPE_CHROMEOS_KERNEL; diff --git a/firmware/lib/cgptlib/include/cgptlib_internal.h b/firmware/lib/cgptlib/include/cgptlib_internal.h index 8dc05914..f88bc567 100644 --- a/firmware/lib/cgptlib/include/cgptlib_internal.h +++ b/firmware/lib/cgptlib/include/cgptlib_internal.h @@ -149,11 +149,6 @@ void SetEntryPriority(GptEntry *e, int priority); void SetEntryTries(GptEntry *e, int tries); /** - * Return 1 if the entry is unused, 0 if it is used. - */ -int IsUnusedEntry(const GptEntry *e); - -/** * Return 1 if the entry is a Chrome OS kernel partition, else 0. */ int IsKernelEntry(const GptEntry *e); diff --git a/firmware/lib/gpt_misc.c b/firmware/lib/gpt_misc.c index 975e853b..c16d4729 100644 --- a/firmware/lib/gpt_misc.c +++ b/firmware/lib/gpt_misc.c @@ -185,3 +185,8 @@ fail: return ret; } +int IsUnusedEntry(const GptEntry *e) +{ + static Guid zero = {{{0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0}}}}; + return !Memcmp(&zero, (const uint8_t*)(&e->type), sizeof(zero)); +} |