aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.h')
-rw-r--r--lib/util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/util.h b/lib/util.h
index 508fafb..ed03ad4 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -30,4 +30,10 @@ static inline uint64_t fuse_higher_32_bits(uint64_t nr)
#define FUSE_VAR_UNUSED(var) (__attribute__((unused)) var)
#endif
+#define container_of(ptr, type, member) \
+ ({ \
+ unsigned long __mptr = (unsigned long)(ptr); \
+ ((type *)(__mptr - offsetof(type, member))); \
+ })
+
#endif