Re: [PATCH 2/2 for 8.0] qemu: add index for isa-serial device using target.port

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

 



On Thu, Jan 13, 2022 at 03:43:12PM +0100, Michal Prívozník wrote:

> >      switch ((virDomainChrSerialTargetModel) serial->targetModel) {
> >      case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
> > @@ -10750,11 +10752,24 @@ qemuBuildSerialChrDeviceProps(const virDomainDef *def,
> >          return NULL;
> >      }
> >  
> > -    if (virJSONValueObjectAdd(&props,
> > -                              "s:driver", virDomainChrSerialTargetModelTypeToString(serial->targetModel),
> > -                              "s:chardev", chardev,
> > -                              "s:id", serial->info.alias,
> > -                              NULL) < 0)
> 
> There's no need to remove this code, especially when you're replacing it
> with itself. The pattern that we can use here is:
> 
> if (virJSONValueObjectAdd(&props, ...) < 0) /* this is the unchanged
>     return NULL;                               call */
> 
> if (serial->targetModel == ISA_SERIAL &&
>     virJSONValueObjectAdd(&props,
>                           "k:index", serial->target.port,
>                           NULL) < 0)
>     return NULL;

Ah yes, much better, thanks!

regards
john





[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]

  Powered by Linux