Hi ----- Original Message ----- > Hi! > > On 15.09.2015 19:07, marcandre.lur...@redhat.com wrote: > > From: Marc-André Lureau <marcandre.lur...@redhat.com> > > > > Use a more explicit function name parse_mem_size(). I guess such > > function could be common (or exists already somewhere). > > strtosz() from include/qemu-common.h is appropriate
thanks, that's what I was looking for! cheers > > > > > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > > --- > > hw/misc/ivshmem.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > > index f9ac955..5fb2123 100644 > > --- a/hw/misc/ivshmem.c > > +++ b/hw/misc/ivshmem.c > > @@ -643,12 +643,12 @@ static void ivshmem_reset(DeviceState *d) > > ivshmem_use_msix(s); > > } > > > > -static uint64_t ivshmem_get_size(IVShmemState * s, Error **errp) { > > - > > +static uint64_t parse_mem_size(const char *sizearg, Error **errp) > > +{ > > uint64_t value; > > char *ptr; > > > > - value = strtoull(s->sizearg, &ptr, 10); > > + value = strtoull(sizearg, &ptr, 10); > > switch (*ptr) { > > case 0: case 'M': case 'm': > > value <<= 20; > > @@ -657,7 +657,7 @@ static uint64_t ivshmem_get_size(IVShmemState * s, > > Error **errp) { > > value <<= 30; > > break; > > default: > > - error_setg(errp, "invalid ram size: %s", s->sizearg); > > + error_setg(errp, "invalid ram size: %s", sizearg); > > return 0; > > } > > > > @@ -704,7 +704,7 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error > > **errp) > > if (s->sizearg == NULL) { > > s->ivshmem_size = 4 << 20; /* 4 MB default */ > > } else { > > - s->ivshmem_size = ivshmem_get_size(s, &local_err); > > + s->ivshmem_size = parse_mem_size(s->sizearg, &local_err); > > if (local_err) { > > error_propagate(errp, local_err); > > return; > > > -- > Best regards, > Vladimir > * now, @virtuozzo.com instead of @parallels.com. Sorry for this > inconvenience. > >