Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-17 Thread Laszlo Ersek
On 5/16/23 22:22, Richard W.M. Jones wrote: > On Tue, May 16, 2023 at 02:35:38PM -0500, Eric Blake wrote: >> Our pre-existing error filter is already doing percentage calculations >> via floating point, so on the grounds that this patch is consolidating >> common code patterns to avoid reimplement

Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-17 Thread Laszlo Ersek
On 5/16/23 21:35, Eric Blake wrote: > On Tue, May 16, 2023 at 07:20:16PM +0200, Laszlo Ersek wrote: >> On 5/16/23 14:12, Richard W.M. Jones wrote: >>> +else if (d2 == 0) /* N/0 is bad */ >>> + goto bad_parse; >>> +else >>> + d /= d2; >> >> I don't want to be a spoils

Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-17 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 09:22:31PM +0100, Richard W.M. Jones wrote: > I'm not really sure we reached a conclusion so far, but I did want to > say that I changed the evil filter impl so that it now treats any > 0 <= P < 1e-12 as effectively 0. (P == evil-probability; P < 0 and P > 1 > are still rej

Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Richard W.M. Jones
On Tue, May 16, 2023 at 02:35:38PM -0500, Eric Blake wrote: > > > +=head2 Parsing probabilities > > > + > > > +Use the C utility function to parse > > > +probabilities. Common formats understood include: C<"0.1">, C<"10%"> > > > +or C<"1:10">, which all mean a probability of 1 in 10. > > > + > > >

Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Eric Blake
On Tue, May 16, 2023 at 07:20:16PM +0200, Laszlo Ersek wrote: > > On 5/16/23 14:12, Richard W.M. Jones wrote: > > In nbdkit-error-filter we need to parse parameters as probabilities. > > This is useful enough to add to nbdkit, since we will use it in > > another filter in future. > > --- I'll st

Re: [Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Laszlo Ersek
On 5/16/23 14:12, Richard W.M. Jones wrote: > In nbdkit-error-filter we need to parse parameters as probabilities. > This is useful enough to add to nbdkit, since we will use it in > another filter in future. > --- > docs/nbdkit-plugin.pod | 19 +++ > plugins/python/nbdkit-pyt

[Libguestfs] [PATCH nbdkit 1/5] Add new public nbdkit_parse_probability function

2023-05-16 Thread Richard W.M. Jones
In nbdkit-error-filter we need to parse parameters as probabilities. This is useful enough to add to nbdkit, since we will use it in another filter in future. --- docs/nbdkit-plugin.pod | 19 +++ plugins/python/nbdkit-python-plugin.pod | 6 ++ include/nbdkit-common.h