From c1d1fd850ee7b8e52bd2ea5064fab68ac0c27098 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Wed, 5 Feb 2014 01:10:08 -0600 Subject: cbfstool: Deserialize CBFS master header when reading image Rather than using [hn]to[nh] whenever accessing a member of the CBFS header, deserialize the header when opening the CBFS image. The header is no longer a pointer inside the CBFS buffer, but a separate struct, a copy of the original header in a host-friendly format. This kills more of the ntohl usage. Change-Id: I5f8a5818b9d5a2d1152b1906249c4a5847d02bac Signed-off-by: Alexandru Gagniuc Reviewed-on: http://review.coreboot.org/5121 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Ronald G. Minnich --- util/cbfstool/cbfs_image.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util/cbfstool/cbfs_image.h') diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h index 8ea4e47519..0a05eb2841 100644 --- a/util/cbfstool/cbfs_image.h +++ b/util/cbfstool/cbfs_image.h @@ -34,6 +34,8 @@ struct cbfs_image { /* Given a pointer, serialize the header from host-native byte format * to cbfs format, i.e. big-endian. */ void cbfs_put_header(void *dest, const struct cbfs_header *header); +/* Or deserialize into host-native format */ +void cbfs_get_header(struct cbfs_header *header, const void *src); /* Creates an empty CBFS image by given size, and description to its content * (bootblock, align, header location, starting offset of CBFS entries. -- cgit v1.2.3