On Mittwoch, 20. April 2022 10:33:38 CEST Daniel P. Berrangé wrote:

Hi Daniel,

> If we're going to conditionalize this, then we really ought to be
> address it fully, because 'native' is also platform specific.

Good point. I can do that as well. 

> IOW, we would end up needing something more like this:
> 
>            .help = "host AIO implementation (threads"
>  #if defined(WIN32) || defined(CONFIG_LINUX_AIO)
>                    ", native"
>  #endif
>  #if defined(CONFIG_LINUX_IO_URING)
>                    ", io_uring"
>  #else
>                    "),"
> 
> admittedly pretty ugly


the only other option I came up with so far is something like this:

+#if defined(CONFIG_LINUX_AIO)
+#define IF_CONFIG_LINUX_AIO(X) X
+#else
+#define IF_CONFIG_LINUX_AIO(X)
+#endif
+
+#if defined(CONFIG_LINUX_IO_URING)
+#define IF_CONFIG_LINUX_IO_URING(X) X
+#else
+#define IF_CONFIG_LINUX_IO_URING(X)
+#endif
+


and then use it like


-            .help = "host AIO implementation (threads"
-#ifdef CONFIG_LINUX_AIO
-            ", native"
-#endif
-#ifdef CONFIG_LINUX_IO_URING
-            ", io_uring"
-#endif
-            ")",
+            .help = "host AIO implementation (threads" IF_CONFIG_LINUX_AIO(", 
native") IF_CONFIG_LINUX_IO_URING(", io_uring") ")",


WDYT, is that worth it?

Thanks,
Dirk




Reply via email to