From 22aef2ccd3af406f5d1044c0684799d17e8e8c0a Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Thu, 12 Mar 2020 15:50:03 +0800 Subject: [PATCH] [mpp_common]: Add container_of macro Include and add container_of macro. Change-Id: Ie439b7683e026be9336e618c605b3b934e4fde38 Signed-off-by: Herman Chen --- osal/inc/mpp_common.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osal/inc/mpp_common.h b/osal/inc/mpp_common.h index ac0223a0..0aca15f8 100644 --- a/osal/inc/mpp_common.h +++ b/osal/inc/mpp_common.h @@ -148,11 +148,14 @@ #define fseeko fseeko64 #else #include +#include #include #include #define mkdir(x) mkdir(x, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) #endif +#define container_of(ptr, type, member) \ + ((type *)((char *)(ptr) - offsetof(type, member))) #define __RETURN __Return #define __FAILED __failed