Re: [PATCH 25/33] qemu: Add qemuDomainDefaultSerialModel()

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

 



On Wed, Jan 24, 2024 at 20:37:45 +0100, Andrea Bolognani wrote:
> Factor out the existing code.
> 
> Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
> ---
>  src/qemu/qemu_domain.c | 66 ++++++++++++++++++++++--------------------
>  1 file changed, 35 insertions(+), 31 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index b3e63b3648..c9d213dd7b 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -4312,6 +4312,40 @@ qemuDomainDefaultSerialType(const virDomainDef *def)
>  }
>  
>  
> +static int
> +qemuDomainDefaultSerialModel(const virDomainDef *def,
> +                             const virDomainChrDef *chr)
> +{
> +    switch ((virDomainChrSerialTargetType)chr->targetType) {
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA:
> +        return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
> +        return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI:
> +        return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO:
> +        return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
> +        if (qemuDomainIsARMVirt(def)) {
> +            return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011;
> +        } else if (qemuDomainIsRISCVVirt(def)) {
> +            return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_16550A;
> +        }
> +        break;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
> +        return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA_DEBUG:
> +        return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_DEBUGCON;
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
> +    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
> +        /* Nothing to do */
> +        break;
> +    }

Preferrably add visual separation around each case.


> +
> +    return VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE;
> +}
> +
> +
>  static int

Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[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