diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-03-20 15:02:34 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-03-20 23:47:50 -0700 |
commit | 3f806a2abf07d7b801852a4a6f3a9080a4b5c427 (patch) | |
tree | 936deb68cac1010957023c1e7cc8f2988feddd25 | |
parent | 95bae09c7e54a604d89f16b4a8e8b946642af8e7 (diff) | |
download | vboot-3f806a2abf07d7b801852a4a6f3a9080a4b5c427.tar.gz |
Apply consistent naming scheme for hostlib functions.
The chromeos-installer uses several functions from the vboot_reference
userspace library, but the names of those functions are inconsistent:
IsZero
MapFile
VbGetSystemPropertyString
cgpt_add
cgpt_boot
cgpt_create
cgpt_get_boot_partition_number
cgpt_get_num_non_empty_partitions
cgpt_get_partition_details
cgpt_prioritize
cgpt_set_attributes
find_kernel_config
The Google C++ style guide says types and functions should use CamelCase,
while variables use lower_case_with_underscores.
Kernel style (which vboot_reference tries to be more-or-less compatible
with) uses lower_case_with_underscores for everything, but that really only
has to apply to firmware stuff. For userspace, we can use the Google style.
BUG=chromium:221544
BRANCH=none
TEST=buildbot
CQ-DEPEND=CL:46045
Renaming/cleanup only; no functional changes.
Change-Id: I9c82c9ff8909be88586194c8ffdb435fc771195f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46044
-rw-r--r-- | cgpt/cgpt.h | 2 | ||||
-rw-r--r-- | cgpt/cgpt_add.c | 12 | ||||
-rw-r--r-- | cgpt/cgpt_boot.c | 4 | ||||
-rw-r--r-- | cgpt/cgpt_common.c | 4 | ||||
-rw-r--r-- | cgpt/cgpt_create.c | 2 | ||||
-rw-r--r-- | cgpt/cgpt_find.c | 4 | ||||
-rw-r--r-- | cgpt/cgpt_legacy.c | 2 | ||||
-rw-r--r-- | cgpt/cgpt_params.h | 26 | ||||
-rw-r--r-- | cgpt/cgpt_prioritize.c | 2 | ||||
-rw-r--r-- | cgpt/cgpt_repair.c | 2 | ||||
-rw-r--r-- | cgpt/cgpt_show.c | 10 | ||||
-rw-r--r-- | cgpt/cmd_add.c | 2 | ||||
-rw-r--r-- | cgpt/cmd_boot.c | 2 | ||||
-rw-r--r-- | cgpt/cmd_create.c | 2 | ||||
-rw-r--r-- | cgpt/cmd_find.c | 4 | ||||
-rw-r--r-- | cgpt/cmd_legacy.c | 2 | ||||
-rw-r--r-- | cgpt/cmd_prioritize.c | 2 | ||||
-rw-r--r-- | cgpt/cmd_repair.c | 2 | ||||
-rw-r--r-- | cgpt/cmd_show.c | 2 | ||||
-rw-r--r-- | utility/dump_kernel_config.c | 4 | ||||
-rw-r--r-- | utility/dump_kernel_config_lib.c | 4 | ||||
-rw-r--r-- | utility/include/dump_kernel_config.h | 4 |
22 files changed, 50 insertions, 50 deletions
diff --git a/cgpt/cgpt.h b/cgpt/cgpt.h index b3f7ff3b..47630928 100644 --- a/cgpt/cgpt.h +++ b/cgpt/cgpt.h @@ -78,7 +78,7 @@ int CheckValid(const struct drive *drive); int StrToGuid(const char *str, Guid *guid); void GuidToStr(const Guid *guid, char *str, unsigned int buflen); int GuidEqual(const Guid *guid1, const Guid *guid2); -int IsZero(const Guid *guid); +int GuidIsZero(const Guid *guid); /* Constant global type values to compare against */ extern const Guid guid_chromeos_firmware; diff --git a/cgpt/cgpt_add.c b/cgpt/cgpt_add.c index 9a966bac..684d4d2f 100644 --- a/cgpt/cgpt_add.c +++ b/cgpt/cgpt_add.c @@ -83,7 +83,7 @@ static void set_entry_attributes(struct drive drive, // Set the attributes such as is_successful, num_tries_left, priority, etc. // from the given values in params. -int cgpt_set_attributes(CgptAddParams *params) { +int CgptSetAttributes(CgptAddParams *params) { struct drive drive; int gpt_retval; @@ -144,7 +144,7 @@ bad: // guids of the partitions, etc. Input is the partition number or the // unique id of the partition. Output is populated in the respective // fields of params. -int cgpt_get_partition_details(CgptAddParams *params) { +int CgptGetPartitionDetails(CgptAddParams *params) { struct drive drive; int gpt_retval; @@ -227,7 +227,7 @@ bad: } -int cgpt_add(CgptAddParams *params) { +int CgptAdd(CgptAddParams *params) { struct drive drive; int gpt_retval; @@ -266,7 +266,7 @@ int cgpt_add(CgptAddParams *params) { // Find next empty partition. for (index = 0; index < max_part; index++) { entry = GetEntry(&drive.gpt, PRIMARY, index); - if (IsZero(&entry->type)) { + if (GuidIsZero(&entry->type)) { params->partition = index + 1; break; } @@ -279,12 +279,12 @@ int cgpt_add(CgptAddParams *params) { memcpy(&backup, entry, sizeof(backup)); // New partitions must specify type, begin, and size. - if (IsZero(&entry->type)) { + if (GuidIsZero(&entry->type)) { if (!params->set_begin || !params->set_size || !params->set_type) { Error("-t, -b, and -s options are required for new partitions\n"); goto bad; } - if (IsZero(¶ms->type_guid)) { + if (GuidIsZero(¶ms->type_guid)) { Error("New partitions must have a type other than \"unused\"\n"); goto bad; } diff --git a/cgpt/cgpt_boot.c b/cgpt/cgpt_boot.c index 9176a0cb..4de9c4c5 100644 --- a/cgpt/cgpt_boot.c +++ b/cgpt/cgpt_boot.c @@ -13,7 +13,7 @@ #include "endian.h" -int cgpt_get_boot_partition_number(CgptBootParams *params) { +int CgptGetBootPartitionNumber(CgptBootParams *params) { struct drive drive; int gpt_retval= 0; int retval; @@ -62,7 +62,7 @@ done: } -int cgpt_boot(CgptBootParams *params) { +int CgptBoot(CgptBootParams *params) { struct drive drive; int retval = 1; int gpt_retval= 0; diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c index 8def05ef..dc42d41f 100644 --- a/cgpt/cgpt_common.c +++ b/cgpt/cgpt_common.c @@ -872,13 +872,13 @@ int GuidEqual(const Guid *guid1, const Guid *guid2) { return (0 == memcmp(guid1, guid2, sizeof(Guid))); } -int IsZero(const Guid *gp) { +int GuidIsZero(const Guid *gp) { return GuidEqual(gp, &guid_unused); } void PMBRToStr(struct pmbr *pmbr, char *str, unsigned int buflen) { char buf[GUID_STRLEN]; - if (IsZero(&pmbr->boot_guid)) { + if (GuidIsZero(&pmbr->boot_guid)) { require(snprintf(str, buflen, "PMBR") < buflen); } else { GuidToStr(&pmbr->boot_guid, buf, sizeof(buf)); diff --git a/cgpt/cgpt_create.c b/cgpt/cgpt_create.c index 8c899d19..f4d67d58 100644 --- a/cgpt/cgpt_create.c +++ b/cgpt/cgpt_create.c @@ -9,7 +9,7 @@ #include "cgptlib_internal.h" #include "cgpt_params.h" -int cgpt_create(CgptCreateParams *params) { +int CgptCreate(CgptCreateParams *params) { struct drive drive; if (params == NULL) diff --git a/cgpt/cgpt_find.c b/cgpt/cgpt_find.c index 7ca158ac..795eab62 100644 --- a/cgpt/cgpt_find.c +++ b/cgpt/cgpt_find.c @@ -105,7 +105,7 @@ static int do_search(CgptFindParams *params, char *fileName) { for (i = 0; i < GetNumberOfEntries(&drive.gpt); ++i) { entry = GetEntry(&drive.gpt, ANY_VALID, i); - if (IsZero(&entry->type)) + if (GuidIsZero(&entry->type)) continue; int found = 0; @@ -213,7 +213,7 @@ static int scan_real_devs(CgptFindParams *params) { } -void cgpt_find(CgptFindParams *params) { +void CgptFind(CgptFindParams *params) { if (params == NULL) return; diff --git a/cgpt/cgpt_legacy.c b/cgpt/cgpt_legacy.c index 7d1eeeac..ac2d4f04 100644 --- a/cgpt/cgpt_legacy.c +++ b/cgpt/cgpt_legacy.c @@ -9,7 +9,7 @@ #include "cgptlib_internal.h" #include "cgpt_params.h" -int cgpt_legacy(CgptLegacyParams *params) { +int CgptLegacy(CgptLegacyParams *params) { struct drive drive; GptHeader *h1, *h2; diff --git a/cgpt/cgpt_params.h b/cgpt/cgpt_params.h index fcee03c4..470e0ffb 100644 --- a/cgpt/cgpt_params.h +++ b/cgpt/cgpt_params.h @@ -47,7 +47,7 @@ typedef struct CgptShowParams { int single_item; int debug; - // This is filled in by the relevant methods in cgpt_show.c + // This is filled in by the relevant methods in CgptShow.c int num_partitions; } CgptShowParams; @@ -98,31 +98,31 @@ typedef struct CgptLegacyParams { } CgptLegacyParams; // create related methods. -int cgpt_create(CgptCreateParams *params); +int CgptCreate(CgptCreateParams *params); // add/attribute/details related methods -int cgpt_add(CgptAddParams *params); -int cgpt_set_attributes(CgptAddParams *params); -int cgpt_get_partition_details(CgptAddParams *params); +int CgptAdd(CgptAddParams *params); +int CgptSetAttributes(CgptAddParams *params); +int CgptGetPartitionDetails(CgptAddParams *params); // boot related methods. -int cgpt_boot(CgptBootParams *params); -int cgpt_get_boot_partition_number(CgptBootParams *params); +int CgptBoot(CgptBootParams *params); +int CgptGetBootPartitionNumber(CgptBootParams *params); // show/get related methods. -int cgpt_show(CgptShowParams *params); -int cgpt_get_num_non_empty_partitions(CgptShowParams *params); +int CgptShow(CgptShowParams *params); +int CgptGetNumNonEmptyPartitions(CgptShowParams *params); // repair related methods. -int cgpt_repair(CgptRepairParams *params); +int CgptRepair(CgptRepairParams *params); // priority related methods. -int cgpt_prioritize(CgptPrioritizeParams *params); +int CgptPrioritize(CgptPrioritizeParams *params); // find related methods. -void cgpt_find(CgptFindParams *params); +void CgptFind(CgptFindParams *params); // legacy related methods. -int cgpt_legacy(CgptLegacyParams *params); +int CgptLegacy(CgptLegacyParams *params); #endif // VBOOT_REFERENCE_CGPT_CGPT_PARAMS_H_ diff --git a/cgpt/cgpt_prioritize.c b/cgpt/cgpt_prioritize.c index 2b3feb06..dd74ccf3 100644 --- a/cgpt/cgpt_prioritize.c +++ b/cgpt/cgpt_prioritize.c @@ -92,7 +92,7 @@ static void SortGroups(group_list_t *gl) { } } -int cgpt_prioritize(CgptPrioritizeParams *params) { +int CgptPrioritize(CgptPrioritizeParams *params) { struct drive drive; int priority; diff --git a/cgpt/cgpt_repair.c b/cgpt/cgpt_repair.c index 97beef84..aeac0b93 100644 --- a/cgpt/cgpt_repair.c +++ b/cgpt/cgpt_repair.c @@ -9,7 +9,7 @@ #include "cgptlib_internal.h" #include "cgpt_params.h" -int cgpt_repair(CgptRepairParams *params) { +int CgptRepair(CgptRepairParams *params) { struct drive drive; if (params == NULL) diff --git a/cgpt/cgpt_show.c b/cgpt/cgpt_show.c index 45837d97..6c2160ca 100644 --- a/cgpt/cgpt_show.c +++ b/cgpt/cgpt_show.c @@ -158,14 +158,14 @@ void EntriesDetails(GptData *gpt, const int secondary, int raw) { GptEntry *entry; entry = GetEntry(gpt, secondary, i); - if (IsZero(&entry->type)) + if (GuidIsZero(&entry->type)) continue; EntryDetails(entry, i, raw); } } -int cgpt_get_num_non_empty_partitions(CgptShowParams *params) { +int CgptGetNumNonEmptyPartitions(CgptShowParams *params) { struct drive drive; int gpt_retval; int retval; @@ -188,7 +188,7 @@ int cgpt_get_num_non_empty_partitions(CgptShowParams *params) { int i; for(i = 0; i < numEntries; i++) { GptEntry *entry = GetEntry(&drive.gpt, ANY_VALID, i); - if (IsZero(&entry->type)) + if (GuidIsZero(&entry->type)) continue; params->num_partitions++; @@ -201,7 +201,7 @@ done: return retval; } -int cgpt_show(CgptShowParams *params) { +int CgptShow(CgptShowParams *params) { struct drive drive; int gpt_retval; @@ -275,7 +275,7 @@ int cgpt_show(CgptShowParams *params) { for (i = 0; i < GetNumberOfEntries(&drive.gpt); ++i) { entry = GetEntry(&drive.gpt, ANY_VALID, i); - if (IsZero(&entry->type)) + if (GuidIsZero(&entry->type)) continue; if (!params->numeric && CGPT_OK == ResolveType(&entry->type, type)) { diff --git a/cgpt/cmd_add.c b/cgpt/cmd_add.c index 3a211cd3..500633b0 100644 --- a/cgpt/cmd_add.c +++ b/cgpt/cmd_add.c @@ -169,5 +169,5 @@ int cmd_add(int argc, char *argv[]) { params.drive_name = argv[optind]; - return cgpt_add(¶ms); + return CgptAdd(¶ms); } diff --git a/cgpt/cmd_boot.c b/cgpt/cmd_boot.c index 05ba6e93..d2e63b7f 100644 --- a/cgpt/cmd_boot.c +++ b/cgpt/cmd_boot.c @@ -81,5 +81,5 @@ int cmd_boot(int argc, char *argv[]) { params.drive_name = argv[optind]; - return cgpt_boot(¶ms); + return CgptBoot(¶ms); } diff --git a/cgpt/cmd_create.c b/cgpt/cmd_create.c index cf7b80ce..c2b8adfc 100644 --- a/cgpt/cmd_create.c +++ b/cgpt/cmd_create.c @@ -63,5 +63,5 @@ int cmd_create(int argc, char *argv[]) { params.drive_name = argv[optind]; - return cgpt_create(¶ms); + return CgptCreate(¶ms); } diff --git a/cgpt/cmd_find.c b/cgpt/cmd_find.c index 459c101a..4b2964d4 100644 --- a/cgpt/cmd_find.c +++ b/cgpt/cmd_find.c @@ -153,10 +153,10 @@ int cmd_find(int argc, char *argv[]) { if (optind < argc) { for (i=optind; i<argc; i++) { params.drive_name = argv[i]; - cgpt_find(¶ms); + CgptFind(¶ms); } } else { - cgpt_find(¶ms); + CgptFind(¶ms); } if (params.oneonly && params.hits != 1) { diff --git a/cgpt/cmd_legacy.c b/cgpt/cmd_legacy.c index 5dad01e3..593d2ece 100644 --- a/cgpt/cmd_legacy.c +++ b/cgpt/cmd_legacy.c @@ -63,5 +63,5 @@ int cmd_legacy(int argc, char *argv[]) { params.drive_name = argv[optind]; - return cgpt_legacy(¶ms); + return CgptLegacy(¶ms); } diff --git a/cgpt/cmd_prioritize.c b/cgpt/cmd_prioritize.c index b81bda0c..05e7e0e6 100644 --- a/cgpt/cmd_prioritize.c +++ b/cgpt/cmd_prioritize.c @@ -103,5 +103,5 @@ int cmd_prioritize(int argc, char *argv[]) { params.drive_name = argv[optind]; - return cgpt_prioritize(¶ms); + return CgptPrioritize(¶ms); } diff --git a/cgpt/cmd_repair.c b/cgpt/cmd_repair.c index 4f1bc026..3c313303 100644 --- a/cgpt/cmd_repair.c +++ b/cgpt/cmd_repair.c @@ -58,5 +58,5 @@ int cmd_repair(int argc, char *argv[]) { params.drive_name = argv[optind]; - return cgpt_repair(¶ms); + return CgptRepair(¶ms); } diff --git a/cgpt/cmd_show.c b/cgpt/cmd_show.c index fa0e5f8b..2df199d3 100644 --- a/cgpt/cmd_show.c +++ b/cgpt/cmd_show.c @@ -108,5 +108,5 @@ int cmd_show(int argc, char *argv[]) { params.drive_name = argv[optind]; - return cgpt_show(¶ms); + return CgptShow(¶ms); } diff --git a/utility/dump_kernel_config.c b/utility/dump_kernel_config.c index 20a51871..0a8e0279 100644 --- a/utility/dump_kernel_config.c +++ b/utility/dump_kernel_config.c @@ -83,13 +83,13 @@ int main(int argc, char* argv[]) { } /* Map the kernel image blob. */ - blob = MapFile(infile, &blob_size); + blob = MMapFile(infile, &blob_size); if (!blob) { VbExError("Error reading input file\n"); return 1; } - config = find_kernel_config(blob, (uint64_t)blob_size, + config = FindKernelConfig(blob, (uint64_t)blob_size, kernel_body_load_address); if (!config) { VbExError("Error parsing input file\n"); diff --git a/utility/dump_kernel_config_lib.c b/utility/dump_kernel_config_lib.c index a6989e1c..9559a739 100644 --- a/utility/dump_kernel_config_lib.c +++ b/utility/dump_kernel_config_lib.c @@ -13,7 +13,7 @@ #include "kernel_blob.h" #include "vboot_api.h" -uint8_t* find_kernel_config(uint8_t* blob, uint64_t blob_size, +uint8_t* FindKernelConfig(uint8_t* blob, uint64_t blob_size, uint64_t kernel_body_load_address) { VbKeyBlockHeader* key_block; @@ -54,7 +54,7 @@ uint8_t* find_kernel_config(uint8_t* blob, uint64_t blob_size, return blob + offset; } -void* MapFile(const char* filename, size_t *size) { +void* MMapFile(const char* filename, size_t *size) { FILE* f; uint8_t* buf; long file_size = 0; diff --git a/utility/include/dump_kernel_config.h b/utility/include/dump_kernel_config.h index c6f9b2b6..2289da72 100644 --- a/utility/include/dump_kernel_config.h +++ b/utility/include/dump_kernel_config.h @@ -11,9 +11,9 @@ #include <inttypes.h> #include <stdlib.h> -uint8_t* find_kernel_config(uint8_t* blob, uint64_t blob_size, +uint8_t* FindKernelConfig(uint8_t* blob, uint64_t blob_size, uint64_t kernel_body_load_address); -void* MapFile(const char* filename, size_t *size); +void* MMapFile(const char* filename, size_t *size); #endif // DUMP_KERNEL_CONFIG_UTILITY_H_ |