graph: fix bar graph min/max displays
[fio.git] / cconv.c
diff --git a/cconv.c b/cconv.c
index f16e0d6a90b80dc7c5cabde2f1baeab03fee68e4..eba1de81b77555e43bd43e0008c462f36c569b70 100644 (file)
--- a/cconv.c
+++ b/cconv.c
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "thread_options.h"
 
 static void string_to_cpu(char **dst, const uint8_t *src)
@@ -182,6 +184,8 @@ void convert_thread_options_to_cpu(struct thread_options *o,
        o->flow_watermark = __le32_to_cpu(top->flow_watermark);
        o->flow_sleep = le32_to_cpu(top->flow_sleep);
        o->sync_file_range = le32_to_cpu(top->sync_file_range);
+       o->compress_percentage = le32_to_cpu(top->compress_percentage);
+       o->compress_chunk = le32_to_cpu(top->compress_chunk);
 
        o->trim_backlog = le64_to_cpu(top->trim_backlog);
 
@@ -319,6 +323,8 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
        top->flow_watermark = __cpu_to_le32(o->flow_watermark);
        top->flow_sleep = cpu_to_le32(o->flow_sleep);
        top->sync_file_range = cpu_to_le32(o->sync_file_range);
+       top->compress_percentage = cpu_to_le32(o->compress_percentage);
+       top->compress_chunk = cpu_to_le32(o->compress_chunk);
 
        for (i = 0; i < 2; i++) {
                top->bs[i] = cpu_to_le32(o->bs[i]);
@@ -372,3 +378,23 @@ void convert_thread_options_to_net(struct thread_options_pack *top,
 
 }
 
+/*
+ * Basic conversion test. We'd really need to fill in more of the options
+ * to have a thorough test. Even better, we should auto-generate the
+ * converter functions...
+ */
+int fio_test_cconv(struct thread_options *__o)
+{
+       struct thread_options o;
+       struct thread_options_pack top1, top2;
+
+       memset(&top1, 0, sizeof(top1));
+       memset(&top2, 0, sizeof(top2));
+
+       convert_thread_options_to_net(&top1, __o);
+       memset(&o, 0, sizeof(o));
+       convert_thread_options_to_cpu(&o, &top1);
+       convert_thread_options_to_net(&top2, &o);
+
+       return memcmp(&top1, &top2, sizeof(top1));
+}