efi: add poor man's offsetof() implementation
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Jun 2018 16:49:52 +0000 (18:49 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Oct 2018 14:44:34 +0000 (16:44 +0200)
src/boot/efi/util.h

index 8a3e052..3e6e610 100644 (file)
@@ -5,6 +5,7 @@
 #include <efilib.h>
 
 #define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
+#define OFFSETOF(x,y) ((UINTN) &(((x*)0)->y))
 
 static inline const CHAR16 *yes_no(BOOLEAN b) {
         return b ? L"yes" : L"no";