On Wed, Feb 16, 2022 at 01:15:23PM -0600, Eric Blake wrote: > On Wed, Feb 16, 2022 at 04:20:41PM +0000, Richard W.M. Jones wrote: > > + if (*minimum == 0) { /* Plugin didn't set anything. */ > > + if (config_minimum) > > + *minimum = config_minimum; > > + else > > + *minimum = 1; > > + > > + if (config_preferred) > > + *preferred = config_preferred; > > + else > > + *preferred = 4096; > > + > > + if (config_maximum) > > + *maximum = config_maximum; > > + else > > + *maximum = 0xffffffff; > > + } > > + else { /* Plugin set some values. */ > > Didn't we say back in server/plugin.c that if the plugin set any > value, it should set all three? It's one thing for the filter to allow > partial results (easier use from the command line), but another for a > plugin to have partial results (what does the plugin want us to supply > for the other values?) > > > + if (config_minimum) > > + *minimum = config_minimum; > > + > > + if (config_preferred) > > + *preferred = config_preferred; > > + > > + if (config_maximum) > > + *maximum = config_maximum; > > + } > > + > > + if (*minimum > *preferred || *preferred > *maximum) { > > + nbdkit_error ("computed block size values are invalid, minimum %" > > PRIu32 > > + " > preferred %" PRIu32 > > + " or preferred > maximum %" PRIu32, > > + *minimum, *preferred, *maximum); > > + return -1; > > + } > > + return 0; > > +}
It'd be wrong for the filter to return a result set where some but not all of the values are 0. But I don't think it does that above? Note we assume that the values returned by the plugin have been checked by server/plugin.c. However the code doesn't check everything for sure, eg. it doesn't check that the result set has powers of 2 in the right places, preferred is a multiple of minimum, probably other things. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/ _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs