[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 09/10] hw/core/loader.c: Remove load_image()
From: |
Peter Maydell |
Subject: |
[Qemu-ppc] [PATCH 09/10] hw/core/loader.c: Remove load_image() |
Date: |
Fri, 30 Nov 2018 15:17:11 +0000 |
The load_image() function is now no longer used anywhere, so
we can remove it completely. (Use load_image_size() or
g_file_get_contents() instead.)
Signed-off-by: Peter Maydell <address@hidden>
---
include/hw/loader.h | 1 -
hw/core/loader.c | 25 -------------------------
2 files changed, 26 deletions(-)
diff --git a/include/hw/loader.h b/include/hw/loader.h
index 67a0af84ac3..3766559bc24 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -11,7 +11,6 @@
* On error, errno is also set as appropriate.
*/
int64_t get_image_size(const char *filename);
-int load_image(const char *filename, uint8_t *addr); /* deprecated */
ssize_t load_image_size(const char *filename, void *addr, size_t size);
/**load_image_targphys_as:
diff --git a/hw/core/loader.c b/hw/core/loader.c
index aa0b3fc8679..180d891b19c 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -73,31 +73,6 @@ int64_t get_image_size(const char *filename)
return size;
}
-/* return the size or -1 if error */
-/* deprecated, because caller does not specify buffer size! */
-int load_image(const char *filename, uint8_t *addr)
-{
- int fd, size;
- fd = open(filename, O_RDONLY | O_BINARY);
- if (fd < 0)
- return -1;
- size = lseek(fd, 0, SEEK_END);
- if (size == -1) {
- fprintf(stderr, "file %-20s: get size error: %s\n",
- filename, strerror(errno));
- close(fd);
- return -1;
- }
-
- lseek(fd, 0, SEEK_SET);
- if (read(fd, addr, size) != size) {
- close(fd);
- return -1;
- }
- close(fd);
- return size;
-}
-
/* return the size or -1 if error */
ssize_t load_image_size(const char *filename, void *addr, size_t size)
{
--
2.19.1
- [Qemu-ppc] [PATCH 04/10] hw/pci/pci.c: Don't use load_image(), (continued)
- [Qemu-ppc] [PATCH 04/10] hw/pci/pci.c: Don't use load_image(), Peter Maydell, 2018/11/30
- [Qemu-ppc] [PATCH 03/10] hw/smbios/smbios.c: Don't use load_image(), Peter Maydell, 2018/11/30
- [Qemu-ppc] [PATCH 01/10] hw/ppc/mac_newworld, mac_oldworld: Don't use load_image(), Peter Maydell, 2018/11/30
- [Qemu-ppc] [PATCH 07/10] hw/block/tc58128.c: Don't use load_image(), Peter Maydell, 2018/11/30
- [Qemu-ppc] [PATCH 05/10] hw/i386/pc.c: Don't use load_image(), Peter Maydell, 2018/11/30
- [Qemu-ppc] [PATCH 09/10] hw/core/loader.c: Remove load_image(),
Peter Maydell <=