diff mbox series

[2/3] change load_image() reture type to ssize_t

Message ID 1542008730-6375-2-git-send-email-lizhijian@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show
Series [1/3] unify len and addr type for memory/address APIs | expand

Commit Message

Li Zhijian Nov. 12, 2018, 7:45 a.m. UTC
This patch allow load_iamge to load >=2G file

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
 hw/core/loader.c    | 5 +++--
 include/hw/loader.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hw/core/loader.c b/hw/core/loader.c
index aa0b3fc..0d53229 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -75,9 +75,10 @@  int64_t get_image_size(const char *filename)
 
 /* return the size or -1 if error */
 /* deprecated, because caller does not specify buffer size! */
-int load_image(const char *filename, uint8_t *addr)
+ssize_t load_image(const char *filename, uint8_t *addr)
 {
-    int fd, size;
+    int fd;
+    ssize_t size;
     fd = open(filename, O_RDONLY | O_BINARY);
     if (fd < 0)
         return -1;
diff --git a/include/hw/loader.h b/include/hw/loader.h
index 67a0af8..49bb189 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -11,7 +11,7 @@ 
  * 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(const char *filename, uint8_t *addr); /* deprecated */
 ssize_t load_image_size(const char *filename, void *addr, size_t size);
 
 /**load_image_targphys_as: