diff options
author | Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com> | 2015-01-15 02:48:07 -0200 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2015-01-29 13:38:41 -0500 |
commit | a93648d197df48fa46dd55f925ff70468bd81c71 (patch) | |
tree | 87672e7f6b2132cf992d79dde7bde7a2cc060977 /tools/dumpimage.c | |
parent | 067d15607598884e270f3076c721f56d3c4f65e6 (diff) | |
download | u-boot-imx-a93648d197df48fa46dd55f925ff70468bd81c71.zip u-boot-imx-a93648d197df48fa46dd55f925ff70468bd81c71.tar.gz u-boot-imx-a93648d197df48fa46dd55f925ff70468bd81c71.tar.bz2 |
imagetool: replace image registration function by linker_lists feature
The registration was introduced in commit f86ed6a8d52c99bb2d17d3cac1647edca0c4399c
This commit also removes all registration functions, and the member "next"
from image_type_params struct
Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Diffstat (limited to 'tools/dumpimage.c')
-rw-r--r-- | tools/dumpimage.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/tools/dumpimage.c b/tools/dumpimage.c index 0228e18..80bf583 100644 --- a/tools/dumpimage.c +++ b/tools/dumpimage.c @@ -20,41 +20,6 @@ static struct image_tool_params params = { .type = IH_TYPE_KERNEL, }; -/** - * dumpimage_register() - register respective image generation/list support - * - * the input struct image_type_params is checked and appended to the link - * list, if the input structure is already registered, issue an error - * - * @tparams: Image type parameters - */ -static void dumpimage_register(struct image_type_params *tparams) -{ - struct image_type_params **tp; - - if (!tparams) { - fprintf(stderr, "%s: %s: Null input\n", params.cmdname, - __func__); - exit(EXIT_FAILURE); - } - - /* scan the linked list, check for registry and point the last one */ - for (tp = &dumpimage_tparams; *tp != NULL; tp = &(*tp)->next) { - if (!strcmp((*tp)->name, tparams->name)) { - fprintf(stderr, "%s: %s already registered\n", - params.cmdname, tparams->name); - return; - } - } - - /* add input struct entry at the end of link list */ - *tp = tparams; - /* mark input entry as last entry in the link list */ - tparams->next = NULL; - - debug("Registered %s\n", tparams->name); -} - /* * dumpimage_extract_datafile - * @@ -70,8 +35,12 @@ static int dumpimage_extract_datafile(void *ptr, struct stat *sbuf) { int retval = -1; struct image_type_params *curr; + struct image_type_params *start = ll_entry_start( + struct image_type_params, image_type); + struct image_type_params *end = ll_entry_end( + struct image_type_params, image_type); - for (curr = dumpimage_tparams; curr != NULL; curr = curr->next) { + for (curr = start; curr != end; curr++) { if (curr->verify_header) { retval = curr->verify_header((unsigned char *)ptr, sbuf->st_size, ¶ms); @@ -104,9 +73,6 @@ int main(int argc, char **argv) int retval = 0; struct image_type_params *tparams = NULL; - /* Init all image generation/list support */ - register_image_tool(dumpimage_register); - params.cmdname = *argv; while ((opt = getopt(argc, argv, "li:o:p:V")) != -1) { @@ -142,7 +108,7 @@ int main(int argc, char **argv) usage(); /* set tparams as per input type_id */ - tparams = imagetool_get_type(params.type, dumpimage_tparams); + tparams = imagetool_get_type(params.type); if (tparams == NULL) { fprintf(stderr, "%s: unsupported type %s\n", params.cmdname, genimg_get_type_name(params.type)); |