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
diff --git a/cgpt/cgpt.h b/cgpt/cgpt.h
index b3f7ff3..4763092 100644
--- a/cgpt/cgpt.h
+++ b/cgpt/cgpt.h
@@ -78,7 +78,7 @@
 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 9a966ba..684d4d2 100644
--- a/cgpt/cgpt_add.c
+++ b/cgpt/cgpt_add.c
@@ -83,7 +83,7 @@
 
 // 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 @@
 // 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 @@
 }
 
 
-int cgpt_add(CgptAddParams *params) {
+int CgptAdd(CgptAddParams *params) {
   struct drive drive;
 
   int gpt_retval;
@@ -266,7 +266,7 @@
     // 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 @@
   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(&params->type_guid)) {
+    if (GuidIsZero(&params->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 9176a0c..4de9c4c 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 @@
 }
 
 
-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 8def05e..dc42d41 100644
--- a/cgpt/cgpt_common.c
+++ b/cgpt/cgpt_common.c
@@ -872,13 +872,13 @@
   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 8c899d1..f4d67d5 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 7ca158a..795eab6 100644
--- a/cgpt/cgpt_find.c
+++ b/cgpt/cgpt_find.c
@@ -105,7 +105,7 @@
   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 @@
 }
 
 
-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 7d1eeea..ac2d4f0 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 fcee03c..470e0ff 100644
--- a/cgpt/cgpt_params.h
+++ b/cgpt/cgpt_params.h
@@ -47,7 +47,7 @@
   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 @@
 } 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 2b3feb0..dd74ccf 100644
--- a/cgpt/cgpt_prioritize.c
+++ b/cgpt/cgpt_prioritize.c
@@ -92,7 +92,7 @@
   }
 }
 
-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 97beef8..aeac0b9 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 45837d9..6c2160c 100644
--- a/cgpt/cgpt_show.c
+++ b/cgpt/cgpt_show.c
@@ -158,14 +158,14 @@
     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 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 @@
   return retval;
 }
 
-int cgpt_show(CgptShowParams *params) {
+int CgptShow(CgptShowParams *params) {
   struct drive drive;
   int gpt_retval;
 
@@ -275,7 +275,7 @@
     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 3a211cd..500633b 100644
--- a/cgpt/cmd_add.c
+++ b/cgpt/cmd_add.c
@@ -169,5 +169,5 @@
 
   params.drive_name = argv[optind];
 
-  return cgpt_add(&params);
+  return CgptAdd(&params);
 }
diff --git a/cgpt/cmd_boot.c b/cgpt/cmd_boot.c
index 05ba6e9..d2e63b7 100644
--- a/cgpt/cmd_boot.c
+++ b/cgpt/cmd_boot.c
@@ -81,5 +81,5 @@
 
   params.drive_name = argv[optind];
 
-  return cgpt_boot(&params);
+  return CgptBoot(&params);
 }
diff --git a/cgpt/cmd_create.c b/cgpt/cmd_create.c
index cf7b80c..c2b8adf 100644
--- a/cgpt/cmd_create.c
+++ b/cgpt/cmd_create.c
@@ -63,5 +63,5 @@
 
   params.drive_name = argv[optind];
 
-  return cgpt_create(&params);
+  return CgptCreate(&params);
 }
diff --git a/cgpt/cmd_find.c b/cgpt/cmd_find.c
index 459c101..4b2964d 100644
--- a/cgpt/cmd_find.c
+++ b/cgpt/cmd_find.c
@@ -153,10 +153,10 @@
   if (optind < argc) {
     for (i=optind; i<argc; i++) {
       params.drive_name = argv[i];
-      cgpt_find(&params);
+      CgptFind(&params);
       }
   } else {
-      cgpt_find(&params);
+      CgptFind(&params);
   }
 
   if (params.oneonly && params.hits != 1) {
diff --git a/cgpt/cmd_legacy.c b/cgpt/cmd_legacy.c
index 5dad01e..593d2ec 100644
--- a/cgpt/cmd_legacy.c
+++ b/cgpt/cmd_legacy.c
@@ -63,5 +63,5 @@
 
   params.drive_name = argv[optind];
 
-  return cgpt_legacy(&params);
+  return CgptLegacy(&params);
 }
diff --git a/cgpt/cmd_prioritize.c b/cgpt/cmd_prioritize.c
index b81bda0..05e7e0e 100644
--- a/cgpt/cmd_prioritize.c
+++ b/cgpt/cmd_prioritize.c
@@ -103,5 +103,5 @@
 
   params.drive_name = argv[optind];
 
-  return cgpt_prioritize(&params);
+  return CgptPrioritize(&params);
 }
diff --git a/cgpt/cmd_repair.c b/cgpt/cmd_repair.c
index 4f1bc02..3c31330 100644
--- a/cgpt/cmd_repair.c
+++ b/cgpt/cmd_repair.c
@@ -58,5 +58,5 @@
 
   params.drive_name = argv[optind];
 
-  return cgpt_repair(&params);
+  return CgptRepair(&params);
 }
diff --git a/cgpt/cmd_show.c b/cgpt/cmd_show.c
index fa0e5f8..2df199d 100644
--- a/cgpt/cmd_show.c
+++ b/cgpt/cmd_show.c
@@ -108,5 +108,5 @@
 
   params.drive_name = argv[optind];
 
-  return cgpt_show(&params);
+  return CgptShow(&params);
 }
diff --git a/utility/dump_kernel_config.c b/utility/dump_kernel_config.c
index 20a5187..0a8e027 100644
--- a/utility/dump_kernel_config.c
+++ b/utility/dump_kernel_config.c
@@ -83,13 +83,13 @@
   }
 
   /* 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 a6989e1..9559a73 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 @@
   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 c6f9b2b..2289da7 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_