Re: [PATCH v2 2/7] qemu: domain: store and update panic info

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

 



Michal Privoznik <mprivozn@xxxxxxxxxx> [2019-03-27, 02:05PM +0100]:
> On 3/25/19 9:04 AM, Bjoern Walk wrote:
> > @@ -14069,6 +14072,39 @@ qemuDomainStatePanicInfoFormatMsg(qemuDomainStatePanicInfoPtr info)
> >   }
> > +void
> > +qemuDomainStatePanicInfoSet(virDomainObjPtr vm,
> > +                            qemuDomainStatePanicInfoPtr info)
> > +{
> > +    qemuDomainObjPrivatePtr priv = vm->privateData;
> > +
> > +    if (!priv->panicInfo && VIR_ALLOC(priv->panicInfo) < 0)
> > +        return;
> > +
> > +    priv->panicInfo->type = info->type;
> > +
> > +    switch (info->type) {
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_HYPERV:
> > +        priv->panicInfo->data.hyperv.arg1 = info->data.hyperv.arg1;
> > +        priv->panicInfo->data.hyperv.arg2 = info->data.hyperv.arg2;
> > +        priv->panicInfo->data.hyperv.arg3 = info->data.hyperv.arg3;
> > +        priv->panicInfo->data.hyperv.arg4 = info->data.hyperv.arg4;
> > +        priv->panicInfo->data.hyperv.arg5 = info->data.hyperv.arg5;
> > +        break;
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_S390:
> > +        priv->panicInfo->data.s390.core = info->data.s390.core;
> > +        priv->panicInfo->data.s390.psw_mask = info->data.s390.psw_mask;
> > +        priv->panicInfo->data.s390.psw_addr = info->data.s390.psw_addr;
> > +        ignore_value(VIR_STRDUP(priv->panicInfo->data.s390.reason,
> > +                                info->data.s390.reason));
> > +        break;
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_NONE:
> > +    case QEMU_DOMAIN_STATE_PANIC_INFO_TYPE_LAST:
> > +        break;
> > +    }
> 
> How about memcpy() and then just STRDUP() in the one place we need to?
> 
> No need to send v3 for that, just asking and if so, I can fix that before
> pushing.
> 
> My reasoning is that it might be easy to forget update this function if
> qemuDomainStatePanicInfo struct gets a new member.

Yes, I agree, that's much better.

> 
> Michal
> 

Attachment: signature.asc
Description: PGP signature

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

  Powered by Linux