[coreboot] r588 - coreboot-v3/util/lar
svn at coreboot.org
svn at coreboot.org
Tue Feb 12 21:31:43 CET 2008
Author: myles
Date: 2008-02-12 21:31:42 +0100 (Tue, 12 Feb 2008)
New Revision: 588
Modified:
coreboot-v3/util/lar/stream.c
Log:
This patch makes lar -l print a total of the bytes used in an archive.
I did it because I wanted to know the differences between preparsing
elf files and compressing the pieces.
Signed-off-by: Myles Watson <myles at pel.cs.byu.edu>
Acked-by: Ronald G. Minnich <rminnich at gmail.com>
Modified: coreboot-v3/util/lar/stream.c
===================================================================
--- coreboot-v3/util/lar/stream.c 2008-02-11 01:30:24 UTC (rev 587)
+++ coreboot-v3/util/lar/stream.c 2008-02-12 20:31:42 UTC (rev 588)
@@ -545,6 +545,7 @@
void lar_list_files(struct lar *lar, struct file *files)
{
u8 *ptr = lar->map;
+ u32 total_size = 0;
char *filename;
struct lar_header *header;
@@ -553,12 +554,13 @@
while (ptr < (lar->map + get_bootblock_offset(lar->size))) {
header = (struct lar_header *) ptr;
- /* We interpet the absence of the magic as empty space */
+ /* We interpret the absence of the magic as empty space */
if (strncmp(header->magic, MAGIC, 8))
break;
filename = (char *) (ptr + sizeof(struct lar_header));
+ total_size += sizeof(struct lar_header);
if (file_in_list(files, filename)) {
printf(" %s ", filename);
@@ -568,6 +570,7 @@
ntohl(header->len),
(unsigned long)(ptr - lar->map) +
ntohl(header->offset));
+ total_size += ntohl(header->len);
} else {
printf("(%d bytes, %s compressed to %d bytes "
"@0x%lx);",
@@ -576,6 +579,7 @@
ntohl(header->len),
(unsigned long)(ptr - lar->map) +
ntohl(header->offset));
+ total_size += ntohl(header->len);
}
printf("loadaddress 0x%#x entry 0x%#x\n",
ntohl(header->loadaddress),
@@ -595,7 +599,12 @@
ntohl(header->len),
get_bootblock_offset(lar->size) +
ntohl(header->offset));
+ total_size += sizeof(struct lar_header) + ntohl(header->len);
}
+
+ /* Print the total size */
+ printf ("Total size = %d bytes (0x%x)\n", total_size, total_size);
+
}
/**
More information about the coreboot
mailing list