Teach logger about O_DIRECT

Plump the option down through aos.

This will let us (in a future change) detect whether the storage disk
should use O_DIRECT or not, as appropriate.

Change-Id: I2bc68606a4954460a3bcd61e5e649e122ebb1358
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/events/logging/log_edit.cc b/aos/events/logging/log_edit.cc
index 7d3ba2f..4585ab7 100644
--- a/aos/events/logging/log_edit.cc
+++ b/aos/events/logging/log_edit.cc
@@ -24,6 +24,9 @@
     "Max size of a message to be written.  This sets the buffers inside "
     "the encoders.");
 
+DEFINE_bool(direct, false,
+            "If true, write using O_DIRECT and write 512 byte aligned blocks "
+            "whenever possible.");
 int main(int argc, char **argv) {
   gflags::SetUsageMessage(R"(This tool lets us manipulate log files.)");
   aos::InitGoogle(&argc, &argv);
@@ -49,7 +52,7 @@
     aos::logger::SpanReader span_reader(orig_path);
     CHECK(!span_reader.ReadMessage().empty()) << ": Empty header, aborting";
 
-    aos::logger::FileBackend file_backend("/");
+    aos::logger::FileBackend file_backend("/", FLAGS_direct);
     aos::logger::DetachedBufferWriter buffer_writer(
         file_backend.RequestFile(FLAGS_logfile),
         std::make_unique<aos::logger::DummyEncoder>(FLAGS_max_message_size));