On 9/6/2024 8:45 AM, Akhil Goyal wrote: >>> >>> Here's an idea... >>> >>> We can introduce a generic design pattern where we keep the _LIST_END enum >> value at the end, somehow marking it private (and not part of the API/ABI), >> and >> move the _list_end() function inside the C file, so it uses the _LIST_END >> enum >> value that the library was built with. E.g. like this: >>> >>> >>> In the header file: >>> >>> enum rte_crypto_asym_op_type { >>> RTE_CRYPTO_ASYM_OP_VERIFY, >>> /**< Signature Verification operation */ >>> #if RTE_BUILDING_INTERNAL >>> __RTE_CRYPTO_ASYM_OP_LIST_END /* internal */ >>> #endif >>> } >>> >>> int rte_crypto_asym_op_list_end(void); >>> >>> >>> And in the associated library code file, when including rte_crypto_asym.h: >>> >>> #define RTE_BUILDING_INTERNAL >>> #include <cryptodev/rte_crypto_asym.h> >>> >>> int >>> rte_crypto_asym_op_list_end(void) >>> { >>> return __RTE_CRYPTO_ASYM_OP_LIST_END; >>> } >> >> It's more generic, and also keep LIST_END in the define, we just add new enum >> before it. >> But based on my understanding of ABI compatibility, from the point view of >> application, >> this API should return old-value even with the new library, but it will >> return new- >> value >> with new library. It could also break ABI. >> >> So this API should force inline, just as this patch did. But it seem can't >> work if >> move >> this API to header file and add static inline. >> > Yes, moving to c file does not seem to solve the purpose. > So should we move with the way the patch is submitted or we have some other > suggestion? >
+1, when it is not inline function, this approach won't work.