From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9uvG-0002x6-Ag for qemu-devel@nongnu.org; Wed, 23 Jul 2014 07:41:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9uvA-0004HR-6s for qemu-devel@nongnu.org; Wed, 23 Jul 2014 07:41:26 -0400 Received: from mail-we0-f171.google.com ([74.125.82.171]:41506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9uvA-0004HN-0e for qemu-devel@nongnu.org; Wed, 23 Jul 2014 07:41:20 -0400 Received: by mail-we0-f171.google.com with SMTP id p10so1040824wes.16 for ; Wed, 23 Jul 2014 04:41:16 -0700 (PDT) Message-ID: <53CF9F41.5080808@linaro.org> Date: Wed, 23 Jul 2014 13:40:49 +0200 From: Eric Auger MIME-Version: 1.0 References: <1404736043-22900-1-git-send-email-eric.auger@linaro.org> <1404736043-22900-5-git-send-email-eric.auger@linaro.org> <1404859290.4256.152.camel@ul30vt.home> <53CF883C.5000504@linaro.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v4 04/13] hw/vfio/pci: introduce VFIODevice List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Alexander Graf , Kim Phillips , eric.auger@st.com, Patch Tracking , Will Deacon , QEMU Developers , Alvise Rigo , Bharat Bhushan , Alex Williamson , Stuart Yoder , Antonios Motakis , "kvmarm@lists.cs.columbia.edu" , Christoffer Dall On 07/23/2014 12:24 PM, Peter Maydell wrote: > On 23 July 2014 11:02, Eric Auger wrote: >> On 07/09/2014 12:41 AM, Alex Williamson wrote: >>> On Mon, 2014-07-07 at 13:27 +0100, Eric Auger wrote: >>>> + vdev->vbasedev.ops = &vfio_pci_ops; >>>> + >>>> + vdev->vbasedev.type = VFIO_DEVICE_TYPE_PCI; >>>> + vdev->vbasedev.name = g_malloc0(PATH_MAX); >>>> + snprintf(vdev->vbasedev.name, PATH_MAX, "%04x:%02x:%02x.%01x", >>>> + vdev->host.domain, vdev->host.bus, vdev->host.slot, >>>> + vdev->host.function); >>>> + >>> >>> asprintf(3)? This is a deterministic length, so PATH_MAX is especially >>> ridiculous. >> agreed, will use asprintf instead. > > A minor nit given this is going to be in "only on Linux" > code, but we generally prefer g_strdup_printf() over > raw asprintf() (they do the same thing, but the glib > function is guaranteed to be present everywhere, > and the returned memory is freeable with g_free() > like most of our strings, rather than needing to remember > that it needs to be freed via free().) Hi Peter, thanks. this is noted. BR Eric > > thanks > -- PMM >