]> git.sur5r.net Git - u-boot/commitdiff
image: Create a table of information for each category
authorSimon Glass <sjg@chromium.org>
Thu, 30 Jun 2016 16:52:14 +0000 (10:52 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 14 Jul 2016 22:22:29 +0000 (18:22 -0400)
Add a table that contains the category name, the number of items in each
category and a pointer to the table of items. This will allow us to use
generic code to deal with the categories.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
common/image.c
include/image.h

index 0be09e5c6306df7973b3a45e00c6c891cef7ee26..4e503b3a060c2c5c61d9379fda3a95c982a7c211 100644 (file)
@@ -176,6 +176,19 @@ static const table_entry_t uimage_comp[] = {
        {       -1,             "",             "",                     },
 };
 
+struct table_info {
+       const char *desc;
+       int count;
+       const table_entry_t *table;
+};
+
+static const struct table_info table_info[IH_COUNT] = {
+       { "architecture", IH_ARCH_COUNT, uimage_arch },
+       { "compression", IH_COMP_COUNT, uimage_comp },
+       { "operating system", IH_OS_COUNT, uimage_os },
+       { "image type", IH_TYPE_COUNT, uimage_type },
+};
+
 /*****************************************************************************/
 /* Legacy format routines */
 /*****************************************************************************/
index 7646daec5c833ff94cd987dfb87a5b403f563ab7..5879ebcd7a567d483a2b7c7c92327553b0ce4c1d 100644 (file)
@@ -123,6 +123,15 @@ struct lmb;
 # define IMAGE_OF_SYSTEM_SETUP 0
 #endif
 
+enum ih_category {
+       IH_ARCH,
+       IH_COMP,
+       IH_OS,
+       IH_TYPE,
+
+       IH_COUNT,
+};
+
 /*
  * Operating System Codes
  */