From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwAef-0000XV-Sk for qemu-devel@nongnu.org; Wed, 03 Dec 2014 09:11:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwAeZ-0008Vo-Ov for qemu-devel@nongnu.org; Wed, 03 Dec 2014 09:11:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwAeZ-0008Va-BM for qemu-devel@nongnu.org; Wed, 03 Dec 2014 09:11:39 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB3EBcIZ010704 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 3 Dec 2014 09:11:38 -0500 Message-ID: <547F1A17.1040701@redhat.com> Date: Wed, 03 Dec 2014 15:11:35 +0100 From: Max Reitz MIME-Version: 1.0 References: <1417602521-14482-1-git-send-email-famz@redhat.com> <1417602521-14482-2-git-send-email-famz@redhat.com> In-Reply-To: <1417602521-14482-2-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 1/6] vmdk: Use g_random_int to generate CID List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Markus Armbruster , Stefan Hajnoczi On 2014-12-03 at 11:28, Fam Zheng wrote: > This replaces two "time(NULL)" invocations with "g_random_int()". > According to VMDK spec, CID "is a random 32=E2=80=90bit value updated t= he first > time the content of the virtual disk is modified after the virtual disk > is opened". Using "seconds since epoch" is just a "lame way" to generat= e > it, and not completely safe because of the low precision. > > Suggested-by: Markus Armbruster > Signed-off-by: Fam Zheng > Reviewed-by: Markus Armbruster > --- > block/vmdk.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/block/vmdk.c b/block/vmdk.c > index 2cbfd3e..ebb4b70 100644 > --- a/block/vmdk.c > +++ b/block/vmdk.c > @@ -28,6 +28,7 @@ > #include "qemu/module.h" > #include "migration/migration.h" > #include > +#include This should be covered by qemu-common.h already. But anyway: Reviewed-by: Max Reitz