Re: [Libguestfs] [PATCH nbdkit] server: Move size parsing code (nbdkit_parse_size) to common/include

2023-09-06 Thread Laszlo Ersek
On 9/5/23 16:57, Eric Blake wrote: > On Tue, Sep 05, 2023 at 11:09:02AM +0100, Richard W.M. Jones wrote: +static inline int64_t +human_size_parse (const char *str, + const char **error, const char **pstr) +{ + int64_t size; + char *end; +

Re: [Libguestfs] [PATCH nbdkit] server: Move size parsing code (nbdkit_parse_size) to common/include

2023-09-05 Thread Eric Blake
On Tue, Sep 05, 2023 at 11:09:02AM +0100, Richard W.M. Jones wrote: > > > +static inline int64_t > > > +human_size_parse (const char *str, > > > + const char **error, const char **pstr) > > > +{ > > > + int64_t size; > > > + char *end; > > > + uint64_t scale = 1; > > > + > > >

Re: [Libguestfs] [PATCH nbdkit] server: Move size parsing code (nbdkit_parse_size) to common/include

2023-09-05 Thread Richard W.M. Jones
On Mon, Sep 04, 2023 at 09:52:53AM +0200, Laszlo Ersek wrote: > On 9/3/23 17:22, Richard W.M. Jones wrote: > > This is broadly simple code motion, intended so that we can reuse the > > same code in libnbd. > > --- > > common/include/Makefile.am | 6 ++ > > common/include/human-size.h

Re: [Libguestfs] [PATCH nbdkit] server: Move size parsing code (nbdkit_parse_size) to common/include

2023-09-04 Thread Laszlo Ersek
On 9/3/23 17:22, Richard W.M. Jones wrote: > This is broadly simple code motion, intended so that we can reuse the > same code in libnbd. > --- > common/include/Makefile.am | 6 ++ > common/include/human-size.h | 137 +++ > common/include/test-human-size.c

[Libguestfs] [PATCH nbdkit] server: Move size parsing code (nbdkit_parse_size) to common/include

2023-09-03 Thread Richard W.M. Jones
This is broadly simple code motion, intended so that we can reuse the same code in libnbd. --- common/include/Makefile.am | 6 ++ common/include/human-size.h | 137 +++ common/include/test-human-size.c | 133 ++ server/public.c

[Libguestfs] [PATCH nbdkit] server: Move size parsing code (nbdkit_parse_size) to common/include

2023-09-03 Thread Richard W.M. Jones
This is the first part of a pair of patch series which aim to let us use nbdkit_parse_size (or rather, an equivalent common function) in nbdcopy, so we can write: nbdcopy --request-size=32M ... We can't do that now which was annoying me earlier in the week. This commit creates a new function