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

Re: [Xen-devel] [PATCH] xen: add macro for defining variable length array in public headers



On 30.08.19 17:22, Jan Beulich wrote:
On 30.08.2019 16:29, Juergen Gross wrote:
On 30.08.19 16:21, Jan Beulich wrote:
On 30.08.2019 10:32, Juergen Gross wrote:
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -53,6 +53,15 @@ DEFINE_XEN_GUEST_HANDLE(uint64_t);
   DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
   DEFINE_XEN_GUEST_HANDLE(xen_ulong_t);
+/* Define a variable length array (depends on compiler). */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define __XEN_VARLEN_ARRAY_SIZE
+#elif defined(__GNUC__)
+#define __XEN_VARLEN_ARRAY_SIZE  0
+#else
+#define __XEN_VARLEN_ARRAY_SIZE  1 /* variable size */
+#endif

To be in line with the intentions, the C90 standard, and io/ring.h
I'd suggest to use FLEX instead of VARLEN. Furthermore, especially
in a public header, two double leading underscores need to go away.

And then, with FLEX in the name, SIZE isn't really appropriate
anymore. Therefore I see three possible names: XEN_FLEXIBLE_ARRAY,
XEN_FLEX_ARRAY_DIMENSION (possibly just _DIM at its end), or
XEN_FLEX_ARRAY_DESIGNATOR.

Okay to the "FLEX" part, but the "XEN_" prefix is not working due to
compat header generation (that will result in COMPAT_ prefix in the
compat headers).

So any other ideas for a sensible prefix?

Hmm, ugly. Perhaps all lower case then? Or have

xen_ and Xen_ are being converted, too.


#define COMPAT_FLEX_... XEN_FLEX_...

somewhere?

Seems as if doing that in include/public/xen-compat.h is working.


Juergen

_______________________________________________
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®.