clang format changes

Change-Id: I93a1c322984e44e074e869d02df9fe265c406662
diff --git a/common/vsoc/lib/region.h b/common/vsoc/lib/region.h
index 4a6695b..41184e7 100644
--- a/common/vsoc/lib/region.h
+++ b/common/vsoc/lib/region.h
@@ -18,10 +18,10 @@
 
 // Object that represents a region on the Host
 
-#include <atomic>
-#include <cstdint>
 #include <stdlib.h>
 #include <sys/mman.h>
+#include <atomic>
+#include <cstdint>
 
 #include "common/libs/fs/shared_fd.h"
 #include "uapi/vsoc_shm.h"
@@ -54,18 +54,19 @@
  protected:
   RegionBase() {}
 
-  template <typename T> T* region_offset_to_pointer(uint32_t offset) {
-    return reinterpret_cast<T*> (
-        reinterpret_cast<uintptr_t>(region_base_) +
-        offset - region_desc_.region_begin_offset);
+  template <typename T>
+  T* region_offset_to_pointer(uint32_t offset) {
+    return reinterpret_cast<T*>(reinterpret_cast<uintptr_t>(region_base_) +
+                                offset - region_desc_.region_begin_offset);
   }
 
-  template <typename T> uint32_t pointer_to_region_offset(T* ptr) {
+  template <typename T>
+  uint32_t pointer_to_region_offset(T* ptr) {
     return reinterpret_cast<uintptr_t>(ptr) - region_desc_.region_begin_offset;
   }
 
   vsoc_device_region region_desc_{};
-  void *region_base_{};
+  void* region_base_{};
 };
 
-}  // vsoc
+}  // namespace vsoc
diff --git a/common/vsoc/shm/base.h b/common/vsoc/shm/base.h
index bd90d87..82d697e 100644
--- a/common/vsoc/shm/base.h
+++ b/common/vsoc/shm/base.h
@@ -20,9 +20,9 @@
 #include <type_traits>
 #include "common/vsoc/shm/version.h"
 
-#define ASSERT_SHM_COMPATIBLE(T,R)                                      \
-  static_assert(sizeof(T) == vsoc::layout::version_info::R::T##_size,   \
-                "size changed, update the version");                    \
+#define ASSERT_SHM_COMPATIBLE(T, R)                                   \
+  static_assert(sizeof(T) == vsoc::layout::version_info::R::T##_size, \
+                "size changed, update the version");                  \
   static_assert(std::is_trivial<T>(), "Class uses features that are unsafe")
 
 #define ASSERT_SHM_CONSTANT_VALUE(T, R)                                 \
@@ -36,5 +36,5 @@
 };
 ASSERT_SHM_COMPATIBLE(Base, multi_region);
 
-}  // layout
-}  // vsoc
+}  // namespace layout
+}  // namespace vsoc
diff --git a/common/vsoc/shm/version.h b/common/vsoc/shm/version.h
index f9c31db..28ead3f 100644
--- a/common/vsoc/shm/version.h
+++ b/common/vsoc/shm/version.h
@@ -45,27 +45,27 @@
 // of the regions bumping the version number if they used the fields in their
 // definition.
 const uint32_t version = 0;
-}
+}  // namespace
 
 static const std::size_t Base_size = 1;
 static const std::size_t PixelFormatRegister_size = 4;
 static const std::size_t PixelFormatMaskRegister_size = 8;
 
 namespace constant_values {
-  static const uint32_t VSOC_PIXEL_FORMAT_UNINITIALIZED = 0;
-  static const uint32_t VSOC_PIXEL_FORMAT_BLOB = 1;
+static const uint32_t VSOC_PIXEL_FORMAT_UNINITIALIZED = 0;
+static const uint32_t VSOC_PIXEL_FORMAT_BLOB = 1;
 
-  static const uint32_t VSOC_PIXEL_FORMAT_RGB_565 = 8;
-  static const uint32_t VSOC_PIXEL_FORMAT_YV12 = 9;
-  static const uint32_t VSOC_PIXEL_FORMAT_YCbCr_420_888 = 10;
+static const uint32_t VSOC_PIXEL_FORMAT_RGB_565 = 8;
+static const uint32_t VSOC_PIXEL_FORMAT_YV12 = 9;
+static const uint32_t VSOC_PIXEL_FORMAT_YCbCr_420_888 = 10;
 
-  static const uint32_t VSOC_PIXEL_FORMAT_RGB_888 = 16;
+static const uint32_t VSOC_PIXEL_FORMAT_RGB_888 = 16;
 
-  static const uint32_t VSOC_PIXEL_FORMAT_RGBA_8888 = 24;
-  static const uint32_t VSOC_PIXEL_FORMAT_RGBX_8888 = 25;
-  static const uint32_t VSOC_PIXEL_FORMAT_BGRA_8888 = 26;
-}  // constant_values
-}  // multi_region
+static const uint32_t VSOC_PIXEL_FORMAT_RGBA_8888 = 24;
+static const uint32_t VSOC_PIXEL_FORMAT_RGBX_8888 = 25;
+static const uint32_t VSOC_PIXEL_FORMAT_BGRA_8888 = 26;
+}  // namespace constant_values
+}  // namespace multi_region
 
 // Versioning information for e2e_test_region.h
 // Changes to these structures will affect only the e2e_test_region
@@ -78,8 +78,8 @@
 static const std::size_t E2ESecondaryTestRegion_size = 72;
 static const std::size_t E2ETestRegionBase_size = 72;
 static const std::size_t E2ETestStageRegister_size = 4;
-}  // e2e_test_region
+}  // namespace e2e_test
 
