Re: [PATCH] qemu: Use -vga none only if it is supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > @@ -1252,11 +1253,15 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
> >          if (strstr(help, "readonly="))
> >              flags |= QEMUD_CMD_FLAG_DRIVE_READONLY;
> >      }
> > -    if (strstr(help, "-vga") && !strstr(help, "-std-vga")) {
> > +    if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
> 
> I think this can be simplified to work via a single scan, rather than
> having to do a second scan to filter out the older -std-vga:
> 
> if ((p = strstr(help, "\n-vga") != NULL) {

Hmm, it's not exactly the same thing. In case there were both "-vga" and
"-std-vga" present, the new condition would return true while the original
would fail. I doubt there is a qemu version out there which would provide both
but to be safe I will leave it as is.

> >          flags |= QEMUD_CMD_FLAG_VGA;
> >  
> >          if (strstr(help, "|qxl"))
> >              flags |= QEMUD_CMD_FLAG_VGA_QXL;
> 
> Ouch - we don't have anything in tests/qemuhelpdata/ that tests this
> line of code.  But that's an independent problem.
> 
> Meanwhile, that could be made more efficient via strstr(p, "|qxl") (no
> need to reparse the chunk between help and p).

Yeah, makes sense. I'll change this.

> > +        if ((p = strstr(p, "|none")) && p < nl)
> > +            flags |= QEMUD_CMD_FLAG_VGA_NONE;
> 
> qemu -help parsing is so brittle.  But this looks correct.
> 
> ACK - I can live with the patch as-is (since you want to backport it
> rapidly to RHEL); or you can take the time to make the tweaks above.

Thanks, I made the small change above and pushed.

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]