Fix build error
[platform/core/system/libdevice-node.git] / hw / common.h
index 76c88f4..b11fa09 100644 (file)
 extern "C" {
 #endif
 
+#include <errno.h>
+#include <stddef.h>
 #include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
 
 #define MAKE_TAG_CONSTANT(A,B,C,D)     (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
 #define HARDWARE_INFO_TAG      MAKE_TAG_CONSTANT('T','H','I','T')
@@ -86,6 +90,13 @@ int hw_get_info(const char *id, const struct hw_info **info);
        __attribute__ ((visibility("default"))) \
        struct hw_info HARDWARE_INFO_SYM
 
+#ifndef container_of
+#define container_of(ptr, type, member) ({                      \
+        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+        (type *)( (char *)__mptr - offsetof(type,member) );})
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif