From 549a2e94f146c741b76b5fb99af5ba7c1519c8d2 Mon Sep 17 00:00:00 2001
From: Abdulla Kamar <abdulla@google.com>
Date: Thu, 31 Jan 2019 11:34:11 +1100
Subject: [PATCH] [devmgr] Run `fx format-code` without header-guard

Run `fx format-code` without changing "#pragma once" to header guards.
Also set the line limit to 100 columns in the Zircon clang-format
configuration.

Test: N/A
Change-Id: I7049fcec3ebe80a0ca910ed2be95bdbc0303a596
---
 system/core/devmgr/devhost/api.cpp            |  47 ++-
 system/core/devmgr/devhost/core.cpp           | 128 +++----
 system/core/devmgr/devhost/devhost.cpp        | 122 +++----
 system/core/devmgr/devhost/devhost.h          |  86 ++---
 system/core/devmgr/devhost/device-internal.h  |  51 ++-
 system/core/devmgr/devhost/lock.h             |  16 +-
 system/core/devmgr/devhost/rpc-server.cpp     |  70 ++--
 system/core/devmgr/devmgr/binding.cpp         |  12 +-
 .../core/devmgr/devmgr/coordinator-test.cpp   |  18 +-
 system/core/devmgr/devmgr/coordinator.cpp     | 311 +++++++++---------
 system/core/devmgr/devmgr/coordinator.h       |  51 +--
 system/core/devmgr/devmgr/devfs.cpp           |  90 +++--
 .../devmgr/devmgr/devhost-loader-service.cpp  |   2 +-
 system/core/devmgr/devmgr/device.cpp          |   9 +-
 system/core/devmgr/devmgr/device.h            |  20 +-
 system/core/devmgr/devmgr/drivers.cpp         |  15 +-
 system/core/devmgr/devmgr/fidl.cpp            |  21 +-
 system/core/devmgr/devmgr/main.cpp            |  46 +--
 system/core/devmgr/devmgr/metadata.h          |  20 +-
 system/core/devmgr/dmctl/dmctl.cpp            |  16 +-
 system/core/devmgr/fshost/block-watcher.cpp   | 128 ++++---
 system/core/devmgr/fshost/fshost.h            |  21 +-
 system/core/devmgr/fshost/main.cpp            |  43 ++-
 system/core/devmgr/fshost/vfs-rpc.cpp         |  38 +--
 .../shared/async-loop-owned-rpc-handler.h     |  15 +-
 system/core/devmgr/shared/env.cpp             |   6 +-
 system/core/devmgr/shared/fdio.cpp            |  39 ++-
 system/core/devmgr/shared/fdio.h              |  36 +-
 system/core/devmgr/shared/fidl_txn.h          |   9 +-
 system/core/devmgr/shared/log.h               |  10 +-
 30 files changed, 651 insertions(+), 845 deletions(-)

diff --git a/system/core/devmgr/devhost/api.cpp b/system/core/devmgr/devhost/api.cpp
index dcc5ede0218..f626be6c42b 100644
--- a/system/core/devmgr/devhost/api.cpp
+++ b/system/core/devmgr/devhost/api.cpp
@@ -4,9 +4,9 @@
 
 #include <zircon/compiler.h>
 
+#include "devhost.h"
 #include <ddk/debug.h>
 #include <ddk/device.h>
-#include "devhost.h"
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -20,12 +20,10 @@ using namespace devmgr;
 //
 // Driver code MUST NOT directly call devhost_* APIs
 
-
 // LibDriver Device Interface
 
