Re: [PATCH 3/7] event: add API for requiring an event loop impl to be registered

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

 



On 12/2/19 10:03 AM, Daniel P. Berrangé wrote:
> Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
> ---
>  po/POTFILES.in      |  1 +
>  src/util/virevent.c | 25 +++++++++++++++++++++++++
>  src/util/virevent.h |  2 ++
>  3 files changed, 28 insertions(+)
> 
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index debb51cd70..b396797ff2 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -238,6 +238,7 @@
>  @SRCDIR@/src/util/virdnsmasq.c
>  @SRCDIR@/src/util/virerror.c
>  @SRCDIR@/src/util/virerror.h
> +@SRCDIR@/src/util/virevent.c
>  @SRCDIR@/src/util/vireventpoll.c
>  @SRCDIR@/src/util/virfcp.c
>  @SRCDIR@/src/util/virfdstream.c
> diff --git a/src/util/virevent.c b/src/util/virevent.c
> index 3cac9f9472..a86acf64c0 100644
> --- a/src/util/virevent.c
> +++ b/src/util/virevent.c
> @@ -29,6 +29,9 @@
>  
>  VIR_LOG_INIT("util.event");
>  
> +
> +#define VIR_FROM_THIS VIR_FROM_EVENT
> +

Other files I looked at, this comes before VIR_LOG_INIT, but I don't
think that has any effect

>  static virEventAddHandleFunc addHandleImpl;
>  static virEventUpdateHandleFunc updateHandleImpl;
>  static virEventRemoveHandleFunc removeHandleImpl;
> @@ -251,6 +254,26 @@ void virEventRegisterImpl(virEventAddHandleFunc addHandle,
>      removeTimeoutImpl = removeTimeout;
>  }
>  
> +
> +/**
> + * virEventRequireImpl:
> + *
> + * Require that there is an event loop implementation
> + * registered.
> + *
> + * Returns: -1 if no event loop is registered, 0 otherwise
> + */
> +int virEventRequireImpl(void)
> +{
> +    if (!addHandleImpl || !addTimeoutImpl) {
> +        virReportError(VIR_ERR_NO_SUPPORT, "%s",
> +                       _("An event loop implementation must be registered"));
> +        return -1;
> +    }
> +
> +    return 0;
> +}
> +
> /**

Spacing is inconsistent here, there's two lines before the function and
one after

Reviewed-by: Cole Robinson <crobinso@xxxxxxxxxx>

- Cole

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