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/y2023/vision/image_logger.cc b/y2023/vision/image_logger.cc
index c2cfa0a..1b457f9 100644
--- a/y2023/vision/image_logger.cc
+++ b/y2023/vision/image_logger.cc
@@ -18,6 +18,9 @@
 DECLARE_int32(flush_size);
 DEFINE_double(disabled_time, 5.0,
               "Continue logging if disabled for this amount of time or less");
+DEFINE_bool(direct, false,
+            "If true, write using O_DIRECT and write 512 byte aligned blocks "
+            "whenever possible.");
 
 std::unique_ptr<aos::logger::MultiNodeFilesLogNamer> MakeLogNamer(
     aos::EventLoop *event_loop) {
@@ -29,7 +32,8 @@
   }
 
   return std::make_unique<aos::logger::MultiNodeFilesLogNamer>(
-      absl::StrCat(log_name.value(), "/"), event_loop);
+      event_loop, std::make_unique<aos::logger::RenamableFileBackend>(
+                      absl::StrCat(log_name.value(), "/"), FLAGS_direct));
 }
 
 int main(int argc, char *argv[]) {