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

Re: [libvirt] [PATCHv2 12/21] fix fallout in src/uml



On 06.03.2013 16:37, Peter Krempa wrote:
> ---
>  src/uml/uml_conf.h   |  1 +
>  src/uml/uml_driver.c | 32 ++++++++++++++++++++------------
>  2 files changed, 21 insertions(+), 12 deletions(-)
> 
> diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
> index ff71b45..488c1b7 100644
> --- a/src/uml/uml_conf.h
> +++ b/src/uml/uml_conf.h
> @@ -63,6 +63,7 @@ struct uml_driver {
>      int inotifyWatch;
> 
>      virCapsPtr caps;
> +    virDomainXMLConfPtr xmlconf;
> 
>      /* Event handling */
>      virDomainEventStatePtr domainEventState;
> diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
> index 63a807a..ab68a68 100644
> --- a/src/uml/uml_driver.c
> +++ b/src/uml/uml_driver.c
> @@ -433,7 +433,12 @@ umlStartup(bool privileged,
>      char *base = NULL;
>      char *userdir = NULL;
> 
> -    if (VIR_ALLOC(uml_driver) < 0)
> +    virDomainXMLPrivateDataCallbacks privcb = {
> +        .alloc = umlDomainObjPrivateAlloc,
> +        .free = umlDomainObjPrivateFree,
> +    };
> +
> +     if (VIR_ALLOC(uml_driver) < 0)
>          return -1;

indent

> 
>      uml_driver->privileged = privileged;
> @@ -500,10 +505,11 @@ umlStartup(bool privileged,
>      if ((uml_driver->caps = umlCapsInit()) == NULL)
>          goto out_of_memory;
> 
> -    uml_driver->caps->privateDataAllocFunc = umlDomainObjPrivateAlloc;
> -    uml_driver->caps->privateDataFreeFunc = umlDomainObjPrivateFree;
> +    if (!(uml_driver->xmlconf = virDomainXMLConfNew(&privcb,
> +                                                    NULL)))
> +        goto error;
> 
> -    if ((uml_driver->inotifyFD = inotify_init()) < 0) {
> +   if ((uml_driver->inotifyFD = inotify_init()) < 0) {

indent

>          VIR_ERROR(_("cannot initialize inotify"));
>          goto error;
>      }
> @@ -537,6 +543,7 @@ umlStartup(bool privileged,
> 
>      if (virDomainObjListLoadAllConfigs(uml_driver->domains,
>                                         uml_driver->caps,
> +                                       uml_driver->xmlconf,
>                                         uml_driver->configDir,
>                                         uml_driver->autostartDir,
>                                         0, 1 << VIR_DOMAIN_VIRT_UML,
> @@ -592,6 +599,7 @@ umlReload(void) {
>      umlDriverLock(uml_driver);
>      virDomainObjListLoadAllConfigs(uml_driver->domains,
>                                     uml_driver->caps,
> +                                   uml_driver->xmlconf,
>                                     uml_driver->configDir,
>                                     uml_driver->autostartDir,
>                                     0, 1 << VIR_DOMAIN_VIRT_UML,
> @@ -1055,7 +1063,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
>       * report implicit runtime defaults in the XML, like vnc listen/socket
>       */
>      VIR_DEBUG("Setting current domain def as transient");
> -    if (virDomainObjSetDefTransient(driver->caps, vm, true) < 0) {
> +    if (virDomainObjSetDefTransient(driver->caps, driver->xmlconf, vm, true) < 0) {

Do you mind wrapping this long line?

>          VIR_FORCE_CLOSE(logfd);
>          return -1;
>      }
> @@ -1088,7 +1096,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
>          (ret = umlProcessAutoDestroyAdd(driver, vm, conn)) < 0)
>          goto cleanup;
> 
> -    ret = virDomainObjSetDefTransient(driver->caps, vm, false);
> +    ret = virDomainObjSetDefTransient(driver->caps, driver->xmlconf, vm, false);
>  cleanup:
>      VIR_FORCE_CLOSE(logfd);
>      virCommandFree(cmd);
> @@ -1495,13 +1503,13 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char *xml,
>      virCheckFlags(VIR_DOMAIN_START_AUTODESTROY, NULL);
> 
>      umlDriverLock(driver);
> -    if (!(def = virDomainDefParseString(driver->caps, xml,
> -                                        1 << VIR_DOMAIN_VIRT_UML,
> +    if (!(def = virDomainDefParseString(driver->caps, driver->xmlconf,
> +                                        xml, 1 << VIR_DOMAIN_VIRT_UML,
>                                          VIR_DOMAIN_XML_INACTIVE)))
>          goto cleanup;
> 
>      if (!(vm = virDomainObjListAdd(driver->domains,
> -                                   driver->caps,
> +                                   driver->xmlconf,
>                                     def,
>                                     VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
>                                     NULL)))
> @@ -1916,13 +1924,13 @@ static virDomainPtr umlDomainDefine(virConnectPtr conn, const char *xml) {
>      virDomainPtr dom = NULL;
> 
>      umlDriverLock(driver);
> -    if (!(def = virDomainDefParseString(driver->caps, xml,
> -                                        1 << VIR_DOMAIN_VIRT_UML,
> +    if (!(def = virDomainDefParseString(driver->caps, driver->xmlconf,
> +                                        xml, 1 << VIR_DOMAIN_VIRT_UML,
>                                          VIR_DOMAIN_XML_INACTIVE)))
>          goto cleanup;
> 
>      if (!(vm = virDomainObjListAdd(driver->domains,
> -                                   driver->caps,
> +                                   driver->xmlconf,
>                                     def,
>                                     0, NULL)))
>          goto cleanup;
> 


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