[syslinux:firmware] com32: Move initramfs_size() into header file

syslinux-bot for Matt Fleming matt.fleming at intel.com
Fri Nov 9 09:06:15 PST 2012


Commit-ID:  43ac5e363c66b5f12e2cb31125dcb7032b5abb18
Gitweb:     http://www.syslinux.org/commit/43ac5e363c66b5f12e2cb31125dcb7032b5abb18
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Wed, 1 Feb 2012 11:47:37 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Thu, 2 Feb 2012 16:21:00 +0000

com32: Move initramfs_size() into header file

Both the EFI and BIOS firmwares need to calculate the size of
initramfs, so move this helper function into a common header file.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/include/syslinux/linux.h  |   17 +++++++++++++++++
 com32/lib/syslinux/load_linux.c |   17 -----------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/com32/include/syslinux/linux.h b/com32/include/syslinux/linux.h
index 6a89c21..cf28762 100644
--- a/com32/include/syslinux/linux.h
+++ b/com32/include/syslinux/linux.h
@@ -113,4 +113,21 @@ int initramfs_load_file(struct initramfs *ihead, const char *src_filename,
 int initramfs_add_trailer(struct initramfs *ihead);
 int initramfs_load_archive(struct initramfs *ihead, const char *filename);
 
+/* Get the combined size of the initramfs */
+static inline uint32_t initramfs_size(struct initramfs *initramfs)
+{
+    struct initramfs *ip;
+    uint32_t size = 0;
+
+    if (!initramfs)
+	return 0;
+
+    for (ip = initramfs->next; ip->len; ip = ip->next) {
+	size = (size + ip->align - 1) & ~(ip->align - 1);	/* Alignment */
+	size += ip->len;
+    }
+
+    return size;
+}
+
 #endif /* _SYSLINUX_LINUX_H */
diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c
index cd7760f..8d4f717 100644
--- a/com32/lib/syslinux/load_linux.c
+++ b/com32/lib/syslinux/load_linux.c
@@ -94,23 +94,6 @@ static inline uint32_t saturate32(unsigned long long v)
     return (v > 0xffffffff) ? 0xffffffff : (uint32_t) v;
 }
 
-/* Get the combined size of the initramfs */
-static addr_t initramfs_size(struct initramfs *initramfs)
-{
-    struct initramfs *ip;
-    addr_t size = 0;
-
-    if (!initramfs)
-	return 0;
-
-    for (ip = initramfs->next; ip->len; ip = ip->next) {
-	size = (size + ip->align - 1) & ~(ip->align - 1);	/* Alignment */
-	size += ip->len;
-    }
-
-    return size;
-}
-
 /* Create the appropriate mappings for the initramfs */
 static int map_initramfs(struct syslinux_movelist **fraglist,
 			 struct syslinux_memmap **mmap,


More information about the Syslinux-commits mailing list