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

Re: [libvirt] [PATCH v2 1/2] util: Deduplicate code in virNetlinkEventServiceStopAll




On 05/18/2017 12:06 AM, Wang King wrote:
> Commit 15a71e60 introduced the virNetlinkEventServiceStopAll function, and
> the code in virNetlinkEventServiceStop is copied to this function. can use
> virNetlinkEventServiceStop instead.
> ---
>  src/util/virnetlink.c | 25 +++----------------------
>  1 file changed, 3 insertions(+), 22 deletions(-)
> 
> diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
> index 92ecf77..fad1e8e 100644
> --- a/src/util/virnetlink.c
> +++ b/src/util/virnetlink.c
> @@ -775,32 +775,13 @@ virNetlinkEventServiceStop(unsigned int protocol)
>  int
>  virNetlinkEventServiceStopAll(void)
>  {
> -    size_t i, j;
> +    size_t i;
>      virNetlinkEventSrvPrivatePtr srv = NULL;

^^^
This wasn't necessary either...  I'll remove it before pushing.

Reviewed-by: John Ferlan <jferlan redhat com>

John

>  
>      VIR_INFO("stopping all netlink event services");
>  
> -    for (i = 0; i < MAX_LINKS; i++) {
> -        srv = server[i];
> -        if (!srv)
> -            continue;
> -
> -        virNetlinkEventServerLock(srv);
> -        nl_close(srv->netlinknh);
> -        virNetlinkFree(srv->netlinknh);
> -        virEventRemoveHandle(srv->eventwatch);
> -
> -        for (j = 0; j < srv->handlesCount; j++) {
> -            if (srv->handles[j].deleted == VIR_NETLINK_HANDLE_VALID)
> -                virNetlinkEventRemoveClientPrimitive(j, i);
> -        }
> -
> -        server[i] = NULL;
> -        virNetlinkEventServerUnlock(srv);
> -
> -        virMutexDestroy(&srv->lock);
> -        VIR_FREE(srv);
> -    }
> +    for (i = 0; i < MAX_LINKS; i++)
> +        virNetlinkEventServiceStop(i);
>  
>      return 0;
>  }
> 


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