Re: [PATCH 2/2] util: Alter virCloseCallback typedef to return void

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

 



On Thu, Mar 29, 2018 at 02:48 PM +0200, John Ferlan <jferlan@xxxxxxxxxx> wrote:
> Since virCloseCallbacksRun was ignoring the value anyway, let's
> just change it to be a void function.
>
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/bhyve/bhyve_process.c    | 8 ++------
>  src/lxc/lxc_process.c        | 8 ++------
>  src/qemu/qemu_migration.c    | 7 ++-----
>  src/qemu/qemu_process.c      | 7 ++-----
>  src/util/virclosecallbacks.c | 5 ++---
>  src/util/virclosecallbacks.h | 6 +++---
>  6 files changed, 13 insertions(+), 28 deletions(-)
>
> diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
> index 4ff6257f8..9276d7d36 100644
> --- a/src/bhyve/bhyve_process.c
> +++ b/src/bhyve/bhyve_process.c
> @@ -53,7 +53,7 @@
>
>  VIR_LOG_INIT("bhyve.bhyve_process");
>
> -static virDomainObjPtr
> +static void
>  bhyveProcessAutoDestroy(virDomainObjPtr vm,
>                          virConnectPtr conn ATTRIBUTE_UNUSED,
>                          void *opaque)
> @@ -62,12 +62,8 @@ bhyveProcessAutoDestroy(virDomainObjPtr vm,
>
>      virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_DESTROYED);
>
> -    if (!vm->persistent) {
> +    if (!vm->persistent)
>          virDomainObjListRemove(driver->domains, vm);
> -        vm = NULL;
> -    }
> -
> -    return vm;
>  }
>
>  static void
> diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
> index bc321e360..c155bd9d4 100644
> --- a/src/lxc/lxc_process.c
> +++ b/src/lxc/lxc_process.c
> @@ -59,7 +59,7 @@ VIR_LOG_INIT("lxc.lxc_process");
>
>  #define START_POSTFIX ": starting up\n"
>
> -static virDomainObjPtr
> +static void
>  lxcProcessAutoDestroy(virDomainObjPtr dom,
>                        virConnectPtr conn,
>                        void *opaque)
> @@ -79,15 +79,11 @@ lxcProcessAutoDestroy(virDomainObjPtr dom,
>                                       VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
>      priv->doneStopEvent = true;
>
> -    if (!dom->persistent) {
> +    if (!dom->persistent)
>          virDomainObjListRemove(driver->domains, dom);
> -        dom = NULL;
> -    }
>
>      if (event)
>          virObjectEventStateQueue(driver->domainEventState, event);
> -
> -    return dom;
>  }
>
>  /*
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index e5231555d..256b994bd 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -1954,7 +1954,7 @@ qemuMigrationDstRun(virQEMUDriverPtr driver,
>   * qemuDomainMigrateBegin3 and qemuDomainMigratePerform3 or
>   * qemuDomainMigratePerform3 and qemuDomainMigrateConfirm3.
>   */
> -static virDomainObjPtr
> +static void
>  qemuMigrationSrcCleanup(virDomainObjPtr vm,
>                          virConnectPtr conn,
>                          void *opaque)
> @@ -1969,7 +1969,7 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
>                                                priv->job.phase));
>
>      if (!qemuMigrationJobIsActive(vm, QEMU_ASYNC_JOB_MIGRATION_OUT))
> -        goto cleanup;
> +        return;
>
>      VIR_DEBUG("The connection which started outgoing migration of domain %s"
>                " was closed; canceling the migration",
> @@ -2005,9 +2005,6 @@ qemuMigrationSrcCleanup(virDomainObjPtr vm,
>          /* unreachable */
>          ;
>      }
> -
> - cleanup:
> -    return vm;
>  }
>
>
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 14f197e7f..288409685 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -7045,7 +7045,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
>  }
>
>
> -static virDomainObjPtr
> +static void
>  qemuProcessAutoDestroy(virDomainObjPtr dom,
>                         virConnectPtr conn,
>                         void *opaque)
> @@ -7069,7 +7069,7 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
>      VIR_DEBUG("Killing domain");
>
>      if (qemuProcessBeginStopJob(driver, dom, QEMU_JOB_DESTROY, true) < 0)
> -        goto cleanup;
> +        return;
>
>      qemuProcessStop(driver, dom, VIR_DOMAIN_SHUTOFF_DESTROYED,
>                      QEMU_ASYNC_JOB_NONE, stopFlags);
> @@ -7084,9 +7084,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
>      qemuDomainObjEndJob(driver, dom);
>
>      qemuDomainEventQueue(driver, event);
> -
> - cleanup:
> -    return dom;
>  }
>
>  int qemuProcessAutoDestroyAdd(virQEMUDriverPtr driver,
> diff --git a/src/util/virclosecallbacks.c b/src/util/virclosecallbacks.c
> index 4db50e8b6..49dac6589 100644
> --- a/src/util/virclosecallbacks.c
> +++ b/src/util/virclosecallbacks.c
> @@ -359,10 +359,9 @@ virCloseCallbacksRun(virCloseCallbacksPtr closeCallbacks,
>           * we're about to call the callback function and we have another
>           * ref anyway (so it cannot be deleted).
>           *
> -         * Call the callback function, ignoring the return since it might be
> -         * NULL. Once we're done with the object, then end the API usage. */
> +         * Call the callback function and end the API usage. */
>          virObjectUnref(vm);
> -        ignore_value(list->entries[i].callback(vm, conn, opaque));
> +        list->entries[i].callback(vm, conn, opaque);
>          virDomainObjEndAPI(&vm);
>      }
>      VIR_FREE(list->entries);
> diff --git a/src/util/virclosecallbacks.h b/src/util/virclosecallbacks.h
> index d48997181..79ca635bd 100644
> --- a/src/util/virclosecallbacks.h
> +++ b/src/util/virclosecallbacks.h
> @@ -30,9 +30,9 @@
>  typedef struct _virCloseCallbacks virCloseCallbacks;
>  typedef virCloseCallbacks *virCloseCallbacksPtr;
>
> -typedef virDomainObjPtr (*virCloseCallback)(virDomainObjPtr vm,
> -                                            virConnectPtr conn,
> -                                            void *opaque);
> +typedef void (*virCloseCallback)(virDomainObjPtr vm,
> +                                 virConnectPtr conn,
> +                                 void *opaque);
>  virCloseCallbacksPtr virCloseCallbacksNew(void);
>  int virCloseCallbacksSet(virCloseCallbacksPtr closeCallbacks,
>                           virDomainObjPtr vm,
> --
> 2.13.6
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Reviewed-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxxxxxxx>

--
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


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