lib: work around unnamed structs/unions
[dpdk.git] / lib / librte_mempool / rte_mempool.h
index fb7052e..0243f9e 100644 (file)
@@ -75,6 +75,7 @@
 #include <rte_branch_prediction.h>
 #include <rte_ring.h>
 #include <rte_memcpy.h>
+#include <rte_common.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -123,7 +124,9 @@ struct rte_mempool_objsz {
        /**< Total size of an object (header + elt + trailer). */
 };
 
-#define RTE_MEMPOOL_NAMESIZE 32 /**< Maximum length of a memory pool. */
+/**< Maximum length of a memory pool's name. */
+#define RTE_MEMPOOL_NAMESIZE (RTE_RING_NAMESIZE - \
+                             sizeof(RTE_MEMPOOL_MZ_PREFIX) + 1)
 #define RTE_MEMPOOL_MZ_PREFIX "MP_"
 
 /* "MP_<name>" */
@@ -163,6 +166,8 @@ struct rte_mempool_objhdr {
  */
 STAILQ_HEAD(rte_mempool_objhdr_list, rte_mempool_objhdr);
 
+#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
+
 /**
  * Mempool object trailer structure
  *
@@ -170,11 +175,11 @@ STAILQ_HEAD(rte_mempool_objhdr_list, rte_mempool_objhdr);
  * trailer structure containing a cookie preventing memory corruptions.
  */
 struct rte_mempool_objtlr {
-#ifdef RTE_LIBRTE_MEMPOOL_DEBUG
        uint64_t cookie;                 /**< Debug cookie. */
-#endif
 };
 
+#endif
+
 /**
  * A list of memory where objects are stored
  */
@@ -206,7 +211,13 @@ struct rte_mempool_memhdr {
  * The RTE mempool structure.
  */
 struct rte_mempool {
-       char name[RTE_MEMPOOL_NAMESIZE]; /**< Name of mempool. */
+       /*
+        * Note: this field kept the RTE_MEMZONE_NAMESIZE size due to ABI
+        * compatibility requirements, it could be changed to
+        * RTE_MEMPOOL_NAMESIZE next time the ABI changes
+        */
+       char name[RTE_MEMZONE_NAMESIZE]; /**< Name of mempool. */
+       RTE_STD_C11
        union {
                void *pool_data;         /**< Ring or pool to store objects. */
                uint64_t pool_id;        /**< External mempool identifier. */