]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mkimage: Make table_entry code global
authorPrafulla Wadaskar <prafulla@marvell.com>
Mon, 7 Sep 2009 09:29:08 +0000 (14:59 +0530)
committerWolfgang Denk <wd@denx.de>
Thu, 10 Sep 2009 20:58:48 +0000 (22:58 +0200)
- make get_table_entry_id() global
- make get_table_entry_name() global
- move struct table_entry to image.h

Currently this code is used by image.c only.

This patch makes this API global so it can be used by other parts of
code, too.

Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Ron Lee <ron.debian.org>
Edit comments and commit message.

Signed-off-by: Wolfgang Denk <wd@denx.de>
common/image.c
include/image.h

index ca8205ce43d3f9d0e2f164718b6f90f34668f2b3..e8ecfa5c03203c35970ba0f02fde40df9883484b 100644 (file)
@@ -74,12 +74,6 @@ static const image_header_t* image_get_ramdisk (ulong rd_addr, uint8_t arch,
 #include <image.h>
 #endif /* !USE_HOSTCC*/
 
-typedef struct table_entry {
-       int     id;             /* as defined in image.h        */
-       char    *sname;         /* short (input) name           */
-       char    *lname;         /* long (output) name           */
-} table_entry_t;
-
 static table_entry_t uimage_arch[] = {
        {       IH_ARCH_INVALID,        NULL,           "Invalid ARCH", },
        {       IH_ARCH_ALPHA,          "alpha",        "Alpha",        },
@@ -514,7 +508,7 @@ static void genimg_print_time (time_t timestamp)
  *     long entry name if translation succeeds
  *     msg otherwise
  */
-static char *get_table_entry_name (table_entry_t *table, char *msg, int id)
+char *get_table_entry_name (table_entry_t *table, char *msg, int id)
 {
        for (; table->id >= 0; ++table) {
                if (table->id == id)
@@ -561,7 +555,7 @@ const char *genimg_get_comp_name (uint8_t comp)
  *     entry id if translation succeeds
  *     -1 otherwise
  */
-static int get_table_entry_id (table_entry_t *table,
+int get_table_entry_id (table_entry_t *table,
                const char *table_name, const char *name)
 {
        table_entry_t *t;
index 4a7bf7820a8e0ad55ecb04113730986d23a9fa50..d4cbf8c7093b69c3851ad529fe510ad0b48ee4fb 100644 (file)
@@ -284,6 +284,30 @@ typedef struct bootm_headers {
 #define uimage_to_cpu(x)               be32_to_cpu(x)
 #define cpu_to_uimage(x)               cpu_to_be32(x)
 
+/*
+ * Translation table for entries of a specific type; used by
+ * get_table_entry_id() and get_table_entry_name().
+ */
+typedef struct table_entry {
+       int     id;
+       char    *sname;         /* short (input) name to find table entry */
+       char    *lname;         /* long (output) name to print for messages */
+} table_entry_t;
+
+/*
+ * get_table_entry_id() scans the translation table trying to find an
+ * entry that matches the given short name. If a matching entry is
+ * found, it's id is returned to the caller.
+ */
+int get_table_entry_id (table_entry_t *table,
+               const char *table_name, const char *name);
+/*
+ * get_table_entry_name() scans the translation table trying to find
+ * an entry that matches the given id. If a matching entry is found,
+ * its long name is returned to the caller.
+ */
+char *get_table_entry_name (table_entry_t *table, char *msg, int id);
+
 const char *genimg_get_os_name (uint8_t os);
 const char *genimg_get_arch_name (uint8_t arch);
 const char *genimg_get_type_name (uint8_t type);