Make cgpt_add error messages a little more verbose

When the cgpt utility complaints about parameter errors, it is
impossible to tell what exactly went wrong. This change consolidates
error definitions and adds a function to convert integer error values
into text messages.

BRANCH=none
BUG=none
TEST=manual
  . emerge-link vbooot_reference
  . copy generated `cgpt' to a Link device
  . run command with wrong arguments with respect to the existing GPT:
   localhost var # ./cgpt add -i 3 -b 3985408 -s 1757184 -t rootfs -l ROOT-A /dev/sda
   ERROR: cgpt add: Starting LBA overlaps
   ERROR: cgpt add: -i 3 -l ROOT-A -b 3985408 -s 1757184 -t 3CB8E202-3B7E-47DD-8A3C-7FF2A13CFCEC
  . on the host, in the chroot in src/platform/vboot_reference run

   $ make && make runtests

   observe all tests succeed

Change-Id: Ibd23ca0430a875f70524adc99e0509b26ae699b2
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34003
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Vadim Bendebury
2012-09-24 17:41:18 -07:00
committed by Gerrit
parent 210c5ef2d9
commit 65d3c277a2
5 changed files with 105 additions and 43 deletions

View File

@@ -119,4 +119,7 @@ int IsKernelEntry(const GptEntry* e);
/* Copies the current kernel partition's UniquePartitionGuid to the dest */
void GetCurrentKernelUniqueGuid(GptData *gpt, void *dest);
/* Returns a pointer to text describing the passed in error */
const char* GptErrorText(int error_code);
#endif /* VBOOT_REFERENCE_CGPTLIB_INTERNAL_H_ */