add FIELD_SIZE macro to calculate the size of the specified field
authorRoman Pen <r.peniaev@gmail.com>
Wed, 19 Aug 2015 10:33:10 +0000 (12:33 +0200)
committerJens Axboe <axboe@fb.com>
Fri, 4 Sep 2015 19:33:08 +0000 (13:33 -0600)
Will use this stuff later.

Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
fio.h

diff --git a/fio.h b/fio.h
index 53d82560053ba95ab768f1aedc78f6275a780233..a00e8f23000c6450b5e636868602556c0057c35d 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -668,7 +668,8 @@ extern const char *fio_get_arch_string(int);
 extern const char *fio_get_os_string(int);
 
 #ifdef FIO_INTERNAL
 extern const char *fio_get_os_string(int);
 
 #ifdef FIO_INTERNAL
-#define ARRAY_SIZE(x) (sizeof((x)) / (sizeof((x)[0])))
+#define ARRAY_SIZE(x)    (sizeof((x)) / (sizeof((x)[0])))
+#define FIELD_SIZE(s, f) (sizeof(((typeof(s))0)->f))
 #endif
 
 enum {
 #endif
 
 enum {