esp_linux_helper.h 438 B

1234567891011121314151617181920
  1. /*
  2. * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #if CONFIG_IDF_TARGET_LINUX && !defined(__containerof)
  11. #define __containerof(ptr, type, member) ({ \
  12. const typeof( ((type *)0)->member ) *__mptr = (ptr); \
  13. (type *)( (char *)__mptr - offsetof(type,member) );})
  14. #endif
  15. #ifdef __cplusplus
  16. }
  17. #endif