On 08/11/18 17:28, Ian Jackson wrote:
> Andrew Cooper writes ("Re: [Xen-devel] [PATCH v2 01/11] tools/libs/toollog:
> Provide a default logger"):
>> You want something like:
>>
>> static xentoollog_logger_stdiostream stdio_logger = {
>> .vtable = {
>> .vmessage = stdiostream_vmessage,
>> .progress = stdiostream_progress,
>> .destroy = 0, /* no-one should destroy this */
>> },
>> .min_level = XTL_PROGRESS,
>> /* for other fields except .f, 0 is good */
>> };
>>
>> static void __attribute__((__constructor__)) init_stdio_logger(void)
>> {
>> stdio_logger.f = stderr;
>> }
> Blimey. Is that portable enough ?
Should be. Its how C++ globals work, and it appears that we already use
it in xc_dom.h for the dombuilder register_{loader,arch_hooks}()
infrastructure.
> I can switch to that if we think so. It's certainly more pleasant.
Absolutely (although be warned - that was entirely untested code).
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel