diff --git a/components/linux/include/esp_linux_helper.h b/components/linux/include/esp_linux_helper.h new file mode 100644 index 0000000000..22bfa98518 --- /dev/null +++ b/components/linux/include/esp_linux_helper.h @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#if CONFIG_IDF_TARGET_LINUX +#define __containerof(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) +#endif + +#ifdef __cplusplus +} +#endif