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

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

 



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@xxxxxxxxxx>
> > 
> > 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@xxxxxxxxxx>
> > ---
> >  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 :|

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