char ni_interface[LNET_MAX_STR_LEN];
__u32 ni_status;
__u32 ni_cpts[LNET_MAX_SHOW_NUM_CPT];
- char cfg_bulk[0];
+ char cfg_bulk[];
};
#define LNET_TINY_BUF_IDX 0
} cfg_buffers;
} cfg_config_u;
- char cfg_bulk[0];
+ char cfg_bulk[];
};
struct lnet_ioctl_comm_count {
__u32 lic_idx;
__s32 lic_dev_cpt;
char pad[4];
- char lic_bulk[0];
+ char lic_bulk[];
};
struct lnet_peer_ni_credit_info {
/* #define DVS_PORTAL 63 */
/* reserved for Cray DVS - spitzcor@cray.com, roe@cray.com, n8851@cray.com */
-#ifndef DECLARE_FLEX_ARRAY
-#ifdef __cplusplus
-/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
-#define DECLARE_FLEX_ARRAY(T, member) T member[0]
-#else
-/**
- * DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
- *
- * @TYPE: The type of each flexible array element
- * @NAME: The name of the flexible array member
- *
- * In order to have a flexible array member in a union or alone in a
- * struct, it needs to be wrapped in an anonymous struct with at least 1
- * named member, but that member can be empty.
- */
-#define DECLARE_FLEX_ARRAY(TYPE, NAME) \
- struct { \
- struct { } __empty_ ## NAME; \
- TYPE NAME[]; \
- }
-#endif
-#endif /* DECLARE_FLEX_ARRAY */
-
/**
* Describes a range of sequence, lsr_start is included but lsr_end is
* not in the range.
#define fstatat_f fstatat
#endif
+#ifndef DECLARE_FLEX_ARRAY
+#ifdef __cplusplus
+/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
+#define DECLARE_FLEX_ARRAY(T, member) T member[0]
+#else
+/**
+ * DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
+ *
+ * @TYPE: The type of each flexible array element
+ * @NAME: The name of the flexible array member
+ *
+ * In order to have a flexible array member in a union or alone in a
+ * struct, it needs to be wrapped in an anonymous struct with at least 1
+ * named member, but that member can be empty.
+ */
+#define DECLARE_FLEX_ARRAY(TYPE, NAME) \
+ struct { \
+ struct { } __empty_ ## NAME; \
+ TYPE NAME[]; \
+ }
+#endif
+#endif /* DECLARE_FLEX_ARRAY */
+
#ifndef STATX_BASIC_STATS
/*
* Timestamp structure for the timestamps in struct statx.
/* internal storage of constant string */
char *string;
/* upcall stores constant string in a raw */
- char bytestring[0];
+ DECLARE_FLEX_ARRAY(char, bytestring);
};
};
};
dlc_glue:
echo "generating liblnetconfig.i"
$(PYTHON) $(GEN_SWIG_INTF_PY) $(top_builddir)
+ echo "work-around SWIG limitations with flexible arrays"
+ sed -i '1i\%immutable lnet_ioctl_net_config::cfg_bulk;\n' $(LNETCONFIG_I)
+ sed -i '1i\%immutable lnet_ioctl_config_data::cfg_bulk;' $(LNETCONFIG_I)
+ sed -i '1i\%immutable lnet_ioctl_config_ni::lic_bulk;' $(LNETCONFIG_I)
echo "generating liblndconfig_wrap.c"
$(SWIG) -python $(DLC_SWIG_FLAGS) $(DLC_SWIG_INCLUDES) $(LNETCONFIG_I)
echo "building liblnetconfig_wrap.c"