queue_extras: use SPDK_CONTAINEROF
A couple of the functions inside of the queue_extras file were relying on an undefined __containerof function. Replace that with SPDK_CONTAINEROF. Then add an extra check so that when someone includes this file on FreeBSD, it doesn't throw compiler warnings for the redefinitions (see our cpp headers test for example). The argument order for both functions is the same, namely pointer, type, member. Change-Id: I1bd0497ee14df8b37f4de1046e271e5fe144ca82 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470191 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
parent
584a630287
commit
fcaabb48fa
@ -105,6 +105,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "spdk/util.h"
|
||||
|
||||
/*
|
||||
* Singly-linked Tail queue declarations.
|
||||
*/
|
||||
@ -141,7 +143,7 @@ struct name { \
|
||||
|
||||
#define STAILQ_LAST(head, type, field) \
|
||||
(STAILQ_EMPTY((head)) ? NULL : \
|
||||
__containerof((head)->stqh_last, struct type, field.stqe_next))
|
||||
SPDK_CONTAINEROF((head)->stqh_last, struct type, field.stqe_next))
|
||||
|
||||
#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
|
||||
|
||||
@ -233,7 +235,7 @@ struct { \
|
||||
|
||||
#define LIST_PREV(elm, head, type, field) \
|
||||
((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
|
||||
__containerof((elm)->field.le_prev, struct type, field.le_next))
|
||||
SPDK_CONTAINEROF((elm)->field.le_prev, struct type, field.le_next))
|
||||
|
||||
#define LIST_SWAP(head1, head2, type, field) do { \
|
||||
struct type *swap_tmp = LIST_FIRST((head1)); \
|
||||
|
@ -35,6 +35,10 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
|
||||
HEADERS := $(wildcard $(SPDK_ROOT_DIR)/include/spdk/*.h)
|
||||
|
||||
# On Linux, queue_extras.h is pulled in with queue.h,
|
||||
# on FreeBSD, we want to ignore queue_extras.h entirely.
|
||||
HEADERS := $(filter-out $(SPDK_ROOT_DIR)/include/spdk/queue_extras.h,$(HEADERS))
|
||||
CXX_SRCS := $(patsubst %.h,%.cpp,$(notdir $(HEADERS)))
|
||||
|
||||
install : all
|
||||
|
Loading…
x
Reference in New Issue
Block a user