[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v5 4/4] spapr_pci: populate ibm,loc-code

From: Nikunj A Dadhania
Subject: Re: [Qemu-devel] [PATCH v5 4/4] spapr_pci: populate ibm,loc-code
Date: Mon, 25 May 2015 15:57:41 +0530
User-agent: Notmuch/0.17+27~gae47d61 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-redhat-linux-gnu)

Alexey Kardashevskiy <address@hidden> writes:

> On 05/25/2015 02:58 PM, Nikunj A Dadhania wrote:
>> Alexey Kardashevskiy <address@hidden> writes:
>>>> +    }
>>>> +    /*
>>>> +     * For emulated devices and VFIO-failure case, make up
>>>> +     * the loc-code.
>>>> +     */
>>>> +    buf = g_strdup_printf("%s_%s:%02d:%02d.%1d",
>>> How is "1d" different here from just "d"? If @devfn>10, all digits will be
>>> printed.
>> A device can have only 8 functions, right ?
> Yes. It is "%d" (decimal) so "1" is a minimum field length anyway ("1" only 
> makes sense for strings imho). And if a function number is bigger than 9, 
> print() will print all digits, not just the last one. So %d==%1d but I 
> would never grep for "%02d:%02d.%1d", I would grep for "%02d:%02d.%d".
> [few minutes later] And I just did. And I found that most places actually 
> use "%02x:%02x.%x" (trace-events, hw/pci/pci.c, hw/vfio/pci.c) and only one 
> (get_pci_host_devaddr) uses "%d" for a function (and even there "%02x" is 
> used for a bus and a slot, not "%02d").

Using "%02x:%02x.%x" should be fine then, I will change the code


reply via email to

[Prev in Thread] Current Thread [Next in Thread]