Re: [Qemu-devel] [RFC/PoC PATCH 2/3] change size type from int to int64_t on load_image()
On 11/08/2018 07:04 PM, Peter Maydell wrote: On 8 November 2018 at 10:59, Li Zhijian wrote: allow load_image to load >= 2G file CC: Philip Li Signed-off-by: Li Zhijian --- hw/core/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index aa0b3fc..8fbc4bd 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -77,7 +77,8 @@ int64_t get_image_size(const char *filename) /* deprecated, because caller does not specify buffer size! */ int load_image(const char *filename, uint8_t *addr) { -int fd, size; +int fd; +int64_t size; fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) return -1; This function returns "size", so changing the type of "size" without also changing its return type looks wrong. load_image_size() uses ssize_t here, which may be what we want. will change to ssize_t at next version Thanks Zhijian thanks -- PMM
Re: [Qemu-devel] [RFC/PoC PATCH 2/3] change size type from int to int64_t on load_image()
On 8 November 2018 at 10:59, Li Zhijian wrote: > allow load_image to load >= 2G file > > CC: Philip Li > Signed-off-by: Li Zhijian > --- > hw/core/loader.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/core/loader.c b/hw/core/loader.c > index aa0b3fc..8fbc4bd 100644 > --- a/hw/core/loader.c > +++ b/hw/core/loader.c > @@ -77,7 +77,8 @@ int64_t get_image_size(const char *filename) > /* deprecated, because caller does not specify buffer size! */ > int load_image(const char *filename, uint8_t *addr) > { > -int fd, size; > +int fd; > +int64_t size; > fd = open(filename, O_RDONLY | O_BINARY); > if (fd < 0) > return -1; This function returns "size", so changing the type of "size" without also changing its return type looks wrong. load_image_size() uses ssize_t here, which may be what we want. thanks -- PMM
[Qemu-devel] [RFC/PoC PATCH 2/3] change size type from int to int64_t on load_image()
allow load_image to load >= 2G file CC: Philip Li Signed-off-by: Li Zhijian --- hw/core/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index aa0b3fc..8fbc4bd 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -77,7 +77,8 @@ int64_t get_image_size(const char *filename) /* deprecated, because caller does not specify buffer size! */ int load_image(const char *filename, uint8_t *addr) { -int fd, size; +int fd; +int64_t size; fd = open(filename, O_RDONLY | O_BINARY); if (fd < 0) return -1; -- 2.7.4