On Tue, Oct 12, 2010 at 08:23:21AM -0600, Eric Blake wrote: > On 10/12/2010 04:46 AM, Daniel P. Berrange wrote: > >This enables support for nested SVM using the regular CPU > >model/features block. If the CPU model or features include > >'svm', then the '-enable-nesting' flag will be added to the > >QEMU command line. Latest out of tree patches for nested > >'vmx', no longer require the '-enable-nesting' flag. They > >instead just look at the cpu features. Several of the models > >already include svm support, but QEMU was just masking out > >the svm bit silently. So this will enable SVM on such > >models > > > >+ > >+bool > >+cpuHasFeature(const char *arch, > >+ const union cpuData *data, > >+ const char *feature) > >+{ > >+ struct cpuArchDriver *driver; > >+ > >+ VIR_DEBUG("arch=%s, data=%p, feature=%s", > >+ arch, data, feature); > >+ > >+ if ((driver = cpuGetSubDriver(arch)) == NULL) > >+ return -1; > > Ouch. -1 promotes to true. > > >+ > >+ if (driver->hasFeature == NULL) { > >+ virCPUReportError(VIR_ERR_NO_SUPPORT, > >+ _("cannot check guest CPU data for %s architecture"), > >+ arch); > >+ return -1; > > Likewise. > > >+ } > >+ > >+ return driver->hasFeature(data, feature); > >+} > > You either need to change the return type to int and take a bool* > parameter (return -1 on failure, 0 on success when *param was > written to), or return an int value rather than a bool; since the > caller needs to distinguish between feature-not-present and > error-message-reported. Yup, that's why I'm always a bit suspicious when a function returns a boolean, that said for an internal API it's less of a problem Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list