From: Waldemar Kozaczuk <[email protected]> Committer: WALDEMAR KOZACZUK <[email protected]> Branch: master
ena_com: adapt headers to work in C++ code Signed-off-by: Waldemar Kozaczuk <[email protected]> --- diff --git a/bsd/sys/contrib/ena_com/ena_com.h b/bsd/sys/contrib/ena_com/ena_com.h --- a/bsd/sys/contrib/ena_com/ena_com.h +++ b/bsd/sys/contrib/ena_com/ena_com.h @@ -977,7 +977,8 @@ int ena_com_config_dev_mode(struct ena_com_dev *ena_dev, */ static inline struct ena_com_dev *ena_com_io_sq_to_ena_dev(struct ena_com_io_sq *io_sq) { - return container_of(io_sq, struct ena_com_dev, io_sq_queues[io_sq->qid]); + ena_com_io_sq *first = io_sq - io_sq->qid; + return reinterpret_cast<ena_com_dev *>(((uintptr_t)first - offsetof(ena_com_dev, io_sq_queues))); } /* ena_com_io_cq_to_ena_dev - Extract ena_com_dev using contained field io_cq. @@ -987,7 +988,8 @@ static inline struct ena_com_dev *ena_com_io_sq_to_ena_dev(struct ena_com_io_sq */ static inline struct ena_com_dev *ena_com_io_cq_to_ena_dev(struct ena_com_io_cq *io_cq) { - return container_of(io_cq, struct ena_com_dev, io_cq_queues[io_cq->qid]); + ena_com_io_cq *first = io_cq - io_cq->qid; + return reinterpret_cast<ena_com_dev *>(((uintptr_t)first - offsetof(ena_com_dev, io_cq_queues))); } static inline bool ena_com_get_adaptive_moderation_enabled(struct ena_com_dev *ena_dev) diff --git a/bsd/sys/contrib/ena_com/ena_eth_com.h b/bsd/sys/contrib/ena_com/ena_eth_com.h --- a/bsd/sys/contrib/ena_com/ena_eth_com.h +++ b/bsd/sys/contrib/ena_com/ena_eth_com.h @@ -34,10 +34,11 @@ #ifndef ENA_ETH_COM_H_ #define ENA_ETH_COM_H_ +#include "ena_com.h" + #if defined(__cplusplus) extern "C" { #endif -#include "ena_com.h" /* head update threshold in units of (queue size / ENA_COMP_HEAD_THRESH) */ #define ENA_COMP_HEAD_THRESH 4 -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/00000000000063ef7a060eaf1480%40google.com.
