]> git.proxmox.com Git - qemu.git/blobdiff - osdep.h
Update version and changelog for release
[qemu.git] / osdep.h
diff --git a/osdep.h b/osdep.h
index 4b4aad4d491a39f3fecbd8869819eddacda548c5..75b581630f2a26e7c374884f7b8b700232d5eca3 100644 (file)
--- a/osdep.h
+++ b/osdep.h
         (type *) ((char *) __mptr - offsetof(type, member));})
 #endif
 
+/* Convert from a base type to a parent type, with compile time checking.  */
+#ifdef __GNUC__
+#define DO_UPCAST(type, field, dev) ( __extension__ ( { \
+    char __attribute__((unused)) offset_must_be_zero[ \
+        -offsetof(type, field)]; \
+    container_of(dev, type, field);}))
+#else
+#define DO_UPCAST(type, field, dev) container_of(dev, type, field)
+#endif
+
 #define typeof_field(type, field) typeof(((type *)0)->field)
 #define type_check(t1,t2) ((t1*)0 - (t2*)0)