-}  // version_info
-}  // layout
-}  // vsoc
+}  // namespace version_info
+}  // namespace layout
+}  // namespace vsoc
diff --git a/guest/vsoc/lib/guest_region.cpp b/guest/vsoc/lib/guest_region.cpp
index 1b5edff..50f3c10 100644
--- a/guest/vsoc/lib/guest_region.cpp
+++ b/guest/vsoc/lib/guest_region.cpp
@@ -15,13 +15,13 @@
  */
 #include "guest/vsoc/lib/guest_region.h"
 
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #include <string>
 #include <thread>
@@ -32,21 +32,21 @@
 using avd::SharedFD;
 
 bool vsoc::OpenableRegion::Open(const char* region_name) {
-      std::string path("/dev/");
-      path += region_name;
-      region_fd_ = SharedFD::Open(path.c_str(), O_RDWR);
-      if (!region_fd_->IsOpen()) {
-        LOG(FATAL) << "Unable to open region " << region_name << " (" <<
-                   region_fd_->StrError() << ")";
-        return false;
-  }
-  if (region_fd_->Ioctl(VSOC_DESCRIBE_REGION, &region_desc_)) {
-    LOG(FATAL) << "Unable to obtain region descriptor (" <<
-               region_fd_->StrError() << ")";
+  std::string path("/dev/");
+  path += region_name;
+  region_fd_ = SharedFD::Open(path.c_str(), O_RDWR);
+  if (!region_fd_->IsOpen()) {
+    LOG(FATAL) << "Unable to open region " << region_name << " ("
+               << region_fd_->StrError() << ")";
     return false;
   }
-  region_base_ = region_fd_->Mmap(0, region_size(),
-                      PROT_READ|PROT_WRITE, MAP_SHARED, 0);
+  if (region_fd_->Ioctl(VSOC_DESCRIBE_REGION, &region_desc_)) {
+    LOG(FATAL) << "Unable to obtain region descriptor ("
+               << region_fd_->StrError() << ")";
+    return false;
+  }
+  region_base_ =
+      region_fd_->Mmap(0, region_size(), PROT_READ | PROT_WRITE, MAP_SHARED, 0);
   if (region_base_ == MAP_FAILED) {
     LOG(FATAL) << "mmap failed (" << region_fd_->StrError() << ")";
     return false;
diff --git a/guest/vsoc/lib/guest_region.h b/guest/vsoc/lib/guest_region.h
index 0299134..a718bec 100644
--- a/guest/vsoc/lib/guest_region.h
+++ b/guest/vsoc/lib/guest_region.h
@@ -20,10 +20,10 @@
 
 #include "common/vsoc/lib/region.h"
 
-#include <atomic>
-#include <cstdint>
 #include <stdlib.h>
 #include <sys/mman.h>
+#include <atomic>
+#include <cstdint>
 
 #include "common/libs/fs/shared_fd.h"
 #include "uapi/vsoc_shm.h"
@@ -60,16 +60,13 @@
  public:
   /* Returns a pointer to the region with a type that matches the layout */
   Layout* data() {
-    return reinterpret_cast<Layout*>(
-        reinterpret_cast<uintptr_t>(region_base_) +
-        region_desc_.offset_of_region_data);
+    return reinterpret_cast<Layout*>(reinterpret_cast<uintptr_t>(region_base_) +
+                                     region_desc_.offset_of_region_data);
   }
 
   TypedRegion() {}
 
-  bool Open() {
-    return OpenableRegion::Open(Layout::region_name);
-  }
+  bool Open() { return OpenableRegion::Open(Layout::region_name); }
 };
 
-}  // vsoc
+}  // namespace vsoc
diff --git a/host/vsoc/lib/host_region.cpp b/host/vsoc/lib/host_region.cpp
index a1fcb2b..17045f4 100644
--- a/host/vsoc/lib/host_region.cpp
+++ b/host/vsoc/lib/host_region.cpp
@@ -19,11 +19,11 @@
 
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
 #include <sys/types.h>
+#include <sys/mman.h>
 #include <sys/socket.h>
 #include <sys/syscall.h>
+#include <unistd.h>
 
 #include <sstream>
 #include <thread>
diff --git a/host/vsoc/lib/host_region.h b/host/vsoc/lib/host_region.h
index dda0bb9..055f632 100644
--- a/host/vsoc/lib/host_region.h
+++ b/host/vsoc/lib/host_region.h
@@ -20,10 +20,10 @@
 
 #include "common/vsoc/lib/region.h"
 
-#include <atomic>
-#include <cstdint>
 #include <stdlib.h>
 #include <sys/mman.h>
+#include <atomic>
+#include <cstdint>
 
 #include "common/libs/fs/shared_fd.h"
 #include "uapi/vsoc_shm.h"
@@ -43,8 +43,7 @@
  protected:
   OpenableRegion() {}
 
-  bool Open(const char* name,
-            const char* domain = nullptr);
+  bool Open(const char* name, const char* domain = nullptr);
 
   avd::SharedFD incoming_interrupt_fd_;
   avd::SharedFD outgoing_interrupt_fd_;
@@ -63,9 +62,8 @@
  public:
   /* Returns a pointer to the region with a type that matches the layout */
   Layout* data() {
-    return reinterpret_cast<Layout*>(
-        reinterpret_cast<uintptr_t>(region_base_) +
-        region_desc_.offset_of_region_data);
+    return reinterpret_cast<Layout*>(reinterpret_cast<uintptr_t>(region_base_) +
+                                     region_desc_.offset_of_region_data);
   }
 
   TypedRegion() {}
@@ -75,4 +73,4 @@
   }
 };
 
-}  // vsoc
+}  // namespace vsoc