diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-02-01 11:47:37 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-02-02 16:21:00 +0000 |
commit | 43ac5e363c66b5f12e2cb31125dcb7032b5abb18 (patch) | |
tree | 3bb106cc122d3ddf60055dc0d2bbae7cc6e424c7 | |
parent | 7a2f23d259bcebae1b4009b4c757770c583accfb (diff) | |
download | syslinux-43ac5e363c66b5f12e2cb31125dcb7032b5abb18.tar.gz syslinux-43ac5e363c66b5f12e2cb31125dcb7032b5abb18.tar.xz syslinux-43ac5e363c66b5f12e2cb31125dcb7032b5abb18.zip |
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@intel.com>
-rw-r--r-- | com32/include/syslinux/linux.h | 17 | ||||
-rw-r--r-- | 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 6a89c21e..cf28762d 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 cd7760f6..8d4f7175 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, |