From 3fcde22a30fc26fa299d4e26a9cc0bde7eb0356d Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Tue, 4 Feb 2014 17:35:44 -0800 Subject: Add an xdr function for the cbfs_file header And use it in fit.c and remove one more use of htonl. Change-Id: Ibf18dcc0a7f08d75c2374115de0db7a4bf64ec1e Signed-off-by: Ronald G. Minnich Reviewed-on: http://review.coreboot.org/5120 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- util/cbfstool/common.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'util/cbfstool/common.c') diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c index 98d9517bf4..f594e8453b 100644 --- a/util/cbfstool/common.c +++ b/util/cbfstool/common.c @@ -103,6 +103,15 @@ void buffer_delete(struct buffer *buffer) { buffer->size = 0; } +void cbfs_file_get_header(struct buffer *buf, struct cbfs_file *file) +{ + bgets(buf, &file->magic, sizeof(file->magic)); + file->len = xdr_be.get32(buf); + file->type = xdr_be.get32(buf); + file->checksum = xdr_be.get32(buf); + file->offset = xdr_be.get32(buf); +} + static struct { uint32_t arch; const char *name; -- cgit v1.2.3