Message ID | 1541674784-25936-3-git-send-email-lizhijian@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | support initrd size up to 4G | expand |
On 8 November 2018 at 10:59, Li Zhijian <lizhijian@cn.fujitsu.com> wrote: > allow load_image to load >= 2G file > > CC: Philip Li <philip.li@intel.com> > Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> > --- > 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
On 11/08/2018 07:04 PM, Peter Maydell wrote: > On 8 November 2018 at 10:59, Li Zhijian <lizhijian@cn.fujitsu.com> wrote: >> allow load_image to load >= 2G file >> >> CC: Philip Li <philip.li@intel.com> >> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> >> --- >> 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 > > >
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;
allow load_image to load >= 2G file CC: Philip Li <philip.li@intel.com> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> --- hw/core/loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)