ä 2011å01æ28æ 23:33, Eric Blake åé:
On 01/28/2011 05:11 AM, Osier Yang wrote:
ä 2011å01æ28æ 20:02, Daniel P. Berrange åé:
On Fri, Jan 28, 2011 at 07:53:44PM +0800, Osier Yang wrote:
As cgroup doesn't allow one writes negative into files like cpu.shares,
(e.g. echo -1> /cgroup/cpu/libvirt/qemu/rhel6/cpu.shares), user will be
confused if libvirt accepts negative value and converts it into unsigned
int (or long int, etc) silently.
But strtoul() is explicitly documented as accepting -1 as shorthand for
ULONG_MAX, and as a command-line convenience, I much prefer that
shorthand over 18446744073709551615. I don't see this as confusing.
Surely this check should be done inside virStrToLong_{ui,ul,ull}
If we want to be sticklers about reject '-' and module 2^32 (2^64)
wraparound, then yes, virStrToLong_u* would be the place to do it. But
I'm not convinced that this is a good change.
I'm afraid changing on virStrToLong_u* will affect other codes, pretty
codes use them.
Is there some codes that expects virStrToLong_{ui,ul,ull} to convert
the negative to {ui, ul, ull}?
Probably, given the above arguments about -1 being useful shorthand for
the maximum value.
Yeah, so are you agreed with danpb? making changes on docs?
Regards
Osier
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list