[libvirt PATCH 01/12] nwfilter_driver: Statically initialize mutex

Daniel P. Berrangé berrange at redhat.com
Wed Mar 9 11:04:49 UTC 2022


On Wed, Mar 09, 2022 at 12:02:19PM +0100, Tim Wiederhake wrote:
> This enables a later patch to simplify locking during initialization
> and cleanup of virNWFilterDriverState.
> 
> Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
> ---
>  src/conf/virnwfilterobj.h      |  1 -
>  src/nwfilter/nwfilter_driver.c | 11 +++++------
>  2 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/src/conf/virnwfilterobj.h b/src/conf/virnwfilterobj.h
> index 44ba31f732..c365d0f28a 100644
> --- a/src/conf/virnwfilterobj.h
> +++ b/src/conf/virnwfilterobj.h
> @@ -30,7 +30,6 @@ typedef struct _virNWFilterObjList virNWFilterObjList;
>  
>  typedef struct _virNWFilterDriverState virNWFilterDriverState;
>  struct _virNWFilterDriverState {
> -    virMutex lock;
>      bool privileged;
>  
>      /* pid file FD, ensures two copies of the driver can't use the same root */
> diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
> index 3ce8fce7f9..26edfd3691 100644
> --- a/src/nwfilter/nwfilter_driver.c
> +++ b/src/nwfilter/nwfilter_driver.c
> @@ -57,13 +57,15 @@ static int nwfilterStateCleanup(void);
>  
>  static int nwfilterStateReload(void);
>  
> +static virMutex mutex = VIR_MUTEX_INITIALIZER;

Please call this 'driverLock'.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


More information about the libvir-list mailing list