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

Re: [Xen-devel] [PATCH 4/5] print: introduce a format specifier for pci_sbdf_t



>>> On 27.05.19 at 17:48, <roger.pau@xxxxxxxxxx> wrote:
> On Fri, May 24, 2019 at 04:36:42AM -0600, Jan Beulich wrote:
>> Since we can't
>> use entirely new format specifiers, did you consider (ab)using one
>> we rarely use, like %o, suffixed similarly like we do for %p? The
>> extension could be restricted to apply only when neither field width
>> nor precision nor any flags were specified, i.e. only to plain %o (at
>> least initially).
>> 
>> We'd then have something along the lines of
>> 
>> #define PRI_sbdf "op"
>> #define PRI_SBDF(v) ((v).sbdf)
>> 
>> and
>> 
>>     printk("%" PRI_sbdf ": ...\n", PRI_SBDF(pdev->sbdf), ...);
> 
> I have to admit this looks more hacky than my current suggestion IMO.

Hmm, a matter of taste perhaps. I certainly consider constructs
like "&PCI_SBDF2_T(seg, bdf)" ugly/hacky enough. Taking
Andrew's position of wanting function-style macros to behave
function-like, this isn't even legal C then (because you can't
take the address of the result of a function call).

> The %p formatter overloading seems more standard and expected rather
> than overloading %o.

Well, it looked odd (to me at least) for %p in the beginning too, so
perhaps it's just a matter of getting used to it.

> Plus, one thing I didn't realize, I think Xen could even use %pci to
> print and SBDF, which will make it even clearer.

Documentation-wise - nice. But making every involved string literal
one character longer again.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.