From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBUzo-0005aX-Aa for qemu-devel@nongnu.org; Fri, 01 Mar 2013 13:47:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBUzn-0008Ig-3q for qemu-devel@nongnu.org; Fri, 01 Mar 2013 13:47:52 -0500 Received: from cantor2.suse.de ([195.135.220.15]:51088 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBUzm-0008IY-Tr for qemu-devel@nongnu.org; Fri, 01 Mar 2013 13:47:51 -0500 Message-ID: <5130F7D4.3060406@suse.de> Date: Fri, 01 Mar 2013 19:47:48 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <876237ebst.fsf@codemonkey.ws> <1362158493-11907-1-git-send-email-peter@gridcentric.ca> In-Reply-To: <1362158493-11907-1-git-send-email-peter@gridcentric.ca> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] exec: make -mem-path filenames deterministic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter@gridcentric.ca Cc: andreslc@gridcentric.ca, aliguori@us.ibm.com, qemu-devel@nongnu.org Am 01.03.2013 18:21, schrieb peter@gridcentric.ca: > From: Peter Feiner >=20 > Adds ramblocks' names to their backing files when using -mem-path. Eas= es > introspection and debugging. >=20 > Signed-off-by: Peter Feiner > --- >=20 > On Tue, Jan 8, 2013 at 2:04 PM, Anthony Liguori w= rote: >> >> Yes, please submit the oneliner. >=20 > Here it is :) >=20 > The commit should probably be called "exec: add ramblocks' names to -me= m-path > files" since the paths aren't deterministic. >=20 > v1 -> v2: Just add ramblock name to mkstemp template.=20 >=20 > Thanks, > Peter >=20 > exec.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/exec.c b/exec.c > index a41bcb8..16a5452 100644 > --- a/exec.c > +++ b/exec.c > @@ -865,7 +865,8 @@ static void *file_ram_alloc(RAMBlock *block, > return NULL; > } > =20 > - filename =3D g_strdup_printf("%s/qemu_back_mem.XXXXXX", path); > + filename =3D g_strdup_printf("%s/qemu_back_mem.%s.XXXXXX", path, > + block->mr->name); Is it safe to use a MemoryRegion name as part of mkstemp()? "/../" seems rather unlikely but a "/" less so. Also note that v2 is expected to be posted as a top-level patch since the patches tool does not cope well with "hidden" reposts. Andreas > =20 > fd =3D mkstemp(filename); > if (fd < 0) { >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg