[libvirt] [PATCH 3/3] conf: Move the privateData from virDomainChrDef to virDomainChrSourceDef

Pavel Hrdina phrdina at redhat.com
Fri Oct 21 16:09:14 UTC 2016


On Fri, Oct 21, 2016 at 09:01:44AM -0400, John Ferlan wrote:
> Commit id '5f2a132786' should have placed the data in the host source
> def structure since that's also used by smartcard, redirdev, and rng in
> order to provide a backend tcp channel.  The data in the private structure
> will be necessary in order to provide the secret properly
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/domain_conf.c | 17 +++++++----------
>  src/conf/domain_conf.h |  2 +-
>  2 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 2b89ea2..a684c48 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -2024,6 +2024,7 @@ void virDomainChrSourceDefFree(virDomainChrSourceDefPtr def)
>          return;
>  
>      virDomainChrSourceDefClear(def);
> +    virObjectUnref(def->privateData);
>  
>      VIR_FREE(def);
>  }
> @@ -2125,8 +2126,6 @@ void virDomainChrDefFree(virDomainChrDefPtr def)
>          VIR_FREE(def->seclabels);
>      }
>  
> -    virObjectUnref(def->privateData);
> -
>      VIR_FREE(def);
>  }
>  
> @@ -10318,13 +10317,17 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
>  
>  
>  static virDomainChrSourceDefPtr
> -virDomainChrSourceDefNew(void)
> +virDomainChrSourceDefNew(virDomainXMLOptionPtr xmlopt)
>  {
>      virDomainChrSourceDefPtr def = NULL;
>  
>      if (VIR_ALLOC(def) < 0)
>          return NULL;
>  
> +    if (xmlopt && xmlopt->privateData.chardevNew &&
> +        !(def->privateData = xmlopt->privateData.chardevNew()))

Perhaps rename it to chardevSourceNew or charSourceNew.

ACK

Pavel

> +        VIR_FREE(def);
> +
>      return def;
>  }
>  
> @@ -10342,15 +10345,9 @@ virDomainChrDefNew(virDomainXMLOptionPtr xmlopt)
>  
>      def->target.port = -1;
>  
> -    if (!(def->source = virDomainChrSourceDefNew()))
> +    if (!(def->source = virDomainChrSourceDefNew(xmlopt)))
>          VIR_FREE(def);
>  
> -    if (xmlopt && xmlopt->privateData.chardevNew &&
> -        !(def->privateData = xmlopt->privateData.chardevNew())) {
> -        virDomainChrSourceDefFree(def->source);
> -        VIR_FREE(def);
> -    }
> -
>      return def;
>  }
>  
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 5247d34..97ffcf4 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1078,6 +1078,7 @@ typedef enum {
>  /* The host side information for a character device.  */
>  struct _virDomainChrSourceDef {
>      int type; /* virDomainChrType */
> +    virObjectPtr privateData;
>      union {
>          /* no <source> for null, vc, stdio */
>          struct {
> @@ -1117,7 +1118,6 @@ struct _virDomainChrSourceDef {
>  /* A complete character device, both host and domain views.  */
>  struct _virDomainChrDef {
>      int deviceType; /* enum virDomainChrDeviceType */
> -    virObjectPtr privateData;
>  
>      bool targetTypeAttr;
>      int targetType; /* enum virDomainChrConsoleTargetType ||
> -- 
> 2.7.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161021/b8824e91/attachment-0001.sig>


More information about the libvir-list mailing list