[libvirt] [PATCH 01/13] Remove manual one-shot global initializers

Daniel P. Berrange berrange at redhat.com
Tue Jul 31 19:17:46 UTC 2012


On Tue, Jul 31, 2012 at 01:06:59PM -0600, Eric Blake wrote:
> On 07/31/2012 10:58 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > Remove the use of a manually run virLogStartup and
> > virNodeSuspendInitialize methods. Instead make sure they
> > are automatically run using VIR_ONCE_GLOBAL_INIT
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> >  daemon/libvirtd.c         |    1 -
> >  src/libvirt.c             |    4 +---
> >  src/libvirt_private.syms  |    3 ---
> >  src/util/logging.c        |   54 +++++++++++++--------------------------------
> >  src/util/logging.h        |    2 --
> >  src/util/virnodesuspend.c |   25 +++++++++++----------
> >  src/util/virnodesuspend.h |    1 -
> >  7 files changed, 29 insertions(+), 61 deletions(-)
> 
> ACK, what you have is a strict improvement.  But given commit a22a36e8,
> 
> > @@ -407,8 +406,7 @@ virInitialize(void)
> >  
> >      if (virThreadInitialize() < 0 ||
> >          virErrorInitialize() < 0 ||
> > -        virRandomInitialize(time(NULL) ^ getpid()) ||
> > -        virNodeSuspendInit() < 0)
> > +        virRandomInitialize(time(NULL) ^ getpid()))
> 
> ...should we be getting rid of virRandomInitialize and doing that in a
> one-shot initializer as well, since at least seclabeltest would have
> benefitted from it?

I did wonder about that when I wrote this. I didn't do it because
obviously virRandomInitialize has a parameter passed in. Now I see
that every single caller just does the same 'time(NULL) ^ getpid()'
we might as well just make virRandomInitialize be 'void' and used
the fixed pattern for seed.

I'll do this as a followup patch though

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list