diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-29 10:26:12 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-04-01 10:38:55 +0200 |
commit | b8837986a0a828577426c9d7eb41ca712bfca067 (patch) | |
tree | 85b8ac015930b28dc65770f9ed9dc4e0f4a6ce6d /common/imd.c | |
parent | 439d6830517e15a2b31e90733b8aeaaf98b9e0f2 (diff) | |
download | barebox-b8837986a0a828577426c9d7eb41ca712bfca067.tar.gz barebox-b8837986a0a828577426c9d7eb41ca712bfca067.tar.xz |
imd: export functions
To make the image metadata API usable for external users export
some functions.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/imd.c')
-rw-r--r-- | common/imd.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/common/imd.c b/common/imd.c index 3a7cbc96e4..1cc4d719ec 100644 --- a/common/imd.c +++ b/common/imd.c @@ -169,7 +169,13 @@ static struct imd_type_names imd_types[] = { }, }; -static const char *imd_type_to_name(uint32_t type) +/** + * imd_type_to_name - convert a imd type to a name + * @type: The imd type + * + * This function returns a string representation of the imd type + */ +const char *imd_type_to_name(uint32_t type) { int i; @@ -191,7 +197,16 @@ static uint32_t imd_name_to_type(const char *name) return IMD_TYPE_INVALID; } -static const char *imd_string_data(struct imd_header *imd, int index) +/** + * imd_string_data - get string data + * @imd: The IMD entry + * @index: The index of the string + * + * This function returns the string in @imd indexed by @index. + * + * Return: A pointer to the string or NULL if the string is not found + */ +const char *imd_string_data(struct imd_header *imd, int index) { int i, total = 0, l = 0; int len = imd_read_length(imd); @@ -209,7 +224,16 @@ static const char *imd_string_data(struct imd_header *imd, int index) return NULL; } -static char *imd_concat_strings(struct imd_header *imd) +/** + * imd_concat_strings - get string data + * @imd: The IMD entry + * + * This function returns the concatenated strings in @imd. The string + * returned is allocated with malloc() and the caller has to free() it. + * + * Return: A pointer to the string or NULL if the string is not found + */ +char *imd_concat_strings(struct imd_header *imd) { int i, len = imd_read_length(imd); char *str; |