[U-Boot] [PATCH 6/8] tools: mkimage: Making table_entry code global

Prafulla Wadaskar prafulla at marvell.com
Tue Jul 28 20:04:28 CEST 2009


1. get_table_entry_id API made global
2. get_table_entry_name API made global
3. typedef table_entry_t moved to image.h

Currently it is used by image.c only
These APIs can be used by additional mkimage types supports
for ex. kwbimage, to use it the API is made global

Signed-off-by: Prafulla Wadaskar <prafulla at marvell.com>
---
 common/image.c  |   10 ++--------
 include/image.h |   10 ++++++++++
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/common/image.c b/common/image.c
index 232348c..8cf675d 100644
--- a/common/image.c
+++ b/common/image.c
@@ -74,12 +74,6 @@ static 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",	},
@@ -513,7 +507,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)
@@ -560,7 +554,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;
diff --git a/include/image.h b/include/image.h
index 88a13ab..f119cee 100644
--- a/include/image.h
+++ b/include/image.h
@@ -168,6 +168,15 @@
 #define IH_MAGIC	0x27051956	/* Image Magic Number		*/
 #define IH_NMLEN		32	/* Image Name Length		*/
 
+typedef struct table_entry {
+	int	id;		/* as defined in image.h	*/
+	char	*sname;		/* short (input) name		*/
+	char	*lname;		/* long (output) name		*/
+} table_entry_t;
+
+int get_table_entry_id (table_entry_t *table,
+		const char *table_name, const char *name);
+
 /*
  * Legacy format image header,
  * all data in network byte order (aka natural aka bigendian).
@@ -300,6 +309,7 @@ int genimg_get_comp_id (const char *name);
 #define IMAGE_FORMAT_LEGACY	0x01	/* legacy image_header based format */
 #define IMAGE_FORMAT_FIT	0x02	/* new, libfdt based format */
 
+char *get_table_entry_name (table_entry_t *table, char *msg, int id);
 void genimg_print_size (uint32_t size);
 int genimg_get_format (void *img_addr);
 int genimg_has_config (bootm_headers_t *images);
-- 
1.5.3.3



More information about the U-Boot mailing list