-#define ALLOWED_FLAGS (\
-    DEVICE_ADD_NON_BINDABLE | DEVICE_ADD_INSTANCE |\
-    DEVICE_ADD_MUST_ISOLATE | DEVICE_ADD_INVISIBLE)
+#define ALLOWED_FLAGS                                                                              \
+    (DEVICE_ADD_NON_BINDABLE | DEVICE_ADD_INSTANCE | DEVICE_ADD_MUST_ISOLATE | DEVICE_ADD_INVISIBLE)
 
 __EXPORT zx_status_t device_add_from_driver(zx_driver_t* drv, zx_device_t* parent,
                                             device_add_args_t* args, zx_device_t** out) {
@@ -83,8 +81,8 @@ __EXPORT zx_status_t device_add_from_driver(zx_driver_t* drv, zx_device_t* paren
         }
 
         if (args->flags & DEVICE_ADD_MUST_ISOLATE) {
-            r = devhost_device_add(dev, parent_ref, args->props, args->prop_count,
-                                   args->proxy_args, std::move(client_remote));
+            r = devhost_device_add(dev, parent_ref, args->props, args->prop_count, args->proxy_args,
+                                   std::move(client_remote));
         } else if (args->flags & DEVICE_ADD_INSTANCE) {
             dev->flags |= DEV_FLAG_INSTANCE | DEV_FLAG_UNBINDABLE;
             r = devhost_device_add(dev, parent_ref, nullptr, 0, nullptr,
@@ -134,7 +132,6 @@ __EXPORT void device_make_visible(zx_device_t* dev) {
     devhost_make_visible(dev_ref);
 }
 
-
 __EXPORT const char* device_get_name(zx_device_t* dev) {
     return dev->name;
 }
@@ -166,25 +163,22 @@ __EXPORT void device_state_clr_set(zx_device_t* dev, zx_signals_t clearflag, zx_
     dev->event.signal(clearflag, setflag);
 }
 
-
 __EXPORT zx_off_t device_get_size(zx_device_t* dev) {
     return dev->ops->get_size(dev->ctx);
 }
 
-__EXPORT zx_status_t device_read(zx_device_t* dev, void* buf, size_t count,
-                                 zx_off_t off, size_t* actual) {
+__EXPORT zx_status_t device_read(zx_device_t* dev, void* buf, size_t count, zx_off_t off,
+                                 size_t* actual) {
     return dev->ops->read(dev->ctx, buf, count, off, actual);
 }
 
-__EXPORT zx_status_t device_write(zx_device_t* dev, const void* buf, size_t count,
-                                  zx_off_t off, size_t* actual) {
+__EXPORT zx_status_t device_write(zx_device_t* dev, const void* buf, size_t count, zx_off_t off,
+                                  size_t* actual) {
     return dev->ops->write(dev->ctx, buf, count, off, actual);
 }
 
-__EXPORT zx_status_t device_ioctl(zx_device_t* dev, uint32_t op,
-                                  const void* in_buf, size_t in_len,
-                                  void* out_buf, size_t out_len,
-                                  size_t* out_actual) {
+__EXPORT zx_status_t device_ioctl(zx_device_t* dev, uint32_t op, const void* in_buf, size_t in_len,
+                                  void* out_buf, size_t out_len, size_t* out_actual) {
     return dev->ops->ioctl(dev->ctx, op, in_buf, in_len, out_buf, out_len, out_actual);
 }
 
@@ -198,8 +192,8 @@ __EXPORT zx_handle_t get_root_resource() {
     return root_resource_handle;
 }
 
-__EXPORT zx_status_t load_firmware(zx_device_t* dev, const char* path,
-                                   zx_handle_t* fw, size_t* size) {
+__EXPORT zx_status_t load_firmware(zx_device_t* dev, const char* path, zx_handle_t* fw,
+                                   size_t* size) {
     ApiAutoLock lock;
     fbl::RefPtr<zx_device_t> dev_ref(dev);
     return devhost_load_firmware(dev_ref, path, fw, size);
@@ -230,29 +224,28 @@ zx_status_t device_close(fbl::RefPtr<zx_device_t> dev, uint32_t flags) {
     return devhost_device_close(std::move(dev), flags);
 }
 
-__EXPORT zx_status_t device_get_metadata(zx_device_t* dev, uint32_t type,
-                                         void* buf, size_t buflen, size_t* actual) {
+__EXPORT zx_status_t device_get_metadata(zx_device_t* dev, uint32_t type, void* buf, size_t buflen,
+                                         size_t* actual) {
     ApiAutoLock lock;
     auto dev_ref = fbl::WrapRefPtr(dev);
     return devhost_get_metadata(dev_ref, type, buf, buflen, actual);
 }
 
-__EXPORT zx_status_t device_get_metadata_size(zx_device_t* dev, uint32_t type,
-                                                size_t* out_size) {
+__EXPORT zx_status_t device_get_metadata_size(zx_device_t* dev, uint32_t type, size_t* out_size) {
     ApiAutoLock lock;
     auto dev_ref = fbl::WrapRefPtr(dev);
     return devhost_get_metadata_size(dev_ref, type, out_size);
 }
 
-__EXPORT zx_status_t device_add_metadata(zx_device_t* dev, uint32_t type,
-                                         const void* data, size_t length) {
+__EXPORT zx_status_t device_add_metadata(zx_device_t* dev, uint32_t type, const void* data,
+                                         size_t length) {
     ApiAutoLock lock;
     auto dev_ref = fbl::WrapRefPtr(dev);
     return devhost_add_metadata(dev_ref, type, data, length);
 }
 
-__EXPORT zx_status_t device_publish_metadata(zx_device_t* dev, const char* path,
-                                             uint32_t type, const void* data, size_t length) {
+__EXPORT zx_status_t device_publish_metadata(zx_device_t* dev, const char* path, uint32_t type,
+                                             const void* data, size_t length) {
     ApiAutoLock lock;
     auto dev_ref = fbl::WrapRefPtr(dev);
     return devhost_publish_metadata(dev_ref, path, type, data, length);
diff --git a/system/core/devmgr/devhost/core.cpp b/system/core/devmgr/devhost/core.cpp
index cf5188baca9..72588c9a37d 100644
--- a/system/core/devmgr/devhost/core.cpp
+++ b/system/core/devmgr/devhost/core.cpp
@@ -34,8 +34,8 @@ namespace devmgr {
 #if TRACE
 #define xprintf(fmt...) printf(fmt)
 #else
-#define xprintf(fmt...) \
-    do {                \
+#define xprintf(fmt...)                                                                            \
+    do {                                                                                           \
     } while (0)
 #endif
 
@@ -67,17 +67,16 @@ static zx_status_t default_close(void* ctx, uint32_t flags) {
     return ZX_OK;
 }
 
-static void default_unbind(void* ctx) {
-}
+static void default_unbind(void* ctx) {}
 
-static void default_release(void* ctx) {
-}
+static void default_release(void* ctx) {}
 
 static zx_status_t default_read(void* ctx, void* buf, size_t count, zx_off_t off, size_t* actual) {
     return ZX_ERR_NOT_SUPPORTED;
 }
 
-static zx_status_t default_write(void* ctx, const void* buf, size_t count, zx_off_t off, size_t* actual) {
+static zx_status_t default_write(void* ctx, const void* buf, size_t count, zx_off_t off,
+                                 size_t* actual) {
     return ZX_ERR_NOT_SUPPORTED;
 }
 
@@ -85,9 +84,8 @@ static zx_off_t default_get_size(void* ctx) {
     return 0;
 }
 
-static zx_status_t default_ioctl(void* ctx, uint32_t op,
-                             const void* in_buf, size_t in_len,
-                             void* out_buf, size_t out_len, size_t* out_actual) {
+static zx_status_t default_ioctl(void* ctx, uint32_t op, const void* in_buf, size_t in_len,
+                                 void* out_buf, size_t out_len, size_t* out_actual) {
     return ZX_ERR_NOT_SUPPORTED;
 }
 
@@ -103,8 +101,8 @@ static zx_status_t default_rxrpc(void* ctx, zx_handle_t channel) {
     return ZX_ERR_NOT_SUPPORTED;
 }
 
-static zx_status_t default_message(void *ctx, fidl_msg_t* msg, fidl_txn_t* txn) {
-    fidl_message_header_t* hdr = (fidl_message_header_t*) msg->bytes;
+static zx_status_t default_message(void* ctx, fidl_msg_t* msg, fidl_txn_t* txn) {
+    fidl_message_header_t* hdr = (fidl_message_header_t*)msg->bytes;
     printf("devhost: Unsupported FIDL operation: 0x%x\n", hdr->ordinal);
     zx_handle_close_many(msg->handles, msg->num_handles);
     return ZX_ERR_NOT_SUPPORTED;
@@ -128,54 +126,35 @@ zx_protocol_device_t device_default_ops = []() {
     return ops;
 }();
 
-[[noreturn]]
-static void device_invalid_fatal(void* ctx) {
+[[noreturn]] static void device_invalid_fatal(void* ctx) {
     printf("devhost: FATAL: zx_device_t used after destruction.\n");
     __builtin_trap();
 }
 
 static zx_protocol_device_t device_invalid_ops = []() {
     zx_protocol_device_t ops = {};
-    ops.open = +[](void* ctx, zx_device_t**, uint32_t) -> zx_status_t {
-        device_invalid_fatal(ctx);
-    };
+    ops.open =
+        +[](void* ctx, zx_device_t**, uint32_t) -> zx_status_t { device_invalid_fatal(ctx); };
     ops.open_at = +[](void* ctx, zx_device_t**, const char*, uint32_t) -> zx_status_t {
         device_invalid_fatal(ctx);
     };
-    ops.close = +[](void* ctx, uint32_t) -> zx_status_t {
-        device_invalid_fatal(ctx);
-    };
-    ops.unbind = +[](void* ctx) {
-        device_invalid_fatal(ctx);
-    };
-    ops.release = +[](void* ctx) {
-        device_invalid_fatal(ctx);
-    };
+    ops.close = +[](void* ctx, uint32_t) -> zx_status_t { device_invalid_fatal(ctx); };
+    ops.unbind = +[](void* ctx) { device_invalid_fatal(ctx); };
+    ops.release = +[](void* ctx) { device_invalid_fatal(ctx); };
     ops.read = +[](void* ctx, void*, size_t, size_t, size_t*) -> zx_status_t {
         device_invalid_fatal(ctx);
     };
     ops.write = +[](void* ctx, const void*, size_t, size_t, size_t*) -> zx_status_t {
         device_invalid_fatal(ctx);
     };
-    ops.get_size = +[](void* ctx) -> zx_off_t {
-        device_invalid_fatal(ctx);
-    };
-    ops.ioctl = +[](void* ctx, uint32_t, const void*, size_t, void*, size_t, size_t*)
-        -> zx_status_t {
-        device_invalid_fatal(ctx);
-    };
-    ops.suspend = +[](void* ctx, uint32_t) -> zx_status_t {
-        device_invalid_fatal(ctx);
-    };
-    ops.resume = +[](void* ctx, uint32_t) -> zx_status_t {
-        device_invalid_fatal(ctx);
-    };
-    ops.rxrpc = +[](void* ctx, zx_handle_t) -> zx_status_t {
-        device_invalid_fatal(ctx);
-    };
-    ops.message = +[](void* ctx, fidl_msg_t*, fidl_txn_t*) -> zx_status_t {
-        device_invalid_fatal(ctx);
-    };
+    ops.get_size = +[](void* ctx) -> zx_off_t { device_invalid_fatal(ctx); };
+    ops.ioctl = +[](void* ctx, uint32_t, const void*, size_t, void*, size_t,
+                    size_t*) -> zx_status_t { device_invalid_fatal(ctx); };
+    ops.suspend = +[](void* ctx, uint32_t) -> zx_status_t { device_invalid_fatal(ctx); };
+    ops.resume = +[](void* ctx, uint32_t) -> zx_status_t { device_invalid_fatal(ctx); };
+    ops.rxrpc = +[](void* ctx, zx_handle_t) -> zx_status_t { device_invalid_fatal(ctx); };
+    ops.message =
+        +[](void* ctx, fidl_msg_t*, fidl_txn_t*) -> zx_status_t { device_invalid_fatal(ctx); };
     return ops;
 }();
 
@@ -255,8 +234,7 @@ void devhost_finalize() {
             // If the parent wants rebinding when its children are gone,
             // And the parent is not dead, And this was the last child...
             if ((dev->parent->flags & DEV_FLAG_WANTS_REBIND) &&
-                (!(dev->parent->flags & DEV_FLAG_DEAD)) &&
-                dev->parent->children.is_empty()) {
+                (!(dev->parent->flags & DEV_FLAG_DEAD)) && dev->parent->children.is_empty()) {
                 // Clear the wants rebind flag and request the rebind
                 dev->parent->flags &= (~DEV_FLAG_WANTS_REBIND);
                 devhost_device_bind(dev->parent, "");
@@ -270,7 +248,6 @@ void devhost_finalize() {
     }
 }
 
-
 // enum_lock_{acquire,release}() are used whenever we're iterating
 // on the device tree.  When "enum locked" it is legal to add a new
 // child to the end of a device's list-of-children, but it is not
@@ -288,9 +265,8 @@ static void enum_lock_release() REQ_DM_LOCK {
 }
 
 zx_status_t devhost_device_create(zx_driver_t* drv, const fbl::RefPtr<zx_device_t>& parent,
-                                  const char* name, void* ctx,
-                                  zx_protocol_device_t* ops, fbl::RefPtr<zx_device_t>* out)
-                                  REQ_DM_LOCK {
+                                  const char* name, void* ctx, zx_protocol_device_t* ops,
+                                  fbl::RefPtr<zx_device_t>* out) REQ_DM_LOCK {
 
     if (!drv) {
         printf("devhost: device_add could not find driver!\n");
@@ -330,9 +306,9 @@ zx_status_t devhost_device_create(zx_driver_t* drv, const fbl::RefPtr<zx_device_
     return ZX_OK;
 }
 
-#define DEFAULT_IF_NULL(ops,method) \
-    if (ops->method == nullptr) { \
-        ops->method = default_##method; \
+#define DEFAULT_IF_NULL(ops, method)                                                               \
+    if (ops->method == nullptr) {                                                                  \
+        ops->method = default_##method;                                                            \
     }
 
 static zx_status_t device_validate(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_LOCK {
@@ -351,8 +327,7 @@ static zx_status_t device_validate(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_L
         printf("device add: %p(%s): nullptr ops\n", dev.get(), dev->name);
         return ZX_ERR_INVALID_ARGS;
     }
-    if ((dev->protocol_id == ZX_PROTOCOL_MISC_PARENT) ||
-        (dev->protocol_id == ZX_PROTOCOL_ROOT)) {
+    if ((dev->protocol_id == ZX_PROTOCOL_MISC_PARENT) || (dev->protocol_id == ZX_PROTOCOL_ROOT)) {
         // These protocols is only allowed for the special
         // singleton misc or root parent devices.
         return ZX_ERR_INVALID_ARGS;
@@ -385,8 +360,7 @@ static zx_status_t device_validate(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_L
 zx_status_t devhost_device_add(const fbl::RefPtr<zx_device_t>& dev,
                                const fbl::RefPtr<zx_device_t>& parent,
                                const zx_device_prop_t* props, uint32_t prop_count,
-                               const char* proxy_args, zx::channel client_remote)
-                               REQ_DM_LOCK {
+                               const char* proxy_args, zx::channel client_remote) REQ_DM_LOCK {
     auto fail = [&dev](zx_status_t status) {
         if (dev) {
             dev->flags |= DEV_FLAG_DEAD | DEV_FLAG_VERY_DEAD;
@@ -426,15 +400,14 @@ zx_status_t devhost_device_add(const fbl::RefPtr<zx_device_t>& dev,
     }
 
 #if TRACE_ADD_REMOVE
-    printf("devhost: device add: %p(%s) parent=%p(%s)\n",
-            dev.get(), dev->name, parent.get(), parent->name);
+    printf("devhost: device add: %p(%s) parent=%p(%s)\n", dev.get(), dev->name, parent.get(),
+           parent->name);
 #endif
 
     // Don't create an event handle if we alredy have one
     if (!dev->event.is_valid() &&
         ((status = zx::eventpair::create(0, &dev->event, &dev->local_event)) < 0)) {
-        printf("device add: %p(%s): cannot create event: %d\n",
-               dev.get(), dev->name, status);
+        printf("device add: %p(%s): cannot create event: %d\n", dev.get(), dev->name, status);
         return fail(status);
     }
 
@@ -462,8 +435,7 @@ zx_status_t devhost_device_add(const fbl::RefPtr<zx_device_t>& dev,
         // devhost_add always consumes the handle
         status = devhost_add(parent, dev, proxy_args, props, prop_count, std::move(client_remote));
         if (status < 0) {
-            printf("devhost: %p(%s): remote add failed %d\n",
-                   dev.get(), dev->name, status);
+            printf("devhost: %p(%s): remote add failed %d\n", dev.get(), dev->name, status);
             dev->parent->children.erase(*dev);
             dev->parent.reset();
 
@@ -484,9 +456,7 @@ zx_status_t devhost_device_add(const fbl::RefPtr<zx_device_t>& dev,
     return ZX_OK;
 }
 
-#define REMOVAL_BAD_FLAGS \
-    (DEV_FLAG_DEAD | DEV_FLAG_BUSY |\
-     DEV_FLAG_INSTANCE | DEV_FLAG_MULTI_BIND)
+#define REMOVAL_BAD_FLAGS (DEV_FLAG_DEAD | DEV_FLAG_BUSY | DEV_FLAG_INSTANCE | DEV_FLAG_MULTI_BIND)
 
 static const char* removal_problem(uint32_t flags) {
     if (flags & DEV_FLAG_DEAD) {
@@ -514,8 +484,8 @@ static void devhost_unbind_children(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_
             // Try to get a reference to the child.   This will fail if the last
             // reference to it went away and fbl_recycle() is going to blocked
             // waiting for the DM lock
-            auto child_ref = fbl::MakeRefPtrUpgradeFromRaw(&child,
-                                                           &::devmgr::internal::devhost_api_lock);
+            auto child_ref =
+                fbl::MakeRefPtrUpgradeFromRaw(&child, &::devmgr::internal::devhost_api_lock);
             if (child_ref) {
                 devhost_device_unbind(std::move(child_ref));
             }
@@ -526,8 +496,8 @@ static void devhost_unbind_children(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_
 
 zx_status_t devhost_device_remove(fbl::RefPtr<zx_device_t> dev) REQ_DM_LOCK {
     if (dev->flags & REMOVAL_BAD_FLAGS) {
-        printf("device: %p(%s): cannot be removed (%s)\n",
-               dev.get(), dev->name, removal_problem(dev->flags));
+        printf("device: %p(%s): cannot be removed (%s)\n", dev.get(), dev->name,
+               removal_problem(dev->flags));
         return ZX_ERR_INVALID_ARGS;
     }
 #if TRACE_ADD_REMOVE
@@ -571,9 +541,8 @@ zx_status_t devhost_device_unbind(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_LO
 }
 
 zx_status_t devhost_device_open_at(const fbl::RefPtr<zx_device_t>& dev,
-                                   fbl::RefPtr<zx_device_t>* out,
-                                   const char* path, uint32_t flags)
-                                   REQ_DM_LOCK {
+                                   fbl::RefPtr<zx_device_t>* out, const char* path,
+                                   uint32_t flags) REQ_DM_LOCK {
     if (dev->flags & DEV_FLAG_DEAD) {
         printf("device open: %p(%s) is dead!\n", dev.get(), dev->name);
         return ZX_ERR_BAD_STATE;
@@ -612,7 +581,7 @@ zx_status_t devhost_device_close(fbl::RefPtr<zx_device_t> dev, uint32_t flags) R
 }
 
 static zx_status_t devhost_device_suspend_locked(const fbl::RefPtr<zx_device>& dev,
-                                               uint32_t flags) REQ_DM_LOCK {
+                                                 uint32_t flags) REQ_DM_LOCK {
     // first suspend children (so we suspend from leaf up)
     zx_status_t st;
     for (auto& child : dev->children) {
@@ -620,8 +589,8 @@ static zx_status_t devhost_device_suspend_locked(const fbl::RefPtr<zx_device>& d
             // Try to get a reference to the child.   This will fail if the last
             // reference to it went away and fbl_recycle() is going to blocked
             // waiting for the DM lock
-            auto child_ref = fbl::MakeRefPtrUpgradeFromRaw(&child,
-                                                           &::devmgr::internal::devhost_api_lock);
+            auto child_ref =
+                fbl::MakeRefPtrUpgradeFromRaw(&child, &::devmgr::internal::devhost_api_lock);
             if (child_ref) {
                 st = devhost_device_suspend(std::move(child_ref), flags);
                 if (st != ZX_OK) {
@@ -645,9 +614,8 @@ static zx_status_t devhost_device_suspend_locked(const fbl::RefPtr<zx_device>& d
     }
 }
 
-zx_status_t devhost_device_suspend(const fbl::RefPtr<zx_device>& dev,
-                                   uint32_t flags) REQ_DM_LOCK {
-    //TODO this should eventually be two-pass using SUSPENDING/SUSPENDED flags
+zx_status_t devhost_device_suspend(const fbl::RefPtr<zx_device>& dev, uint32_t flags) REQ_DM_LOCK {
+    // TODO this should eventually be two-pass using SUSPENDING/SUSPENDED flags
     enum_lock_acquire();
     zx_status_t r = devhost_device_suspend_locked(dev, flags);
     enum_lock_release();
diff --git a/system/core/devmgr/devhost/devhost.cpp b/system/core/devmgr/devhost/devhost.cpp
index 7eed1eb344b..0bc58560ece 100644
--- a/system/core/devmgr/devhost/devhost.cpp
+++ b/system/core/devmgr/devhost/devhost.cpp
@@ -14,10 +14,10 @@
 #include <unistd.h>
 #include <utility>
 
+#include <ddk/binding.h>
 #include <ddk/debug.h>
 #include <ddk/device.h>
 #include <ddk/driver.h>
-#include <ddk/binding.h>
 
 #include <zircon/dlfcn.h>
 #include <zircon/process.h>
@@ -70,8 +70,8 @@ struct ProxyIostate : AsyncLoopOwnedRpcHandler<ProxyIostate> {
     // Request the destruction of the proxy connection
     void Cancel();
 
-    static void HandleRpc(fbl::unique_ptr<ProxyIostate> conn,
-                          async_dispatcher_t* dispatcher, async::WaitBase* wait, zx_status_t status,
+    static void HandleRpc(fbl::unique_ptr<ProxyIostate> conn, async_dispatcher_t* dispatcher,
+                          async::WaitBase* wait, zx_status_t status,
                           const zx_packet_signal_t* signal);
 
     fbl::RefPtr<zx_device_t> dev;
@@ -108,6 +108,7 @@ public:
 
     zx_status_t QueueDevcoordinatorConnection(DevcoordinatorConnection* conn);
     zx_status_t QueueProxyConnection(ProxyIostate* conn);
+
 private:
     ConnectionDestroyer() = default;
 
@@ -143,25 +144,25 @@ zx_status_t ConnectionDestroyer::QueueDevcoordinatorConnection(DevcoordinatorCon
 }
 
 void ConnectionDestroyer::Handler(async_dispatcher_t* dispatcher, async::Receiver* receiver,
-                               zx_status_t status, const zx_packet_user_t* data) {
+                                  zx_status_t status, const zx_packet_user_t* data) {
     Type type = static_cast<Type>(data->u64[0]);
     uintptr_t ptr = data->u64[1];
 
     switch (type) {
-        case Type::Devcoordinator: {
-            auto conn = reinterpret_cast<DevcoordinatorConnection*>(ptr);
-            log(TRACE, "devhost: destroying devcoord conn '%p'\n", conn);
-            delete conn;
-            break;
-        }
-        case Type::Proxy: {
-            auto conn = reinterpret_cast<ProxyIostate*>(ptr);
-            log(TRACE, "devhost: destroying proxy conn '%p'\n", conn);
-            delete conn;
-            break;
-        }
-        default:
-            ZX_ASSERT_MSG(false, "Unknown IosDestructionType %" PRIu64 "\n", data->u64[0]);
+    case Type::Devcoordinator: {
+        auto conn = reinterpret_cast<DevcoordinatorConnection*>(ptr);
+        log(TRACE, "devhost: destroying devcoord conn '%p'\n", conn);
+        delete conn;
+        break;
+    }
+    case Type::Proxy: {
+        auto conn = reinterpret_cast<ProxyIostate*>(ptr);
+        log(TRACE, "devhost: destroying proxy conn '%p'\n", conn);
+        delete conn;
+        break;
+    }
+    default:
+        ZX_ASSERT_MSG(false, "Unknown IosDestructionType %" PRIu64 "\n", data->u64[0]);
     }
 }
 
@@ -280,8 +281,9 @@ static zx_status_t dh_find_driver(fbl::StringPiece libname, zx::vmo vmo,
         return new_driver->status();
     }
     if (dr->ops->version != DRIVER_OPS_VERSION) {
-        log(ERROR, "devhost: driver '%s' has bad driver ops version %" PRIx64
-            ", expecting %" PRIx64 "\n", c_libname, dr->ops->version, DRIVER_OPS_VERSION);
+        log(ERROR,
+            "devhost: driver '%s' has bad driver ops version %" PRIx64 ", expecting %" PRIx64 "\n",
+            c_libname, dr->ops->version, DRIVER_OPS_VERSION);
         new_driver->set_status(ZX_ERR_INVALID_ARGS);
         return new_driver->status();
     }
@@ -308,14 +310,15 @@ static zx_status_t dh_find_driver(fbl::StringPiece libname, zx::vmo vmo,
                 break;
             }
         }
-        log(INFO, "devhost: driver '%s': log flags set to: 0x%x\n", new_driver->name(), dr->log_flags);
+        log(INFO, "devhost: driver '%s': log flags set to: 0x%x\n", new_driver->name(),
+            dr->log_flags);
     }
 
     if (new_driver->has_init_op()) {
         new_driver->set_status(new_driver->InitOp());
         if (new_driver->status() != ZX_OK) {
-            log(ERROR, "devhost: driver '%s' failed in init: %d\n",
-                c_libname, new_driver->status());
+            log(ERROR, "devhost: driver '%s' failed in init: %d\n", c_libname,
+                new_driver->status());
         }
     } else {
         new_driver->set_status(ZX_OK);
@@ -364,7 +367,7 @@ static zx_status_t fidl_CreateDeviceStub(void* raw_ctx, zx_handle_t raw_rpc, uin
 
     fbl::RefPtr<zx_device_t> dev;
     zx_status_t r = zx_device::Create(&dev);
-    //TODO: dev->ops and other lifecycle bits
+    // TODO: dev->ops and other lifecycle bits
     // no name means a dummy proxy device
     if (r != ZX_OK) {
         return r;
@@ -399,8 +402,8 @@ static zx_status_t fidl_CreateDevice(void* raw_ctx, zx_handle_t raw_rpc,
     // any API surface until a driver is bound to it.
     // (which can only happen via another message on this thread)
     log(RPC_IN, "devhost[%s] create device drv='%.*s' args='%.*s'\n", ctx->path,
-        static_cast<int>(driver_path_size), driver_path_data,
-        static_cast<int>(proxy_args_size), proxy_args_data);
+        static_cast<int>(driver_path_size), driver_path_data, static_cast<int>(proxy_args_size),
+        proxy_args_data);
 
     auto newconn = fbl::make_unique<DevcoordinatorConnection>();
     if (!newconn) {
@@ -434,7 +437,8 @@ static zx_status_t fidl_CreateDevice(void* raw_ctx, zx_handle_t raw_rpc,
         memcpy(proxy_args, proxy_args_data, proxy_args_size);
         proxy_args[proxy_args_size] = 0;
 
-        r = drv->CreateOp(&creation_context, creation_context.parent, "proxy", proxy_args, parent_proxy.release());
+        r = drv->CreateOp(&creation_context, creation_context.parent, "proxy", proxy_args,
+                          parent_proxy.release());
 
         // Suppress a warning about dummy device being in a bad state.  The
         // message is spurious in this case, since the dummy parent never
@@ -455,7 +459,7 @@ static zx_status_t fidl_CreateDevice(void* raw_ctx, zx_handle_t raw_rpc,
         log(ERROR, "devhost[%s] driver create() not supported\n", ctx->path);
         return ZX_ERR_NOT_SUPPORTED;
     }
-    //TODO: inform devcoord
+    // TODO: inform devcoord
 
     newconn->set_channel(std::move(rpc));
     log(RPC_IN, "devhost[%s] creating '%.*s' conn=%p\n", ctx->path,
@@ -474,9 +478,9 @@ static zx_status_t fidl_BindDriver(void* raw_ctx, const char* driver_path_data,
     zx::vmo driver_vmo(raw_driver_vmo);
     fbl::StringPiece driver_path(driver_path_data, driver_path_size);
 
-    //TODO: api lock integration
-    log(RPC_IN, "devhost[%s] bind driver '%.*s'\n", ctx->path,
-        static_cast<int>(driver_path_size), driver_path_data);
+    // TODO: api lock integration
+    log(RPC_IN, "devhost[%s] bind driver '%.*s'\n", ctx->path, static_cast<int>(driver_path_size),
+        driver_path_data);
     fbl::RefPtr<zx_driver_t> drv;
     if (ctx->conn->dev->flags & DEV_FLAG_DEAD) {
         log(ERROR, "devhost[%s] bind to removed device disallowed\n", ctx->path);
@@ -503,14 +507,14 @@ static zx_status_t fidl_BindDriver(void* raw_ctx, const char* driver_path_data,
         }
         if (r != ZX_OK) {
             log(ERROR, "devhost[%s] bind driver '%.*s' failed: %d\n", ctx->path,
-                   static_cast<int>(driver_path_size), driver_path_data, r);
+                static_cast<int>(driver_path_size), driver_path_data, r);
         }
         return fuchsia_device_manager_ControllerBindDriver_reply(txn, r);
     }
 
     if (!drv->has_create_op()) {
-        log(ERROR, "devhost[%s] neither create nor bind are implemented: '%.*s'\n",
-            ctx->path, static_cast<int>(driver_path_size), driver_path_data);
+        log(ERROR, "devhost[%s] neither create nor bind are implemented: '%.*s'\n", ctx->path,
+            static_cast<int>(driver_path_size), driver_path_data);
     }
     return fuchsia_device_manager_ControllerBindDriver_reply(txn, ZX_ERR_NOT_SUPPORTED);
 }
@@ -610,7 +614,7 @@ static zx_status_t dh_handle_rpc_read(zx_handle_t h, DevcoordinatorConnection* c
     }
 
     FidlTxn txn(zx::unowned_channel(h), hdr->txid);
-    DevhostRpcReadContext read_ctx = { path, conn };
+    DevhostRpcReadContext read_ctx = {path, conn};
     return fuchsia_device_manager_Controller_dispatch(&read_ctx, txn.fidl_txn(), &fidl_msg,
                                                       &fidl_ops);
 }
@@ -773,7 +777,6 @@ static void proxy_ios_destroy(const fbl::RefPtr<zx_device_t>& dev) {
     dev->proxy_ios = nullptr;
 }
 
-
 #define LOGBUF_MAX (ZX_LOG_RECORD_MAX - sizeof(zx_log_record_t))
 
 static zx::debuglog devhost_log_handle;
@@ -841,8 +844,8 @@ __EXPORT void driver_printf(uint32_t flags, const char* fmt, ...) {
 
 namespace devmgr {
 
-static zx_status_t devhost_log_write(zxio_t* io, const void* buffer,
-                                     size_t capacity, size_t* out_actual) {
+static zx_status_t devhost_log_write(zxio_t* io, const void* buffer, size_t capacity,
+                                     size_t* out_actual) {
     devhost_log_write_internal(0, buffer, capacity);
     *out_actual = capacity;
     return ZX_OK;
@@ -901,16 +904,16 @@ zx_status_t devhost_add(const fbl::RefPtr<zx_device_t>& parent,
     static_assert(sizeof(zx_device_prop_t) == sizeof(uint64_t));
     if (add_invisible) {
         status = fuchsia_device_manager_CoordinatorAddDeviceInvisible(
-                rpc.get(), hsend.release(), reinterpret_cast<const uint64_t*>(props), prop_count,
-                child->name, strlen(child->name), child->protocol_id,
-                child->driver->libname().data(), child->driver->libname().size(), proxy_args,
-                proxy_args_len, client_remote.release(), &call_status);
+            rpc.get(), hsend.release(), reinterpret_cast<const uint64_t*>(props), prop_count,
+            child->name, strlen(child->name), child->protocol_id, child->driver->libname().data(),
+            child->driver->libname().size(), proxy_args, proxy_args_len, client_remote.release(),
+            &call_status);
     } else {
         status = fuchsia_device_manager_CoordinatorAddDevice(
-                rpc.get(), hsend.release(), reinterpret_cast<const uint64_t*>(props), prop_count,
-                child->name, strlen(child->name), child->protocol_id,
-                child->driver->libname().data(), child->driver->libname().size(), proxy_args,
-                proxy_args_len, client_remote.release(), &call_status);
+            rpc.get(), hsend.release(), reinterpret_cast<const uint64_t*>(props), prop_count,
+            child->name, strlen(child->name), child->protocol_id, child->driver->libname().data(),
+            child->driver->libname().size(), proxy_args, proxy_args_len, client_remote.release(),
+            &call_status);
     }
     if (status != ZX_OK) {
         log(ERROR, "devhost[%s] add '%s': rpc sending failed: %d\n", path, child->name, status);
@@ -957,8 +960,7 @@ void devhost_make_visible(const fbl::RefPtr<zx_device_t>& dev) {
     // TODO(teisenbe): Handle failures here...
     log_rpc(dev, "make-visible");
     zx_status_t call_status;
-    zx_status_t status = fuchsia_device_manager_CoordinatorMakeVisible(
-            rpc.get(), &call_status);
+    zx_status_t status = fuchsia_device_manager_CoordinatorMakeVisible(rpc.get(), &call_status);
     log_rpc_result("make-visible", status, call_status);
 }
 
@@ -1024,7 +1026,7 @@ zx_status_t devhost_get_topo_path(const fbl::RefPtr<zx_device_t>& dev, char* pat
     log_rpc(remote_dev, "get-topo-path");
     zx_status_t call_status;
     zx_status_t status = fuchsia_device_manager_CoordinatorGetTopologicalPath(
-            rpc.get(), &call_status, path, max - 1, actual);
+        rpc.get(), &call_status, path, max - 1, actual);
     log_rpc_result("get-topo-path", status, call_status);
     if (status != ZX_OK) {
         return status;
@@ -1051,7 +1053,7 @@ zx_status_t devhost_device_bind(const fbl::RefPtr<zx_device_t>& dev, const char*
     log_rpc(dev, "bind-device");
     zx_status_t call_status;
     zx_status_t status = fuchsia_device_manager_CoordinatorBindDevice(
-            rpc.get(), drv_libname, strlen(drv_libname), &call_status);
+        rpc.get(), drv_libname, strlen(drv_libname), &call_status);
     log_rpc_result("bind-device", status, call_status);
     if (status != ZX_OK) {
         return status;
@@ -1072,7 +1074,7 @@ zx_status_t devhost_load_firmware(const fbl::RefPtr<zx_device_t>& dev, const cha
     log_rpc(dev, "load-firmware");
     zx_status_t call_status;
     zx_status_t status = fuchsia_device_manager_CoordinatorLoadFirmware(
-            rpc.get(), path, strlen(path), &call_status, vmo, size);
+        rpc.get(), path, strlen(path), &call_status, vmo, size);
     log_rpc_result("load-firmware", status, call_status);
     if (status != ZX_OK) {
         return status;
@@ -1098,7 +1100,7 @@ zx_status_t devhost_get_metadata(const fbl::RefPtr<zx_device_t>& dev, uint32_t t
     log_rpc(dev, "get-metadata");
     zx_status_t call_status;
     zx_status_t status = fuchsia_device_manager_CoordinatorGetMetadata(
-            rpc.get(), type, &call_status, data, sizeof(data), &length);
+        rpc.get(), type, &call_status, data, sizeof(data), &length);
     if (status != ZX_OK) {
         log(ERROR, "devhost: rpc:get-metadata sending failed: %d\n", status);
         return status;
@@ -1118,7 +1120,7 @@ zx_status_t devhost_get_metadata(const fbl::RefPtr<zx_device_t>& dev, uint32_t t
 }
 
 zx_status_t devhost_get_metadata_size(const fbl::RefPtr<zx_device_t>& dev, uint32_t type,
-                                        size_t* out_length) {
+                                      size_t* out_length) {
 
     const zx::channel& rpc = *dev->rpc;
     if (!rpc.is_valid()) {
@@ -1127,7 +1129,7 @@ zx_status_t devhost_get_metadata_size(const fbl::RefPtr<zx_device_t>& dev, uint3
     log_rpc(dev, "get-metadata");
     zx_status_t call_status;
     zx_status_t status = fuchsia_device_manager_CoordinatorGetMetadataSize(
-            rpc.get(), type, &call_status, out_length);
+        rpc.get(), type, &call_status, out_length);
     if (status != ZX_OK) {
         log(ERROR, "devhost: rpc:get-metadata sending failed: %d\n", status);
         return status;
@@ -1153,7 +1155,7 @@ zx_status_t devhost_add_metadata(const fbl::RefPtr<zx_device_t>& dev, uint32_t t
     log_rpc(dev, "add-metadata");
     zx_status_t call_status;
     zx_status_t status = fuchsia_device_manager_CoordinatorAddMetadata(
-            rpc.get(), type, reinterpret_cast<const uint8_t*>(data), length, &call_status);
+        rpc.get(), type, reinterpret_cast<const uint8_t*>(data), length, &call_status);
     log_rpc_result("add-metadata", status, call_status);
     if (status != ZX_OK) {
         return status;
@@ -1161,9 +1163,8 @@ zx_status_t devhost_add_metadata(const fbl::RefPtr<zx_device_t>& dev, uint32_t t
     return call_status;
 }
 
-zx_status_t devhost_publish_metadata(const fbl::RefPtr<zx_device_t>& dev,
-                                     const char* path, uint32_t type,
-                                     const void* data, size_t length) {
+zx_status_t devhost_publish_metadata(const fbl::RefPtr<zx_device_t>& dev, const char* path,
+                                     uint32_t type, const void* data, size_t length) {
     if (!path || (!data && length)) {
         return ZX_ERR_INVALID_ARGS;
     }
@@ -1174,8 +1175,8 @@ zx_status_t devhost_publish_metadata(const fbl::RefPtr<zx_device_t>& dev,
     log_rpc(dev, "publish-metadata");
     zx_status_t call_status;
     zx_status_t status = fuchsia_device_manager_CoordinatorPublishMetadata(
-            rpc.get(), path, strlen(path), type, reinterpret_cast<const uint8_t*>(data), length,
-            &call_status);
+        rpc.get(), path, strlen(path), type, reinterpret_cast<const uint8_t*>(data), length,
+        &call_status);
     log_rpc_result("publish-metadata", status, call_status);
     if (status != ZX_OK) {
         return status;
@@ -1185,7 +1186,6 @@ zx_status_t devhost_publish_metadata(const fbl::RefPtr<zx_device_t>& dev,
 
 zx_handle_t root_resource_handle;
 
-
 zx_status_t devhost_start_connection(fbl::unique_ptr<DevfsConnection> conn, zx::channel h) {
     conn->set_channel(std::move(h));
     return DevfsConnection::BeginWait(std::move(conn), DevhostAsyncLoop()->dispatcher());
diff --git a/system/core/devmgr/devhost/devhost.h b/system/core/devmgr/devhost/devhost.h
index 6eb5c5b0d92..ccf4e54bf1a 100644
--- a/system/core/devmgr/devhost/devhost.h
+++ b/system/core/devmgr/devhost/devhost.h
@@ -4,9 +4,9 @@
 
 #pragma once
 
-#include "lock.h"
-#include "device-internal.h"
 #include "../shared/async-loop-owned-rpc-handler.h"
+#include "device-internal.h"
+#include "lock.h"
 
 #include <ddk/binding.h>
 #include <ddk/device.h>
@@ -24,8 +24,8 @@
 #include <zircon/thread_annotations.h>
 #include <zircon/types.h>
 
-#include <threads.h>
 #include <stdint.h>
+#include <threads.h>
 
 namespace devmgr {
 
@@ -46,64 +46,37 @@ void devhost_set_creation_context(CreationContext* ctx);
 // Safe external APIs are in device.h and device_internal.h
 
 // Note that this must be a struct to match the public opaque declaration.
-struct zx_driver : fbl::DoublyLinkedListable<fbl::RefPtr<zx_driver>>,
-                   fbl::RefCounted<zx_driver> {
+struct zx_driver : fbl::DoublyLinkedListable<fbl::RefPtr<zx_driver>>, fbl::RefCounted<zx_driver> {
     static zx_status_t Create(fbl::RefPtr<zx_driver>* out_driver);
 
-    const char* name() const {
-        return name_;
-    }
+    const char* name() const { return name_; }
 
-    zx_driver_rec_t* driver_rec() const {
-        return driver_rec_;
-    }
+    zx_driver_rec_t* driver_rec() const { return driver_rec_; }
 
-    zx_status_t status() const {
-        return status_;
-    }
+    zx_status_t status() const { return status_; }
 
-    const fbl::String& libname() const {
-        return libname_;
-    }
+    const fbl::String& libname() const { return libname_; }
 
-    void set_name(const char* name) {
-        name_ = name;
-    }
+    void set_name(const char* name) { name_ = name; }
 
-    void set_driver_rec(zx_driver_rec_t* driver_rec) {
-        driver_rec_ = driver_rec;
-    }
+    void set_driver_rec(zx_driver_rec_t* driver_rec) { driver_rec_ = driver_rec; }
 
-    void set_ops(const zx_driver_ops_t* ops) {
-        ops_ = ops;
-    }
+    void set_ops(const zx_driver_ops_t* ops) { ops_ = ops; }
 
-    void set_status(zx_status_t status) {
-        status_ = status;
-    }
+    void set_status(zx_status_t status) { status_ = status; }
 
-    void set_libname(fbl::StringPiece libname) {
-        libname_ = libname;
-    }
+    void set_libname(fbl::StringPiece libname) { libname_ = libname; }
 
     // Interface to |ops|. These names contain Op in order to not
     // collide with e.g. RefPtr names.
 
-    bool has_init_op() const {
-        return ops_->init != nullptr;
-    }
+    bool has_init_op() const { return ops_->init != nullptr; }
 
-    bool has_bind_op() const {
-        return ops_->bind != nullptr;
-    }
+    bool has_bind_op() const { return ops_->bind != nullptr; }
 
-    bool has_create_op() const {
-        return ops_->create != nullptr;
-    }
+    bool has_create_op() const { return ops_->create != nullptr; }
 
-    zx_status_t InitOp() {
-        return ops_->init(&ctx_);
-    }
+    zx_status_t InitOp() { return ops_->init(&ctx_); }
 
     zx_status_t BindOp(devmgr::CreationContext* creation_context,
                        const fbl::RefPtr<zx_device_t>& device) const {
@@ -152,16 +125,16 @@ zx_status_t devhost_device_add(const fbl::RefPtr<zx_device_t>& dev,
 // Note that devhost_device_remove() takes a RefPtr rather than a const RefPtr&.
 // It intends to consume a reference.
 zx_status_t devhost_device_remove(fbl::RefPtr<zx_device_t> dev) REQ_DM_LOCK;
-zx_status_t devhost_device_bind(const fbl::RefPtr<zx_device_t>& dev, const char* drv_libname) REQ_DM_LOCK;
+zx_status_t devhost_device_bind(const fbl::RefPtr<zx_device_t>& dev,
+                                const char* drv_libname) REQ_DM_LOCK;
 zx_status_t devhost_device_rebind(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_LOCK;
 zx_status_t devhost_device_unbind(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_LOCK;
 zx_status_t devhost_device_create(zx_driver_t* drv, const fbl::RefPtr<zx_device_t>& parent,
-                                  const char* name, void* ctx,
-                                  zx_protocol_device_t* ops,
+                                  const char* name, void* ctx, zx_protocol_device_t* ops,
                                   fbl::RefPtr<zx_device_t>* out) REQ_DM_LOCK;
 zx_status_t devhost_device_open_at(const fbl::RefPtr<zx_device_t>& dev,
-                                   fbl::RefPtr<zx_device_t>* out,
-                                   const char* path, uint32_t flags) REQ_DM_LOCK;
+                                   fbl::RefPtr<zx_device_t>* out, const char* path,
+                                   uint32_t flags) REQ_DM_LOCK;
 zx_status_t devhost_device_close(fbl::RefPtr<zx_device_t> dev, uint32_t flags) REQ_DM_LOCK;
 zx_status_t devhost_device_suspend(const fbl::RefPtr<zx_device_t>& dev, uint32_t flags) REQ_DM_LOCK;
 void devhost_device_destroy(zx_device_t* dev) REQ_DM_LOCK;
@@ -169,14 +142,14 @@ void devhost_device_destroy(zx_device_t* dev) REQ_DM_LOCK;
 zx_status_t devhost_load_firmware(const fbl::RefPtr<zx_device_t>& dev, const char* path,
                                   zx_handle_t* fw, size_t* size) REQ_DM_LOCK;
 
-zx_status_t devhost_get_topo_path(const fbl::RefPtr<zx_device_t>& dev, char* path,
-                                  size_t max, size_t* actual);
+zx_status_t devhost_get_topo_path(const fbl::RefPtr<zx_device_t>& dev, char* path, size_t max,
+                                  size_t* actual);
 
 zx_status_t devhost_get_metadata(const fbl::RefPtr<zx_device_t>& dev, uint32_t type, void* buf,
                                  size_t buflen, size_t* actual) REQ_DM_LOCK;
 
 zx_status_t devhost_get_metadata_size(const fbl::RefPtr<zx_device_t>& dev, uint32_t type,
-                                        size_t* size) REQ_DM_LOCK;
+                                      size_t* size) REQ_DM_LOCK;
 
 zx_status_t devhost_add_metadata(const fbl::RefPtr<zx_device_t>& dev, uint32_t type,
                                  const void* data, size_t length) REQ_DM_LOCK;
@@ -198,8 +171,8 @@ struct DevcoordinatorConnection : AsyncLoopOwnedRpcHandler<DevcoordinatorConnect
 struct DevfsConnection : AsyncLoopOwnedRpcHandler<DevfsConnection> {
     DevfsConnection() = default;
 
-    static void HandleRpc(fbl::unique_ptr<DevfsConnection> conn,
-                          async_dispatcher_t* dispatcher, async::WaitBase* wait, zx_status_t status,
+    static void HandleRpc(fbl::unique_ptr<DevfsConnection> conn, async_dispatcher_t* dispatcher,
+                          async::WaitBase* wait, zx_status_t status,
                           const zx_packet_signal_t* signal);
 
     fbl::RefPtr<zx_device_t> dev;
@@ -222,9 +195,8 @@ zx_status_t devhost_start_connection(fbl::unique_ptr<DevfsConnection> ios, zx::c
 // routines devhost uses to talk to dev coordinator
 // |client_remote| will only be a valid handle if the device was added with
 // DEVICE_ADD_INVISIBLE or DEVICE_ADD_MUST_ISOLATE.
-zx_status_t devhost_add(const fbl::RefPtr<zx_device_t>& dev,
-                        const fbl::RefPtr<zx_device_t>& child, const char* proxy_args,
-                        const zx_device_prop_t* props, uint32_t prop_count,
+zx_status_t devhost_add(const fbl::RefPtr<zx_device_t>& dev, const fbl::RefPtr<zx_device_t>& child,
+                        const char* proxy_args, const zx_device_prop_t* props, uint32_t prop_count,
                         zx::channel client_remote) REQ_DM_LOCK;
 zx_status_t devhost_remove(const fbl::RefPtr<zx_device_t>& dev) REQ_DM_LOCK;
 void devhost_make_visible(const fbl::RefPtr<zx_device_t>& dev);
diff --git a/system/core/devmgr/devhost/device-internal.h b/system/core/devmgr/devhost/device-internal.h
index 0131aa02cd0..b9f0f0a0460 100644
--- a/system/core/devmgr/devhost/device-internal.h
+++ b/system/core/devmgr/devhost/device-internal.h
@@ -26,7 +26,7 @@ struct ProxyIostate;
 #define DEV_MAGIC 'MDEV'
 
 // This needs to be a struct, not a class, to match the public definition
-struct zx_device : fbl::RefCountedUpgradeable<zx_device>, fbl::Recyclable<zx_device>  {
+struct zx_device : fbl::RefCountedUpgradeable<zx_device>, fbl::Recyclable<zx_device> {
     ~zx_device() = default;
 
     zx_device(const zx_device&) = delete;
@@ -42,48 +42,32 @@ struct zx_device : fbl::RefCountedUpgradeable<zx_device>, fbl::Recyclable<zx_dev
         return ops->open_at(ctx, dev_out, path, flags);
     }
 
-    zx_status_t CloseOp(uint32_t flags) {
-        return ops->close(ctx, flags);
-    }
+    zx_status_t CloseOp(uint32_t flags) { return ops->close(ctx, flags); }
 
-    void UnbindOp() {
-        ops->unbind(ctx);
-    }
+    void UnbindOp() { ops->unbind(ctx); }
 
-    void ReleaseOp() {
-        ops->release(ctx);
-    }
+    void ReleaseOp() { ops->release(ctx); }
 
-    zx_status_t SuspendOp(uint32_t flags) {
-        return ops->suspend(ctx, flags);
-    }
+    zx_status_t SuspendOp(uint32_t flags) { return ops->suspend(ctx, flags); }
 
-    zx_status_t ResumeOp(uint32_t flags) {
-        return ops->resume(ctx, flags);
-    }
+    zx_status_t ResumeOp(uint32_t flags) { return ops->resume(ctx, flags); }
 
-    zx_status_t ReadOp(void* buf, size_t count, zx_off_t off,
-                       size_t* actual) {
+    zx_status_t ReadOp(void* buf, size_t count, zx_off_t off, size_t* actual) {
         return ops->read(ctx, buf, count, off, actual);
     }
 
-    zx_status_t WriteOp(const void* buf, size_t count,
-                        zx_off_t off, size_t* actual) {
+    zx_status_t WriteOp(const void* buf, size_t count, zx_off_t off, size_t* actual) {
         return ops->write(ctx, buf, count, off, actual);
     }
 
-    zx_off_t GetSizeOp() {
-        return ops->get_size(ctx);
-    }
+    zx_off_t GetSizeOp() { return ops->get_size(ctx); }
 
-    zx_status_t IoctlOp(uint32_t op, const void* in_buf, size_t in_len,
-                        void* out_buf, size_t out_len, size_t* out_actual) {
+    zx_status_t IoctlOp(uint32_t op, const void* in_buf, size_t in_len, void* out_buf,
+                        size_t out_len, size_t* out_actual) {
         return ops->ioctl(ctx, op, in_buf, in_len, out_buf, out_len, out_actual);
     }
 
-    zx_status_t MessageOp(fidl_msg_t* msg, fidl_txn_t* txn) {
-        return ops->message(ctx, msg, txn);
-    }
+    zx_status_t MessageOp(fidl_msg_t* msg, fidl_txn_t* txn) { return ops->message(ctx, msg, txn); }
 
     uintptr_t magic = DEV_MAGIC;
 
@@ -113,8 +97,7 @@ struct zx_device : fbl::RefCountedUpgradeable<zx_device>, fbl::Recyclable<zx_dev
     // for the parent's device_list
     fbl::DoublyLinkedListNodeState<zx_device*> node;
     struct Node {
-        static fbl::DoublyLinkedListNodeState<zx_device*>& node_state(
-            zx_device& obj) {
+        static fbl::DoublyLinkedListNodeState<zx_device*>& node_state(zx_device& obj) {
             return obj.node;
         }
     };
@@ -125,8 +108,7 @@ struct zx_device : fbl::RefCountedUpgradeable<zx_device>, fbl::Recyclable<zx_dev
     // list node for the defer_device_list
     fbl::DoublyLinkedListNodeState<zx_device*> defer;
     struct DeferNode {
-        static fbl::DoublyLinkedListNodeState<zx_device*>& node_state(
-            zx_device& obj) {
+        static fbl::DoublyLinkedListNodeState<zx_device*>& node_state(zx_device& obj) {
             return obj.defer;
         }
     };
@@ -140,6 +122,7 @@ struct zx_device : fbl::RefCountedUpgradeable<zx_device>, fbl::Recyclable<zx_dev
     devmgr::ProxyIostate* proxy_ios TA_GUARDED(proxy_ios_lock) = nullptr;
 
     char name[ZX_DEVICE_NAME_MAX + 1] = {};
+
 private:
     zx_device() = default;
 
@@ -153,6 +136,8 @@ private:
 // fields which it may fill out after init and before device_add() is called,
 // and the ctx field which may be used to store driver-specific data.
 
+// clang-format off
+
 #define DEV_FLAG_DEAD           0x00000001  // being deleted
 #define DEV_FLAG_VERY_DEAD      0x00000002  // safe for ref0 and release()
 #define DEV_FLAG_UNBINDABLE     0x00000004  // nobody may bind to this device
@@ -164,6 +149,8 @@ private:
 #define DEV_FLAG_UNBOUND        0x00000400  // informed that it should self-delete asap
 #define DEV_FLAG_WANTS_REBIND   0x00000800  // when last child goes, rebind this device
 
+// clang-format on
+
 zx_status_t device_bind(const fbl::RefPtr<zx_device_t>& dev, const char* drv_libname);
 zx_status_t device_unbind(const fbl::RefPtr<zx_device_t>& dev);
 zx_status_t device_open_at(const fbl::RefPtr<zx_device_t>& dev, fbl::RefPtr<zx_device_t>* out,
diff --git a/system/core/devmgr/devhost/lock.h b/system/core/devmgr/devhost/lock.h
index f81521d401a..07813c25fbe 100644
--- a/system/core/devmgr/devhost/lock.h
+++ b/system/core/devmgr/devhost/lock.h
@@ -36,22 +36,14 @@ static inline bool DM_LOCK_HELD() {
 
 class ApiAutoLock {
 public:
-    ApiAutoLock() TA_ACQ(&::devmgr::internal::devhost_api_lock) {
-        DM_LOCK();
-    }
-    ~ApiAutoLock() TA_REL(&::devmgr::internal::devhost_api_lock) {
-        DM_UNLOCK();
-    }
+    ApiAutoLock() TA_ACQ(&::devmgr::internal::devhost_api_lock) { DM_LOCK(); }
+    ~ApiAutoLock() TA_REL(&::devmgr::internal::devhost_api_lock) { DM_UNLOCK(); }
 };
 
 class ApiAutoRelock {
 public:
-    ApiAutoRelock() TA_REL(&::devmgr::internal::devhost_api_lock) {
-        DM_UNLOCK();
-    }
-    ~ApiAutoRelock() TA_ACQ(&::devmgr::internal::devhost_api_lock) {
-        DM_LOCK();
-    }
+    ApiAutoRelock() TA_REL(&::devmgr::internal::devhost_api_lock) { DM_UNLOCK(); }
+    ~ApiAutoRelock() TA_ACQ(&::devmgr::internal::devhost_api_lock) { DM_LOCK(); }
 };
 
 } // namespace devmgr
diff --git a/system/core/devmgr/devhost/rpc-server.cpp b/system/core/devmgr/devhost/rpc-server.cpp
index 807e9d6ae87..810b939c2b6 100644
--- a/system/core/devmgr/devhost/rpc-server.cpp
+++ b/system/core/devmgr/devhost/rpc-server.cpp
@@ -15,9 +15,9 @@
 #include <threads.h>
 #include <utility>
 
-#include <lib/sync/completion.h>
 #include <ddk/device.h>
 #include <ddk/driver.h>
+#include <lib/sync/completion.h>
 
 #include <zircon/device/device.h>
 #include <zircon/device/vfs.h>
@@ -51,8 +51,7 @@ void describe_error(zx::channel h, zx_status_t status) {
     h.write(0, &msg, sizeof(msg), nullptr, 0);
 }
 
-static zx_status_t create_description(const fbl::RefPtr<zx_device_t>& dev,
-                                      fs::OnOpenMsg* msg,
+static zx_status_t create_description(const fbl::RefPtr<zx_device_t>& dev, fs::OnOpenMsg* msg,
                                       zx::eventpair* handle) {
     memset(msg, 0, sizeof(*msg));
     msg->primary.hdr.ordinal = fuchsia_io_NodeOnOpenOrdinal;
@@ -96,8 +95,8 @@ static zx_status_t devhost_get_handles(zx::channel rh, const fbl::RefPtr<zx_devi
     fbl::RefPtr<zx_device_t> new_dev;
     r = device_open_at(dev, &new_dev, path, flags);
     if (r != ZX_OK) {
-        fprintf(stderr, "devhost_get_handles(%p:%s) open path='%s', r=%d\n",
-                dev.get(), dev->name, path ? path : "", r);
+        fprintf(stderr, "devhost_get_handles(%p:%s) open path='%s', r=%d\n", dev.get(), dev->name,
+                path ? path : "", r);
         goto fail;
     }
     newconn->dev = new_dev;
@@ -232,7 +231,7 @@ static ssize_t do_ioctl(const fbl::RefPtr<zx_device_t>& dev, uint32_t op, const
         if (out_len < sizeof(uint32_t)) {
             return ZX_ERR_BUFFER_TOO_SMALL;
         }
-        *((uint32_t *)out_buf) = dev->driver->driver_rec()->log_flags;
+        *((uint32_t*)out_buf) = dev->driver->driver_rec()->log_flags;
         *out_actual = sizeof(uint32_t);
         return ZX_OK;
     }
@@ -243,7 +242,7 @@ static ssize_t do_ioctl(const fbl::RefPtr<zx_device_t>& dev, uint32_t op, const
         if (in_len < sizeof(driver_log_flags_t)) {
             return ZX_ERR_BUFFER_TOO_SMALL;
         }
-        driver_log_flags_t* flags = (driver_log_flags_t *)in_buf;
+        driver_log_flags_t* flags = (driver_log_flags_t*)in_buf;
         dev->driver->driver_rec()->log_flags &= ~flags->clear;
         dev->driver->driver_rec()->log_flags |= flags->set;
         *out_actual = sizeof(driver_log_flags_t);
@@ -301,7 +300,7 @@ zx_status_t devhost_device_connect(const fbl::RefPtr<zx_device_t>& dev, uint32_t
     // TODO(smklein): Avoid assuming paths are null-terminated; this is only
     // safe because the path is the last secondary object in the DirectoryOpen
     // request.
-    ((char*) path_data)[path_size] = 0;
+    ((char*)path_data)[path_size] = 0;
 
     if (!strcmp(path_data, ".")) {
         path_data = nullptr;
@@ -322,8 +321,8 @@ static zx_status_t fidl_directory_open(void* ctx, uint32_t flags, uint32_t mode,
     return devhost_device_connect(conn->dev, flags, path_data, path_size, std::move(c));
 }
 
-static zx_status_t fidl_directory_unlink(void* ctx, const char* path_data,
-                                         size_t path_size, fidl_txn_t* txn) {
+static zx_status_t fidl_directory_unlink(void* ctx, const char* path_data, size_t path_size,
+                                         fidl_txn_t* txn) {
     return fuchsia_io_DirectoryUnlink_reply(txn, ZX_ERR_NOT_SUPPORTED);
 }
 
@@ -339,18 +338,16 @@ static zx_status_t fidl_directory_gettoken(void* ctx, fidl_txn_t* txn) {
     return fuchsia_io_DirectoryGetToken_reply(txn, ZX_ERR_NOT_SUPPORTED, ZX_HANDLE_INVALID);
 }
 
-static zx_status_t fidl_directory_rename(void* ctx, const char* src_data,
-                                         size_t src_size, zx_handle_t dst_parent_token,
-                                         const char* dst_data, size_t dst_size,
-                                         fidl_txn_t* txn) {
+static zx_status_t fidl_directory_rename(void* ctx, const char* src_data, size_t src_size,
+                                         zx_handle_t dst_parent_token, const char* dst_data,
+                                         size_t dst_size, fidl_txn_t* txn) {
     zx_handle_close(dst_parent_token);
     return fuchsia_io_DirectoryRename_reply(txn, ZX_ERR_NOT_SUPPORTED);
 }
 
-static zx_status_t fidl_directory_link(void* ctx, const char* src_data,
-                                       size_t src_size, zx_handle_t dst_parent_token,
-                                       const char* dst_data, size_t dst_size,
-                                       fidl_txn_t* txn) {
+static zx_status_t fidl_directory_link(void* ctx, const char* src_data, size_t src_size,
+                                       zx_handle_t dst_parent_token, const char* dst_data,
+                                       size_t dst_size, fidl_txn_t* txn) {
     zx_handle_close(dst_parent_token);
     return fuchsia_io_DirectoryLink_reply(txn, ZX_ERR_NOT_SUPPORTED);
 }
@@ -391,9 +388,9 @@ static zx_status_t fidl_directory_admin_mount(void* ctx, zx_handle_t h, fidl_txn
     return fuchsia_io_DirectoryAdminMount_reply(txn, ZX_ERR_NOT_SUPPORTED);
 }
 
-static zx_status_t fidl_directory_admin_mount_and_create(void* ctx, zx_handle_t h,
-                                                         const char* name, size_t len,
-                                                         uint32_t flags, fidl_txn_t* txn) {
+static zx_status_t fidl_directory_admin_mount_and_create(void* ctx, zx_handle_t h, const char* name,
+                                                         size_t len, uint32_t flags,
+                                                         fidl_txn_t* txn) {
     zx_handle_close(h);
     return fuchsia_io_DirectoryAdminMountAndCreate_reply(txn, ZX_ERR_NOT_SUPPORTED);
 }
@@ -403,21 +400,19 @@ static zx_status_t fidl_directory_admin_unmount(void* ctx, fidl_txn_t* txn) {
 }
 
 static zx_status_t fidl_directory_admin_unmount_node(void* ctx, fidl_txn_t* txn) {
-    return fuchsia_io_DirectoryAdminUnmountNode_reply(txn, ZX_ERR_NOT_SUPPORTED,
-                                                      ZX_HANDLE_INVALID);
+    return fuchsia_io_DirectoryAdminUnmountNode_reply(txn, ZX_ERR_NOT_SUPPORTED, ZX_HANDLE_INVALID);
 }
 
 static zx_status_t fidl_directory_admin_query_filesystem(void* ctx, fidl_txn_t* txn) {
     fuchsia_io_FilesystemInfo info;
     memset(&info, 0, sizeof(info));
     const char* devhost_name = "devfs:host";
-    strlcpy((char*) info.name, devhost_name, fuchsia_io_MAX_FS_NAME_BUFFER);
+    strlcpy((char*)info.name, devhost_name, fuchsia_io_MAX_FS_NAME_BUFFER);
     return fuchsia_io_DirectoryAdminQueryFilesystem_reply(txn, ZX_OK, &info);
 }
 
 static zx_status_t fidl_directory_admin_get_device_path(void* ctx, fidl_txn_t* txn) {
-    return fuchsia_io_DirectoryAdminGetDevicePath_reply(txn, ZX_ERR_NOT_SUPPORTED,
-                                                        NULL, 0);
+    return fuchsia_io_DirectoryAdminGetDevicePath_reply(txn, ZX_ERR_NOT_SUPPORTED, NULL, 0);
 }
 
 static const fuchsia_io_DirectoryAdmin_ops_t kDirectoryAdminOps = []() {
@@ -480,7 +475,7 @@ static zx_status_t fidl_file_write(void* ctx, const uint8_t* data, size_t count,
     }
     size_t actual = 0;
     zx_status_t status = ZX_OK;
-    ssize_t r = do_sync_io(conn->dev, DO_WRITE, (uint8_t*) data, count, conn->io_off);
+    ssize_t r = do_sync_io(conn->dev, DO_WRITE, (uint8_t*)data, count, conn->io_off);
     if (r >= 0) {
         conn->io_off += r;
         actual = r;
@@ -490,8 +485,8 @@ static zx_status_t fidl_file_write(void* ctx, const uint8_t* data, size_t count,
     return fuchsia_io_FileWrite_reply(txn, status, actual);
 }
 
-static zx_status_t fidl_file_writeat(void* ctx, const uint8_t* data, size_t count,
-                                     uint64_t offset, fidl_txn_t* txn) {
+static zx_status_t fidl_file_writeat(void* ctx, const uint8_t* data, size_t count, uint64_t offset,
+                                     fidl_txn_t* txn) {
     auto conn = static_cast<DevfsConnection*>(ctx);
     if (!CAN_WRITE(conn)) {
         return fuchsia_io_FileWriteAt_reply(txn, ZX_ERR_ACCESS_DENIED, 0);
@@ -499,7 +494,7 @@ static zx_status_t fidl_file_writeat(void* ctx, const uint8_t* data, size_t coun
 
     size_t actual = 0;
     zx_status_t status = ZX_OK;
-    ssize_t r = do_sync_io(conn->dev, DO_WRITE, (uint8_t*) data, count, offset);
+    ssize_t r = do_sync_io(conn->dev, DO_WRITE, (uint8_t*)data, count, offset);
     if (r >= 0) {
         actual = r;
     } else {
@@ -511,9 +506,7 @@ static zx_status_t fidl_file_writeat(void* ctx, const uint8_t* data, size_t coun
 static zx_status_t fidl_file_seek(void* ctx, int64_t offset, fuchsia_io_SeekOrigin start,
                                   fidl_txn_t* txn) {
     auto conn = static_cast<DevfsConnection*>(ctx);
-    auto bad_args = [&]() {
-        return fuchsia_io_FileSeek_reply(txn, ZX_ERR_INVALID_ARGS, 0);
-    };
+    auto bad_args = [&]() { return fuchsia_io_FileSeek_reply(txn, ZX_ERR_INVALID_ARGS, 0); };
     size_t end = conn->dev->GetSizeOp();
     size_t n;
     switch (start) {
@@ -614,28 +607,25 @@ static zx_status_t fidl_node_getattr(void* ctx, fidl_txn_t* txn) {
 }
 
 static zx_status_t fidl_node_setattr(void* ctx, uint32_t flags,
-                                        const fuchsia_io_NodeAttributes* attributes,
-                                        fidl_txn_t* txn) {
+                                     const fuchsia_io_NodeAttributes* attributes, fidl_txn_t* txn) {
     return fuchsia_io_NodeSetAttr_reply(txn, ZX_ERR_NOT_SUPPORTED);
 }
 
 static zx_status_t fidl_node_ioctl(void* ctx, uint32_t opcode, uint64_t max_out,
                                    const zx_handle_t* handles_data, size_t handles_count,
-                                   const uint8_t* in_data, size_t in_count,
-                                   fidl_txn_t* txn) {
+                                   const uint8_t* in_data, size_t in_count, fidl_txn_t* txn) {
     auto conn = static_cast<DevfsConnection*>(ctx);
     char in_buf[FDIO_IOCTL_MAX_INPUT];
     size_t hsize = handles_count * sizeof(zx_handle_t);
     if ((in_count > FDIO_IOCTL_MAX_INPUT) || (max_out > ZXFIDL_MAX_MSG_BYTES)) {
         zx_handle_close_many(handles_data, handles_count);
-        return fuchsia_io_NodeIoctl_reply(txn, ZX_ERR_INVALID_ARGS, nullptr, 0,
-                                          nullptr, 0);
+        return fuchsia_io_NodeIoctl_reply(txn, ZX_ERR_INVALID_ARGS, nullptr, 0, nullptr, 0);
     }
     memcpy(in_buf, in_data, in_count);
     memcpy(in_buf, handles_data, hsize);
 
     uint8_t out[max_out];
-    zx_handle_t* out_handles = (zx_handle_t*) out;
+    zx_handle_t* out_handles = (zx_handle_t*)out;
     size_t out_count = 0;
     ssize_t r = do_ioctl(conn->dev, opcode, in_buf, in_count, out, max_out, &out_count);
     size_t out_hcount = 0;
diff --git a/system/core/devmgr/devmgr/binding.cpp b/system/core/devmgr/devmgr/binding.cpp
index af0190e37f6..daf8fe989fa 100644
--- a/system/core/devmgr/devmgr/binding.cpp
+++ b/system/core/devmgr/devmgr/binding.cpp
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <ddk/binding.h>
 #include <ddk/device.h>
 #include <ddk/driver.h>
-#include <ddk/binding.h>
 
 #include <stdio.h>
 
@@ -102,8 +102,7 @@ bool is_bindable(BindProgramContext* ctx) {
             case OP_GOTO: {
                 uint32_t label = BINDINST_PA(inst);
                 while (++ip < end) {
-                    if ((BINDINST_OP(ip->op) == OP_LABEL) &&
-                        (BINDINST_PA(ip->op) == label)) {
+                    if ((BINDINST_OP(ip->op) == OP_LABEL) && (BINDINST_PA(ip->op) == label)) {
                         goto next_instruction;
                     }
                 }
@@ -120,7 +119,7 @@ bool is_bindable(BindProgramContext* ctx) {
             }
         }
 
-next_instruction:
+    next_instruction:
         ip++;
     }
 
@@ -132,9 +131,8 @@ next_instruction:
 
 namespace devmgr {
 
-bool dc_is_bindable(const Driver* drv, uint32_t protocol_id,
-                    zx_device_prop_t* props, size_t prop_count,
-                    bool autobind) {
+bool dc_is_bindable(const Driver* drv, uint32_t protocol_id, zx_device_prop_t* props,
+                    size_t prop_count, bool autobind) {
     if (drv->binding_size == 0) {
         return false;
     }
diff --git a/system/core/devmgr/devmgr/coordinator-test.cpp b/system/core/devmgr/devmgr/coordinator-test.cpp
index 96608994fb9..389eb4737f0 100644
--- a/system/core/devmgr/devmgr/coordinator-test.cpp
+++ b/system/core/devmgr/devmgr/coordinator-test.cpp
@@ -15,10 +15,10 @@
 #include "devmgr.h"
 
 namespace devmgr {
-    zx::channel fs_clone(const char* path) {
-        return zx::channel();
-    }
+zx::channel fs_clone(const char* path) {
+    return zx::channel();
 }
+} // namespace devmgr
 
 static devmgr::CoordinatorConfig default_config(async_dispatcher_t* dispatcher) {
     devmgr::CoordinatorConfig config;
@@ -158,17 +158,15 @@ bool bind_devices() {
     status = zx::channel::create(0, &local, &remote);
     ASSERT_EQ(ZX_OK, status);
     status = coordinator.AddDevice(&coordinator.test_device(), std::move(local),
-                                   nullptr /* props_data */, 0 /* props_count */,
-                                   "mock-device", ZX_PROTOCOL_TEST, nullptr /* driver_path */,
-                                   nullptr /* args */, false /* invisible */,
-                                   zx::channel() /* client_remote */);
+                                   nullptr /* props_data */, 0 /* props_count */, "mock-device",
+                                   ZX_PROTOCOL_TEST, nullptr /* driver_path */, nullptr /* args */,
+                                   false /* invisible */, zx::channel() /* client_remote */);
     ASSERT_EQ(ZX_OK, status);
     ASSERT_EQ(1, coordinator.devices().size_slow());
 
     // Add the driver.
-    devmgr::find_loadable_drivers("/boot/driver/test",
-                                  fit::bind_member(&coordinator,
-                                                   &devmgr::Coordinator::DriverAdded));
+    devmgr::find_loadable_drivers(
+        "/boot/driver/test", fit::bind_member(&coordinator, &devmgr::Coordinator::DriverAdded));
     loop.RunUntilIdle();
     ASSERT_FALSE(coordinator.drivers().is_empty());
 
diff --git a/system/core/devmgr/devmgr/coordinator.cpp b/system/core/devmgr/devmgr/coordinator.cpp
index 115958ff2f4..50d69ff06fd 100644
--- a/system/core/devmgr/devmgr/coordinator.cpp
+++ b/system/core/devmgr/devmgr/coordinator.cpp
@@ -40,12 +40,12 @@
 
 #include <utility>
 
-#include "devhost-loader-service.h"
-#include "devmgr.h"
 #include "../shared/env.h"
 #include "../shared/fdio.h"
 #include "../shared/fidl_txn.h"
 #include "../shared/log.h"
+#include "devhost-loader-service.h"
+#include "devmgr.h"
 
 namespace {
 
@@ -63,8 +63,7 @@ void vfs_exit(const zx::event& fshost_event) {
         printf("devmgr: Failed to signal VFS exit\n");
         return;
     } else if ((status = fshost_event.wait_one(FSHOST_SIGNAL_EXIT_DONE,
-                                               zx::deadline_after(zx::sec(5)),
-                                               nullptr)) != ZX_OK) {
+                                               zx::deadline_after(zx::sec(5)), nullptr)) != ZX_OK) {
         printf("devmgr: Failed to wait for VFS exit completion\n");
     }
 }
@@ -173,7 +172,9 @@ uint32_t log_flags = LOG_ERROR | LOG_INFO;
 
 Coordinator::Coordinator(CoordinatorConfig config) : config_(std::move(config)) {}
 
-Coordinator::~Coordinator() { drivers_.clear(); }
+Coordinator::~Coordinator() {
+    drivers_.clear();
+}
 
 bool Coordinator::InSuspend() const {
     return suspend_context_.flags() == SuspendContext::Flags::kSuspend;
@@ -346,7 +347,7 @@ zx_status_t Coordinator::HandleDmctlWrite(size_t len, const char* cmd) {
         return ZX_OK;
     }
     DmPrintf("unknown command\n");
-    log(ERROR, "dmctl: unknown command '%.*s'\n", (int) len, cmd);
+    log(ERROR, "dmctl: unknown command '%.*s'\n", (int)len, cmd);
     return ZX_ERR_NOT_SUPPORTED;
 }
 
@@ -392,7 +393,7 @@ zx_status_t Coordinator::LibnameToVmo(const fbl::String& libname, zx::vmo* out_v
     // Check for cached DSO
     if (drv->dso_vmo != ZX_HANDLE_INVALID) {
         zx_status_t r = drv->dso_vmo.duplicate(ZX_RIGHTS_BASIC | ZX_RIGHTS_PROPERTY |
-                                               ZX_RIGHT_READ | ZX_RIGHT_EXECUTE | ZX_RIGHT_MAP,
+                                                   ZX_RIGHT_READ | ZX_RIGHT_EXECUTE | ZX_RIGHT_MAP,
                                                out_vmo);
         if (r != ZX_OK) {
             log(ERROR, "devcoord: cannot duplicate cached dso for '%s' '%s'\n", drv->name.data(),
@@ -420,14 +421,11 @@ void Coordinator::DumpDevice(const Device* dev, size_t indent) const {
         extra[0] = 0;
     }
     if (pid == 0) {
-        DmPrintf("%*s[%s]%s\n", (int) (indent * 3), "", dev->name.data(), extra);
+        DmPrintf("%*s[%s]%s\n", (int)(indent * 3), "", dev->name.data(), extra);
     } else {
-        DmPrintf("%*s%c%s%c pid=%zu%s %s\n",
-                 (int) (indent * 3), "",
-                 dev->flags & DEV_CTX_PROXY ? '<' : '[',
-                 dev->name.data(),
-                 dev->flags & DEV_CTX_PROXY ? '>' : ']',
-                 pid, extra, dev->libname.data());
+        DmPrintf("%*s%c%s%c pid=%zu%s %s\n", (int)(indent * 3), "",
+                 dev->flags & DEV_CTX_PROXY ? '<' : '[', dev->name.data(),
+                 dev->flags & DEV_CTX_PROXY ? '>' : ']', pid, extra, dev->libname.data());
     }
     if (dev->proxy) {
         indent++;
@@ -447,31 +445,22 @@ void Coordinator::DumpState() const {
 
 void Coordinator::DumpDeviceProps(const Device* dev) const {
     if (dev->host) {
-        DmPrintf("Name [%s]%s%s%s\n",
-                 dev->name.data(),
-                 dev->libname.empty() ? "" : " Driver [",
-                 dev->libname.empty() ? "" : dev->libname.data(),
-                 dev->libname.empty() ? "" : "]");
-        DmPrintf("Flags   :%s%s%s%s%s%s%s\n",
-                 dev->flags & DEV_CTX_IMMORTAL     ? " Immortal"  : "",
-                 dev->flags & DEV_CTX_MUST_ISOLATE ? " Isolate"   : "",
-                 dev->flags & DEV_CTX_MULTI_BIND   ? " MultiBind" : "",
-                 dev->flags & DEV_CTX_BOUND        ? " Bound"     : "",
-                 dev->flags & DEV_CTX_DEAD         ? " Dead"      : "",
-                 dev->flags & DEV_CTX_ZOMBIE       ? " Zombie"    : "",
-                 dev->flags & DEV_CTX_PROXY        ? " Proxy"     : "");
+        DmPrintf("Name [%s]%s%s%s\n", dev->name.data(), dev->libname.empty() ? "" : " Driver [",
+                 dev->libname.empty() ? "" : dev->libname.data(), dev->libname.empty() ? "" : "]");
+        DmPrintf("Flags   :%s%s%s%s%s%s%s\n", dev->flags & DEV_CTX_IMMORTAL ? " Immortal" : "",
+                 dev->flags & DEV_CTX_MUST_ISOLATE ? " Isolate" : "",
+                 dev->flags & DEV_CTX_MULTI_BIND ? " MultiBind" : "",
+                 dev->flags & DEV_CTX_BOUND ? " Bound" : "",
+                 dev->flags & DEV_CTX_DEAD ? " Dead" : "",
+                 dev->flags & DEV_CTX_ZOMBIE ? " Zombie" : "",
+                 dev->flags & DEV_CTX_PROXY ? " Proxy" : "");
 
         char a = (char)((dev->protocol_id >> 24) & 0xFF);
         char b = (char)((dev->protocol_id >> 16) & 0xFF);
         char c = (char)((dev->protocol_id >> 8) & 0xFF);
         char d = (char)(dev->protocol_id & 0xFF);
-        DmPrintf("ProtoId : '%c%c%c%c' 0x%08x(%u)\n",
-                 isprint(a) ? a : '.',
-                 isprint(b) ? b : '.',
-                 isprint(c) ? c : '.',
-                 isprint(d) ? d : '.',
-                 dev->protocol_id,
-                 dev->protocol_id);
+        DmPrintf("ProtoId : '%c%c%c%c' 0x%08x(%u)\n", isprint(a) ? a : '.', isprint(b) ? b : '.',
+                 isprint(c) ? c : '.', isprint(d) ? d : '.', dev->protocol_id, dev->protocol_id);
 
         DmPrintf("%u Propert%s\n", dev->prop_count, dev->prop_count == 1 ? "y" : "ies");
         for (uint32_t i = 0; i < dev->prop_count; ++i) {
@@ -479,11 +468,11 @@ void Coordinator::DumpDeviceProps(const Device* dev) const {
             const char* param_name = di_bind_param_name(p->id);
 
             if (param_name) {
-                DmPrintf("[%2u/%2u] : Value 0x%08x Id %s\n",
-                         i, dev->prop_count, p->value, param_name);
+                DmPrintf("[%2u/%2u] : Value 0x%08x Id %s\n", i, dev->prop_count, p->value,
+                         param_name);
             } else {
-                DmPrintf("[%2u/%2u] : Value 0x%08x Id 0x%04hx\n",
-                         i, dev->prop_count, p->value, p->id);
+                DmPrintf("[%2u/%2u] : Value 0x%08x Id 0x%04hx\n", i, dev->prop_count, p->value,
+                         p->id);
             }
         }
         DmPrintf("\n");
@@ -513,8 +502,8 @@ void Coordinator::DumpDrivers() const {
         if (drv.binding_size) {
             char line[256];
             uint32_t count = drv.binding_size / static_cast<uint32_t>(sizeof(drv.binding[0]));
-            DmPrintf("Binding : %u instruction%s (%u bytes)\n",
-                     count, (count == 1) ? "" : "s", drv.binding_size);
+            DmPrintf("Binding : %u instruction%s (%u bytes)\n", count, (count == 1) ? "" : "s",
+                     drv.binding_size);
             for (uint32_t i = 0; i < count; ++i) {
                 di_dump_bind_inst(&drv.binding[i], line, sizeof(line));
                 DmPrintf("[%u/%u]: %s\n", i + 1, count, line);
@@ -599,7 +588,7 @@ static zx_status_t dc_launch_devhost(Devhost* host, DevhostLoaderService* loader
     launchpad_add_handle(lp, hrpc, PA_HND(PA_USER0, 0));
 
     // Give devhosts the root resource if we have it (in tests, we may not)
-    //TODO: limit root resource to root devhost only
+    // TODO: limit root resource to root devhost only
     if (root_resource.is_valid()) {
         zx::resource resource;
         zx_status_t status = root_resource.duplicate(ZX_RIGHT_SAME_RIGHTS, &resource);
@@ -612,14 +601,16 @@ static zx_status_t dc_launch_devhost(Devhost* host, DevhostLoaderService* loader
     // Inherit devmgr's environment (including kernel cmdline)
     launchpad_clone(lp, LP_CLONE_ENVIRON);
 
-    const char* nametable[2] = { "/boot", "/svc", };
+    const char* nametable[2] = {
+        "/boot",
+        "/svc",
+    };
     uint32_t name_count = 0;
 
-    //TODO: eventually devhosts should not have vfs access
-    launchpad_add_handle(lp, fs_clone("boot").release(),
-                         PA_HND(PA_NS_DIR, name_count++));
+    // TODO: eventually devhosts should not have vfs access
+    launchpad_add_handle(lp, fs_clone("boot").release(), PA_HND(PA_NS_DIR, name_count++));
 
-    //TODO: constrain to /svc/device
+    // TODO: constrain to /svc/device
     zx::channel svc_channel = fs_clone("svc");
     if (svc_channel.is_valid()) {
         launchpad_add_handle(lp, svc_channel.release(), PA_HND(PA_NS_DIR, name_count++));
@@ -627,7 +618,7 @@ static zx_status_t dc_launch_devhost(Devhost* host, DevhostLoaderService* loader
 
     launchpad_set_nametable(lp, name_count, nametable);
 
-    //TODO: limit sysinfo job access to root devhost only
+    // TODO: limit sysinfo job access to root devhost only
     zx::job sysinfo_job_duplicate;
     zx_status_t status = sysinfo_job.duplicate(ZX_RIGHT_SAME_RIGHTS, &sysinfo_job_duplicate);
     if (status != ZX_OK) {
@@ -667,8 +658,8 @@ zx_status_t Coordinator::NewDevhost(const char* name, Devhost* parent, Devhost**
     dh->set_hrpc(dh_hrpc);
 
     if ((r = dc_launch_devhost(dh.get(), loader_service_, get_devhost_bin(config_.asan_drivers),
-        name, hrpc, root_resource(), config_.sysinfo_job, zx::unowned_job(config_.devhost_job))) <
-        0) {
+                               name, hrpc, root_resource(), config_.sysinfo_job,
+                               zx::unowned_job(config_.devhost_job))) < 0) {
         zx_handle_close(dh->hrpc());
         return r;
     }
@@ -738,22 +729,18 @@ void Coordinator::ReleaseDevice(Device* dev) {
         }
     }
 
-    //TODO: cancel any pending rpc responses
-    //TODO: Have dtor assert that DEV_CTX_IMMORTAL set on flags
+    // TODO: cancel any pending rpc responses
+    // TODO: Have dtor assert that DEV_CTX_IMMORTAL set on flags
     delete dev;
 }
 
 // Add a new device to a parent device (same devhost)
 // New device is published in devfs.
 // Caller closes handles on error, so we don't have to.
-zx_status_t Coordinator::AddDevice(Device* parent, zx::channel rpc,
-                                   const uint64_t* props_data, size_t props_count,
-                                   fbl::StringPiece name,
-                                   uint32_t protocol_id,
-                                   fbl::StringPiece driver_path,
-                                   fbl::StringPiece args,
-                                   bool invisible,
-                                   zx::channel client_remote) {
+zx_status_t Coordinator::AddDevice(Device* parent, zx::channel rpc, const uint64_t* props_data,
+                                   size_t props_count, fbl::StringPiece name, uint32_t protocol_id,
+                                   fbl::StringPiece driver_path, fbl::StringPiece args,
+                                   bool invisible, zx::channel client_remote) {
     // If this is true, then |name_data|'s size is properly bounded.
     static_assert(fuchsia_device_manager_DEVICE_NAME_MAX == ZX_DEVICE_NAME_MAX);
     static_assert(fuchsia_device_manager_PROPERTIES_MAX <= UINT32_MAX);
@@ -764,8 +751,8 @@ zx_status_t Coordinator::AddDevice(Device* parent, zx::channel rpc,
         return ZX_ERR_BAD_STATE;
     }
 
-    log(RPC_IN, "devcoord: rpc: add-device '%.*s' args='%.*s'\n",
-        static_cast<int>(name.size()), name.data(), static_cast<int>(args.size()), args.data());
+    log(RPC_IN, "devcoord: rpc: add-device '%.*s' args='%.*s'\n", static_cast<int>(name.size()),
+        name.data(), static_cast<int>(args.size()), args.data());
 
     auto dev = fbl::make_unique<Device>(this);
     if (!dev) {
@@ -831,7 +818,7 @@ zx_status_t Coordinator::AddDevice(Device* parent, zx::channel rpc,
     }
 
     if (dev->host) {
-        //TODO host == nullptr should be impossible
+        // TODO host == nullptr should be impossible
         dev->host->AddRef();
         dev->host->devices().push_back(dev.get());
     }
@@ -843,11 +830,11 @@ zx_status_t Coordinator::AddDevice(Device* parent, zx::channel rpc,
 
     devices_.push_back(dev.get());
 
-    log(DEVLC, "devcoord: dev %p name='%s' ++ref=%d (child)\n",
-        parent, parent->name.data(), parent->refcount_);
+    log(DEVLC, "devcoord: dev %p name='%s' ++ref=%d (child)\n", parent, parent->name.data(),
+        parent->refcount_);
 
-    log(DEVLC, "devcoord: publish %p '%s' props=%u args='%s' parent=%p\n",
-        dev.get(), dev->name.data(), dev->prop_count, dev->args.data(), dev->parent);
+    log(DEVLC, "devcoord: publish %p '%s' props=%u args='%s' parent=%p\n", dev.get(),
+        dev->name.data(), dev->prop_count, dev->args.data(), dev->parent);
 
     if (!invisible) {
         r = dev->publish_task.Post(dispatcher());
@@ -939,7 +926,7 @@ zx_status_t Coordinator::RemoveDevice(Device* dev, bool forced) {
                 last = next;
             }
 
-            //TODO: set a timer so if this devhost does not finish dying
+            // TODO: set a timer so if this devhost does not finish dying
             //      in a reasonable amount of time, we fix the glitch.
         }
 
@@ -957,7 +944,7 @@ zx_status_t Coordinator::RemoveDevice(Device* dev, bool forced) {
             if (parent->children.is_empty()) {
                 parent->flags &= (~DEV_CTX_BOUND);
 
-                //TODO: This code is to cause the bind process to
+                // TODO: This code is to cause the bind process to
                 //      restart and get a new devhost to be launched
                 //      when a devhost dies.  It should probably be
                 //      more tied to devhost teardown than it is.
@@ -967,18 +954,17 @@ zx_status_t Coordinator::RemoveDevice(Device* dev, bool forced) {
                 // AND our parent is a BUSDEV
                 // AND our parent's devhost is not dying
                 // THEN we will want to rebind our parent
-                if (!(parent->flags & DEV_CTX_DEAD) &&
-                    (parent->flags & DEV_CTX_MUST_ISOLATE) &&
+                if (!(parent->flags & DEV_CTX_DEAD) && (parent->flags & DEV_CTX_MUST_ISOLATE) &&
                     ((parent->host == nullptr) ||
-                    !(parent->host->flags() & Devhost::Flags::kDying))) {
+                     !(parent->host->flags() & Devhost::Flags::kDying))) {
 
-                    log(DEVLC, "devcoord: bus device %p name='%s' is unbound\n",
-                        parent, parent->name.data());
+                    log(DEVLC, "devcoord: bus device %p name='%s' is unbound\n", parent,
+                        parent->name.data());
 
                     if (parent->retries > 0) {
                         // Add device with an exponential backoff.
-                        zx_status_t r = parent->publish_task.PostDelayed(dispatcher(),
-                                                                         parent->backoff);
+                        zx_status_t r =
+                            parent->publish_task.PostDelayed(dispatcher(), parent->backoff);
                         if (r != ZX_OK) {
                             return r;
                         }
@@ -1010,8 +996,8 @@ zx_status_t Coordinator::RemoveDevice(Device* dev, bool forced) {
 }
 
 zx_status_t Coordinator::BindDevice(Device* dev, fbl::StringPiece drvlibname) {
-     log(INFO, "devcoord: dc_bind_device() '%.*s'\n", static_cast<int>(drvlibname.size()),
-         drvlibname.data());
+    log(INFO, "devcoord: dc_bind_device() '%.*s'\n", static_cast<int>(drvlibname.size()),
+        drvlibname.data());
 
     // shouldn't be possible to get a bind request for a proxy device
     if (dev->flags & DEV_CTX_PROXY) {
@@ -1022,13 +1008,13 @@ zx_status_t Coordinator::BindDevice(Device* dev, fbl::StringPiece drvlibname) {
     // instead of a specific request
     bool autobind = (drvlibname.size() == 0);
 
-    //TODO: disallow if we're in the middle of enumeration, etc
+    // TODO: disallow if we're in the middle of enumeration, etc
     for (const auto& drv : drivers_) {
         if (autobind || !drvlibname.compare(drv.libname)) {
-            if (dc_is_bindable(&drv, dev->protocol_id,
-                               dev->props.get(), dev->prop_count, autobind)) {
-                log(SPEW, "devcoord: drv='%s' bindable to dev='%s'\n",
-                    drv.name.data(), dev->name.data());
+            if (dc_is_bindable(&drv, dev->protocol_id, dev->props.get(), dev->prop_count,
+                               autobind)) {
+                log(SPEW, "devcoord: drv='%s' bindable to dev='%s'\n", drv.name.data(),
+                    dev->name.data());
                 return AttemptBind(&drv, dev);
             }
         }
@@ -1078,7 +1064,7 @@ zx_status_t Coordinator::LoadFirmware(Device* dev, const char* path, zx::vmo* vm
 static bool path_is_child(const char* parent_path, const char* child_path) {
     size_t parent_length = strlen(parent_path);
     return (!strncmp(parent_path, child_path, parent_length) &&
-        (child_path[parent_length] == 0 || child_path[parent_length] == '/'));
+            (child_path[parent_length] == 0 || child_path[parent_length] == '/'));
 }
 
 zx_status_t Coordinator::GetMetadata(Device* dev, uint32_t type, void* buffer, size_t buflen,
@@ -1207,12 +1193,10 @@ zx_status_t Coordinator::PublishMetadata(Device* dev, const char* path, uint32_t
     return ZX_OK;
 }
 
-static zx_status_t fidl_AddDevice(void* ctx, zx_handle_t raw_rpc,
-                                  const uint64_t* props_data, size_t props_count,
-                                  const char* name_data, size_t name_size,
-                                  uint32_t protocol_id,
-                                  const char* driver_path_data, size_t driver_path_size,
-                                  const char* args_data, size_t args_size,
+static zx_status_t fidl_AddDevice(void* ctx, zx_handle_t raw_rpc, const uint64_t* props_data,
+                                  size_t props_count, const char* name_data, size_t name_size,
+                                  uint32_t protocol_id, const char* driver_path_data,
+                                  size_t driver_path_size, const char* args_data, size_t args_size,
                                   zx_handle_t raw_client_remote, fidl_txn_t* txn) {
     auto parent = static_cast<Device*>(ctx);
     zx::channel rpc(raw_rpc);
@@ -1230,10 +1214,10 @@ static zx_status_t fidl_AddDevice(void* ctx, zx_handle_t raw_rpc,
 static zx_status_t fidl_AddDeviceInvisible(void* ctx, zx_handle_t raw_rpc,
                                            const uint64_t* props_data, size_t props_count,
                                            const char* name_data, size_t name_size,
-                                           uint32_t protocol_id,
-                                           const char* driver_path_data, size_t driver_path_size,
-                                           const char* args_data, size_t args_size,
-                                           zx_handle_t raw_client_remote, fidl_txn_t* txn) {
+                                           uint32_t protocol_id, const char* driver_path_data,
+                                           size_t driver_path_size, const char* args_data,
+                                           size_t args_size, zx_handle_t raw_client_remote,
+                                           fidl_txn_t* txn) {
     auto parent = static_cast<Device*>(ctx);
     zx::channel rpc(raw_rpc);
     fbl::StringPiece name(name_data, name_size);
@@ -1298,8 +1282,8 @@ static zx_status_t fidl_GetTopologicalPath(void* ctx, fidl_txn_t* txn) {
     if ((status = dev->coordinator->GetTopoPath(dev, path, sizeof(path))) != ZX_OK) {
         return fuchsia_device_manager_CoordinatorGetTopologicalPath_reply(txn, status, nullptr, 0);
     }
-    return fuchsia_device_manager_CoordinatorGetTopologicalPath_reply(txn, ZX_OK,
-                                                                      path, strlen(path));
+    return fuchsia_device_manager_CoordinatorGetTopologicalPath_reply(txn, ZX_OK, path,
+                                                                      strlen(path));
 }
 
 static zx_status_t fidl_LoadFirmware(void* ctx, const char* fw_path_data, size_t fw_path_size,
@@ -1314,8 +1298,8 @@ static zx_status_t fidl_LoadFirmware(void* ctx, const char* fw_path_data, size_t
     uint64_t size = 0;
     zx_status_t status;
     if ((status = dev->coordinator->LoadFirmware(dev, fw_path, &vmo, &size)) != ZX_OK) {
-        return fuchsia_device_manager_CoordinatorLoadFirmware_reply(txn, status,
-                                                                    ZX_HANDLE_INVALID, 0);
+        return fuchsia_device_manager_CoordinatorLoadFirmware_reply(txn, status, ZX_HANDLE_INVALID,
+                                                                    0);
     }
 
     return fuchsia_device_manager_CoordinatorLoadFirmware_reply(txn, ZX_OK, vmo.release(), size);
@@ -1343,13 +1327,13 @@ static zx_status_t fidl_GetMetadataSize(void* ctx, uint32_t key, fidl_txn_t* txn
     return fuchsia_device_manager_CoordinatorGetMetadataSize_reply(txn, status, size);
 }
 
-static zx_status_t fidl_AddMetadata(void* ctx, uint32_t key,
-                                    const uint8_t* data_data, size_t data_count, fidl_txn_t* txn) {
+static zx_status_t fidl_AddMetadata(void* ctx, uint32_t key, const uint8_t* data_data,
+                                    size_t data_count, fidl_txn_t* txn) {
     static_assert(fuchsia_device_manager_METADATA_MAX <= UINT32_MAX);
 
     auto dev = static_cast<Device*>(ctx);
-    zx_status_t status = dev->coordinator->AddMetadata(dev, key, data_data,
-                                                       static_cast<uint32_t>(data_count));
+    zx_status_t status =
+        dev->coordinator->AddMetadata(dev, key, data_data, static_cast<uint32_t>(data_count));
     return fuchsia_device_manager_CoordinatorAddMetadata_reply(txn, status);
 }
 
@@ -1368,8 +1352,8 @@ static zx_status_t fidl_PublishMetadata(void* ctx, const char* device_path_data,
     return fuchsia_device_manager_CoordinatorPublishMetadata_reply(txn, status);
 }
 
-static zx_status_t fidl_DmCommand(void* ctx, zx_handle_t raw_log_socket,
-                                  const char* command_data, size_t command_size, fidl_txn_t* txn) {
+static zx_status_t fidl_DmCommand(void* ctx, zx_handle_t raw_log_socket, const char* command_data,
+                                  size_t command_size, fidl_txn_t* txn) {
     zx::socket log_socket(raw_log_socket);
 
     auto dev = static_cast<Device*>(ctx);
@@ -1410,7 +1394,8 @@ static zx_status_t fidl_DmMexec(void* ctx, zx_handle_t raw_kernel, zx_handle_t r
         return st;
     }
 
-    st = original_bootdata.clone(ZX_VMO_CLONE_COPY_ON_WRITE, 0, original_size + PAGE_SIZE * 4, &bootdata);
+    st = original_bootdata.clone(ZX_VMO_CLONE_COPY_ON_WRITE, 0, original_size + PAGE_SIZE * 4,
+                                 &bootdata);
     if (st != ZX_OK) {
         log(ERROR, "dm_mexec: failed to clone bootdata st = %d\n", st);
         return st;
@@ -1444,7 +1429,7 @@ static zx_status_t fidl_DmMexec(void* ctx, zx_handle_t raw_kernel, zx_handle_t r
         return st;
     }
 
-    void* bootdata_ptr = mapper.start(); 
+    void* bootdata_ptr = mapper.start();
     zbi::Zbi bootdata_zbi(static_cast<uint8_t*>(bootdata_ptr), vmo_size);
     zbi::Zbi mexec_payload_zbi(buffer);
 
@@ -1530,57 +1515,56 @@ zx_status_t Coordinator::HandleDeviceRead(Device* dev) {
 
     // TODO: Check txid on the message
     switch (hdr->ordinal) {
-        case fuchsia_device_manager_ControllerBindDriverOrdinal:
-        case fuchsia_device_manager_ControllerBindDriverGenOrdinal: {
-            const char* err_msg = nullptr;
-            r = fidl_decode_msg(&fuchsia_device_manager_ControllerBindDriverResponseTable,
-                                &fidl_msg, &err_msg);
-            if (r != ZX_OK) {
-                log(ERROR, "devcoord: rpc: bind-driver '%s' received malformed reply: %s\n",
-                    dev->name.data(), err_msg);
-                return ZX_ERR_IO;
-            }
-            auto resp = reinterpret_cast<fuchsia_device_manager_ControllerBindDriverResponse*>(
-                    fidl_msg.bytes);
-            if (resp->status != ZX_OK) {
-                log(ERROR, "devcoord: rpc: bind-driver '%s' status %d\n", dev->name.data(),
-                    resp->status);
-            }
-            //TODO: try next driver, clear BOUND flag
-            break;
+    case fuchsia_device_manager_ControllerBindDriverOrdinal:
+    case fuchsia_device_manager_ControllerBindDriverGenOrdinal: {
+        const char* err_msg = nullptr;
+        r = fidl_decode_msg(&fuchsia_device_manager_ControllerBindDriverResponseTable, &fidl_msg,
+                            &err_msg);
+        if (r != ZX_OK) {
+            log(ERROR, "devcoord: rpc: bind-driver '%s' received malformed reply: %s\n",
+                dev->name.data(), err_msg);
+            return ZX_ERR_IO;
         }
-        case fuchsia_device_manager_ControllerSuspendOrdinal:
-        case fuchsia_device_manager_ControllerSuspendGenOrdinal: {
-            const char* err_msg = nullptr;
-            r = fidl_decode_msg(&fuchsia_device_manager_ControllerSuspendResponseTable, &fidl_msg,
-                                &err_msg);
-            if (r != ZX_OK) {
-                log(ERROR, "devcoord: rpc: suspend '%s' received malformed reply: %s\n",
-                    dev->name.data(), err_msg);
-                return ZX_ERR_IO;
-            }
-            auto resp = reinterpret_cast<fuchsia_device_manager_ControllerSuspendResponse*>(
-                    fidl_msg.bytes);
-            if (resp->status != ZX_OK) {
-                log(ERROR, "devcoord: rpc: suspend '%s' status %d\n", dev->name.data(),
-                    resp->status);
-            }
-            suspend_context_.set_status(resp->status);
-            ContinueSuspend(&suspend_context_, root_resource());
-            break;
+        auto resp =
+            reinterpret_cast<fuchsia_device_manager_ControllerBindDriverResponse*>(fidl_msg.bytes);
+        if (resp->status != ZX_OK) {
+            log(ERROR, "devcoord: rpc: bind-driver '%s' status %d\n", dev->name.data(),
+                resp->status);
         }
-        default:
-            log(ERROR, "devcoord: rpc: dev '%s' received wrong unexpected reply %08x\n",
-                dev->name.data(), hdr->ordinal);
-            zx_handle_close_many(fidl_msg.handles, fidl_msg.num_handles);
+        // TODO: try next driver, clear BOUND flag
+        break;
+    }
+    case fuchsia_device_manager_ControllerSuspendOrdinal:
+    case fuchsia_device_manager_ControllerSuspendGenOrdinal: {
+        const char* err_msg = nullptr;
+        r = fidl_decode_msg(&fuchsia_device_manager_ControllerSuspendResponseTable, &fidl_msg,
+                            &err_msg);
+        if (r != ZX_OK) {
+            log(ERROR, "devcoord: rpc: suspend '%s' received malformed reply: %s\n",
+                dev->name.data(), err_msg);
             return ZX_ERR_IO;
+        }
+        auto resp =
+            reinterpret_cast<fuchsia_device_manager_ControllerSuspendResponse*>(fidl_msg.bytes);
+        if (resp->status != ZX_OK) {
+            log(ERROR, "devcoord: rpc: suspend '%s' status %d\n", dev->name.data(), resp->status);
+        }
+        suspend_context_.set_status(resp->status);
+        ContinueSuspend(&suspend_context_, root_resource());
+        break;
+    }
+    default:
+        log(ERROR, "devcoord: rpc: dev '%s' received wrong unexpected reply %08x\n",
+            dev->name.data(), hdr->ordinal);
+        zx_handle_close_many(fidl_msg.handles, fidl_msg.num_handles);
+        return ZX_ERR_IO;
     }
     return ZX_OK;
 }
 
 // send message to devhost, requesting the creation of a device
-static zx_status_t dh_create_device(Device* dev, Devhost* dh,
-                                    const char* args, zx::handle rpc_proxy) {
+static zx_status_t dh_create_device(Device* dev, Devhost* dh, const char* args,
+                                    zx::handle rpc_proxy) {
     zx_status_t r;
 
     zx::channel hrpc, hrpc_remote;
@@ -1648,8 +1632,8 @@ static zx_status_t dc_create_proxy(Coordinator* coordinator, Device* parent) {
     dev->AddRef();
     parent->proxy = dev.get();
     parent->AddRef();
-    log(DEVLC, "devcoord: dev %p name='%s' ++ref=%d (proxy)\n",
-        parent, parent->name.data(), parent->refcount_);
+    log(DEVLC, "devcoord: dev %p name='%s' ++ref=%d (proxy)\n", parent, parent->name.data(),
+        parent->refcount_);
     // TODO(teisenbe/kulakowski): This should go away once we switch to refptrs
     // here
     __UNUSED auto ptr = dev.release();
@@ -1687,7 +1671,7 @@ zx_status_t Coordinator::PrepareProxy(Device* dev) {
     arg1++;
 
     char devhostname[32];
-    snprintf(devhostname, sizeof(devhostname), "devhost:%.*s", (int) arg0len, arg0);
+    snprintf(devhostname, sizeof(devhostname), "devhost:%.*s", (int)arg0len, arg0);
 
     zx_status_t r;
     if ((r = dc_create_proxy(this, dev)) < 0) {
@@ -1759,7 +1743,7 @@ zx_status_t Coordinator::AttemptBind(const Driver* drv, Device* dev) {
     }
 
     r = dh_bind_driver(dev->proxy, drv->libname.c_str());
-    //TODO(swetland): arrange to mark us unbound when the proxy (or its devhost) goes away
+    // TODO(swetland): arrange to mark us unbound when the proxy (or its devhost) goes away
     if ((r == ZX_OK) && !(dev->flags & DEV_CTX_MULTI_BIND)) {
         dev->flags |= DEV_CTX_BOUND;
     }
@@ -1882,7 +1866,7 @@ static struct zx_bind_inst misc_device_binding =
 
 static bool is_misc_driver(Driver* drv) {
     return (drv->binding_size == sizeof(misc_device_binding)) &&
-        (memcmp(&misc_device_binding, drv->binding.get(), sizeof(misc_device_binding)) == 0);
+           (memcmp(&misc_device_binding, drv->binding.get(), sizeof(misc_device_binding)) == 0);
 }
 
 // device binding program that pure (parentless)
@@ -1892,24 +1876,23 @@ static struct zx_bind_inst test_device_binding =
 
 static bool is_test_driver(Driver* drv) {
     return (drv->binding_size == sizeof(test_device_binding)) &&
-        (memcmp(&test_device_binding, drv->binding.get(), sizeof(test_device_binding)) == 0);
+           (memcmp(&test_device_binding, drv->binding.get(), sizeof(test_device_binding)) == 0);
 }
 
-
 // device binding program that special root-level
 // devices use to get published in the root devhost
-static struct zx_bind_inst root_device_binding =
-    BI_MATCH_IF(EQ, BIND_PROTOCOL, ZX_PROTOCOL_ROOT);
+static struct zx_bind_inst root_device_binding = BI_MATCH_IF(EQ, BIND_PROTOCOL, ZX_PROTOCOL_ROOT);
 
 static bool is_root_driver(Driver* drv) {
     return (drv->binding_size == sizeof(root_device_binding)) &&
-        (memcmp(&root_device_binding, drv->binding.get(), sizeof(root_device_binding)) == 0);
+           (memcmp(&root_device_binding, drv->binding.get(), sizeof(root_device_binding)) == 0);
 }
 
 fbl::unique_ptr<Driver> Coordinator::ValidateDriver(fbl::unique_ptr<Driver> drv) {
     if ((drv->flags & ZIRCON_DRIVER_NOTE_FLAG_ASAN) && !config_.asan_drivers) {
         if (launched_first_devhost_) {
-            log(ERROR, "%s (%s) requires ASan: cannot load after boot;"
+            log(ERROR,
+                "%s (%s) requires ASan: cannot load after boot;"
                 " consider devmgr.devhost.asan=true\n",
                 drv->libname.data(), drv->name.data());
             return nullptr;
@@ -1994,8 +1977,7 @@ zx_status_t Coordinator::BindDriver(Driver* drv) {
     }
     printf("devcoord: driver '%s' added\n", drv->name.data());
     for (auto& dev : devices_) {
-        if (dev.flags & (DEV_CTX_BOUND | DEV_CTX_DEAD |
-                            DEV_CTX_ZOMBIE | DEV_CTX_INVISIBLE)) {
+        if (dev.flags & (DEV_CTX_BOUND | DEV_CTX_DEAD | DEV_CTX_ZOMBIE | DEV_CTX_INVISIBLE)) {
             // If device is already bound or being destroyed or invisible, skip it.
             continue;
         } else if (!dc_is_bindable(drv, dev.protocol_id, dev.props.get(), dev.prop_count, true)) {
@@ -2067,8 +2049,8 @@ void coordinator_setup(Coordinator* coordinator, DevmgrArgs args) {
         args.driver_search_paths.push_back("/boot/driver");
     }
     if (args.sys_device_driver == nullptr) {
-    // x86 platforms use acpi as the system device
-    // all other platforms use the platform bus
+        // x86 platforms use acpi as the system device
+        // all other platforms use the platform bus
 #if defined(__x86_64__)
         args.sys_device_driver = "/boot/driver/bus-acpi.so";
 #else
@@ -2114,7 +2096,8 @@ void coordinator_setup(Coordinator* coordinator, DevmgrArgs args) {
     coordinator->PrepareProxy(&coordinator->test_device());
 
     if (coordinator->require_system() && !coordinator->system_loaded()) {
-        printf("devcoord: full system required, ignoring fallback drivers until /system is loaded\n");
+        printf(
+            "devcoord: full system required, ignoring fallback drivers until /system is loaded\n");
     } else {
         coordinator->UseFallbackDrivers();
     }
diff --git a/system/core/devmgr/devmgr/coordinator.h b/system/core/devmgr/devmgr/coordinator.h
index 9148910f769..406388784e9 100644
--- a/system/core/devmgr/devmgr/coordinator.h
+++ b/system/core/devmgr/devmgr/coordinator.h
@@ -37,20 +37,17 @@ public:
     };
 
     struct AllDevhostsNode {
-        static fbl::DoublyLinkedListNodeState<Devhost*>& node_state(
-            Devhost& obj) {
+        static fbl::DoublyLinkedListNodeState<Devhost*>& node_state(Devhost& obj) {
             return obj.anode_;
         }
     };
     struct SuspendNode {
-        static fbl::DoublyLinkedListNodeState<Devhost*>& node_state(
-            Devhost& obj) {
+        static fbl::DoublyLinkedListNodeState<Devhost*>& node_state(Devhost& obj) {
             return obj.snode_;
         }
     };
     struct Node {
-        static fbl::DoublyLinkedListNodeState<Devhost*>& node_state(
-            Devhost& obj) {
+        static fbl::DoublyLinkedListNodeState<Devhost*>& node_state(Devhost& obj) {
             return obj.node_;
         }
     };
@@ -69,9 +66,7 @@ public:
     fbl::DoublyLinkedList<Devhost*, Node>& children() { return children_; }
 
     // The AddRef and Release functions follow the contract for fbl::RefPtr.
-    void AddRef() const {
-        ++refcount_;
-    }
+    void AddRef() const { ++refcount_; }
 
     // Returns true when the last reference has been released.
     bool Release() const {
@@ -114,18 +109,12 @@ public:
 
     SuspendContext() = default;
 
-    SuspendContext(Coordinator* coordinator,
-                   Flags flags, uint32_t sflags, zx::socket socket,
-                   zx::vmo kernel = zx::vmo(),
-                   zx::vmo bootdata = zx::vmo()) :
-        coordinator_(coordinator), flags_(flags), sflags_(sflags),
-        socket_(std::move(socket)), kernel_(std::move(kernel)),
-        bootdata_(std::move(bootdata)) {
-    }
+    SuspendContext(Coordinator* coordinator, Flags flags, uint32_t sflags, zx::socket socket,
+                   zx::vmo kernel = zx::vmo(), zx::vmo bootdata = zx::vmo())
+        : coordinator_(coordinator), flags_(flags), sflags_(sflags), socket_(std::move(socket)),
+          kernel_(std::move(kernel)), bootdata_(std::move(bootdata)) {}
 
-    ~SuspendContext() {
-        devhosts_.clear();
-    }
+    ~SuspendContext() { devhosts_.clear(); }
 
     SuspendContext(SuspendContext&&) = default;
     SuspendContext& operator=(SuspendContext&&) = default;
@@ -149,14 +138,10 @@ public:
     const zx::vmo& bootdata() const { return bootdata_; }
 
     // Close the socket whose ownership was handed to this SuspendContext.
-    void CloseSocket() {
-        socket_.reset();
-    }
+    void CloseSocket() { socket_.reset(); }
 
     // The AddRef and Release functions follow the contract for fbl::RefPtr.
-    void AddRef() const {
-        ++count_;
-    }
+    void AddRef() const { ++count_; }
 
     // Returns true when the last message reference has been released.
     bool Release() const {
@@ -187,6 +172,8 @@ private:
     zx::vmo bootdata_;
 };
 
+// clang-format off
+
 // This device is never destroyed
 #define DEV_CTX_IMMORTAL      0x01
 
@@ -220,6 +207,8 @@ private:
 // return to this state once made visible.
 #define DEV_CTX_INVISIBLE     0x80
 
+// clang-format on
+
 struct Driver {
     Driver() = default;
 
@@ -233,10 +222,7 @@ struct Driver {
 
     fbl::DoublyLinkedListNodeState<Driver*> node;
     struct Node {
-        static fbl::DoublyLinkedListNodeState<Driver*>& node_state(
-            Driver& obj) {
-            return obj.node;
-        }
+        static fbl::DoublyLinkedListNodeState<Driver*>& node_state(Driver& obj) { return obj.node; }
     };
 
     fbl::String libname;
@@ -447,9 +433,8 @@ using DriverLoadCallback = fit::function<void(Driver* driver, const char* versio
 void load_driver(const char* path, DriverLoadCallback func);
 void find_loadable_drivers(const char* path, DriverLoadCallback func);
 
-bool dc_is_bindable(const Driver* drv, uint32_t protocol_id,
-                    zx_device_prop_t* props, size_t prop_count,
-                    bool autobind);
+bool dc_is_bindable(const Driver* drv, uint32_t protocol_id, zx_device_prop_t* props,
+                    size_t prop_count, bool autobind);
 
 // Methods for composing FIDL RPCs to the devhosts
 zx_status_t dh_send_remove_device(const Device* dev);
diff --git a/system/core/devmgr/devmgr/devfs.cpp b/system/core/devmgr/devmgr/devfs.cpp
index d5325dc8357..72cd7712742 100644
--- a/system/core/devmgr/devmgr/devfs.cpp
+++ b/system/core/devmgr/devmgr/devfs.cpp
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "coordinator.h"
-#include "devmgr.h"
 #include "../shared/async-loop-owned-rpc-handler.h"
 #include "../shared/log.h"
+#include "coordinator.h"
+#include "devmgr.h"
 
+#include <zircon/device/vfs.h>
 #include <zircon/fidl.h>
 #include <zircon/syscalls.h>
 #include <zircon/types.h>
-#include <zircon/device/vfs.h>
 
 #include <fbl/intrusive_double_list.h>
 #include <fbl/string.h>
@@ -42,7 +42,9 @@ fbl::unique_ptr<Devnode> devfs_mkdir(Devnode* parent, const fbl::String& name);
 #define PNMAX 16
 const char* proto_name(uint32_t id, char buf[PNMAX]) {
     switch (id) {
-#define DDK_PROTOCOL_DEF(tag, val, name, flags) case val: return name;
+#define DDK_PROTOCOL_DEF(tag, val, name, flags)                                                    \
+    case val:                                                                                      \
+        return name;
 #include <ddk/protodefs.h>
     default:
         snprintf(buf, PNMAX, "proto-%08x", id);
@@ -69,8 +71,7 @@ struct Watcher : fbl::DoublyLinkedListable<fbl::unique_ptr<Watcher>> {
 };
 
 Watcher::Watcher(Devnode* dn, zx::channel ch, uint32_t mask)
-    : devnode(dn), handle(std::move(ch)), mask(mask) {
-}
+    : devnode(dn), handle(std::move(ch)), mask(mask) {}
 
 class DcIostate : public AsyncLoopOwnedRpcHandler<DcIostate> {
 public:
@@ -80,7 +81,8 @@ public:
     // Claims ownership of |*h| on success
     static zx_status_t Create(Devnode* dn, async_dispatcher_t* dispatcher, zx::channel* h);
 
-    static zx_status_t DevfsFidlHandler(fidl_msg_t* msg, fidl_txn_t* txn, void* cookie, async_dispatcher_t* dispatcher);
+    static zx_status_t DevfsFidlHandler(fidl_msg_t* msg, fidl_txn_t* txn, void* cookie,
+                                        async_dispatcher_t* dispatcher);
 
     static void HandleRpc(fbl::unique_ptr<DcIostate> ios, async_dispatcher_t* dispatcher,
                           async::WaitBase* wait, zx_status_t status,
@@ -94,7 +96,7 @@ public:
     // Remove this DcIostate from its devnode
     void DetachFromDevnode();
 
- private:
+private:
     uint64_t readdir_ino_ = 0;
 
     // pointer to our devnode, nullptr if it has been removed
@@ -157,7 +159,7 @@ struct ProtocolInfo {
 };
 
 ProtocolInfo proto_infos[] = {
-#define DDK_PROTOCOL_DEF(tag, val, name, flags) { name, nullptr, val, flags },
+#define DDK_PROTOCOL_DEF(tag, val, name, flags) {name, nullptr, val, flags},
 #include <ddk/protodefs.h>
 };
 
@@ -215,8 +217,7 @@ bool devnode_is_local(Devnode* dn) {
 // Notify a single watcher about the given operation and path.  On failure,
 // frees the watcher.  This can only be called on a watcher that has not yet
 // been added to a Devnode's watchers list.
-void devfs_notify_single(fbl::unique_ptr<Watcher>* watcher,
-                         const fbl::String& name, unsigned op) {
+void devfs_notify_single(fbl::unique_ptr<Watcher>* watcher, const fbl::String& name, unsigned op) {
     size_t len = name.length();
     if (!*watcher || len > fuchsia_io_MAX_FILENAME) {
         return;
@@ -261,7 +262,7 @@ void devfs_notify(Devnode* dn, const fbl::String& name, unsigned op) {
     // convert to mask
     op = (1u << op);
 
-    for (auto itr = dn->watchers.begin(); itr != dn->watchers.end(); ) {
+    for (auto itr = dn->watchers.begin(); itr != dn->watchers.end();) {
         auto& cur = *itr;
         // Advance the iterator now instead of at the end of the loop because we
         // may erase the current element from the list.
@@ -293,7 +294,7 @@ zx_status_t devfs_watch(Devnode* dn, zx::channel h, uint32_t mask) {
             if (child.device && (child.device->flags & DEV_CTX_INVISIBLE)) {
                 continue;
             }
-            //TODO: send multiple per write
+            // TODO: send multiple per write
             devfs_notify_single(&watcher, child.name, fuchsia_io_WATCH_EVENT_EXISTING);
         }
         devfs_notify_single(&watcher, "", fuchsia_io_WATCH_EVENT_IDLE);
@@ -376,8 +377,7 @@ zx_status_t devfs_readdir(Devnode* dn, uint64_t* ino_inout, void* data, size_t l
         }
         ino = child.ino;
         auto vdirent = reinterpret_cast<vdirent_t*>(ptr);
-        zx_status_t r = fill_dirent(vdirent, len, ino, child.name,
-                                    VTYPE_TO_DTYPE(V_TYPE_DIR));
+        zx_status_t r = fill_dirent(vdirent, len, ino, child.name, VTYPE_TO_DTYPE(V_TYPE_DIR));
         if (r < 0) {
             break;
         }
@@ -408,7 +408,7 @@ again:
     }
     for (auto& child : dn->children) {
         if (!strcmp(child.name.c_str(), name)) {
-            if(child.device && (child.device->flags & DEV_CTX_INVISIBLE)) {
+            if (child.device && (child.device->flags & DEV_CTX_INVISIBLE)) {
                 continue;
             }
             dn = &child;
@@ -426,7 +426,8 @@ again:
     return ZX_ERR_NEXT;
 }
 
-void devfs_open(Devnode* dirdn, async_dispatcher_t* dispatcher, zx_handle_t h, char* path, uint32_t flags) {
+void devfs_open(Devnode* dirdn, async_dispatcher_t* dispatcher, zx_handle_t h, char* path,
+                uint32_t flags) {
     zx::channel ipc(h);
     h = ZX_HANDLE_INVALID;
 
@@ -457,7 +458,7 @@ void devfs_open(Devnode* dirdn, async_dispatcher_t* dispatcher, zx_handle_t h, c
             r = ZX_OK;
         }
     } else {
-        path = (char*) ".";
+        path = (char*)".";
     }
 
     if (r != ZX_OK) {
@@ -507,8 +508,7 @@ void devfs_remove(Devnode* dn) {
     }
 
     // notify own file watcher
-    if ((dn->device == nullptr) ||
-        !(dn->device->flags & DEV_CTX_INVISIBLE)) {
+    if ((dn->device == nullptr) || !(dn->device->flags & DEV_CTX_INVISIBLE)) {
         devfs_notify(dn, "", fuchsia_io_WATCH_EVENT_DELETED);
     }
 
@@ -517,8 +517,7 @@ void devfs_remove(Devnode* dn) {
         if (dn->device->self == dn) {
             dn->device->self = nullptr;
 
-            if ((dn->device->parent != nullptr) &&
-                (dn->device->parent->self != nullptr) &&
+            if ((dn->device->parent != nullptr) && (dn->device->parent->self != nullptr) &&
                 !(dn->device->flags & DEV_CTX_INVISIBLE)) {
                 devfs_notify(dn->device->parent->self, dn->name, fuchsia_io_WATCH_EVENT_REMOVED);
             }
@@ -546,9 +545,7 @@ void devfs_remove(Devnode* dn) {
 
 } // namespace
 
-Devnode::Devnode(fbl::String name)
-    : name(std::move(name)) {
-}
+Devnode::Devnode(fbl::String name) : name(std::move(name)) {}
 
 Devnode::~Devnode() {
     devfs_remove(this);
@@ -620,8 +617,7 @@ zx_status_t devfs_publish(Device* parent, Device* dev) {
     }
 
     if ((dev->protocol_id == ZX_PROTOCOL_TEST_PARENT) ||
-        (dev->protocol_id == ZX_PROTOCOL_MISC_PARENT) ||
-        (dev->protocol_id == ZX_PROTOCOL_MISC)) {
+        (dev->protocol_id == ZX_PROTOCOL_MISC_PARENT) || (dev->protocol_id == ZX_PROTOCOL_MISC)) {
         // misc devices are singletons, not a class
         // in the sense of other device classes.
         // They do not get aliases in /dev/class/misc/...
@@ -647,8 +643,7 @@ zx_status_t devfs_publish(Device* parent, Device* dev) {
                 }
             }
             return ZX_ERR_ALREADY_EXISTS;
-got_name:
-            ;
+        got_name:;
         }
 
         fbl::unique_ptr<Devnode> dnlink = devfs_mknode(dev, name);
@@ -689,8 +684,8 @@ zx_status_t devfs_connect(Device* dev, zx::channel client_remote) {
     if (!client_remote.is_valid()) {
         return ZX_ERR_BAD_HANDLE;
     }
-    fuchsia_io_DirectoryOpen(dev->hrpc.get(), 0 /* flags */, 0 /* mode */,
-                             ".", 1, client_remote.release());
+    fuchsia_io_DirectoryOpen(dev->hrpc.get(), 0 /* flags */, 0 /* mode */, ".", 1,
+                             client_remote.release());
     return ZX_OK;
 }
 
@@ -699,23 +694,21 @@ zx_status_t devfs_connect(Device* dev, zx::channel client_remote) {
 
 // Decode the incoming request, returning an error and consuming
 // all handles on error.
-#define DECODE_REQUEST(MSG, METHOD)                                     \
-    do {                                                                \
-        zx_status_t r;                                                  \
-        if ((r = fidl_decode_msg(&fuchsia_io_ ## METHOD ##RequestTable, \
-                                 msg, nullptr)) != ZX_OK) {                \
-            return r;                                                   \
-        }                                                               \
-    } while(0);
+#define DECODE_REQUEST(MSG, METHOD)                                                                \
+    do {                                                                                           \
+        zx_status_t r;                                                                             \
+        if ((r = fidl_decode_msg(&fuchsia_io_##METHOD##RequestTable, msg, nullptr)) != ZX_OK) {    \
+            return r;                                                                              \
+        }                                                                                          \
+    } while (0);
 
 // Define a variable |request| from the incoming method, of
 // the requested type.
-#define DEFINE_REQUEST(MSG, METHOD)                     \
-    fuchsia_io_ ## METHOD ## Request* request =         \
-        (fuchsia_io_ ## METHOD ## Request*) MSG->bytes;
+#define DEFINE_REQUEST(MSG, METHOD)                                                                \
+    fuchsia_io_##METHOD##Request* request = (fuchsia_io_##METHOD##Request*)MSG->bytes;
 
-
-zx_status_t DcIostate::DevfsFidlHandler(fidl_msg_t* msg, fidl_txn_t* txn, void* cookie, async_dispatcher_t* dispatcher) {
+zx_status_t DcIostate::DevfsFidlHandler(fidl_msg_t* msg, fidl_txn_t* txn, void* cookie,
+                                        async_dispatcher_t* dispatcher) {
     auto ios = static_cast<DcIostate*>(cookie);
     Devnode* dn = ios->devnode_;
     if (dn == nullptr) {
@@ -813,7 +806,7 @@ zx_status_t DcIostate::DevfsFidlHandler(fidl_msg_t* msg, fidl_txn_t* txn, void*
         DECODE_REQUEST(msg, DirectoryAdminQueryFilesystem);
         fuchsia_io_FilesystemInfo info;
         memset(&info, 0, sizeof(info));
-        strlcpy((char*) info.name, "devfs", fuchsia_io_MAX_FS_NAME_BUFFER);
+        strlcpy((char*)info.name, "devfs", fuchsia_io_MAX_FS_NAME_BUFFER);
         return fuchsia_io_DirectoryAdminQueryFilesystem_reply(txn, ZX_OK, &info);
     }
     case fuchsia_io_NodeIoctlOrdinal: {
@@ -837,9 +830,10 @@ void DcIostate::HandleRpc(fbl::unique_ptr<DcIostate> ios, async_dispatcher_t* di
     }
 
     if (signal->observed & ZX_CHANNEL_READABLE) {
-        status = fs::ReadMessage(wait->object(), [&ios, dispatcher](fidl_msg_t* msg, fs::FidlConnection* txn) {
-            return DcIostate::DevfsFidlHandler(msg, txn->Txn(), ios.get(), dispatcher);
-        });
+        status = fs::ReadMessage(
+            wait->object(), [&ios, dispatcher](fidl_msg_t* msg, fs::FidlConnection* txn) {
+                return DcIostate::DevfsFidlHandler(msg, txn->Txn(), ios.get(), dispatcher);
+            });
         if (status == ZX_OK) {
             ios->BeginWait(std::move(ios), dispatcher);
             return;
diff --git a/system/core/devmgr/devmgr/devhost-loader-service.cpp b/system/core/devmgr/devmgr/devhost-loader-service.cpp
index fa7d4853104..0a200ce0a8c 100644
--- a/system/core/devmgr/devmgr/devhost-loader-service.cpp
+++ b/system/core/devmgr/devmgr/devhost-loader-service.cpp
@@ -13,8 +13,8 @@
 #include <lib/fdio/io.h>
 #include <lib/fit/defer.h>
 
-#include "coordinator.h"
 #include "../shared/fdio.h"
+#include "coordinator.h"
 
 namespace {
 
diff --git a/system/core/devmgr/devmgr/device.cpp b/system/core/devmgr/devmgr/device.cpp
index b5e8671aca9..ed2acac3ded 100644
--- a/system/core/devmgr/devmgr/device.cpp
+++ b/system/core/devmgr/devmgr/device.cpp
@@ -13,9 +13,8 @@ Device::Device(Coordinator* coord)
     : coordinator(coord), publish_task([this] { coordinator->HandleNewDevice(this); }) {}
 
 // Handle inbound messages from devhost to devices
-void Device::HandleRpc(Device* dev, async_dispatcher_t* dispatcher,
-                      async::WaitBase* wait, zx_status_t status,
-                      const zx_packet_signal_t* signal) {
+void Device::HandleRpc(Device* dev, async_dispatcher_t* dispatcher, async::WaitBase* wait,
+                       zx_status_t status, const zx_packet_signal_t* signal) {
     if (status != ZX_OK) {
         log(ERROR, "devcoord: Device::HandleRpc aborting, saw status %d\n", status);
         return;
@@ -25,8 +24,8 @@ void Device::HandleRpc(Device* dev, async_dispatcher_t* dispatcher,
         zx_status_t r;
         if ((r = dev->coordinator->HandleDeviceRead(dev)) < 0) {
             if (r != ZX_ERR_STOP) {
-                log(ERROR, "devcoord: device %p name='%s' rpc status: %d\n",
-                    dev, dev->name.data(), r);
+                log(ERROR, "devcoord: device %p name='%s' rpc status: %d\n", dev, dev->name.data(),
+                    r);
             }
             dev->coordinator->RemoveDevice(dev, true);
             // Do not start waiting again on this device's channel again
diff --git a/system/core/devmgr/devmgr/device.h b/system/core/devmgr/devmgr/device.h
index 6476c5bd28e..932f89e35cc 100644
--- a/system/core/devmgr/devmgr/device.h
+++ b/system/core/devmgr/devmgr/device.h
@@ -43,9 +43,8 @@ struct Device {
     }
 
     // TODO(teisenbe/kulakowski): Make this take a RefPtr
-    static void HandleRpc(Device* dev, async_dispatcher_t* dispatcher,
-                          async::WaitBase* wait, zx_status_t status,
-                          const zx_packet_signal_t* signal);
+    static void HandleRpc(Device* dev, async_dispatcher_t* dispatcher, async::WaitBase* wait,
+                          zx_status_t status, const zx_packet_signal_t* signal);
 
     Coordinator* coordinator;
     zx::channel hrpc;
@@ -78,18 +77,14 @@ struct Device {
     // list-of-children
     fbl::DoublyLinkedListNodeState<Device*> node;
     struct Node {
-        static fbl::DoublyLinkedListNodeState<Device*>& node_state(
-            Device& obj) {
-            return obj.node;
-        }
+        static fbl::DoublyLinkedListNodeState<Device*>& node_state(Device& obj) { return obj.node; }
     };
 
     // listnode for this device in its devhost's
     // list-of-devices
     fbl::DoublyLinkedListNodeState<Device*> dhnode;
     struct DevhostNode {
-        static fbl::DoublyLinkedListNodeState<Device*>& node_state(
-            Device& obj) {
+        static fbl::DoublyLinkedListNodeState<Device*>& node_state(Device& obj) {
             return obj.dhnode;
         }
     };
@@ -100,8 +95,7 @@ struct Device {
     // listnode for this device in the all devices list
     fbl::DoublyLinkedListNodeState<Device*> anode;
     struct AllDevicesNode {
-        static fbl::DoublyLinkedListNodeState<Device*>& node_state(
-            Device& obj) {
+        static fbl::DoublyLinkedListNodeState<Device*>& node_state(Device& obj) {
             return obj.anode;
         }
     };
@@ -112,9 +106,7 @@ struct Device {
     fbl::unique_ptr<zx_device_prop_t[]> props;
 
     // The AddRef and Release functions follow the contract for fbl::RefPtr.
-    void AddRef() const {
-        ++refcount_;
-    }
+    void AddRef() const { ++refcount_; }
 
     // Returns true when the last reference has been released.
     bool Release() const {
diff --git a/system/core/devmgr/devmgr/drivers.cpp b/system/core/devmgr/devmgr/drivers.cpp
index 5eca592c5ee..a60ae8956fc 100644
--- a/system/core/devmgr/devmgr/drivers.cpp
+++ b/system/core/devmgr/devmgr/drivers.cpp
@@ -10,11 +10,11 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "coordinator.h"
-#include "devmgr.h"
 #include "../shared/env.h"
 #include "../shared/fdio.h"
 #include "../shared/log.h"
+#include "coordinator.h"
+#include "devmgr.h"
 
 #include <driver-info/driver-info.h>
 
@@ -34,8 +34,7 @@ bool is_driver_disabled(const char* name) {
     return devmgr::getenv_bool(opt, false);
 }
 
-void found_driver(zircon_driver_note_payload_t* note,
-                  const zx_bind_inst_t* bi, void* cookie) {
+void found_driver(zircon_driver_note_payload_t* note, const zx_bind_inst_t* bi, void* cookie) {
     auto context = static_cast<const AddContext*>(cookie);
 
     // ensure strings are terminated
@@ -66,7 +65,7 @@ void found_driver(zircon_driver_note_payload_t* note,
     drv->name.Set(note->name);
 
 #if VERBOSE_DRIVER_LOAD
-    printf("found driver: %s\n", (char*) cookie);
+    printf("found driver: %s\n", (char*)cookie);
     printf("        name: %s\n", note->name);
     printf("      vendor: %s\n", note->vendor);
     printf("     version: %s\n", note->version);
@@ -90,7 +89,7 @@ void find_loadable_drivers(const char* path, DriverLoadCallback func) {
     if (dir == nullptr) {
         return;
     }
-    AddContext context = { "", std::move(func) };
+    AddContext context = {"", std::move(func)};
 
     struct dirent* de;
     while ((de = readdir(dir)) != nullptr) {
@@ -126,14 +125,14 @@ void find_loadable_drivers(const char* path, DriverLoadCallback func) {
 }
 
 void load_driver(const char* path, DriverLoadCallback func) {
-    //TODO: check for duplicate driver add
+    // TODO: check for duplicate driver add
     int fd;
     if ((fd = open(path, O_RDONLY)) < 0) {
         printf("devcoord: cannot open '%s'\n", path);
         return;
     }
 
-    AddContext context = { path, std::move(func) };
+    AddContext context = {path, std::move(func)};
     zx_status_t status = di_read_driver_info(fd, &context, found_driver);
     close(fd);
 
diff --git a/system/core/devmgr/devmgr/fidl.cpp b/system/core/devmgr/devmgr/fidl.cpp
index 1a2855ccfcc..ec51600553d 100644
--- a/system/core/devmgr/devmgr/fidl.cpp
+++ b/system/core/devmgr/devmgr/fidl.cpp
@@ -7,8 +7,8 @@
 #include <lib/fidl/cpp/message.h>
 #include <lib/fidl/cpp/message_part.h>
 
-#include "coordinator.h"
 #include "../shared/log.h"
+#include "coordinator.h"
 
 namespace devmgr {
 
@@ -30,9 +30,9 @@ zx_status_t dh_send_create_device(Device* dev, Devhost* dh, zx::channel rpc, zx:
                                   const char* args, zx::handle rpc_proxy) {
     size_t driver_path_size = dev->libname.size();
     size_t args_size = strlen(args);
-    uint32_t wr_num_bytes = static_cast<uint32_t>(
-            sizeof(fuchsia_device_manager_ControllerCreateDeviceRequest) +
-            FIDL_ALIGN(driver_path_size) + FIDL_ALIGN(args_size));
+    uint32_t wr_num_bytes =
+        static_cast<uint32_t>(sizeof(fuchsia_device_manager_ControllerCreateDeviceRequest) +
+                              FIDL_ALIGN(driver_path_size) + FIDL_ALIGN(args_size));
     FIDL_ALIGNDECL char wr_bytes[wr_num_bytes];
     fidl::Builder builder(wr_bytes, wr_num_bytes);
 
@@ -57,7 +57,7 @@ zx_status_t dh_send_create_device(Device* dev, Devhost* dh, zx::channel rpc, zx:
     req->proxy_args.data = reinterpret_cast<char*>(FIDL_ALLOC_PRESENT);
     memcpy(args_data, args, args_size);
 
-    zx_handle_t handles[3] = { rpc.release(), driver.release() };
+    zx_handle_t handles[3] = {rpc.release(), driver.release()};
     uint32_t num_handles = 2;
 
     if (rpc_proxy.is_valid()) {
@@ -79,9 +79,9 @@ zx_status_t dh_send_create_device_stub(Devhost* dh, zx::channel rpc, uint32_t pr
     req->hdr.txid = 1;
 
     req->rpc = FIDL_HANDLE_PRESENT;
-    req->protocol_id  = protocol_id;
+    req->protocol_id = protocol_id;
 
-    zx_handle_t handles[] = { rpc.release() };
+    zx_handle_t handles[] = {rpc.release()};
     fidl::Message msg(builder.Finalize(),
                       fidl::HandlePart(handles, fbl::count_of(handles), fbl::count_of(handles)));
     return msg.Write(dh->hrpc(), 0);
@@ -90,7 +90,7 @@ zx_status_t dh_send_create_device_stub(Devhost* dh, zx::channel rpc, uint32_t pr
 zx_status_t dh_send_bind_driver(Device* dev, const char* libname, zx::vmo driver) {
     size_t libname_size = strlen(libname);
     uint32_t wr_num_bytes = static_cast<uint32_t>(
-            sizeof(fuchsia_device_manager_ControllerBindDriverRequest) + FIDL_ALIGN(libname_size));
+        sizeof(fuchsia_device_manager_ControllerBindDriverRequest) + FIDL_ALIGN(libname_size));
     FIDL_ALIGNDECL char wr_bytes[wr_num_bytes];
     fidl::Builder builder(wr_bytes, wr_num_bytes);
 
@@ -107,7 +107,7 @@ zx_status_t dh_send_bind_driver(Device* dev, const char* libname, zx::vmo driver
 
     req->driver = FIDL_HANDLE_PRESENT;
 
-    zx_handle_t handles[] = { driver.release() };
+    zx_handle_t handles[] = {driver.release()};
     fidl::Message msg(builder.Finalize(),
                       fidl::HandlePart(handles, fbl::count_of(handles), fbl::count_of(handles)));
     return msg.Write(dev->hrpc.get(), 0);
@@ -125,7 +125,7 @@ zx_status_t dh_send_connect_proxy(const Device* dev, zx::channel proxy) {
 
     req->shadow = FIDL_HANDLE_PRESENT;
 
-    zx_handle_t handles[] = { proxy.release() };
+    zx_handle_t handles[] = {proxy.release()};
     fidl::Message msg(builder.Finalize(),
                       fidl::HandlePart(handles, fbl::count_of(handles), fbl::count_of(handles)));
     return msg.Write(dev->hrpc.get(), 0);
@@ -146,5 +146,4 @@ zx_status_t dh_send_suspend(const Device* dev, uint32_t flags) {
     return msg.Write(dev->hrpc.get(), 0);
 }
 
-
 } // namespace devmgr
diff --git a/system/core/devmgr/devmgr/main.cpp b/system/core/devmgr/devmgr/main.cpp
index 66cf73feb55..f7c3845b738 100644
--- a/system/core/devmgr/devmgr/main.cpp
+++ b/system/core/devmgr/devmgr/main.cpp
@@ -45,8 +45,8 @@
 #include "../shared/fdio.h"
 #include "../shared/log.h"
 #include "coordinator.h"
-#include "devmgr.h"
 #include "devhost-loader-service.h"
+#include "devmgr.h"
 
 namespace {
 
@@ -128,13 +128,12 @@ zx_status_t fetch_root_resource(zx::resource* root_resource) {
         zx_take_startup_handle(DEVMGR_LAUNCHER_ROOT_RESOURCE_CHANNEL_HND));
     if (!root_resource_channel) {
         fprintf(stderr, "devmgr: did not receive root resource channel, assuming test "
-            "environment and continuing\n");
+                        "environment and continuing\n");
         return ZX_OK;
     }
     uint32_t actual_handles = 0;
-    zx_status_t status = root_resource_channel.read(0, nullptr, 0, nullptr,
-                                                    root_resource->reset_and_get_address(), 1,
-                                                    &actual_handles);
+    zx_status_t status = root_resource_channel.read(
+        0, nullptr, 0, nullptr, root_resource->reset_and_get_address(), 1, &actual_handles);
     if (status != ZX_OK) {
         return status;
     }
@@ -151,8 +150,8 @@ int fuchsia_starter(void* arg) {
     zx::time deadline = zx::deadline_after(zx::sec(appmgr_timeout));
 
     do {
-        zx_status_t status = coordinator->fshost_event().wait_one(FSHOST_SIGNAL_READY, deadline,
-                                                                   nullptr);
+        zx_status_t status =
+            coordinator->fshost_event().wait_one(FSHOST_SIGNAL_READY, deadline, nullptr);
         if (status == ZX_ERR_TIMED_OUT) {
             if (g_handles.appmgr_server.is_valid()) {
                 if (coordinator->require_system()) {
@@ -296,13 +295,13 @@ int pwrbtn_monitor_starter(void* arg) {
     if ((status = zx::debuglog::create(zx::resource(), 0, &debuglog) < 0)) {
         launchpad_abort(lp, status, "devmgr: cannot create debuglog handle");
     } else {
-        launchpad_add_handle(lp, debuglog.release(), PA_HND(PA_FDIO_LOGGER, FDIO_FLAG_USE_FOR_STDIO | 0));
+        launchpad_add_handle(lp, debuglog.release(),
+                             PA_HND(PA_FDIO_LOGGER, FDIO_FLAG_USE_FOR_STDIO | 0));
     }
 
     const char* errmsg;
     if ((status = launchpad_go(lp, nullptr, &errmsg)) < 0) {
-        printf("devmgr: launchpad %s (%s) failed: %s: %d\n",
-               argv[0], name, errmsg, status);
+        printf("devmgr: launchpad %s (%s) failed: %s: %d\n", argv[0], name, errmsg, status);
     } else {
         printf("devmgr: launch %s (%s) OK\n", argv[0], name);
     }
@@ -313,7 +312,8 @@ void start_console_shell() {
     // start a shell on the kernel console if it isn't already running a shell
     if (!devmgr::getenv_bool("kernel.shell", false)) {
         thrd_t t;
-        if ((thrd_create_with_name(&t, console_starter, nullptr, "console-starter")) == thrd_success) {
+        if ((thrd_create_with_name(&t, console_starter, nullptr, "console-starter")) ==
+            thrd_success) {
             thrd_detach(t);
         }
     }
@@ -332,9 +332,9 @@ zx_status_t fuchsia_create_job() {
     const zx_policy_basic_t fuchsia_job_policy[] = {
         {.condition = ZX_POL_NEW_PROCESS, .policy = ZX_POL_ACTION_DENY}};
 
-    status = g_handles.fuchsia_job.set_policy(ZX_JOB_POL_RELATIVE, ZX_JOB_POL_BASIC,
-                                              fuchsia_job_policy,
-                                              fbl::count_of(fuchsia_job_policy));
+    status =
+        g_handles.fuchsia_job.set_policy(ZX_JOB_POL_RELATIVE, ZX_JOB_POL_BASIC, fuchsia_job_policy,
+                                         fbl::count_of(fuchsia_job_policy));
     if (status != ZX_OK) {
         printf("devmgr: unable to set policy fuchsia job: %d (%s)\n", status,
                zx_status_get_string(status));
@@ -367,7 +367,8 @@ zx_status_t svchost_start(bool require_system) {
         return status;
     }
 
-    status = fdio_service_connect_at(g_handles.appmgr_client.get(), "svc", appmgr_svc_req.release());
+    status =
+        fdio_service_connect_at(g_handles.appmgr_client.get(), "svc", appmgr_svc_req.release());
     if (status != ZX_OK) {
         return status;
     }
@@ -426,8 +427,7 @@ zx_status_t svchost_start(bool require_system) {
 
     const char* errmsg = nullptr;
     if ((status = launchpad_go(lp, nullptr, &errmsg)) < 0) {
-        printf("devmgr: launchpad %s (%s) failed: %s: %d\n",
-               argv[0], name, errmsg, status);
+        printf("devmgr: launchpad %s (%s) failed: %s: %d\n", argv[0], name, errmsg, status);
     } else {
         printf("devmgr: launch %s (%s) OK\n", argv[0], name);
     }
@@ -651,8 +651,8 @@ int service_starter(void* arg) {
         }
 
         zx::debuglog debuglog;
-        status = zx::debuglog::create(coordinator->root_resource(), ZX_LOG_FLAG_READABLE,
-                                      &debuglog);
+        status =
+            zx::debuglog::create(coordinator->root_resource(), ZX_LOG_FLAG_READABLE, &debuglog);
         if (status == ZX_OK) {
             handles[handle_count] = debuglog.release();
             types[handle_count] = PA_HND(PA_USER0, 1);
@@ -741,10 +741,10 @@ zx_status_t CreateDevhostJob(const zx::job& root_job, zx::job* devhost_job_out)
         return status;
     }
     static const zx_policy_basic_t policy[] = {
-        { ZX_POL_BAD_HANDLE, ZX_POL_ACTION_EXCEPTION },
+        {ZX_POL_BAD_HANDLE, ZX_POL_ACTION_EXCEPTION},
     };
-    status = devhost_job.set_policy(ZX_JOB_POL_RELATIVE,
-                                    ZX_JOB_POL_BASIC, &policy, fbl::count_of(policy));
+    status = devhost_job.set_policy(ZX_JOB_POL_RELATIVE, ZX_JOB_POL_BASIC, &policy,
+                                    fbl::count_of(policy));
     if (status != ZX_OK) {
         log(ERROR, "devcoord: zx_job_set_policy() failed\n");
         return status;
@@ -818,7 +818,7 @@ int main(int argc, char** argv) {
         fprintf(stderr, "devmgr: did not receive root resource: %d\n", status);
         return 1;
     }
-    //TODO: limit to enumerate rights
+    // TODO: limit to enumerate rights
     status = g_handles.root_job->duplicate(ZX_RIGHT_SAME_RIGHTS, &config.sysinfo_job);
     if (status != ZX_OK) {
         fprintf(stderr, "devmgr: failed to duplicate root job for sysinfo: %d\n", status);
diff --git a/system/core/devmgr/devmgr/metadata.h b/system/core/devmgr/devmgr/metadata.h
index c91e5ec9834..0678573383f 100644
--- a/system/core/devmgr/devmgr/metadata.h
+++ b/system/core/devmgr/devmgr/metadata.h
@@ -14,23 +14,19 @@ namespace devmgr {
 struct Metadata {
     fbl::DoublyLinkedListNodeState<fbl::unique_ptr<Metadata>> node;
     struct Node {
-        static fbl::DoublyLinkedListNodeState<fbl::unique_ptr<Metadata>>& node_state(
-            Metadata& obj) {
+        static fbl::DoublyLinkedListNodeState<fbl::unique_ptr<Metadata>>&
+        node_state(Metadata& obj) {
             return obj.node;
         }
     };
 
     uint32_t type;
     uint32_t length;
-    bool has_path;      // zero terminated string starts at data[length]
+    bool has_path; // zero terminated string starts at data[length]
 
-    char* Data() {
-        return reinterpret_cast<char*>(this + 1);
-    }
+    char* Data() { return reinterpret_cast<char*>(this + 1); }
 
-    const char* Data() const {
-        return reinterpret_cast<const char*>(this + 1);
-    }
+    const char* Data() const { return reinterpret_cast<const char*>(this + 1); }
 
     static zx_status_t Create(size_t data_len, fbl::unique_ptr<Metadata>* out) {
         uint8_t* buf = new uint8_t[sizeof(Metadata) + data_len];
@@ -46,11 +42,9 @@ struct Metadata {
     // Implement a custom delete to deal with the allocation mechanism used in
     // Create().  Since the ctor is private, all Metadata* will come from
     // Create().
-    void operator delete(void* ptr) {
-        delete [] reinterpret_cast<uint8_t*>(ptr);
-    }
+    void operator delete(void* ptr) { delete[] reinterpret_cast<uint8_t*>(ptr); }
 
- private:
+private:
     Metadata() = default;
 
     Metadata(const Metadata&) = delete;
diff --git a/system/core/devmgr/dmctl/dmctl.cpp b/system/core/devmgr/dmctl/dmctl.cpp
index bbd5f7642f7..6a43bf985ec 100644
--- a/system/core/devmgr/dmctl/dmctl.cpp
+++ b/system/core/devmgr/dmctl/dmctl.cpp
@@ -31,8 +31,7 @@ public:
     zx_status_t DdkMessage(fidl_msg_t* msg, fidl_txn_t* txn);
 };
 
-Dmctl::Dmctl(zx_device_t* parent) : DmctlBase(parent) {
-}
+Dmctl::Dmctl(zx_device_t* parent) : DmctlBase(parent) {}
 
 zx_status_t Dmctl::Bind(void* ctx, zx_device_t* parent) {
     auto dev = fbl::make_unique<Dmctl>(parent);
@@ -53,7 +52,7 @@ zx_status_t Dmctl::DdkWrite(const void* buf, size_t count, zx_off_t off, size_t*
     const zx::channel& rpc = *zxdev()->rpc;
     zx_status_t status, call_status;
     status = fuchsia_device_manager_CoordinatorDmCommand(
-            rpc.get(), ZX_HANDLE_INVALID, static_cast<const char*>(buf), count, &call_status);
+        rpc.get(), ZX_HANDLE_INVALID, static_cast<const char*>(buf), count, &call_status);
     if (status != ZX_OK) {
         return status;
     } else if (call_status != ZX_OK) {
@@ -64,15 +63,15 @@ zx_status_t Dmctl::DdkWrite(const void* buf, size_t count, zx_off_t off, size_t*
 }
 
 static zx_status_t fidl_ExecuteCommand(void* ctx, zx_handle_t raw_log_socket,
-                                       const char* command_data, size_t command_size, fidl_txn_t* txn) {
+                                       const char* command_data, size_t command_size,
+                                       fidl_txn_t* txn) {
     zx::socket log_socket(raw_log_socket);
     auto zxdev = static_cast<zx_device_t*>(ctx);
     const zx::channel& rpc = *zxdev->rpc;
 
     zx_status_t status, call_status;
-    status = fuchsia_device_manager_CoordinatorDmCommand(
-            rpc.get(), log_socket.release(), command_data, command_size,
-            &call_status);
+    status = fuchsia_device_manager_CoordinatorDmCommand(rpc.get(), log_socket.release(),
+                                                         command_data, command_size, &call_status);
     if (status == ZX_OK) {
         status = call_status;
     }
@@ -117,5 +116,4 @@ zx_driver_ops_t dmctl_driver_ops = []() {
 } // namespace
 
 ZIRCON_DRIVER_BEGIN(dmctl, dmctl_driver_ops, "zircon", "0.1", 1)
-    BI_MATCH_IF(EQ, BIND_PROTOCOL, ZX_PROTOCOL_MISC_PARENT),
-ZIRCON_DRIVER_END(dmctl)
+BI_MATCH_IF(EQ, BIND_PROTOCOL, ZX_PROTOCOL_MISC_PARENT), ZIRCON_DRIVER_END(dmctl)
diff --git a/system/core/devmgr/fshost/block-watcher.cpp b/system/core/devmgr/fshost/block-watcher.cpp
index b8b6f57e798..a02cfb33efe 100644
--- a/system/core/devmgr/fshost/block-watcher.cpp
+++ b/system/core/devmgr/fshost/block-watcher.cpp
@@ -36,25 +36,17 @@ public:
     BlockWatcher(fbl::unique_ptr<FsManager> fshost, zx::unowned_job job, bool netboot)
         : fshost_(std::move(fshost)), job_(job), netboot_(netboot) {}
 
-    void FuchsiaStart() const {
-        fshost_->FuchsiaStart();
-    }
+    void FuchsiaStart() const { fshost_->FuchsiaStart(); }
 
-    bool IsSystemMounted() const {
-        return fshost_->IsSystemMounted();
-    }
+    bool IsSystemMounted() const { return fshost_->IsSystemMounted(); }
 
     zx_status_t InstallFs(const char* path, zx::channel h) {
         return fshost_->InstallFs(path, std::move(h));
     }
 
-    const zx::unowned_job& Job() const {
-        return job_;
-    }
+    const zx::unowned_job& Job() const { return job_; }
 
-    bool Netbooting() const {
-        return netboot_;
-    }
+    bool Netbooting() const { return netboot_; }
 
     // Optionally checks the filesystem stored on the device at |device_path|,
     // if "zircon.system.filesystem-check" is set.
@@ -72,7 +64,6 @@ public:
     // Fails if already mounted.
     zx_status_t MountBlob(fbl::unique_fd fd, mount_options_t* options);
 
-
 private:
     fbl::unique_ptr<FsManager> fshost_;
     zx::unowned_job job_;
@@ -93,11 +84,11 @@ zx_status_t fshost_launch_load(void* ctx, launchpad_t* lp, const char* file) {
 void pkgfs_finish(BlockWatcher* watcher, zx::process proc, zx::channel pkgfs_root) {
     auto deadline = zx::deadline_after(zx::sec(5));
     zx_signals_t observed;
-    zx_status_t status = proc.wait_one(ZX_USER_SIGNAL_0 | ZX_PROCESS_TERMINATED,
-                                       deadline, &observed);
+    zx_status_t status =
+        proc.wait_one(ZX_USER_SIGNAL_0 | ZX_PROCESS_TERMINATED, deadline, &observed);
     if (status != ZX_OK) {
-        printf("fshost: pkgfs did not signal completion: %d (%s)\n",
-               status, zx_status_get_string(status));
+        printf("fshost: pkgfs did not signal completion: %d (%s)\n", status,
+               zx_status_get_string(status));
         return;
     }
     if (!(observed & ZX_USER_SIGNAL_0)) {
@@ -117,12 +108,12 @@ void pkgfs_finish(BlockWatcher* watcher, zx::process proc, zx::channel pkgfs_roo
     if (zx::channel::create(0, &binChan, &binReq) != ZX_OK) {
         return;
     }
-    if (fdio_open_at(pkgfs_root.get(), "packages/shell-commands/0/bin", FS_DIR_FLAGS, binReq.release()) != ZX_OK) {
+    if (fdio_open_at(pkgfs_root.get(), "packages/shell-commands/0/bin", FS_DIR_FLAGS,
+                     binReq.release()) != ZX_OK) {
         // non-fatal.
         printf("fshost: failed to install /bin (could not open shell-commands)\n");
     }
 
-
     if (watcher->InstallFs("/pkgfs", std::move(pkgfs_root)) != ZX_OK) {
         printf("fshost: failed to install /pkgfs\n");
         return;
@@ -162,8 +153,8 @@ void old_launch_blob_init(BlockWatcher* watcher) {
         return;
     }
 
-    //TODO: make blob-init a /fs/blob relative path
-    const char *argv[2];
+    // TODO: make blob-init a /fs/blob relative path
+    const char* argv[2];
     char binary[strlen(blob_init) + 4];
     sprintf(binary, "/fs%s", blob_init);
     argv[0] = binary;
@@ -175,9 +166,9 @@ void old_launch_blob_init(BlockWatcher* watcher) {
     }
 
     const zx_handle_t raw_handle = handle.release();
-    zx_status_t status = devmgr_launch(
-        *watcher->Job(), "pkgfs", &fshost_launch_load, nullptr, argc, &argv[0], nullptr, -1,
-        &raw_handle, &type, 1, &proc, FS_DATA | FS_BLOB | FS_SVC);
+    zx_status_t status =
+        devmgr_launch(*watcher->Job(), "pkgfs", &fshost_launch_load, nullptr, argc, &argv[0],
+                      nullptr, -1, &raw_handle, &type, 1, &proc, FS_DATA | FS_BLOB | FS_SVC);
 
     if (status != ZX_OK) {
         printf("fshost: '%s' failed to launch: %d\n", blob_init, status);
@@ -191,15 +182,15 @@ void old_launch_blob_init(BlockWatcher* watcher) {
 // the blobfs without any real filesystem.  Files are found by
 // getenv("zircon.system.pkgfs.file.PATH") returning a blob content ID.
 // That is, a manifest of name->blob is embedded in /boot/config/devmgr.
-zx_status_t pkgfs_ldsvc_load_blob(void* ctx, const char* prefix,
-                                  const char* name, zx_handle_t* vmo) {
+zx_status_t pkgfs_ldsvc_load_blob(void* ctx, const char* prefix, const char* name,
+                                  zx_handle_t* vmo) {
     const int fs_blob_fd = static_cast<int>(reinterpret_cast<intptr_t>(ctx));
     char key[256];
-    if (snprintf(key, sizeof(key), "zircon.system.pkgfs.file.%s%s",
-                 prefix, name) >= (int)sizeof(key)) {
+    if (snprintf(key, sizeof(key), "zircon.system.pkgfs.file.%s%s", prefix, name) >=
+        (int)sizeof(key)) {
         return ZX_ERR_BAD_PATH;
     }
-    const char *blob = getenv(key);
+    const char* blob = getenv(key);
     if (blob == nullptr) {
         return ZX_ERR_NOT_FOUND;
     }
@@ -243,20 +234,19 @@ const loader_service_ops_t pkgfs_ldsvc_ops = {
 // Always consumes fs_blob_fd.
 zx_status_t pkgfs_ldsvc_start(int fs_blob_fd, zx_handle_t* ldsvc) {
     loader_service_t* service;
-    zx_status_t status = loader_service_create(nullptr, &pkgfs_ldsvc_ops,
-                                               (void*)(intptr_t)fs_blob_fd,
-                                               &service);
+    zx_status_t status =
+        loader_service_create(nullptr, &pkgfs_ldsvc_ops, (void*)(intptr_t)fs_blob_fd, &service);
     if (status != ZX_OK) {
-        printf("fshost: cannot create pkgfs loader service: %d (%s)\n",
-               status, zx_status_get_string(status));
+        printf("fshost: cannot create pkgfs loader service: %d (%s)\n", status,
+               zx_status_get_string(status));
         close(fs_blob_fd);
         return status;
     }
     status = loader_service_connect(service, ldsvc);
     loader_service_release(service);
     if (status != ZX_OK) {
-        printf("fshost: cannot connect pkgfs loader service: %d (%s)\n",
-               status, zx_status_get_string(status));
+        printf("fshost: cannot connect pkgfs loader service: %d (%s)\n", status,
+               zx_status_get_string(status));
     }
     return status;
 }
@@ -302,21 +292,19 @@ bool pkgfs_launch(BlockWatcher* watcher) {
     zx::channel h0, h1;
     zx_status_t status = zx::channel::create(0, &h0, &h1);
     if (status != ZX_OK) {
-        printf("fshost: cannot create pkgfs root channel: %d (%s)\n",
-               status, zx_status_get_string(status));
+        printf("fshost: cannot create pkgfs root channel: %d (%s)\n", status,
+               zx_status_get_string(status));
         return false;
     }
 
     const zx_handle_t raw_h1 = h1.release();
     zx::process proc;
-    status = devmgr_launch_cmdline(
-        "fshost", *watcher->Job(), "pkgfs",
-        &pkgfs_launch_load, (void*)(intptr_t)fs_blob_fd.release(), cmd,
-        &raw_h1, (const uint32_t[]){ PA_HND(PA_USER0, 0) }, 1,
-        &proc, FS_DATA | FS_BLOB | FS_SVC);
+    status = devmgr_launch_cmdline("fshost", *watcher->Job(), "pkgfs", &pkgfs_launch_load,
+                                   (void*)(intptr_t)fs_blob_fd.release(), cmd, &raw_h1,
+                                   (const uint32_t[]){PA_HND(PA_USER0, 0)}, 1, &proc,
+                                   FS_DATA | FS_BLOB | FS_SVC);
     if (status != ZX_OK) {
-        printf("fshost: failed to launch %s: %d (%s)\n",
-               cmd, status, zx_status_get_string(status));
+        printf("fshost: failed to launch %s: %d (%s)\n", cmd, status, zx_status_get_string(status));
         return false;
     }
 
@@ -331,25 +319,20 @@ void launch_blob_init(BlockWatcher* watcher) {
     }
 }
 
-zx_status_t launch_blobfs(int argc, const char** argv, zx_handle_t* hnd,
-                          uint32_t* ids, size_t len) {
-    return devmgr_launch(*g_job, "blobfs:/blob",
-                         &fshost_launch_load, nullptr, argc, argv, nullptr, -1,
-                         hnd, ids, len, nullptr, FS_FOR_FSPROC);
+zx_status_t launch_blobfs(int argc, const char** argv, zx_handle_t* hnd, uint32_t* ids,
+                          size_t len) {
+    return devmgr_launch(*g_job, "blobfs:/blob", &fshost_launch_load, nullptr, argc, argv, nullptr,
+                         -1, hnd, ids, len, nullptr, FS_FOR_FSPROC);
 }
 
-zx_status_t launch_minfs(int argc, const char** argv, zx_handle_t* hnd,
-                         uint32_t* ids, size_t len) {
-    return devmgr_launch(*g_job, "minfs:/data",
-                         &fshost_launch_load, nullptr, argc, argv, nullptr, -1,
-                         hnd, ids, len, nullptr, FS_FOR_FSPROC);
+zx_status_t launch_minfs(int argc, const char** argv, zx_handle_t* hnd, uint32_t* ids, size_t len) {
+    return devmgr_launch(*g_job, "minfs:/data", &fshost_launch_load, nullptr, argc, argv, nullptr,
+                         -1, hnd, ids, len, nullptr, FS_FOR_FSPROC);
 }
 
-zx_status_t launch_fat(int argc, const char** argv, zx_handle_t* hnd,
-                       uint32_t* ids, size_t len) {
-    return devmgr_launch(*g_job, "fatfs:/volume",
-                         &fshost_launch_load, nullptr, argc, argv, nullptr, -1,
-                         hnd, ids, len, nullptr, FS_FOR_FSPROC);
+zx_status_t launch_fat(int argc, const char** argv, zx_handle_t* hnd, uint32_t* ids, size_t len) {
+    return devmgr_launch(*g_job, "fatfs:/volume", &fshost_launch_load, nullptr, argc, argv, nullptr,
+                         -1, hnd, ids, len, nullptr, FS_FOR_FSPROC);
 }
 
 zx_status_t BlockWatcher::MountData(fbl::unique_fd fd, mount_options_t* options) {
@@ -358,8 +341,8 @@ zx_status_t BlockWatcher::MountData(fbl::unique_fd fd, mount_options_t* options)
     }
     options->wait_until_ready = true;
 
-    zx_status_t status = mount(fd.release(), "/fs" PATH_DATA, DISK_FORMAT_MINFS,
-                               options, launch_minfs);
+    zx_status_t status =
+        mount(fd.release(), "/fs" PATH_DATA, DISK_FORMAT_MINFS, options, launch_minfs);
     if (status != ZX_OK) {
         printf("devmgr: failed to mount %s: %s.\n", PATH_DATA, zx_status_get_string(status));
     } else {
@@ -373,8 +356,8 @@ zx_status_t BlockWatcher::MountInstall(fbl::unique_fd fd, mount_options_t* optio
         return ZX_ERR_ALREADY_BOUND;
     }
     options->readonly = true;
-    zx_status_t status = mount(fd.release(), "/fs" PATH_INSTALL, DISK_FORMAT_MINFS,
-                               options, launch_minfs);
+    zx_status_t status =
+        mount(fd.release(), "/fs" PATH_INSTALL, DISK_FORMAT_MINFS, options, launch_minfs);
     if (status != ZX_OK) {
         printf("devmgr: failed to mount %s: %s.\n", PATH_INSTALL, zx_status_get_string(status));
     } else {
@@ -387,8 +370,8 @@ zx_status_t BlockWatcher::MountBlob(fbl::unique_fd fd, mount_options_t* options)
     if (blob_mounted_) {
         return ZX_ERR_ALREADY_BOUND;
     }
-    zx_status_t status = mount(fd.release(), "/fs" PATH_BLOB, DISK_FORMAT_BLOBFS,
-                               options, launch_blobfs);
+    zx_status_t status =
+        mount(fd.release(), "/fs" PATH_BLOB, DISK_FORMAT_BLOBFS, options, launch_blobfs);
     if (status != ZX_OK) {
         printf("devmgr: failed to mount %s: %s.\n", PATH_BLOB, zx_status_get_string(status));
     } else {
@@ -408,9 +391,8 @@ zx_status_t BlockWatcher::CheckFilesystem(const char* device_path, disk_format_t
     auto launch_fsck = [](int argc, const char** argv, zx_handle_t* hnd, uint32_t* ids,
                           size_t len) {
         zx::process proc;
-        zx_status_t status = devmgr_launch(*g_job, "fsck", &fshost_launch_load, nullptr,
-                                           argc, argv, nullptr, -1, hnd, ids, len,
-                                           &proc, FS_FOR_FSPROC);
+        zx_status_t status = devmgr_launch(*g_job, "fsck", &fshost_launch_load, nullptr, argc, argv,
+                                           nullptr, -1, hnd, ids, len, &proc, FS_FOR_FSPROC);
         if (status != ZX_OK) {
             fprintf(stderr, "fshost: Couldn't launch fsck\n");
             return status;
@@ -497,8 +479,8 @@ zx_status_t mount_minfs(BlockWatcher* watcher, fbl::unique_fd fd, mount_options_
         options->readonly = getenv("zircon.system.writable") == nullptr;
         options->wait_until_ready = true;
 
-        zx_status_t st = mount(fd.release(), "/fs" PATH_SYSTEM, DISK_FORMAT_MINFS,
-                               options, launch_minfs);
+        zx_status_t st =
+            mount(fd.release(), "/fs" PATH_SYSTEM, DISK_FORMAT_MINFS, options, launch_minfs);
         if (st != ZX_OK) {
             printf("devmgr: failed to mount %s: %s.\n", PATH_SYSTEM, zx_status_get_string(st));
         } else {
@@ -609,8 +591,8 @@ zx_status_t block_device_added(int dirfd, int event, const char* name, void* coo
         options.enable_journal = true;
         zx_status_t status = watcher->MountBlob(std::move(fd), &options);
         if (status != ZX_OK) {
-            printf("devmgr: Failed to mount blobfs partition %s at %s: %s.\n",
-                   device_path, PATH_BLOB, zx_status_get_string(status));
+            printf("devmgr: Failed to mount blobfs partition %s at %s: %s.\n", device_path,
+                   PATH_BLOB, zx_status_get_string(status));
         } else {
             launch_blob_init(watcher);
         }
diff --git a/system/core/devmgr/fshost/fshost.h b/system/core/devmgr/fshost/fshost.h
index be6d43d3884..f1b12bc8171 100644
--- a/system/core/devmgr/fshost/fshost.h
+++ b/system/core/devmgr/fshost/fshost.h
@@ -35,9 +35,7 @@ public:
     // the owned channels as connections.
     zx_status_t CreateNamespace();
 
-    const zx::event& Event() const {
-        return event_;
-    }
+    const zx::event& Event() const { return event_; }
 
 private:
     zx::channel devfs_root_;
@@ -52,25 +50,19 @@ class FsManager {
 public:
     FsManager();
 
-    const FshostConnections& GetConnections() const {
-        return *connections_.get();
-    }
+    const FshostConnections& GetConnections() const { return *connections_.get(); }
 
     // Created a named VmoFile in "/system". Ownership of |vmo| assumed global.
     zx_status_t SystemfsAddFile(const char* path, zx_handle_t vmo, zx_off_t off, size_t len);
 
     // Signal that "/system" has been mounted.
-    void FuchsiaStart() const {
-        connections_->Event().signal(0, FSHOST_SIGNAL_READY);
-    }
+    void FuchsiaStart() const { connections_->Event().signal(0, FSHOST_SIGNAL_READY); }
 
     // Create "/system", and mount it within the global root.
     zx_status_t MountSystem();
 
     // Identifies if "/system" has already been mounted.
-    bool IsSystemMounted() const {
-        return systemfs_root_ != nullptr;
-    }
+    bool IsSystemMounted() const { return systemfs_root_ != nullptr; }
 
     // Set the "/system" VFS filesystem to become readonly.
     void SystemfsSetReadonly(bool value);
@@ -102,9 +94,8 @@ private:
     zx_status_t LocalMount(memfs::VnodeDir* parent, const char* name,
                            fbl::RefPtr<memfs::VnodeDir>& subtree);
 
-    static constexpr const char* kMountPoints[] = {
-        "/bin", "/data", "/volume", "/system", "/install", "/blob", "/pkgfs"
-    };
+    static constexpr const char* kMountPoints[] = {"/bin",     "/data", "/volume", "/system",
+                                                   "/install", "/blob", "/pkgfs"};
     fbl::RefPtr<fs::Vnode> mount_nodes[fbl::count_of(kMountPoints)];
 
     // The Root VFS manages the following filesystems:
diff --git a/system/core/devmgr/fshost/main.cpp b/system/core/devmgr/fshost/main.cpp
index 68d5ac168f8..8ce60e09517 100644
--- a/system/core/devmgr/fshost/main.cpp
+++ b/system/core/devmgr/fshost/main.cpp
@@ -48,16 +48,15 @@ namespace {
 
 #define LAST_PANIC_FILEPATH "log/last-panic.txt"
 
-constexpr uint32_t kFsDirFlags = ZX_FS_RIGHT_READABLE | ZX_FS_RIGHT_ADMIN |
-                                 ZX_FS_FLAG_DIRECTORY | ZX_FS_FLAG_NOREMOTE;
+constexpr uint32_t kFsDirFlags =
+    ZX_FS_RIGHT_READABLE | ZX_FS_RIGHT_ADMIN | ZX_FS_FLAG_DIRECTORY | ZX_FS_FLAG_NOREMOTE;
 
 struct BootdataRamdisk : public fbl::SinglyLinkedListable<fbl::unique_ptr<BootdataRamdisk>> {
 public:
     explicit BootdataRamdisk(zx::vmo vmo) : vmo_(std::move(vmo)) {}
 
-    zx::vmo TakeRamdisk() {
-        return std::move(vmo_);
-    }
+    zx::vmo TakeRamdisk() { return std::move(vmo_); }
+
 private:
     zx::vmo vmo_;
 };
@@ -104,12 +103,11 @@ zx_status_t SetupBootfsVmo(const fbl::unique_ptr<FsManager>& root, uint32_t n, z
     }
     bootfs::Parser bfs;
     if (bfs.Init(zx::unowned_vmo(bootfs_vmo)) == ZX_OK) {
-        bfs.Parse([&root, vmo](const bootfs_entry_t *entry) -> zx_status_t {
-                      // printf("bootfs: %s @%zd (%zd bytes)\n", path, off, len);
-                      root.get()->SystemfsAddFile(entry->name, vmo, entry->data_off,
-                                                  entry->data_len);
-                      return ZX_OK;
-                  });
+        bfs.Parse([&root, vmo](const bootfs_entry_t* entry) -> zx_status_t {
+            // printf("bootfs: %s @%zd (%zd bytes)\n", path, off, len);
+            root.get()->SystemfsAddFile(entry->name, vmo, entry->data_off, entry->data_len);
+            return ZX_OK;
+        });
     }
     root->SystemfsSetReadonly(getenv("zircon.system.writable") == nullptr);
     return ZX_OK;
@@ -202,9 +200,9 @@ void SetupBootfs(const fbl::unique_ptr<FsManager>& root,
             case BOOTDATA_BOOTFS_SYSTEM: {
                 const char* errmsg;
                 zx_handle_t bootfs_vmo;
-                status = decompress_bootdata(zx_vmar_root_self(), vmo.get(),
-                                             off, bootdata.length + sizeof(bootdata_t),
-                                             &bootfs_vmo, &errmsg);
+                status =
+                    decompress_bootdata(zx_vmar_root_self(), vmo.get(), off,
+                                        bootdata.length + sizeof(bootdata_t), &bootfs_vmo, &errmsg);
                 if (status < 0) {
                     printf("devmgr: failed to decompress bootdata: %s\n", errmsg);
                 } else {
@@ -215,13 +213,11 @@ void SetupBootfs(const fbl::unique_ptr<FsManager>& root,
             case BOOTDATA_RAMDISK: {
                 const char* errmsg;
                 zx_handle_t ramdisk_vmo;
-                status = decompress_bootdata(
-                    zx_vmar_root_self(), vmo.get(),
-                    off, bootdata.length + sizeof(bootdata_t),
-                    &ramdisk_vmo, &errmsg);
+                status = decompress_bootdata(zx_vmar_root_self(), vmo.get(), off,
+                                             bootdata.length + sizeof(bootdata_t), &ramdisk_vmo,
+                                             &errmsg);
                 if (status != ZX_OK) {
-                    printf("fshost: failed to decompress bootdata: %s\n",
-                           errmsg);
+                    printf("fshost: failed to decompress bootdata: %s\n", errmsg);
                 } else {
                     auto ramdisk = fbl::make_unique<BootdataRamdisk>(zx::vmo(ramdisk_vmo));
                     ramdisk_list->push_front(std::move(ramdisk));
@@ -243,7 +239,8 @@ void SetupBootfs(const fbl::unique_ptr<FsManager>& root,
 // Setup the loader service to be used by all processes spawned by devmgr.
 void setup_loader_service(zx::channel devmgr_loader) {
     loader_service_t* svc;
-    zx_status_t status = loader_service_create_fs(nullptr, &svc);;
+    zx_status_t status = loader_service_create_fs(nullptr, &svc);
+    ;
     if (status != ZX_OK) {
         fprintf(stderr, "fshost: failed to create loader service %d\n", status);
     }
@@ -366,8 +363,8 @@ int main(int argc, char** argv) {
 
     // Initialize connections to external service managers, and begin
     // monitoring the |fshost_event| for a termination event.
-    root->InitializeConnections(std::move(fs_root), std::move(devfs_root),
-                                std::move(svc_root), std::move(fshost_event));
+    root->InitializeConnections(std::move(fs_root), std::move(devfs_root), std::move(svc_root),
+                                std::move(fshost_event));
     g_fshost = root.get();
 
     // If we have a "/system" ramdisk, start higher level services.
diff --git a/system/core/devmgr/fshost/vfs-rpc.cpp b/system/core/devmgr/fshost/vfs-rpc.cpp
index 7aaf5203c30..3913f8780db 100644
--- a/system/core/devmgr/fshost/vfs-rpc.cpp
+++ b/system/core/devmgr/fshost/vfs-rpc.cpp
@@ -9,20 +9,20 @@
 #include <sys/stat.h>
 #include <threads.h>
 
+#include <fbl/algorithm.h>
+#include <fbl/alloc_checker.h>
+#include <fbl/auto_lock.h>
+#include <fbl/unique_ptr.h>
+#include <fs/vfs.h>
 #include <lib/async-loop/cpp/loop.h>
 #include <lib/async/cpp/wait.h>
-#include <fs/vfs.h>
+#include <lib/fdio/debug.h>
+#include <lib/fdio/io.h>
 #include <zircon/device/device.h>
 #include <zircon/device/vfs.h>
 #include <zircon/processargs.h>
 #include <zircon/syscalls.h>
 #include <zircon/thread_annotations.h>
-#include <lib/fdio/debug.h>
-#include <lib/fdio/io.h>
-#include <fbl/algorithm.h>
-#include <fbl/alloc_checker.h>
-#include <fbl/auto_lock.h>
-#include <fbl/unique_ptr.h>
 
 #include <utility>
 
@@ -44,8 +44,8 @@ zx_status_t AddVmofile(fbl::RefPtr<memfs::VnodeDir> vnb, const char* path, zx_ha
             if (path[0] == 0) {
                 return ZX_ERR_INVALID_ARGS;
             }
-            return vnb->vfs()->CreateFromVmo(vnb.get(), fbl::StringPiece(path, strlen(path)),
-                                             vmo, off, len);
+            return vnb->vfs()->CreateFromVmo(vnb.get(), fbl::StringPiece(path, strlen(path)), vmo,
+                                             off, len);
         } else {
             if (nextpath == path) {
                 return ZX_ERR_INVALID_ARGS;
@@ -87,9 +87,8 @@ FsManager::FsManager() {
 
     for (unsigned n = 0; n < fbl::count_of(kMountPoints); n++) {
         fbl::StringPiece pathout;
-        status = root_vfs_.Open(global_root_, &mount_nodes[n],
-                                fbl::StringPiece(kMountPoints[n]), &pathout,
-                                ZX_FS_RIGHT_READABLE | ZX_FS_FLAG_CREATE, S_IFDIR);
+        status = root_vfs_.Open(global_root_, &mount_nodes[n], fbl::StringPiece(kMountPoints[n]),
+                                &pathout, ZX_FS_RIGHT_READABLE | ZX_FS_FLAG_CREATE, S_IFDIR);
         ZX_ASSERT(status == ZX_OK);
     }
 
@@ -138,10 +137,8 @@ zx_status_t FsManager::InitializeConnections(zx::channel root, zx::channel devfs
         printf("fshost: cannot create global root\n");
     }
 
-    connections_ = fbl::make_unique<FshostConnections>(std::move(devfs_root),
-                                                       std::move(svc_root),
-                                                       std::move(fs_root),
-                                                       std::move(fshost_event));
+    connections_ = fbl::make_unique<FshostConnections>(std::move(devfs_root), std::move(svc_root),
+                                                       std::move(fs_root), std::move(fshost_event));
     // Now that we've initialized our connection to the outside world,
     // monitor for external shutdown events.
     WatchExit();
@@ -166,10 +163,8 @@ zx_status_t FsManager::ServeRoot(zx::channel* out) {
 }
 
 void FsManager::WatchExit() {
-    global_shutdown_.set_handler([this](async_dispatcher_t* dispatcher,
-                                        async::Wait* wait,
-                                        zx_status_t status,
-                                        const zx_packet_signal_t* signal) {
+    global_shutdown_.set_handler([this](async_dispatcher_t* dispatcher, async::Wait* wait,
+                                        zx_status_t status, const zx_packet_signal_t* signal) {
         root_vfs_.UninstallAll(ZX_TIME_INFINITE);
         system_vfs_.UninstallAll(ZX_TIME_INFINITE);
         connections_->Event().signal(0, FSHOST_SIGNAL_EXIT_DONE);
@@ -199,8 +194,7 @@ zx_status_t FsManager::LocalMount(memfs::VnodeDir* parent, const char* name,
     if ((status = ServeVnode(subtree, std::move(server))) != ZX_OK) {
         return status;
     }
-    return parent->vfs()->InstallRemote(std::move(vn),
-                                        fs::MountChannel(std::move(client)));
+    return parent->vfs()->InstallRemote(std::move(vn), fs::MountChannel(std::move(client)));
 }
 
 } // namespace devmgr
diff --git a/system/core/devmgr/shared/async-loop-owned-rpc-handler.h b/system/core/devmgr/shared/async-loop-owned-rpc-handler.h
index 4b6571ce628..2ba0cd9a8e8 100644
--- a/system/core/devmgr/shared/async-loop-owned-rpc-handler.h
+++ b/system/core/devmgr/shared/async-loop-owned-rpc-handler.h
@@ -4,8 +4,8 @@
 
 #pragma once
 
-#include <lib/async/cpp/wait.h>
 #include <fbl/unique_ptr.h>
+#include <lib/async/cpp/wait.h>
 #include <lib/zx/channel.h>
 
 #include <utility>
@@ -33,8 +33,7 @@ public:
 
     // Variant of BeginWait that conditionally consumes |conn|.  On failure,
     // |*conn| is untouched.
-    static zx_status_t BeginWait(fbl::unique_ptr<T>* conn,
-                                 async_dispatcher_t* dispatcher) {
+    static zx_status_t BeginWait(fbl::unique_ptr<T>* conn, async_dispatcher_t* dispatcher) {
         zx_status_t status = (*conn)->wait_.Begin(dispatcher);
         if (status == ZX_OK) {
             __UNUSED auto ptr = conn->release();
@@ -45,8 +44,7 @@ public:
     // Begins waiting in |dispatcher| on |conn->wait|.  This transfers ownership
     // of |conn| to the dispatcher.  The dispatcher returns ownership when the
     // handler is invoked.
-    static zx_status_t BeginWait(fbl::unique_ptr<T> conn,
-                                 async_dispatcher_t* dispatcher) {
+    static zx_status_t BeginWait(fbl::unique_ptr<T> conn, async_dispatcher_t* dispatcher) {
         return BeginWait(&conn, dispatcher);
     }
 
@@ -58,9 +56,7 @@ public:
         T::HandleRpc(std::move(self), dispatcher, wait, status, signal);
     }
 
-    zx::unowned_channel channel() {
-        return zx::unowned_channel(wait_.object());
-    }
+    zx::unowned_channel channel() { return zx::unowned_channel(wait_.object()); }
 
     // Sets the channel to the given handle and returns the old value
     zx::channel set_channel(zx::channel h) {
@@ -70,7 +66,8 @@ public:
     }
 
     using WaitType = async::WaitMethod<AsyncLoopOwnedRpcHandler<T>,
-          &AsyncLoopOwnedRpcHandler<T>::HandleRpcEntry>;
+                                       &AsyncLoopOwnedRpcHandler<T>::HandleRpcEntry>;
+
 private:
     WaitType wait_{this, ZX_HANDLE_INVALID, ZX_CHANNEL_READABLE | ZX_CHANNEL_PEER_CLOSED};
 };
diff --git a/system/core/devmgr/shared/env.cpp b/system/core/devmgr/shared/env.cpp
index a7f716f1121..f09604edd5a 100644
--- a/system/core/devmgr/shared/env.cpp
+++ b/system/core/devmgr/shared/env.cpp
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include  "env.h"
+#include "env.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -14,9 +14,7 @@ bool getenv_bool(const char* key, bool default_value) {
     if (value == nullptr) {
         return default_value;
     }
-    if ((strcmp(value, "0") == 0) ||
-        (strcmp(value, "false") == 0) ||
-        (strcmp(value, "off") == 0)) {
+    if ((strcmp(value, "0") == 0) || (strcmp(value, "false") == 0) || (strcmp(value, "off") == 0)) {
         return false;
     }
     return true;
diff --git a/system/core/devmgr/shared/fdio.cpp b/system/core/devmgr/shared/fdio.cpp
index 03cf73e54c0..d4811454ae3 100644
--- a/system/core/devmgr/shared/fdio.cpp
+++ b/system/core/devmgr/shared/fdio.cpp
@@ -35,6 +35,8 @@ namespace devmgr {
 #define MAX_ENVP 16
 #define CHILD_JOB_RIGHTS (ZX_RIGHTS_BASIC | ZX_RIGHT_MANAGE_JOB | ZX_RIGHT_MANAGE_PROCESS)
 
+// clang-format off
+
 static struct {
     const char* mount;
     const char* name;
@@ -54,17 +56,17 @@ static struct {
     { "/tmp",       "tmp",       FS_TMP },
 };
 
+// clang-format on
+
 void devmgr_disable_appmgr_services() {
     FSTAB[1].flags = 0;
 }
 
-zx_status_t devmgr_launch(
-    const zx::job& job, const char* name,
-    zx_status_t (*load)(void*, launchpad_t*, const char*), void* ctx,
-    int argc, const char* const* argv,
-    const char** initial_envp, int stdiofd,
-    const zx_handle_t* handles, const uint32_t* types, size_t hcount,
-    zx::process* out_proc, uint32_t flags) {
+zx_status_t devmgr_launch(const zx::job& job, const char* name,
+                          zx_status_t (*load)(void*, launchpad_t*, const char*), void* ctx,
+                          int argc, const char* const* argv, const char** initial_envp, int stdiofd,
+                          const zx_handle_t* handles, const uint32_t* types, size_t hcount,
+                          zx::process* out_proc, uint32_t flags) {
     zx_status_t status;
     const char* envp[MAX_ENVP + 1];
     unsigned envn = 0;
@@ -96,7 +98,7 @@ zx_status_t devmgr_launch(
     launchpad_set_environ(lp, envp);
 
     // create namespace based on FS_* flags
-    const char* nametable[fbl::count_of(FSTAB)] = { };
+    const char* nametable[fbl::count_of(FSTAB)] = {};
     uint32_t count = 0;
     zx_handle_t h;
     for (unsigned n = 0; n < fbl::count_of(FSTAB); n++) {
@@ -126,8 +128,7 @@ zx_status_t devmgr_launch(
     zx::process proc;
     const char* errmsg;
     if ((status = launchpad_go(lp, proc.reset_and_get_address(), &errmsg)) < 0) {
-        printf("devmgr: launchpad %s (%s) failed: %s: %d\n",
-               argv[0], name, errmsg, status);
+        printf("devmgr: launchpad %s (%s) failed: %s: %d\n", argv[0], name, errmsg, status);
     } else {
         if (out_proc != nullptr) {
             *out_proc = std::move(proc);
@@ -137,12 +138,11 @@ zx_status_t devmgr_launch(
     return status;
 }
 
-zx_status_t devmgr_launch_cmdline(
-    const char* me, const zx::job& job, const char* name,
-    zx_status_t (*load)(void* ctx, launchpad_t*, const char* file), void* ctx,
-    const char* cmdline,
-    const zx_handle_t* handles, const uint32_t* types, size_t hcount,
-    zx::process* proc, uint32_t flags) {
+zx_status_t devmgr_launch_cmdline(const char* me, const zx::job& job, const char* name,
+                                  zx_status_t (*load)(void* ctx, launchpad_t*, const char* file),
+                                  void* ctx, const char* cmdline, const zx_handle_t* handles,
+                                  const uint32_t* types, size_t hcount, zx::process* proc,
+                                  uint32_t flags) {
 
     // Get the full commandline by splitting on '+'.
     char* buf = strdup(cmdline);
@@ -165,13 +165,12 @@ zx_status_t devmgr_launch_cmdline(
     }
     printf("...\n");
 
-    zx_status_t status = devmgr_launch(
-        job, name, load, ctx, argc, (const char* const*)argv, nullptr, -1,
-        handles, types, hcount, proc, flags);
+    zx_status_t status = devmgr_launch(job, name, load, ctx, argc, (const char* const*)argv,
+                                       nullptr, -1, handles, types, hcount, proc, flags);
 
     free(buf);
 
     return status;
 }
 
-} // namespace
+} // namespace devmgr
diff --git a/system/core/devmgr/shared/fdio.h b/system/core/devmgr/shared/fdio.h
index cb1232b5904..b28a23ad764 100644
--- a/system/core/devmgr/shared/fdio.h
+++ b/system/core/devmgr/shared/fdio.h
@@ -10,6 +10,8 @@
 
 namespace devmgr {
 
+// clang-format off
+
 // Signals for synchronizing between devmgr and fshost during fshost launch
 #define FSHOST_SIGNAL_READY      ZX_USER_SIGNAL_0  // Signalled by fshost
 #define FSHOST_SIGNAL_EXIT       ZX_USER_SIGNAL_1  // Signalled by devmgr
@@ -30,26 +32,24 @@ namespace devmgr {
 #define FS_BIN      0x1000
 #define FS_ALL      0xFFFF
 
-#define FS_FOR_FSPROC  (FS_SVC)
-#define FS_FOR_APPMGR  (FS_ALL & (~FS_HUB))
+// clang-format on
+
+#define FS_FOR_FSPROC (FS_SVC)
+#define FS_FOR_APPMGR (FS_ALL & (~FS_HUB))
 
-#define FS_DIR_FLAGS \
-    (ZX_FS_RIGHT_READABLE | ZX_FS_RIGHT_ADMIN |\
-    ZX_FS_FLAG_DIRECTORY | ZX_FS_FLAG_NOREMOTE)
+#define FS_DIR_FLAGS                                                                               \
+    (ZX_FS_RIGHT_READABLE | ZX_FS_RIGHT_ADMIN | ZX_FS_FLAG_DIRECTORY | ZX_FS_FLAG_NOREMOTE)
 
-zx_status_t devmgr_launch(
-    const zx::job& job, const char* name,
-    zx_status_t (*load)(void* ctx, launchpad_t*, const char* file), void* ctx,
-    int argc, const char* const* argv,
-    const char** envp, int stdiofd,
-    const zx_handle_t* handles, const uint32_t* types, size_t hcount,
-    zx::process* proc_out, uint32_t flags);
-zx_status_t devmgr_launch_cmdline(
-    const char* me, const zx::job& job, const char* name,
-    zx_status_t (*load)(void* ctx, launchpad_t*, const char* file), void* ctx,
-    const char* cmdline,
-    const zx_handle_t* handles, const uint32_t* types, size_t hcount,
-    zx::process* proc_out, uint32_t flags);
+zx_status_t devmgr_launch(const zx::job& job, const char* name,
+                          zx_status_t (*load)(void* ctx, launchpad_t*, const char* file), void* ctx,
+                          int argc, const char* const* argv, const char** envp, int stdiofd,
+                          const zx_handle_t* handles, const uint32_t* types, size_t hcount,
+                          zx::process* proc_out, uint32_t flags);
+zx_status_t devmgr_launch_cmdline(const char* me, const zx::job& job, const char* name,
+                                  zx_status_t (*load)(void* ctx, launchpad_t*, const char* file),
+                                  void* ctx, const char* cmdline, const zx_handle_t* handles,
+                                  const uint32_t* types, size_t hcount, zx::process* proc_out,
+                                  uint32_t flags);
 
 void devmgr_disable_appmgr_services();
 
diff --git a/system/core/devmgr/shared/fidl_txn.h b/system/core/devmgr/shared/fidl_txn.h
index 0a59207172f..a14dcbf2055 100644
--- a/system/core/devmgr/shared/fidl_txn.h
+++ b/system/core/devmgr/shared/fidl_txn.h
@@ -13,8 +13,8 @@ namespace devmgr {
 // FidlTxn must not outlive the channel it is given
 class FidlTxn {
 public:
-    FidlTxn(zx::unowned_channel channel, uint32_t txid) : channel_(channel), txid_(txid) { }
-    FidlTxn(const zx::channel& channel, uint32_t txid) : channel_(channel), txid_(txid) { }
+    FidlTxn(zx::unowned_channel channel, uint32_t txid) : channel_(channel), txid_(txid) {}
+    FidlTxn(const zx::channel& channel, uint32_t txid) : channel_(channel), txid_(txid) {}
 
     FidlTxn& operator=(const FidlTxn&) = delete;
     FidlTxn(const FidlTxn&) = delete;
@@ -25,8 +25,7 @@ public:
     zx_status_t Reply(const fidl_msg_t* msg) {
         auto hdr = static_cast<fidl_message_header_t*>(msg->bytes);
         hdr->txid = txid_;
-        return channel_->write(0, msg->bytes, msg->num_bytes,
-                               msg->handles, msg->num_handles);
+        return channel_->write(0, msg->bytes, msg->num_bytes, msg->handles, msg->num_handles);
     }
 
     static zx_status_t FidlReply(fidl_txn_t* reply, const fidl_msg_t* msg) {
@@ -39,7 +38,7 @@ public:
 private:
     // Due to the implementation of FidlReply, it is important that this be the
     // first member variable.
-    fidl_txn_t txn_ = { .reply = FidlTxn::FidlReply };
+    fidl_txn_t txn_ = {.reply = FidlTxn::FidlReply};
 
     // Reply channel
     const zx::unowned_channel channel_;
diff --git a/system/core/devmgr/shared/log.h b/system/core/devmgr/shared/log.h
index 11f4e2efe4e..3290be7142f 100644
--- a/system/core/devmgr/shared/log.h
+++ b/system/core/devmgr/shared/log.h
@@ -9,6 +9,8 @@
 
 namespace devmgr {
 
+// clang-format off
+
 #define LOG_ERROR    0x001
 #define LOG_INFO     0x002
 #define LOG_TRACE    0x004
@@ -21,8 +23,14 @@ namespace devmgr {
 #define LOG_DEVLC    0x200
 #define LOG_ALL      0x3ff
 
+// clang-format on
+
 extern uint32_t log_flags;
 
-#define log(flag, fmt...) do { if (LOG_##flag & ::devmgr::log_flags) printf(fmt); } while (0)
+#define log(flag, fmt...)                                                                          \
+    do {                                                                                           \
+        if (LOG_##flag & ::devmgr::log_flags)                                                      \
+            printf(fmt);                                                                           \
+    } while (0)
 
 } // namespace devmgr
-- 
GitLab