From patchwork Tue Apr 12 14:09:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 65629 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1943337qge; Tue, 12 Apr 2016 07:09:36 -0700 (PDT) X-Received: by 10.140.139.72 with SMTP id 69mr4424337qhl.68.1460470175987; Tue, 12 Apr 2016 07:09:35 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id e9si24507299qhc.1.2016.04.12.07.09.35; Tue, 12 Apr 2016 07:09:35 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 516DE67390; Tue, 12 Apr 2016 14:09:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5915367312; Tue, 12 Apr 2016 14:09:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AD7C967313; Tue, 12 Apr 2016 14:09:23 +0000 (UTC) Received: from mail-oi0-f54.google.com (mail-oi0-f54.google.com [209.85.218.54]) by lists.linaro.org (Postfix) with ESMTPS id 81DCD672FE for ; Tue, 12 Apr 2016 14:09:17 +0000 (UTC) Received: by mail-oi0-f54.google.com with SMTP id p188so23353988oih.2 for ; Tue, 12 Apr 2016 07:09:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mZpq8e/HS0Dt/mzUdyKDzvlt7eilUhc+4GRjhRb92+E=; b=Nbe3jESSUkRh9NG6OznLUH+odXfoed/oNgGeE2xMHQPy8fF5bsYX1egcJ+sEsVY/25 xzwj6r7hx5DoPJRuajEGV49YlvTvWHkEzIYZoQtBMA6X9lNP/QbPxAB4sUPaF7JPp+Bt tGTmSc0Qg6KIt3QUEwK4zebLhTLxgYwor/hbBBhsd0gLNGSP+LPOIUZbL+xSV4daR8HK i/66N9hgQ9+vLxTqNgbE9Hgut4EUq7vD/eJ/v355XiEhtG3v5saCS0GYYNaqSKmVF/m7 ljjriUm4BjQGDDTIiiCkl4igCDkp9HUYvXDt1BmXCf4igaqMWjf1IM0XlNcHSYuh8Qdn btWQ== X-Gm-Message-State: AOPr4FXJJgWJ0XQt9jjK9lz/TxSKlyU0rFyW9bfOJ/06x1nFAgfW65UtSAsWlTXU6lMlpTuaFzI= X-Received: by 10.202.190.65 with SMTP id o62mr1534649oif.109.1460470156934; Tue, 12 Apr 2016 07:09:16 -0700 (PDT) Received: from Ubuntu15.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id s7sm9887708obk.17.2016.04.12.07.09.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Apr 2016 07:09:16 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Tue, 12 Apr 2016 09:09:14 -0500 Message-Id: <1460470154-2950-1-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.5.0 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCHv2] api: debug: promote ODP_STATIC_ASSERT() to be an ODP API X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Convert the formerly internal _ODP_STATIC_ASSERT() macro to be a full ODP API named ODP_STATIC_ASSERT(). This provides a wrapper around any platform-specific compile-time assertion macro. Signed-off-by: Bill Fischofer --- Changes for v2: Incorporate comment change suggested by Petri helper/include/odp/helper/eth.h | 9 ++++--- helper/include/odp/helper/icmp.h | 3 ++- helper/include/odp/helper/ip.h | 6 +++-- helper/include/odp/helper/ipsec.h | 9 ++++--- helper/include/odp/helper/udp.h | 3 ++- include/odp/api/spec/debug.h | 31 ++++++---------------- platform/linux-generic/include/odp/api/debug.h | 22 +++++++++++++++ .../linux-generic/include/odp_buffer_internal.h | 10 +++---- .../linux-generic/include/odp_packet_internal.h | 12 ++++----- .../linux-generic/include/odp_packet_io_queue.h | 4 +-- platform/linux-generic/include/odp_packet_socket.h | 5 ++-- platform/linux-generic/odp_cpumask.c | 4 +-- platform/linux-generic/odp_schedule.c | 4 +-- platform/linux-generic/odp_shared_memory.c | 4 +-- platform/linux-generic/odp_timer.c | 2 +- platform/linux-generic/pktio/ipc.c | 4 +-- 16 files changed, 75 insertions(+), 57 deletions(-) diff --git a/helper/include/odp/helper/eth.h b/helper/include/odp/helper/eth.h index 1e16225..60949d9 100644 --- a/helper/include/odp/helper/eth.h +++ b/helper/include/odp/helper/eth.h @@ -40,7 +40,8 @@ typedef struct ODP_PACKED { } odph_ethaddr_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == ODPH_ETHADDR_LEN, "ODPH_ETHADDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_ethaddr_t) == ODPH_ETHADDR_LEN, + "ODPH_ETHADDR_T__SIZE_ERROR"); /** * Ethernet header @@ -52,7 +53,8 @@ typedef struct ODP_PACKED { } odph_ethhdr_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_ethhdr_t) == ODPH_ETHHDR_LEN, "ODPH_ETHHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_ethhdr_t) == ODPH_ETHHDR_LEN, + "ODPH_ETHHDR_T__SIZE_ERROR"); /** * VLAN header @@ -65,7 +67,8 @@ typedef struct ODP_PACKED { } odph_vlanhdr_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN, "ODPH_VLANHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_vlanhdr_t) == ODPH_VLANHDR_LEN, + "ODPH_VLANHDR_T__SIZE_ERROR"); /* Ethernet header Ether Type ('type') values, a selected few */ diff --git a/helper/include/odp/helper/icmp.h b/helper/include/odp/helper/icmp.h index 929b8bc..e25646a 100644 --- a/helper/include/odp/helper/icmp.h +++ b/helper/include/odp/helper/icmp.h @@ -92,7 +92,8 @@ typedef struct ODP_PACKED { exceeded*/ /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN, "ODPH_ICMPHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_icmphdr_t) == ODPH_ICMPHDR_LEN, + "ODPH_ICMPHDR_T__SIZE_ERROR"); /** * @} diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index 3789d54..4df41d9 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -71,7 +71,8 @@ typedef struct ODP_PACKED { } odph_ipv4hdr_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == ODPH_IPV4HDR_LEN, "ODPH_IPV4HDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_ipv4hdr_t) == ODPH_IPV4HDR_LEN, + "ODPH_IPV4HDR_T__SIZE_ERROR"); /** * Check if IPv4 checksum is valid @@ -146,7 +147,8 @@ typedef struct ODP_PACKED { } odph_ipv6hdr_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_ipv6hdr_t) == ODPH_IPV6HDR_LEN, "ODPH_IPV6HDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_ipv6hdr_t) == ODPH_IPV6HDR_LEN, + "ODPH_IPV6HDR_T__SIZE_ERROR"); /** * IPv6 Header extensions diff --git a/helper/include/odp/helper/ipsec.h b/helper/include/odp/helper/ipsec.h index af3de87..034a341 100644 --- a/helper/include/odp/helper/ipsec.h +++ b/helper/include/odp/helper/ipsec.h @@ -38,7 +38,8 @@ typedef struct ODP_PACKED { } odph_esphdr_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_esphdr_t) == ODPH_ESPHDR_LEN, "ODPH_ESPHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_esphdr_t) == ODPH_ESPHDR_LEN, + "ODPH_ESPHDR_T__SIZE_ERROR"); /** * IPSec ESP trailer @@ -50,7 +51,8 @@ typedef struct ODP_PACKED { } odph_esptrl_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_esptrl_t) == ODPH_ESPTRL_LEN, "ODPH_ESPTRL_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_esptrl_t) == ODPH_ESPTRL_LEN, + "ODPH_ESPTRL_T__SIZE_ERROR"); /** * IPSec AH header @@ -65,7 +67,8 @@ typedef struct ODP_PACKED { } odph_ahhdr_t; /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_ahhdr_t) == ODPH_AHHDR_LEN, "ODPH_AHHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_ahhdr_t) == ODPH_AHHDR_LEN, + "ODPH_AHHDR_T__SIZE_ERROR"); /** * @} diff --git a/helper/include/odp/helper/udp.h b/helper/include/odp/helper/udp.h index 812f5b9..6f0621b 100644 --- a/helper/include/odp/helper/udp.h +++ b/helper/include/odp/helper/udp.h @@ -87,7 +87,8 @@ static inline uint16_t odph_ipv4_udp_chksum(odp_packet_t pkt) } /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(sizeof(odph_udphdr_t) == ODPH_UDPHDR_LEN, "ODPH_UDPHDR_T__SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(odph_udphdr_t) == ODPH_UDPHDR_LEN, + "ODPH_UDPHDR_T__SIZE_ERROR"); /** * @} diff --git a/include/odp/api/spec/debug.h b/include/odp/api/spec/debug.h index 252a82f..247b0c0 100644 --- a/include/odp/api/spec/debug.h +++ b/include/odp/api/spec/debug.h @@ -17,31 +17,16 @@ extern "C" { #endif -#if defined(__GNUC__) && !defined(__clang__) - - -#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) - -/** - * @internal _Static_assert was only added in GCC 4.6. Provide a weak replacement - * for previous versions. - */ -#define _Static_assert(e, s) (extern int (*static_assert_checker(void)) \ - [sizeof(struct { unsigned int error_if_negative:(e) ? 1 : -1; })]) - -#endif - - - -#endif - - /** - * @internal Compile time assertion-macro - fail compilation if cond is false. - * This macro has zero runtime overhead + * @def ODP_STATIC_ASSERT + * Compile time assertion macro. Fails compilation and outputs message 'msg' + * if condition 'cond' is false. Macro definition is empty when the compiler + * is not supported or the compiler does not support static assertion. + * + * @param cond Conditional expression to be evaluated at compile time + * + * @param msg Compile time error message to be displayed if cond is false */ -#define _ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) - #ifdef __cplusplus } diff --git a/platform/linux-generic/include/odp/api/debug.h b/platform/linux-generic/include/odp/api/debug.h index dc1fce0..7db1433 100644 --- a/platform/linux-generic/include/odp/api/debug.h +++ b/platform/linux-generic/include/odp/api/debug.h @@ -19,6 +19,28 @@ extern "C" { #include +#if defined(__GNUC__) && !defined(__clang__) + +#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) + +/** + * @internal _Static_assert was only added in GCC 4.6. Provide a weak replacement + * for previous versions. + */ +#define _Static_assert(e, s) (extern int (*static_assert_checker(void)) \ + [sizeof(struct { unsigned int error_if_negative:(e) ? 1 : -1; })]) + +#endif + +#endif + +/** + * @internal Compile time assertion macro. Fails compilation and outputs 'msg' + * if condition 'cond' is false. Macro definition is empty when compiler is not + * supported or the compiler does not support static assertion. + */ +#define ODP_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg) + #ifdef __cplusplus } #endif diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index ea092ca..a7a3ffd 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -50,10 +50,10 @@ extern "C" { ((x) <= 65536 ? 16 : \ (0/0))))))))))))))))) -_ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256, - "ODP Segment size must be a minimum of 256 bytes"); +ODP_STATIC_ASSERT(ODP_CONFIG_PACKET_SEG_LEN_MIN >= 256, + "ODP Segment size must be a minimum of 256 bytes"); -_ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX % +ODP_STATIC_ASSERT((ODP_CONFIG_PACKET_BUF_LEN_MAX % ODP_CONFIG_PACKET_SEG_LEN_MIN) == 0, "Packet max size must be a multiple of segment size"); @@ -146,8 +146,8 @@ struct odp_buffer_hdr_t { /** @internal Compile time assert that the * allocator field can handle any allocator id*/ -_ODP_STATIC_ASSERT(INT16_MAX >= ODP_THREAD_COUNT_MAX, - "ODP_BUFFER_HDR_T__ALLOCATOR__SIZE_ERROR"); +ODP_STATIC_ASSERT(INT16_MAX >= ODP_THREAD_COUNT_MAX, + "ODP_BUFFER_HDR_T__ALLOCATOR__SIZE_ERROR"); typedef struct odp_buffer_hdr_stride { uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(odp_buffer_hdr_t))]; diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 92b770f..47f4ff8 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -74,8 +74,8 @@ typedef union { }; } input_flags_t; -_ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), - "INPUT_FLAGS_SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(input_flags_t) == sizeof(uint32_t), + "INPUT_FLAGS_SIZE_ERROR"); /** * Packet error flags @@ -96,8 +96,8 @@ typedef union { }; } error_flags_t; -_ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), - "ERROR_FLAGS_SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), + "ERROR_FLAGS_SIZE_ERROR"); /** * Packet output flags @@ -117,8 +117,8 @@ typedef union { }; } output_flags_t; -_ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), - "OUTPUT_FLAGS_SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), + "OUTPUT_FLAGS_SIZE_ERROR"); /** * Internal Packet header diff --git a/platform/linux-generic/include/odp_packet_io_queue.h b/platform/linux-generic/include/odp_packet_io_queue.h index 12e2b9f..5843f6a 100644 --- a/platform/linux-generic/include/odp_packet_io_queue.h +++ b/platform/linux-generic/include/odp_packet_io_queue.h @@ -24,8 +24,8 @@ extern "C" { /** Max nbr of pkts to receive in one burst (keep same as QUEUE_MULTI_MAX) */ #define ODP_PKTIN_QUEUE_MAX_BURST 16 /* pktin_deq_multi() depends on the condition: */ -_ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX, - "ODP_PKTIN_DEQ_MULTI_MAX_ERROR"); +ODP_STATIC_ASSERT(ODP_PKTIN_QUEUE_MAX_BURST >= QUEUE_MULTI_MAX, + "ODP_PKTIN_DEQ_MULTI_MAX_ERROR"); int pktin_enqueue(queue_entry_t *queue, odp_buffer_hdr_t *buf_hdr, int sustain); odp_buffer_hdr_t *pktin_dequeue(queue_entry_t *queue); diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index bc83e80..09a571b 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -65,8 +65,9 @@ struct ring { struct tpacket_req req; }; -_ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, - "ERR_STRUCT_RING"); + +ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, + "ERR_STRUCT_RING"); /** Packet socket using mmap rings for both Rx and Tx */ typedef struct { diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index fd672e2..3d35ade 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -21,8 +21,8 @@ #include /** @internal Compile time assert */ -_ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE, - "ODP_CPUMASK_SIZE__SIZE_ERROR"); +ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE, + "ODP_CPUMASK_SIZE__SIZE_ERROR"); void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in) { diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-generic/odp_schedule.c index 14a1197..0595e70 100644 --- a/platform/linux-generic/odp_schedule.c +++ b/platform/linux-generic/odp_schedule.c @@ -45,8 +45,8 @@ odp_thrmask_t sched_mask_all; /* Mask of queues per priority */ typedef uint8_t pri_mask_t; -_ODP_STATIC_ASSERT((8*sizeof(pri_mask_t)) >= QUEUES_PER_PRIO, - "pri_mask_t_is_too_small"); +ODP_STATIC_ASSERT((8 * sizeof(pri_mask_t)) >= QUEUES_PER_PRIO, + "pri_mask_t_is_too_small"); /* Internal: Start of named groups in group mask arrays */ #define _ODP_SCHED_GROUP_NAMED (ODP_SCHED_GROUP_CONTROL + 1) diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index 6364105..0beff37 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -28,8 +28,8 @@ #include #include -_ODP_STATIC_ASSERT(ODP_CONFIG_SHM_BLOCKS >= ODP_CONFIG_POOLS, - "ODP_CONFIG_SHM_BLOCKS < ODP_CONFIG_POOLS"); +ODP_STATIC_ASSERT(ODP_CONFIG_SHM_BLOCKS >= ODP_CONFIG_POOLS, + "ODP_CONFIG_SHM_BLOCKS < ODP_CONFIG_POOLS"); typedef struct { char name[ODP_SHM_NAME_LEN]; diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index ac72709..f4fb1f6 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -107,7 +107,7 @@ ODP_ALIGNED(16) /* 16-byte atomic operations need properly aligned addresses */ #endif ; -_ODP_STATIC_ASSERT(sizeof(tick_buf_t) == 16, "sizeof(tick_buf_t) == 16"); +ODP_STATIC_ASSERT(sizeof(tick_buf_t) == 16, "sizeof(tick_buf_t) == 16"); typedef struct odp_timer_s { void *user_ptr; diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index ad8dc55..18fa5c6 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -396,8 +396,8 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED, int ret = -1; int slave; - _ODP_STATIC_ASSERT(ODP_POOL_NAME_LEN == _RING_NAMESIZE, - "mismatch pool and ring name arrays"); + ODP_STATIC_ASSERT(ODP_POOL_NAME_LEN == _RING_NAMESIZE, + "mismatch pool and ring name arrays"); if (strncmp(dev, "ipc", 3)) return -1;