From: Jeff Cody <jcody@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
kwolf@redhat.com, mdroth@linux.vnet.ibm.com,
qemu-block@nongnu.org, sw@weilnetz.de, qemu-devel@nongnu.org,
armbru@redhat.com, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/7] util: Add UUID API
Date: Wed, 3 Aug 2016 00:19:24 -0400 [thread overview]
Message-ID: <20160803041924.GA5270@localhost.localdomain> (raw)
In-Reply-To: <20160803023640.GC8117@ad.usersys.redhat.com>
On Wed, Aug 03, 2016 at 10:36:40AM +0800, Fam Zheng wrote:
> On Tue, 08/02 15:45, Paolo Bonzini wrote:
> >
> >
> > ----- Original Message -----
> > > From: "Fam Zheng" <famz@redhat.com>
> > > To: qemu-devel@nongnu.org
> > > Cc: famz@redhat.com, berrange@redhat.com, pbonzini@redhat.com, kwolf@redhat.com, mreitz@redhat.com,
> > > mdroth@linux.vnet.ibm.com, armbru@redhat.com, sw@weilnetz.de, qemu-block@nongnu.org
> > > Sent: Tuesday, August 2, 2016 11:18:32 AM
> > > Subject: [PATCH 1/7] util: Add UUID API
> > >
> > > A number of different places across the code base use CONFIG_UUID. Some
> > > of them are soft dependency, some are not built if libuuid is not
> > > available, some come with dummy fallback, some throws runtime error.
> > >
> > > It is hard to maintain, and hard to reason for users.
> > >
> > > Since UUID is a simple standard with only a small number of operations,
> > > it is cleaner to have a central support in libqemuutil. This patch adds
> > > qemu_uuid_* the functions so that all uuid users in the code base can
> > > rely on. Except for qemu_uuid_generate which is new code, all other
> > > functions are just copy from existing fallbacks from other files.
> >
> > How is g_random_* seeded?
>
> According to glib doc:
>
> > GLib changed the seeding algorithm for the pseudo-random number generator
> > Mersenne Twister, as used by GRand.
>
> The urandom source is /dev/urandom (or time based if unavailable).
>
> (RFC 4122 explicitly accepts pseudo-random.)
>
> Fam
>
To piggyback on Fam's answer:
It is as if qemu called g_rand_new() [1] for a global static GRand struct.
The g_random_* functions use the glib default global GRand struct. If
you don't set the global seed yourself with g_random_set_seed(), then the
first call into one of the g_random_ functions will create the
global GRand struct seeded from /dev/urandom (if available), or the current
time (if /dev/urandom is not available).
[1] https://developer.gnome.org/glib/stable/glib-Random-Numbers.html#g-rand-new
-Jeff
next prev parent reply other threads:[~2016-08-03 4:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-02 9:18 [Qemu-devel] [PATCH 0/7] UUID clean ups for 2.8 Fam Zheng
2016-08-02 9:18 ` [Qemu-devel] [PATCH 1/7] util: Add UUID API Fam Zheng
2016-08-02 19:45 ` Paolo Bonzini
2016-08-03 2:36 ` Fam Zheng
2016-08-03 4:19 ` Jeff Cody [this message]
2016-08-04 12:44 ` Paolo Bonzini
2016-08-04 12:54 ` Marc-André Lureau
2016-08-04 15:33 ` [Qemu-devel] [Qemu-block] " Jeff Cody
2016-08-08 3:07 ` Fam Zheng
2016-08-08 5:53 ` Fam Zheng
2016-08-04 15:48 ` [Qemu-devel] " Daniel P. Berrange
2016-08-05 8:48 ` Fam Zheng
2016-08-08 6:30 ` Stefan Weil
2016-08-08 6:33 ` Fam Zheng
2016-08-08 7:10 ` Stefan Weil
2016-08-08 10:52 ` Markus Armbruster
2016-08-02 9:18 ` [Qemu-devel] [PATCH 2/7] vhdx: Use QEMU " Fam Zheng
2016-08-02 9:18 ` [Qemu-devel] [PATCH 3/7] vdi: " Fam Zheng
2016-08-04 18:58 ` Stefan Weil
2016-08-04 20:34 ` Eric Blake
2016-08-05 6:31 ` Markus Armbruster
2016-08-05 8:47 ` Fam Zheng
2016-08-02 9:18 ` [Qemu-devel] [PATCH 4/7] vpc: " Fam Zheng
2016-08-02 9:18 ` [Qemu-devel] [PATCH 5/7] crypto: Switch to " Fam Zheng
2016-08-02 9:18 ` [Qemu-devel] [PATCH 6/7] tests: No longer dependent on CONFIG_UUID Fam Zheng
2016-08-02 9:18 ` [Qemu-devel] [PATCH 7/7] configure: Remove detection code for UUID Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160803041924.GA5270@localhost.localdomain \
--to=jcody@redhat.com \
--cc=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).