diff options
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | plugin_blk.c | 11 |
2 files changed, 22 insertions, 3 deletions
@@ -89,12 +89,20 @@ endif | |||
89 | 89 | ||
90 | # $(call test-build, snippet, ret) -> ret if snippet compiles | 90 | # $(call test-build, snippet, ret) -> ret if snippet compiles |
91 | # -> empty otherwise | 91 | # -> empty otherwise |
92 | test-build = $(if $(shell $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 \ | 92 | test-build = $(if $(shell sh -c 'echo "$(1)" | \ |
93 | <<<'$1' && echo y), $2) | 93 | $(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2) |
94 | 94 | ||
95 | # have udis86 disassembler library? | 95 | # have udis86 disassembler library? |
96 | udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86) | 96 | udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86) |
97 | 97 | ||
98 | define BLK_TC_FLUSH_SOURCE | ||
99 | #include <linux/blktrace_api.h> | ||
100 | int main(void) { return BLK_TC_FLUSH; } | ||
101 | endef | ||
102 | |||
103 | # have flush/fua block layer instead of barriers? | ||
104 | blk-flags := $(call test-build,$(BLK_TC_FLUSH_SOURCE),-DHAVE_BLK_TC_FLUSH) | ||
105 | |||
98 | ifeq ("$(origin O)", "command line") | 106 | ifeq ("$(origin O)", "command line") |
99 | BUILD_OUTPUT := $(O) | 107 | BUILD_OUTPUT := $(O) |
100 | endif | 108 | endif |
@@ -223,7 +231,7 @@ endif | |||
223 | 231 | ||
224 | # Append required CFLAGS | 232 | # Append required CFLAGS |
225 | override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) | 233 | override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) |
226 | override CFLAGS += $(udis86-flags) | 234 | override CFLAGS += $(udis86-flags) $(blk-flags) |
227 | 235 | ||
228 | ifeq ($(VERBOSE),1) | 236 | ifeq ($(VERBOSE),1) |
229 | Q = | 237 | Q = |
diff --git a/plugin_blk.c b/plugin_blk.c index 9327b17..c0ecef9 100644 --- a/plugin_blk.c +++ b/plugin_blk.c | |||
@@ -54,6 +54,11 @@ static void fill_rwbs(char *rwbs, int action, unsigned int bytes) | |||
54 | goto out; | 54 | goto out; |
55 | } | 55 | } |
56 | 56 | ||
57 | #if defined(HAVE_BLK_TC_FLUSH) | ||
58 | if (tc & BLK_TC_FLUSH) | ||
59 | rwbs[i++] = 'F'; | ||
60 | #endif | ||
61 | |||
57 | if (tc & BLK_TC_DISCARD) | 62 | if (tc & BLK_TC_DISCARD) |
58 | rwbs[i++] = 'D'; | 63 | rwbs[i++] = 'D'; |
59 | else if (tc & BLK_TC_WRITE) | 64 | else if (tc & BLK_TC_WRITE) |
@@ -63,10 +68,16 @@ static void fill_rwbs(char *rwbs, int action, unsigned int bytes) | |||
63 | else | 68 | else |
64 | rwbs[i++] = 'N'; | 69 | rwbs[i++] = 'N'; |
65 | 70 | ||
71 | #if defined(HAVE_BLK_TC_FLUSH) | ||
72 | if (tc & BLK_TC_FUA) | ||
73 | rwbs[i++] = 'F'; | ||
74 | #endif | ||
66 | if (tc & BLK_TC_AHEAD) | 75 | if (tc & BLK_TC_AHEAD) |
67 | rwbs[i++] = 'A'; | 76 | rwbs[i++] = 'A'; |
77 | #if !defined(HAVE_BLK_TC_FLUSH) | ||
68 | if (tc & BLK_TC_BARRIER) | 78 | if (tc & BLK_TC_BARRIER) |
69 | rwbs[i++] = 'B'; | 79 | rwbs[i++] = 'B'; |
80 | #endif | ||
70 | if (tc & BLK_TC_SYNC) | 81 | if (tc & BLK_TC_SYNC) |
71 | rwbs[i++] = 'S'; | 82 | rwbs[i++] = 'S'; |
72 | if (tc & BLK_TC_META) | 83 | if (tc & BLK_TC_META) |