diff options
author | Hung-Te Lin <hungte@chromium.org> | 2013-01-29 02:15:49 +0800 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-02-05 22:25:13 +0100 |
commit | 3bb035b095a0e4144adfa55fa45b2332e3a6c7d5 (patch) | |
tree | 6990649fbb3e3c95f11818206125a44cb1b30edc /util/cbfstool/cbfs_image.h | |
parent | eab2c81949c8859892443c1e71449f391bc52d97 (diff) | |
download | coreboot-3bb035b095a0e4144adfa55fa45b2332e3a6c7d5.tar.xz |
cbfstool: Use cbfs_image API for "print" command.
Process CBFS ROM image by new cbfs_image API.
To verify, run "cbfstool coreboot.rom print -v" and compare with old cbfstool.
Change-Id: I3a5a9ef176596d825e6cdba28a8ad732f69f5600
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2206
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/cbfstool/cbfs_image.h')
-rw-r--r-- | util/cbfstool/cbfs_image.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h index 9535c2d95f..822f6d54b4 100644 --- a/util/cbfstool/cbfs_image.h +++ b/util/cbfstool/cbfs_image.h @@ -38,6 +38,17 @@ int cbfs_image_write_file(struct cbfs_image *image, const char *filename); /* Releases the CBFS image. Returns 0 on success, otherwise non-zero. */ int cbfs_image_delete(struct cbfs_image *image); +/* Callback function used by cbfs_walk. + * Returns 0 on success, or non-zero to stop further iteration. */ +typedef int (*cbfs_entry_callback)(struct cbfs_image *image, + struct cbfs_file *file, + void *arg); + +/* Iterates through all entries in CBFS image, and invoke with callback. + * Stops if callback returns non-zero values. + * Returns number of entries invoked. */ +int cbfs_walk(struct cbfs_image *image, cbfs_entry_callback callback, void *arg); + /* Primitive CBFS utilities */ /* Returns a pointer to the only valid CBFS header in give buffer, otherwise @@ -62,4 +73,10 @@ uint32_t cbfs_get_entry_addr(struct cbfs_image *image, struct cbfs_file *entry); /* Returns 1 if entry has valid data (by checking magic number), otherwise 0. */ int cbfs_is_valid_entry(struct cbfs_file *entry); +/* Print CBFS component information. */ +int cbfs_print_directory(struct cbfs_image *image); +int cbfs_print_header_info(struct cbfs_image *image); +int cbfs_print_entry_info(struct cbfs_image *image, struct cbfs_file *entry, + void *arg); + #endif |