osi: Apply clang-format

cd osi/
clang-format -i --style=file include/*.h include/socket_utils/* src/*.cc \
    src/socket_utils/* src/protos/* test/*

Test: mma -j32
Change-Id: I659e586076f1e2ec8f687cd33f441700b8d1f823
diff --git a/osi/include/alarm.h b/osi/include/alarm.h
index dc74649..5899d15 100644
--- a/osi/include/alarm.h
+++ b/osi/include/alarm.h
@@ -31,7 +31,7 @@
 typedef struct thread_t thread_t;
 
 // Prototype for the alarm callback function.
-typedef void (*alarm_callback_t)(void *data);
+typedef void (*alarm_callback_t)(void* data);
 
 // Creates a new one-time off alarm object with user-assigned
 // |name|. |name| may not be NULL, and a copy of the string will
@@ -40,7 +40,7 @@
 // better debuggability), but that is not enforced. The returned
 // object must be freed by calling |alarm_free|. Returns NULL on
 // failure.
-alarm_t *alarm_new(const char *name);
+alarm_t* alarm_new(const char* name);
 
 // Creates a new periodic alarm object with user-assigned |name|.
 // |name| may not be NULL, and a copy of the string will be
@@ -49,13 +49,13 @@
 // debuggability), but that is not enforced. The returned object
 // must be freed by calling |alarm_free|. Returns NULL on
 // failure.
-alarm_t *alarm_new_periodic(const char *name);
+alarm_t* alarm_new_periodic(const char* name);
 
 // Frees an |alarm| object created by |alarm_new| or
 // |alarm_new_periodic|. |alarm| may be NULL. If the alarm is
 // pending, it will be cancelled first. It is not safe to call
 // |alarm_free| from inside the callback of |alarm|.
-void alarm_free(alarm_t *alarm);
+void alarm_free(alarm_t* alarm);
 
 // Sets an |alarm| to execute a callback in the future. The |cb|
 // callback is called after the given |interval_ms|, where
@@ -75,8 +75,8 @@
 // thread is not same as the caller’s thread. If two (or more)
 // alarms are set back-to-back with the same |interval_ms|, the
 // callbacks will be called in the order the alarms are set.
-void alarm_set(alarm_t *alarm, period_ms_t interval_ms,
-               alarm_callback_t cb, void *data);
+void alarm_set(alarm_t* alarm, period_ms_t interval_ms, alarm_callback_t cb,
+               void* data);
 
 // Sets an |alarm| to execute a callback in the future on a
 // specific |queue|. This function is same as |alarm_set| except
@@ -85,34 +85,33 @@
 // Also, the callback execution ordering guarantee exists only
 // among alarms that are scheduled on the same queue. |queue|
 // may not be NULL.
-void alarm_set_on_queue(alarm_t *alarm, period_ms_t interval_ms,
-                        alarm_callback_t cb, void *data,
-                        fixed_queue_t *queue);
+void alarm_set_on_queue(alarm_t* alarm, period_ms_t interval_ms,
+                        alarm_callback_t cb, void* data, fixed_queue_t* queue);
 
 // This function cancels the |alarm| if it was previously set.
 // When this call returns, the caller has a guarantee that the
 // callback is not in progress and will not be called if it
 // hasn't already been called. This function is idempotent.
 // |alarm| may not be NULL.
-void alarm_cancel(alarm_t *alarm);
+void alarm_cancel(alarm_t* alarm);
 
 // Tests whether the |alarm| is scheduled.
 // Return true if the |alarm| is scheduled or NULL, otherwise false.
-bool alarm_is_scheduled(const alarm_t *alarm);
+bool alarm_is_scheduled(const alarm_t* alarm);
 
 // Registers |queue| for processing alarm callbacks on |thread|.
 // |queue| may not be NULL. |thread| may not be NULL.
-void alarm_register_processing_queue(fixed_queue_t *queue, thread_t *thread);
+void alarm_register_processing_queue(fixed_queue_t* queue, thread_t* thread);
 
 // Unregisters |queue| for processing alarm callbacks on whichever thread
 // it is registered with. All alarms currently set for execution on |queue|
 // will be canceled. |queue| may not be NULL. This function is idempotent.
-void alarm_unregister_processing_queue(fixed_queue_t *queue);
+void alarm_unregister_processing_queue(fixed_queue_t* queue);
 
 // Figure out how much time until next expiration.
 // Returns 0 if not armed. |alarm| may not be NULL.
 // TODO: Remove this function once PM timers can be re-factored
-period_ms_t alarm_get_remaining_ms(const alarm_t *alarm);
+period_ms_t alarm_get_remaining_ms(const alarm_t* alarm);
 
 // Cleanup the alarm internal state.
 // This function should be called by the OSI module cleanup during
diff --git a/osi/include/allocation_tracker.h b/osi/include/allocation_tracker.h
index b07ec4f..9496ce6 100644
--- a/osi/include/allocation_tracker.h
+++ b/osi/include/allocation_tracker.h
@@ -48,16 +48,18 @@
 // enough memory for canaries; the total allocation size can be determined
 // by calling |allocation_tracker_resize_for_canary|. Returns |ptr| offset
 // to the the beginning of the uncanaried region.
-void *allocation_tracker_notify_alloc(allocator_id_t allocator_id, void *ptr, size_t requested_size);
+void* allocation_tracker_notify_alloc(allocator_id_t allocator_id, void* ptr,
+                                      size_t requested_size);
 
 // Notify the tracker of an allocation that is being freed. |ptr| must be a
 // pointer returned by a call to |allocation_tracker_notify_alloc| with the
 // same |allocator_id|. If |ptr| is NULL, this function does nothing. Returns
 // |ptr| offset to the real beginning of the allocation including any canary
 // space.
-void *allocation_tracker_notify_free(allocator_id_t allocator_id, void *ptr);
+void* allocation_tracker_notify_free(allocator_id_t allocator_id, void* ptr);
 
-// Get the full size for an allocation, taking into account the size of canaries.
+// Get the full size for an allocation, taking into account the size of
+// canaries.
 size_t allocation_tracker_resize_for_canary(size_t size);
 
 #ifdef __cplusplus
diff --git a/osi/include/allocator.h b/osi/include/allocator.h
index 518fc76..c7e870a 100644
--- a/osi/include/allocator.h
+++ b/osi/include/allocator.h
@@ -26,30 +26,30 @@
 extern "C" {
 #endif
 
-typedef void *(*alloc_fn)(size_t size);
-typedef void (*free_fn)(void *ptr);
+typedef void* (*alloc_fn)(size_t size);
+typedef void (*free_fn)(void* ptr);
 
 typedef struct {
   alloc_fn alloc;
-  free_fn  free;
+  free_fn free;
 } allocator_t;
 
 // allocator_t abstractions for the osi_*alloc and osi_free functions
 extern const allocator_t allocator_malloc;
 extern const allocator_t allocator_calloc;
 
-char *osi_strdup(const char *str);
-char *osi_strndup(const char *str, size_t len);
+char* osi_strdup(const char* str);
+char* osi_strndup(const char* str, size_t len);
 
-void *osi_malloc(size_t size);
-void *osi_calloc(size_t size);
-void osi_free(void *ptr);
+void* osi_malloc(size_t size);
+void* osi_calloc(size_t size);
+void osi_free(void* ptr);
 
 // Free a buffer that was previously allocated with function |osi_malloc|
 // or |osi_calloc| and reset the pointer to that buffer to NULL.
 // |p_ptr| is a pointer to the buffer pointer to be reset.
 // |p_ptr| cannot be NULL.
-void osi_free_and_reset(void **p_ptr);
+void osi_free_and_reset(void** p_ptr);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/array.h b/osi/include/array.h
index d275c417..fa05d87 100644
--- a/osi/include/array.h
+++ b/osi/include/array.h
@@ -28,23 +28,27 @@
 
 typedef struct array_t array_t;
 
-// Returns a new array object that stores elements of size |element_size|. The returned
-// object must be freed with |array_free|. |element_size| must be greater than 0. Returns
+// Returns a new array object that stores elements of size |element_size|. The
+// returned
+// object must be freed with |array_free|. |element_size| must be greater than
+// 0. Returns
 // NULL on failure.
-array_t *array_new(size_t element_size);
+array_t* array_new(size_t element_size);
 
 // Frees an array that was allocated with |array_new|. |array| may be NULL.
-void array_free(array_t *array);
+void array_free(array_t* array);
 
-// Returns a pointer to the first stored element in |array|. |array| must not be NULL.
-void *array_ptr(const array_t *array);
+// Returns a pointer to the first stored element in |array|. |array| must not be
+// NULL.
+void* array_ptr(const array_t* array);
 
-// Returns a pointer to the |index|th element of |array|. |index| must be less than
+// Returns a pointer to the |index|th element of |array|. |index| must be less
+// than
 // the array's length. |array| must not be NULL.
-void *array_at(const array_t *array, size_t index);
+void* array_at(const array_t* array, size_t index);
 
 // Returns the number of elements stored in |array|. |array| must not be NULL.
-size_t array_length(const array_t *array);
+size_t array_length(const array_t* array);
 
 // Inserts an element to the end of |array| by value. For example, a caller
 // may simply call array_append_value(array, 5) instead of storing 5 into a
@@ -52,13 +56,15 @@
 // only the lowest |element_size| bytes will be stored. |array| must not be
 // NULL. Returns true if the element could be inserted into the array, false
 // on error.
-bool array_append_value(array_t *array, uint32_t value);
+bool array_append_value(array_t* array, uint32_t value);
 
 // Inserts an element to the end of |array|. The value pointed to by |data| must
-// be at least |element_size| bytes long and will be copied into the array. Neither
-// |array| nor |data| may be NULL. Returns true if the element could be inserted into
+// be at least |element_size| bytes long and will be copied into the array.
+// Neither
+// |array| nor |data| may be NULL. Returns true if the element could be inserted
+// into
 // the array, false on error.
-bool array_append_ptr(array_t *array, void *data);
+bool array_append_ptr(array_t* array, void* data);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/buffer.h b/osi/include/buffer.h
index 0abae36..211f0d6 100644
--- a/osi/include/buffer.h
+++ b/osi/include/buffer.h
@@ -30,34 +30,35 @@
 // Returns a new buffer of |size| bytes. Returns NULL if a buffer could not be
 // allocated. |size| must be non-zero. The caller must release this buffer with
 // |buffer_free|.
-buffer_t *buffer_new(size_t size);
+buffer_t* buffer_new(size_t size);
 
 // Creates a new reference to the buffer |buf|. A reference is indistinguishable
 // from the original: writes to the original will be reflected in the reference
 // and vice versa. In other words, this function creates an alias to |buf|. The
-// caller must release the returned buffer with |buffer_free|. Note that releasing
+// caller must release the returned buffer with |buffer_free|. Note that
+// releasing
 // the returned buffer does not release |buf|. |buf| must not be NULL.
-buffer_t *buffer_new_ref(const buffer_t *buf);
+buffer_t* buffer_new_ref(const buffer_t* buf);
 
 // Creates a new reference to the last |slice_size| bytes of |buf|. See
 // |buffer_new_ref| for a description of references. |slice_size| must be
 // greater than 0 and may be at most |buffer_length|
 // (0 < slice_size <= buffer_length). |buf| must not be NULL.
-buffer_t *buffer_new_slice(const buffer_t *buf, size_t slice_size);
+buffer_t* buffer_new_slice(const buffer_t* buf, size_t slice_size);
 
 // Frees a buffer object. |buf| may be NULL.
-void buffer_free(buffer_t *buf);
+void buffer_free(buffer_t* buf);
 
 // Returns a pointer to a writeable memory region for |buf|. All references
 // and slices that share overlapping bytes will also be written to when
 // writing to the returned pointer. The caller may safely write up to
 // |buffer_length| consecutive bytes starting at the address returned by
 // this function. |buf| must not be NULL.
-void *buffer_ptr(const buffer_t *buf);
+void* buffer_ptr(const buffer_t* buf);
 
 // Returns the length of the writeable memory region referred to by |buf|.
 // |buf| must not be NULL.
-size_t buffer_length(const buffer_t *buf);
+size_t buffer_length(const buffer_t* buf);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/compat.h b/osi/include/compat.h
index f25513d..981c452 100644
--- a/osi/include/compat.h
+++ b/osi/include/compat.h
@@ -33,10 +33,10 @@
 pid_t gettid(void);
 
 /* Copy src to string dst of size siz. */
-size_t strlcpy(char *dst, const char *src, size_t siz);
+size_t strlcpy(char* dst, const char* src, size_t siz);
 
 /* Appends src to string dst of size siz. */
-size_t strlcat(char *dst, const char *src, size_t siz);
+size_t strlcat(char* dst, const char* src, size_t siz);
 
 #endif
 
diff --git a/osi/include/config.h b/osi/include/config.h
index 970c0cc..2243c27 100644
--- a/osi/include/config.h
+++ b/osi/include/config.h
@@ -32,14 +32,14 @@
 // Creates a new config object with no entries (i.e. not backed by a file).
 // This function returns a config object or NULL on error. Clients must call
 // |config_free| on the returned handle when it is no longer required.
-config_t *config_new_empty(void);
+config_t* config_new_empty(void);
 
 // Loads the specified file and returns a handle to the config file. If there
 // was a problem loading the file or allocating memory, this function returns
 // NULL. Clients must call |config_free| on the returned handle when it is no
 // longer required. |filename| must not be NULL and must point to a readable
 // file on the filesystem.
-config_t *config_new(const char *filename);
+config_t* config_new(const char* filename);
 
 // Clones |src|, including all of it's sections, keys, and values.
 // Returns a new config which is a copy and separated from the original;
@@ -48,96 +48,122 @@
 // |src| must not be NULL
 // This function will not return NULL.
 // Clients must call config_free on the returned object.
-config_t *config_new_clone(const config_t *src);
+config_t* config_new_clone(const config_t* src);
 
 // Frees resources associated with the config file. No further operations may
 // be performed on the |config| object after calling this function. |config|
 // may be NULL.
-void config_free(config_t *config);
+void config_free(config_t* config);
 
 // Returns true if the config file contains a section named |section|. If
 // the section has no key/value pairs in it, this function will return false.
 // |config| and |section| must not be NULL.
-bool config_has_section(const config_t *config, const char *section);
+bool config_has_section(const config_t* config, const char* section);
 
 // Returns true if the config file has a key named |key| under |section|.
 // Returns false otherwise. |config|, |section|, and |key| must not be NULL.
-bool config_has_key(const config_t *config, const char *section, const char *key);
+bool config_has_key(const config_t* config, const char* section,
+                    const char* key);
 
 // Returns the integral value for a given |key| in |section|. If |section|
 // or |key| do not exist, or the value cannot be fully converted to an integer,
 // this function returns |def_value|. |config|, |section|, and |key| must not
 // be NULL.
-int config_get_int(const config_t *config, const char *section, const char *key, int def_value);
+int config_get_int(const config_t* config, const char* section, const char* key,
+                   int def_value);
 
 // Returns the boolean value for a given |key| in |section|. If |section|
 // or |key| do not exist, or the value cannot be converted to a boolean, this
-// function returns |def_value|. |config|, |section|, and |key| must not be NULL.
-bool config_get_bool(const config_t *config, const char *section, const char *key, bool def_value);
+// function returns |def_value|. |config|, |section|, and |key| must not be
+// NULL.
+bool config_get_bool(const config_t* config, const char* section,
+                     const char* key, bool def_value);
 
 // Returns the string value for a given |key| in |section|. If |section| or
 // |key| do not exist, this function returns |def_value|. The returned string
 // is owned by the config module and must not be freed. |config|, |section|,
 // and |key| must not be NULL. |def_value| may be NULL.
-const char *config_get_string(const config_t *config, const char *section, const char *key, const char *def_value);
+const char* config_get_string(const config_t* config, const char* section,
+                              const char* key, const char* def_value);
 
 // Sets an integral value for the |key| in |section|. If |key| or |section| do
 // not already exist, this function creates them. |config|, |section|, and |key|
 // must not be NULL.
-void config_set_int(config_t *config, const char *section, const char *key, int value);
+void config_set_int(config_t* config, const char* section, const char* key,
+                    int value);
 
 // Sets a boolean value for the |key| in |section|. If |key| or |section| do
 // not already exist, this function creates them. |config|, |section|, and |key|
 // must not be NULL.
-void config_set_bool(config_t *config, const char *section, const char *key, bool value);
+void config_set_bool(config_t* config, const char* section, const char* key,
+                     bool value);
 
 // Sets a string value for the |key| in |section|. If |key| or |section| do
-// not already exist, this function creates them. |config|, |section|, |key|, and
+// not already exist, this function creates them. |config|, |section|, |key|,
+// and
 // |value| must not be NULL.
-void config_set_string(config_t *config, const char *section, const char *key, const char *value);
+void config_set_string(config_t* config, const char* section, const char* key,
+                       const char* value);
 
-// Removes |section| from the |config| (and, as a result, all keys in the section).
-// Returns true if |section| was found and removed from |config|, false otherwise.
+// Removes |section| from the |config| (and, as a result, all keys in the
+// section).
+// Returns true if |section| was found and removed from |config|, false
+// otherwise.
 // Neither |config| nor |section| may be NULL.
-bool config_remove_section(config_t *config, const char *section);
+bool config_remove_section(config_t* config, const char* section);
 
-// Removes one specific |key| residing in |section| of the |config|. Returns true
+// Removes one specific |key| residing in |section| of the |config|. Returns
+// true
 // if the section and key were found and the key was removed, false otherwise.
 // None of |config|, |section|, or |key| may be NULL.
-bool config_remove_key(config_t *config, const char *section, const char *key);
+bool config_remove_key(config_t* config, const char* section, const char* key);
 
 // Returns an iterator to the first section in the config file. If there are no
 // sections, the iterator will equal the return value of |config_section_end|.
-// The returned pointer must be treated as an opaque handle and must not be freed.
-// The iterator is invalidated on any config mutating operation. |config| may not
+// The returned pointer must be treated as an opaque handle and must not be
+// freed.
+// The iterator is invalidated on any config mutating operation. |config| may
+// not
 // be NULL.
-const config_section_node_t *config_section_begin(const config_t *config);
+const config_section_node_t* config_section_begin(const config_t* config);
 
-// Returns an iterator to one past the last section in the config file. It does not
-// represent a valid section, but can be used to determine if all sections have been
-// iterated over. The returned pointer must be treated as an opaque handle and must
-// not be freed and must not be iterated on (must not call |config_section_next| on
+// Returns an iterator to one past the last section in the config file. It does
+// not
+// represent a valid section, but can be used to determine if all sections have
+// been
+// iterated over. The returned pointer must be treated as an opaque handle and
+// must
+// not be freed and must not be iterated on (must not call |config_section_next|
+// on
 // it). |config| may not be NULL.
-const config_section_node_t *config_section_end(const config_t *config);
+const config_section_node_t* config_section_end(const config_t* config);
 
 // Moves |iter| to the next section. If there are no more sections, |iter| will
 // equal the value of |config_section_end|. |iter| may not be NULL and must be
 // a pointer returned by either |config_section_begin| or |config_section_next|.
-const config_section_node_t *config_section_next(const config_section_node_t *iter);
+const config_section_node_t* config_section_next(
+    const config_section_node_t* iter);
 
-// Returns the name of the section referred to by |iter|. The returned pointer is
-// owned by the config module and must not be freed by the caller. The pointer will
-// remain valid until |config_free| is called. |iter| may not be NULL and must not
+// Returns the name of the section referred to by |iter|. The returned pointer
+// is
+// owned by the config module and must not be freed by the caller. The pointer
+// will
+// remain valid until |config_free| is called. |iter| may not be NULL and must
+// not
 // equal the value returned by |config_section_end|.
-const char *config_section_name(const config_section_node_t *iter);
+const char* config_section_name(const config_section_node_t* iter);
 
-// Saves |config| to a file given by |filename|. Note that this could be a destructive
+// Saves |config| to a file given by |filename|. Note that this could be a
+// destructive
 // operation: if |filename| already exists, it will be overwritten. The config
-// module does not preserve comments or formatting so if a config file was opened
-// with |config_new| and subsequently overwritten with |config_save|, all comments
-// and special formatting in the original file will be lost. Neither |config| nor
+// module does not preserve comments or formatting so if a config file was
+// opened
+// with |config_new| and subsequently overwritten with |config_save|, all
+// comments
+// and special formatting in the original file will be lost. Neither |config|
+// nor
 // |filename| may be NULL.
-bool config_save(const config_t *config, const char *filename);
+bool config_save(const config_t* config, const char* filename);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/data_dispatcher.h b/osi/include/data_dispatcher.h
index 838ee31..7349444 100644
--- a/osi/include/data_dispatcher.h
+++ b/osi/include/data_dispatcher.h
@@ -35,29 +35,33 @@
 // Creates a new data dispatcher object, with the given name.
 // The returned object must be freed by calling |data_dispatcher_free|.
 // Returns NULL on failure. |name| may not be NULL.
-data_dispatcher_t *data_dispatcher_new(const char *name);
+data_dispatcher_t* data_dispatcher_new(const char* name);
 
 // Frees a data dispatcher object created by |data_dispatcher_new|.
 // |data_dispatcher| may be NULL.
-void data_dispatcher_free(data_dispatcher_t *dispatcher);
+void data_dispatcher_free(data_dispatcher_t* dispatcher);
 
 // Registers |type| and |queue| with the data dispatcher so that data
 // sent under |type| ends up in |queue|. If |type| is already registered,
 // it is replaced. If |queue| is NULL, the existing registration is
 // removed, if it exists. |dispatcher| may not be NULL.
-void data_dispatcher_register(data_dispatcher_t *dispatcher, data_dispatcher_type_t type, fixed_queue_t *queue);
+void data_dispatcher_register(data_dispatcher_t* dispatcher,
+                              data_dispatcher_type_t type,
+                              fixed_queue_t* queue);
 
 // Registers a default queue to send data to when there is not a specific
 // type/queue relationship registered. If a default queue is already registered,
 // it is replaced. If |queue| is NULL, the existing registration is
 // removed, if it exists. |dispatcher| may not be NULL.
-void data_dispatcher_register_default(data_dispatcher_t *dispatcher, fixed_queue_t *queue);
+void data_dispatcher_register_default(data_dispatcher_t* dispatcher,
+                                      fixed_queue_t* queue);
 
 // Dispatches |data| to the queue registered for |type|. If no such registration
 // exists, it is dispatched to the default queue if it exists.
 // Neither |dispatcher| nor |data| may be NULL.
 // Returns true if data dispatch was successful.
-bool data_dispatcher_dispatch(data_dispatcher_t *dispatcher, data_dispatcher_type_t type, void *data);
+bool data_dispatcher_dispatch(data_dispatcher_t* dispatcher,
+                              data_dispatcher_type_t type, void* data);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/eager_reader.h b/osi/include/eager_reader.h
index 8e5ee60..ad4887b 100644
--- a/osi/include/eager_reader.h
+++ b/osi/include/eager_reader.h
@@ -32,43 +32,46 @@
 typedef struct eager_reader_t eager_reader_t;
 typedef struct reactor_t reactor_t;
 
-typedef void (*eager_reader_cb)(eager_reader_t *reader, void *context);
+typedef void (*eager_reader_cb)(eager_reader_t* reader, void* context);
 
 // Creates a new eager reader object, which pulls data from |fd_to_read| into
 // buffers of size |buffer_size| allocated using |allocator|, and has an
-// internal read thread named |thread_name|. The returned object must be freed using
-// |eager_reader_free|. |fd_to_read| must be valid, |buffer_size| and |max_buffer_count|
+// internal read thread named |thread_name|. The returned object must be freed
+// using
+// |eager_reader_free|. |fd_to_read| must be valid, |buffer_size| and
+// |max_buffer_count|
 // must be greater than zero. |allocator| and |thread_name| may not be NULL.
-eager_reader_t *eager_reader_new(
-  int fd_to_read,
-  const allocator_t *allocator,
-  size_t buffer_size,
-  size_t max_buffer_count,
-  const char *thread_name
-);
+eager_reader_t* eager_reader_new(int fd_to_read, const allocator_t* allocator,
+                                 size_t buffer_size, size_t max_buffer_count,
+                                 const char* thread_name);
 
 // Frees an eager reader object, and associated internal resources.
 // |reader| may be NULL.
-void eager_reader_free(eager_reader_t *reader);
+void eager_reader_free(eager_reader_t* reader);
 
 // Registers |reader| with the |reactor|. When the reader has data
-// |read_cb| will be called. The |context| parameter is passed, untouched, to |read_cb|.
-// Neither |reader|, nor |reactor|, nor |read_cb| may be NULL. |context| may be NULL.
-void eager_reader_register(eager_reader_t *reader, reactor_t *reactor, eager_reader_cb read_cb, void *context);
+// |read_cb| will be called. The |context| parameter is passed, untouched, to
+// |read_cb|.
+// Neither |reader|, nor |reactor|, nor |read_cb| may be NULL. |context| may be
+// NULL.
+void eager_reader_register(eager_reader_t* reader, reactor_t* reactor,
+                           eager_reader_cb read_cb, void* context);
 
-// Unregisters |reader| from whichever reactor it is registered with, if any. This
+// Unregisters |reader| from whichever reactor it is registered with, if any.
+// This
 // function is idempotent.
-void eager_reader_unregister(eager_reader_t *reader);
+void eager_reader_unregister(eager_reader_t* reader);
 
 // Reads up to |max_size| bytes into |buffer| from currently available bytes.
 // NOT SAFE FOR READING FROM MULTIPLE THREADS
 // but you should probably only be reading from one thread anyway,
 // otherwise the byte stream probably doesn't make sense.
-size_t eager_reader_read(eager_reader_t *reader, uint8_t *buffer, size_t max_size);
+size_t eager_reader_read(eager_reader_t* reader, uint8_t* buffer,
+                         size_t max_size);
 
 // Returns the inbound read thread for a given |reader| or NULL if the thread
 // is not running.
-thread_t* eager_reader_get_read_thread(const eager_reader_t *reader);
+thread_t* eager_reader_get_read_thread(const eager_reader_t* reader);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/fixed_queue.h b/osi/include/fixed_queue.h
index 54f0093..c067e63 100644
--- a/osi/include/fixed_queue.h
+++ b/osi/include/fixed_queue.h
@@ -31,76 +31,76 @@
 typedef struct fixed_queue_t fixed_queue_t;
 typedef struct reactor_t reactor_t;
 
-typedef void (*fixed_queue_free_cb)(void *data);
-typedef void (*fixed_queue_cb)(fixed_queue_t *queue, void *context);
+typedef void (*fixed_queue_free_cb)(void* data);
+typedef void (*fixed_queue_cb)(fixed_queue_t* queue, void* context);
 
 // Creates a new fixed queue with the given |capacity|. If more elements than
 // |capacity| are added to the queue, the caller is blocked until space is
 // made available in the queue. Returns NULL on failure. The caller must free
 // the returned queue with |fixed_queue_free|.
-fixed_queue_t *fixed_queue_new(size_t capacity);
+fixed_queue_t* fixed_queue_new(size_t capacity);
 
 // Frees a queue and (optionally) the enqueued elements.
 // |queue| is the queue to free. If the |free_cb| callback is not null,
 // it is called on each queue element to free it.
 // Freeing a queue that is currently in use (i.e. has waiters
 // blocked on it) results in undefined behaviour.
-void fixed_queue_free(fixed_queue_t *queue, fixed_queue_free_cb free_cb);
+void fixed_queue_free(fixed_queue_t* queue, fixed_queue_free_cb free_cb);
 
 // Flushes a queue and (optionally) frees the enqueued elements.
 // |queue| is the queue to flush. If the |free_cb| callback is not null,
 // it is called on each queue element to free it.
-void fixed_queue_flush(fixed_queue_t *queue, fixed_queue_free_cb free_cb);
+void fixed_queue_flush(fixed_queue_t* queue, fixed_queue_free_cb free_cb);
 
 // Returns a value indicating whether the given |queue| is empty. If |queue|
 // is NULL, the return value is true.
-bool fixed_queue_is_empty(fixed_queue_t *queue);
+bool fixed_queue_is_empty(fixed_queue_t* queue);
 
 // Returns the length of the |queue|. If |queue| is NULL, the return value
 // is 0.
-size_t fixed_queue_length(fixed_queue_t *queue);
+size_t fixed_queue_length(fixed_queue_t* queue);
 
 // Returns the maximum number of elements this queue may hold. |queue| may
 // not be NULL.
-size_t fixed_queue_capacity(fixed_queue_t *queue);
+size_t fixed_queue_capacity(fixed_queue_t* queue);
 
 // Enqueues the given |data| into the |queue|. The caller will be blocked
 // if no more space is available in the queue. Neither |queue| nor |data|
 // may be NULL.
-void fixed_queue_enqueue(fixed_queue_t *queue, void *data);
+void fixed_queue_enqueue(fixed_queue_t* queue, void* data);
 
 // Dequeues the next element from |queue|. If the queue is currently empty,
 // this function will block the caller until an item is enqueued. This
 // function will never return NULL. |queue| may not be NULL.
-void *fixed_queue_dequeue(fixed_queue_t *queue);
+void* fixed_queue_dequeue(fixed_queue_t* queue);
 
 // Tries to enqueue |data| into the |queue|. This function will never block
 // the caller. If the queue capacity would be exceeded by adding one more
 // element, this function returns false immediately. Otherwise, this function
 // returns true. Neither |queue| nor |data| may be NULL.
-bool fixed_queue_try_enqueue(fixed_queue_t *queue, void *data);
+bool fixed_queue_try_enqueue(fixed_queue_t* queue, void* data);
 
 // Tries to dequeue an element from |queue|. This function will never block
 // the caller. If the queue is empty or NULL, this function returns NULL
 // immediately. Otherwise, the next element in the queue is returned.
-void *fixed_queue_try_dequeue(fixed_queue_t *queue);
+void* fixed_queue_try_dequeue(fixed_queue_t* queue);
 
 // Returns the first element from |queue|, if present, without dequeuing it.
 // This function will never block the caller. Returns NULL if there are no
 // elements in the queue or |queue| is NULL.
-void *fixed_queue_try_peek_first(fixed_queue_t *queue);
+void* fixed_queue_try_peek_first(fixed_queue_t* queue);
 
 // Returns the last element from |queue|, if present, without dequeuing it.
 // This function will never block the caller. Returns NULL if there are no
 // elements in the queue or |queue| is NULL.
-void *fixed_queue_try_peek_last(fixed_queue_t *queue);
+void* fixed_queue_try_peek_last(fixed_queue_t* queue);
 
 // Tries to remove a |data| element from the middle of the |queue|. This
 // function will never block the caller. If the queue is empty or NULL, this
 // function returns NULL immediately. |data| may not be NULL. If the |data|
 // element is found in the queue, a pointer to the removed data is returned,
 // otherwise NULL.
-void *fixed_queue_try_remove_from_queue(fixed_queue_t *queue, void *data);
+void* fixed_queue_try_remove_from_queue(fixed_queue_t* queue, void* data);
 
 // Returns the iterateable list with all entries in the |queue|. This function
 // will never block the caller. |queue| may not be NULL.
@@ -109,31 +109,35 @@
 // be modified by another thread, and the result would be unpredictable.
 // TODO: The usage of this function should be refactored, and the function
 // itself should be removed.
-list_t *fixed_queue_get_list(fixed_queue_t *queue);
+list_t* fixed_queue_get_list(fixed_queue_t* queue);
 
 // This function returns a valid file descriptor. Callers may perform one
 // operation on the fd: select(2). If |select| indicates that the file
 // descriptor is readable, the caller may call |fixed_queue_enqueue| without
 // blocking. The caller must not close the returned file descriptor. |queue|
 // may not be NULL.
-int fixed_queue_get_enqueue_fd(const fixed_queue_t *queue);
+int fixed_queue_get_enqueue_fd(const fixed_queue_t* queue);
 
 // This function returns a valid file descriptor. Callers may perform one
 // operation on the fd: select(2). If |select| indicates that the file
 // descriptor is readable, the caller may call |fixed_queue_dequeue| without
 // blocking. The caller must not close the returned file descriptor. |queue|
 // may not be NULL.
-int fixed_queue_get_dequeue_fd(const fixed_queue_t *queue);
+int fixed_queue_get_dequeue_fd(const fixed_queue_t* queue);
 
-// Registers |queue| with |reactor| for dequeue operations. When there is an element
-// in the queue, ready_cb will be called. The |context| parameter is passed, untouched,
-// to the callback routine. Neither |queue|, nor |reactor|, nor |read_cb| may be NULL.
+// Registers |queue| with |reactor| for dequeue operations. When there is an
+// element
+// in the queue, ready_cb will be called. The |context| parameter is passed,
+// untouched,
+// to the callback routine. Neither |queue|, nor |reactor|, nor |read_cb| may be
+// NULL.
 // |context| may be NULL.
-void fixed_queue_register_dequeue(fixed_queue_t *queue, reactor_t *reactor, fixed_queue_cb ready_cb, void *context);
+void fixed_queue_register_dequeue(fixed_queue_t* queue, reactor_t* reactor,
+                                  fixed_queue_cb ready_cb, void* context);
 
 // Unregisters the dequeue ready callback for |queue| from whichever reactor
 // it is registered with, if any. This function is idempotent.
-void fixed_queue_unregister_dequeue(fixed_queue_t *queue);
+void fixed_queue_unregister_dequeue(fixed_queue_t* queue);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/future.h b/osi/include/future.h
index c57ba17..e9928d3 100644
--- a/osi/include/future.h
+++ b/osi/include/future.h
@@ -24,25 +24,25 @@
 
 typedef struct future_t future_t;
 
-#define FUTURE_SUCCESS ((void *)1)
-#define FUTURE_FAIL ((void *)0)
+#define FUTURE_SUCCESS ((void*)1)
+#define FUTURE_FAIL ((void*)0)
 
 // Constructs a new future_t object. Returns NULL on failure.
-future_t *future_new(void);
+future_t* future_new(void);
 
 // Constructs a new future_t object with an immediate |value|. No waiting will
 // occur in the call to |future_await| because the value is already present.
 // Returns NULL on failure.
-future_t *future_new_immediate(void *value);
+future_t* future_new_immediate(void* value);
 
 // Signals that the |future| is ready, passing |value| back to the context
 // waiting for the result. Must only be called once for every future.
 // |future| may not be NULL.
-void future_ready(future_t *future, void *value);
+void future_ready(future_t* future, void* value);
 
 // Waits for the |future| to be ready. Returns the value set in |future_ready|.
 // Frees the future before return. |future| may not be NULL.
-void *future_await(future_t *async_result);
+void* future_await(future_t* async_result);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/hash_map_utils.h b/osi/include/hash_map_utils.h
index 8a46617..1ea3996 100644
--- a/osi/include/hash_map_utils.h
+++ b/osi/include/hash_map_utils.h
@@ -18,8 +18,8 @@
 
 #pragma once
 
-#include <unordered_map>
 #include <string>
+#include <unordered_map>
 
 // Creates a hash map based on the |params| string containing key and value
 // pairs.  Pairs are expected in the form "key=value" separated by the ';'
@@ -31,10 +31,10 @@
 //   "=value0;key1=value1;"      -> map: [key1]="value1"
 // A new hash map or NULL is returned and is owned by the caller.
 std::unordered_map<std::string, std::string>
-hash_map_utils_new_from_string_params(const char *params);
+hash_map_utils_new_from_string_params(const char* params);
 
 // Dumps the contents of the hash_map to the log for debugging purposes.
 // If |map| is not NULL, all entries of |map| will be dumped, otherwise nothing
 // will be dumped. Note that this function does not take the ownership of |map|.
 void hash_map_utils_dump_string_keys_string_values(
-    std::unordered_map<std::string, std::string> &map);
+    std::unordered_map<std::string, std::string>& map);
diff --git a/osi/include/list.h b/osi/include/list.h
index 254e36e..1ecded9 100644
--- a/osi/include/list.h
+++ b/osi/include/list.h
@@ -31,109 +31,128 @@
 struct list_t;
 typedef struct list_t list_t;
 
-typedef void (*list_free_cb)(void *data);
+typedef void (*list_free_cb)(void* data);
 
 // Iterator callback prototype used for |list_foreach|.
 // |data| represents the list item currently being iterated, |context| is a
 // user defined value passed into |list_foreach|.
 // Callback must return true to continue iterating or false to stop iterating.
-typedef bool (*list_iter_cb)(void *data, void *context);
+typedef bool (*list_iter_cb)(void* data, void* context);
 
-// Returns a new, empty list. Returns NULL if not enough memory could be allocated
+// Returns a new, empty list. Returns NULL if not enough memory could be
+// allocated
 // for the list structure. The returned list must be freed with |list_free|. The
-// |callback| specifies a function to be called whenever a list element is removed
-// from the list. It can be used to release resources held by the list element, e.g.
-// memory or file descriptor. |callback| may be NULL if no cleanup is necessary on
+// |callback| specifies a function to be called whenever a list element is
+// removed
+// from the list. It can be used to release resources held by the list element,
+// e.g.
+// memory or file descriptor. |callback| may be NULL if no cleanup is necessary
+// on
 // element removal.
-list_t *list_new(list_free_cb callback);
+list_t* list_new(list_free_cb callback);
 
 // Frees the list. This function accepts NULL as an argument, in which case it
 // behaves like a no-op.
-void list_free(list_t *list);
+void list_free(list_t* list);
 
 // Returns true if |list| is empty (has no elements), false otherwise.
 // |list| may not be NULL.
-bool list_is_empty(const list_t *list);
+bool list_is_empty(const list_t* list);
 
 // Returns true if the list contains |data|, false otherwise.
 // |list| may not be NULL.
-bool list_contains(const list_t *list, const void *data);
+bool list_contains(const list_t* list, const void* data);
 
 // Returns the length of the |list|. |list| may not be NULL.
-size_t list_length(const list_t *list);
+size_t list_length(const list_t* list);
 
 // Returns the first element in the list without removing it. |list| may not
 // be NULL or empty.
-void *list_front(const list_t *list);
+void* list_front(const list_t* list);
 
 // Returns the last element in the list without removing it. |list| may not
 // be NULL or empty.
-void *list_back(const list_t *list);
+void* list_back(const list_t* list);
 
 // Returns the last node in the list without removing it. |list| may not
 // be NULL or empty.
-list_node_t *list_back_node(const list_t *list);
+list_node_t* list_back_node(const list_t* list);
 
 // Inserts |data| after |prev_node| in |list|. |data|, |list|, and |prev_node|
 // may not be NULL. This function does not make a copy of |data| so the pointer
 // must remain valid at least until the element is removed from the list or the
 // list is freed. Returns true if |data| could be inserted, false otherwise
 // (e.g. out of memory).
-bool list_insert_after(list_t *list, list_node_t *prev_node, void *data);
+bool list_insert_after(list_t* list, list_node_t* prev_node, void* data);
 
-// Inserts |data| at the beginning of |list|. Neither |data| nor |list| may be NULL.
+// Inserts |data| at the beginning of |list|. Neither |data| nor |list| may be
+// NULL.
 // This function does not make a copy of |data| so the pointer must remain valid
 // at least until the element is removed from the list or the list is freed.
-// Returns true if |data| could be inserted, false otherwise (e.g. out of memory).
-bool list_prepend(list_t *list, void *data);
+// Returns true if |data| could be inserted, false otherwise (e.g. out of
+// memory).
+bool list_prepend(list_t* list, void* data);
 
 // Inserts |data| at the end of |list|. Neither |data| nor |list| may be NULL.
 // This function does not make a copy of |data| so the pointer must remain valid
 // at least until the element is removed from the list or the list is freed.
-// Returns true if |data| could be inserted, false otherwise (e.g. out of memory).
-bool list_append(list_t *list, void *data);
+// Returns true if |data| could be inserted, false otherwise (e.g. out of
+// memory).
+bool list_append(list_t* list, void* data);
 
-// Removes |data| from the list. Neither |list| nor |data| may be NULL. If |data|
-// is inserted multiple times in the list, this function will only remove the first
-// instance. If a free function was specified in |list_new|, it will be called back
-// with |data|. This function returns true if |data| was found in the list and removed,
+// Removes |data| from the list. Neither |list| nor |data| may be NULL. If
+// |data|
+// is inserted multiple times in the list, this function will only remove the
+// first
+// instance. If a free function was specified in |list_new|, it will be called
+// back
+// with |data|. This function returns true if |data| was found in the list and
+// removed,
 // false otherwise.
-bool list_remove(list_t *list, void *data);
+bool list_remove(list_t* list, void* data);
 
-// Removes all elements in the list. Calling this function will return the list to the
+// Removes all elements in the list. Calling this function will return the list
+// to the
 // same state it was in after |list_new|. |list| may not be NULL.
-void list_clear(list_t *list);
+void list_clear(list_t* list);
 
-// Iterates through the |list| and calls |callback| for each data element. Iteration
-// continues until |callback| returns false. The function returns the pointer to last
-// processed element, or NULL if the list is empty, or all calls to |callback| returned
+// Iterates through the |list| and calls |callback| for each data element.
+// Iteration
+// continues until |callback| returns false. The function returns the pointer to
+// last
+// processed element, or NULL if the list is empty, or all calls to |callback|
+// returned
 // true. |context| is passed to |callback| on each iteration.
-// If the list is empty, |callback| will never be called. It is safe to mutate the
-// list inside the callback. If an element is added before the node being visited,
+// If the list is empty, |callback| will never be called. It is safe to mutate
+// the
+// list inside the callback. If an element is added before the node being
+// visited,
 // there will be no callback for the newly-inserted node. Neither |list| nor
 // |callback| may be NULL.
-list_node_t *list_foreach(const list_t *list, list_iter_cb callback, void *context);
+list_node_t* list_foreach(const list_t* list, list_iter_cb callback,
+                          void* context);
 
 // Returns an iterator to the first element in |list|. |list| may not be NULL.
-// The returned iterator is valid as long as it does not equal the value returned
+// The returned iterator is valid as long as it does not equal the value
+// returned
 // by |list_end|.
-list_node_t *list_begin(const list_t *list);
+list_node_t* list_begin(const list_t* list);
 
 // Returns an iterator that points past the end of the list. In other words,
 // this function returns the value of an invalid iterator for the given list.
 // When an iterator has the same value as what's returned by this function, you
 // may no longer call |list_next| with the iterator. |list| may not be NULL.
-list_node_t *list_end(const list_t *list);
+list_node_t* list_end(const list_t* list);
 
 // Given a valid iterator |node|, this function returns the next value for the
 // iterator. If the returned value equals the value returned by |list_end|, the
 // iterator has reached the end of the list and may no longer be used for any
 // purpose.
-list_node_t *list_next(const list_node_t *node);
+list_node_t* list_next(const list_node_t* node);
 
 // Returns the value stored at the location pointed to by the iterator |node|.
 // |node| must not equal the value returned by |list_end|.
-void *list_node(const list_node_t *node);
+void* list_node(const list_node_t* node);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/log.h b/osi/include/log.h
index 20499e4..9f0f821 100644
--- a/osi/include/log.h
+++ b/osi/include/log.h
@@ -27,7 +27,8 @@
 /* syslog didn't work well here since we would be redefining LOG_DEBUG. */
 #include <stdio.h>
 
-#define LOGWRAPPER(tag, fmt, args...) fprintf(stderr, "%s: " fmt "\n", tag, ## args)
+#define LOGWRAPPER(tag, fmt, args...) \
+  fprintf(stderr, "%s: " fmt "\n", tag, ##args)
 
 #define LOG_VERBOSE(...) LOGWRAPPER(__VA_ARGS__)
 #define LOG_DEBUG(...) LOGWRAPPER(__VA_ARGS__)
@@ -35,43 +36,49 @@
 #define LOG_WARN(...) LOGWRAPPER(__VA_ARGS__)
 #define LOG_ERROR(...) LOGWRAPPER(__VA_ARGS__)
 
-#else  /* !defined(OS_GENERIC) */
+#else /* !defined(OS_GENERIC) */
 
 #include <log/log.h>
 
 /**
- * These log statements are effectively executing only ALOG(_________, tag, fmt, ## args ).
+ * These log statements are effectively executing only ALOG(_________, tag, fmt,
+ * ## args ).
  * fprintf is only to cause compilation error when LOG_TAG is not provided,
  * which breaks build on Linux (for OS_GENERIC).
  */
 
 #if LOG_NDEBUG
-#define LOG_VERBOSE(tag, fmt, args...)                                \
-    do {                                                              \
-        (true) ? ((int)0) : fprintf(stderr, "%s" fmt , tag, ## args); \
-    } while (0)
+#define LOG_VERBOSE(tag, fmt, args...)                          \
+  do {                                                          \
+    (true) ? ((int)0) : fprintf(stderr, "%s" fmt, tag, ##args); \
+  } while (0)
 #else  // LOG_NDEBUG
-#define LOG_VERBOSE(tag, fmt, args...)                                                            \
-    do {                                                                                          \
-        (true) ? ALOG(LOG_VERBOSE, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
-    } while (0)
+#define LOG_VERBOSE(tag, fmt, args...)               \
+  do {                                               \
+    (true) ? ALOG(LOG_VERBOSE, tag, fmt, ##args)     \
+           : fprintf(stderr, "%s" fmt, tag, ##args); \
+  } while (0)
 #endif  // !LOG_NDEBUG
 
-#define LOG_DEBUG(tag, fmt, args...)                                                             \
-    do {                                                                                         \
-        (true) ? ALOG(LOG_DEBUG, tag, fmt, ## args ) : fprintf(stderr, "%s" fmt , tag, ## args); \
-    } while (0)
-#define LOG_INFO(tag, fmt, args...)                                                            \
-    do {                                                                                       \
-        (true) ? ALOG(LOG_INFO, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
-    } while (0)
-#define LOG_WARN(tag, fmt, args...)                                                            \
-    do {                                                                                       \
-        (true) ? ALOG(LOG_WARN, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
-    } while (0)
-#define LOG_ERROR(tag, fmt, args...)                                                            \
-    do {                                                                                        \
-        (true) ? ALOG(LOG_ERROR, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
-    } while (0)
+#define LOG_DEBUG(tag, fmt, args...)                 \
+  do {                                               \
+    (true) ? ALOG(LOG_DEBUG, tag, fmt, ##args)       \
+           : fprintf(stderr, "%s" fmt, tag, ##args); \
+  } while (0)
+#define LOG_INFO(tag, fmt, args...)                  \
+  do {                                               \
+    (true) ? ALOG(LOG_INFO, tag, fmt, ##args)        \
+           : fprintf(stderr, "%s" fmt, tag, ##args); \
+  } while (0)
+#define LOG_WARN(tag, fmt, args...)                  \
+  do {                                               \
+    (true) ? ALOG(LOG_WARN, tag, fmt, ##args)        \
+           : fprintf(stderr, "%s" fmt, tag, ##args); \
+  } while (0)
+#define LOG_ERROR(tag, fmt, args...)                 \
+  do {                                               \
+    (true) ? ALOG(LOG_ERROR, tag, fmt, ##args)       \
+           : fprintf(stderr, "%s" fmt, tag, ##args); \
+  } while (0)
 
-#endif  /* defined(OS_GENERIC) */
+#endif /* defined(OS_GENERIC) */
diff --git a/osi/include/metrics.h b/osi/include/metrics.h
index f0aee3c..644a8f7 100644
--- a/osi/include/metrics.h
+++ b/osi/include/metrics.h
@@ -48,8 +48,8 @@
 // |type| specifies whether it was acquired or relased,
 // |requestor| if provided is the service requesting the wake lock.
 // |name| is the name of the wake lock held.
-void metrics_wake_event(wake_event_type_t type, const char *requestor,
-                        const char *name, uint64_t timestamp_ms);
+void metrics_wake_event(wake_event_type_t type, const char* requestor,
+                        const char* name, uint64_t timestamp_ms);
 
 typedef enum {
   SCAN_TYPE_UNKNOWN,
@@ -63,7 +63,7 @@
 // |initiator| is a unique ID identifying the app starting the scan.
 // |type| is whether the scan reports BR/EDR, LE, or both.
 // |results| is the number of results to be reported.
-void metrics_scan_event(bool start, const char *initator, scan_tech_t type,
+void metrics_scan_event(bool start, const char* initator, scan_tech_t type,
                         uint32_t results, uint64_t timestamp_ms);
 
 // Record A2DP session information.
@@ -81,16 +81,12 @@
 // |buffer_underruns_average| - TODO - not clear what this is.
 // |buffer_underruns_count| is the number of times there was no enough
 // audio data to add to the media buffer.
-void metrics_a2dp_session(int64_t session_duration_sec,
-                          const char *disconnect_reason,
-                          uint32_t device_class,
-                          int32_t media_timer_min_ms,
-                          int32_t media_timer_max_ms,
-                          int32_t media_timer_avg_ms,
-                          int32_t buffer_overruns_max_count,
-                          int32_t buffer_overruns_total,
-                          float buffer_underruns_average,
-                          int32_t buffer_underruns_count);
+void metrics_a2dp_session(
+    int64_t session_duration_sec, const char* disconnect_reason,
+    uint32_t device_class, int32_t media_timer_min_ms,
+    int32_t media_timer_max_ms, int32_t media_timer_avg_ms,
+    int32_t buffer_overruns_max_count, int32_t buffer_overruns_total,
+    float buffer_underruns_average, int32_t buffer_underruns_count);
 
 // Writes the metrics, in packed protobuf format, into the descriptor |fd|.
 // If |clear| is true, metrics events are cleared afterwards.
diff --git a/osi/include/osi.h b/osi/include/osi.h
index 966c617..c540812 100644
--- a/osi/include/osi.h
+++ b/osi/include/osi.h
@@ -44,7 +44,8 @@
 // C++ code that includes base and osi/include/osi.h can thus easily default to
 // the definition from libbase but we should check here to avoid compile errors.
 #ifndef COMPILE_ASSERT
-#define COMPILE_ASSERT(COND) typedef int failed_compile_assert[(COND) ? 1 : -1] __attribute__ ((unused))
+#define COMPILE_ASSERT(COND) \
+  typedef int failed_compile_assert[(COND) ? 1 : -1] __attribute__((unused))
 #endif  // COMPILE_ASSERT
 
 // Macros for safe integer to pointer conversion. In the C language, data is
@@ -52,11 +53,11 @@
 // passing in callbacks. These macros should be used sparingly in new code
 // (never in C++ code). Whenever integers need to be passed as a pointer, use
 // these macros.
-#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
-#define UINT_TO_PTR(u) ((void *) ((uintptr_t) (u)))
+#define PTR_TO_UINT(p) ((unsigned int)((uintptr_t)(p)))
+#define UINT_TO_PTR(u) ((void*)((uintptr_t)(u)))
 
-#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
-#define INT_TO_PTR(i) ((void *) ((intptr_t) (i)))
+#define PTR_TO_INT(p) ((int)((intptr_t)(p)))
+#define INT_TO_PTR(i) ((void*)((intptr_t)(i)))
 
 // Obtain a random number between 0 and INT_MAX inclusive.
 // Taken from a system random source such as /dev/random.
@@ -65,7 +66,9 @@
 int osi_rand(void);
 
 // Re-run |fn| system call until the system call doesn't cause EINTR.
-#define OSI_NO_INTR(fn)  do {} while ((fn) == -1 && errno == EINTR)
+#define OSI_NO_INTR(fn) \
+  do {                  \
+  } while ((fn) == -1 && errno == EINTR)
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/properties.h b/osi/include/properties.h
index 35c21e1..c20a3f8 100644
--- a/osi/include/properties.h
+++ b/osi/include/properties.h
@@ -34,11 +34,11 @@
 // (the length does not include the terminating zero).
 // If the property read fails or returns an empty value, the |default_value|
 // is used (if nonnull).
-int osi_property_get(const char *key, char *value, const char *default_value);
+int osi_property_get(const char* key, char* value, const char* default_value);
 
 // Write value of property associated with key |key| to |value|.
 // Returns 0 on success, < 0 on failure
-int osi_property_set(const char *key, const char *value);
+int osi_property_set(const char* key, const char* value);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/reactor.h b/osi/include/reactor.h
index a873968..d3eca37 100644
--- a/osi/include/reactor.h
+++ b/osi/include/reactor.h
@@ -35,55 +35,72 @@
 
 // Enumerates the reasons a reactor has stopped.
 typedef enum {
-  REACTOR_STATUS_STOP,     // |reactor_stop| was called.
-  REACTOR_STATUS_ERROR,    // there was an error during the operation.
-  REACTOR_STATUS_DONE,     // the reactor completed its work (for the _run_once* variants).
+  REACTOR_STATUS_STOP,   // |reactor_stop| was called.
+  REACTOR_STATUS_ERROR,  // there was an error during the operation.
+  REACTOR_STATUS_DONE,   // the reactor completed its work (for the _run_once*
+                         // variants).
 } reactor_status_t;
 
 // Creates a new reactor object. Returns NULL on failure. The returned object
 // must be freed by calling |reactor_free|.
-reactor_t *reactor_new(void);
+reactor_t* reactor_new(void);
 
 // Frees a reactor object created with |reactor_new|. |reactor| may be NULL.
-void reactor_free(reactor_t *reactor);
+void reactor_free(reactor_t* reactor);
 
-// Starts the reactor. This function blocks the caller until |reactor_stop| is called
+// Starts the reactor. This function blocks the caller until |reactor_stop| is
+// called
 // from another thread or in a callback. |reactor| may not be NULL.
-reactor_status_t reactor_start(reactor_t *reactor);
+reactor_status_t reactor_start(reactor_t* reactor);
 
-// Runs one iteration of the reactor. This function blocks until at least one registered object
+// Runs one iteration of the reactor. This function blocks until at least one
+// registered object
 // becomes ready. |reactor| may not be NULL.
-reactor_status_t reactor_run_once(reactor_t *reactor);
+reactor_status_t reactor_run_once(reactor_t* reactor);
 
-// Immediately unblocks the reactor. This function is safe to call from any thread.
+// Immediately unblocks the reactor. This function is safe to call from any
+// thread.
 // |reactor| may not be NULL.
-void reactor_stop(reactor_t *reactor);
+void reactor_stop(reactor_t* reactor);
 
-// Registers a file descriptor with the reactor. The file descriptor, |fd|, must be valid
-// when this function is called and its ownership is not transferred to the reactor. The
-// |context| variable is a user-defined opaque handle that is passed back to the |read_ready|
-// and |write_ready| functions. It is not copied or even dereferenced by the reactor so it
-// may contain any value including NULL. The |read_ready| and |write_ready| arguments are
-// optional and may be NULL. This function returns an opaque object that represents the
-// file descriptor's registration with the reactor. When the caller is no longer interested
-// in events on the |fd|, it must free the returned object by calling |reactor_unregister|.
-reactor_object_t *reactor_register(reactor_t *reactor,
-    int fd, void *context,
-    void (*read_ready)(void *context),
-    void (*write_ready)(void *context));
+// Registers a file descriptor with the reactor. The file descriptor, |fd|, must
+// be valid
+// when this function is called and its ownership is not transferred to the
+// reactor. The
+// |context| variable is a user-defined opaque handle that is passed back to the
+// |read_ready|
+// and |write_ready| functions. It is not copied or even dereferenced by the
+// reactor so it
+// may contain any value including NULL. The |read_ready| and |write_ready|
+// arguments are
+// optional and may be NULL. This function returns an opaque object that
+// represents the
+// file descriptor's registration with the reactor. When the caller is no longer
+// interested
+// in events on the |fd|, it must free the returned object by calling
+// |reactor_unregister|.
+reactor_object_t* reactor_register(reactor_t* reactor, int fd, void* context,
+                                   void (*read_ready)(void* context),
+                                   void (*write_ready)(void* context));
 
-// Changes the subscription mode for the file descriptor represented by |object|. If the
-// caller has already registered a file descriptor with a reactor, has a valid |object|,
-// and decides to change the |read_ready| and/or |write_ready| callback routines, they
-// can call this routine. Returns true if the subscription was changed, false otherwise.
+// Changes the subscription mode for the file descriptor represented by
+// |object|. If the
+// caller has already registered a file descriptor with a reactor, has a valid
+// |object|,
+// and decides to change the |read_ready| and/or |write_ready| callback
+// routines, they
+// can call this routine. Returns true if the subscription was changed, false
+// otherwise.
 // |object| may not be NULL, |read_ready| and |write_ready| may be NULL.
-bool reactor_change_registration(reactor_object_t *object,
-    void (*read_ready)(void *context),
-    void (*write_ready)(void *context));
+bool reactor_change_registration(reactor_object_t* object,
+                                 void (*read_ready)(void* context),
+                                 void (*write_ready)(void* context));
 
-// Unregisters a previously registered file descriptor with its reactor. |obj| may not be NULL.
-// |obj| is invalid after calling this function so the caller must drop all references to it.
-void reactor_unregister(reactor_object_t *obj);
+// Unregisters a previously registered file descriptor with its reactor. |obj|
+// may not be NULL.
+// |obj| is invalid after calling this function so the caller must drop all
+// references to it.
+void reactor_unregister(reactor_object_t* obj);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/ringbuffer.h b/osi/include/ringbuffer.h
index f1c3812..34d8dc4 100644
--- a/osi/include/ringbuffer.h
+++ b/osi/include/ringbuffer.h
@@ -38,31 +38,32 @@
 
 // Frees the ringbuffer structure and buffer
 // Save to call with NULL.
-void ringbuffer_free(ringbuffer_t *rb);
+void ringbuffer_free(ringbuffer_t* rb);
 
 // Returns remaining buffer size
-size_t ringbuffer_available(const ringbuffer_t *rb);
+size_t ringbuffer_available(const ringbuffer_t* rb);
 
 // Returns size of data in buffer
-size_t ringbuffer_size(const ringbuffer_t *rb);
+size_t ringbuffer_size(const ringbuffer_t* rb);
 
 // Attempts to insert up to |length| bytes of data at |p| into the buffer
 // Return actual number of bytes added. Can be less than |length| if buffer
 // is full.
-size_t ringbuffer_insert(ringbuffer_t *rb, const uint8_t *p, size_t length);
+size_t ringbuffer_insert(ringbuffer_t* rb, const uint8_t* p, size_t length);
 
 // Peek |length| number of bytes from the ringbuffer, starting at |offset|,
 // into the buffer |p|. Return the actual number of bytes peeked. Can be less
 // than |length| if there is less than |length| data available. |offset| must
 // be non-negative.
-size_t ringbuffer_peek(const ringbuffer_t *rb, off_t offset, uint8_t *p, size_t length);
+size_t ringbuffer_peek(const ringbuffer_t* rb, off_t offset, uint8_t* p,
+                       size_t length);
 
 // Does the same as |ringbuffer_peek|, but also advances the ring buffer head
-size_t ringbuffer_pop(ringbuffer_t *rb, uint8_t *p, size_t length);
+size_t ringbuffer_pop(ringbuffer_t* rb, uint8_t* p, size_t length);
 
 // Deletes |length| bytes from the ringbuffer starting from the head
 // Return actual number of bytes deleted.
-size_t ringbuffer_delete(ringbuffer_t *rb, size_t length);
+size_t ringbuffer_delete(ringbuffer_t* rb, size_t length);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/semaphore.h b/osi/include/semaphore.h
index 4ce373a..29d03fd 100644
--- a/osi/include/semaphore.h
+++ b/osi/include/semaphore.h
@@ -30,23 +30,24 @@
 // Creates a new semaphore with an initial value of |value|.
 // Returns NULL on failure. The returned object must be released
 // with |semaphore_free|.
-semaphore_t *semaphore_new(unsigned int value);
+semaphore_t* semaphore_new(unsigned int value);
 
 // Frees a semaphore allocated with |semaphore_new|. |semaphore| may
 // be NULL.
-void semaphore_free(semaphore_t *semaphore);
+void semaphore_free(semaphore_t* semaphore);
 
 // Decrements the value of |semaphore|. If it is 0, this call blocks until
 // it becomes non-zero. |semaphore| may not be NULL.
-void semaphore_wait(semaphore_t *semaphore);
+void semaphore_wait(semaphore_t* semaphore);
 
 // Tries to decrement the value of |semaphore|. Returns true if the value was
-// decremented, false if the value was 0. This function never blocks. |semaphore|
+// decremented, false if the value was 0. This function never blocks.
+// |semaphore|
 // may not be NULL.
-bool semaphore_try_wait(semaphore_t *semaphore);
+bool semaphore_try_wait(semaphore_t* semaphore);
 
 // Increments the value of |semaphore|. |semaphore| may not be NULL.
-void semaphore_post(semaphore_t *semaphore);
+void semaphore_post(semaphore_t* semaphore);
 
 // Returns a file descriptor representing this semaphore. The caller may
 // only perform one operation on the file descriptor: select(2). If |select|
@@ -58,7 +59,7 @@
 //
 // The caller must not close the returned file descriptor. |semaphore| may not
 // be NULL.
-int semaphore_get_fd(const semaphore_t *semaphore);
+int semaphore_get_fd(const semaphore_t* semaphore);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/socket.h b/osi/include/socket.h
index 2ba3f0c..e5d4c8e 100644
--- a/osi/include/socket.h
+++ b/osi/include/socket.h
@@ -31,32 +31,37 @@
 typedef struct socket_t socket_t;
 typedef uint16_t port_t;
 
-typedef void (*socket_cb)(socket_t *socket, void *context);
+typedef void (*socket_cb)(socket_t* socket, void* context);
 
-// Returns a new socket object. The socket is in an idle, disconnected state when
+// Returns a new socket object. The socket is in an idle, disconnected state
+// when
 // it is returned by this function. The returned object must be freed by calling
 // |socket_free|. Returns NULL on failure.
-socket_t *socket_new(void);
+socket_t* socket_new(void);
 
 // Returns a new socket object backed by |fd|. The socket object is in whichever
-// state |fd| is in when it was passed to this function. The returned object must
+// state |fd| is in when it was passed to this function. The returned object
+// must
 // be freed by calling |socket_free|. Returns NULL on failure. If this function
-// is successful, ownership of |fd| is transferred and the caller must not close it.
-socket_t *socket_new_from_fd(int fd);
+// is successful, ownership of |fd| is transferred and the caller must not close
+// it.
+socket_t* socket_new_from_fd(int fd);
 
-// Frees a socket object created by |socket_new| or |socket_accept|. |socket| may
+// Frees a socket object created by |socket_new| or |socket_accept|. |socket|
+// may
 // be NULL. If the socket was connected, it will be disconnected.
-void socket_free(socket_t *socket);
+void socket_free(socket_t* socket);
 
 // Puts |socket| in listening mode for incoming TCP connections on the specified
 // |port| and the loopback IPv4 address. Returns true on success, false on
 // failure (e.g. |port| is bound by another socket). |socket| may not be NULL.
-bool socket_listen(const socket_t *socket, port_t port);
+bool socket_listen(const socket_t* socket, port_t port);
 
-// Blocks on a listening socket, |socket|, until a client connects to it. Returns
+// Blocks on a listening socket, |socket|, until a client connects to it.
+// Returns
 // a connected socket on success, NULL on failure. The returned object must be
 // freed by calling |socket_free|. |socket| may not be NULL.
-socket_t *socket_accept(const socket_t *socket);
+socket_t* socket_accept(const socket_t* socket);
 
 // Reads up to |count| bytes from |socket| into |buf|. This function will not
 // block. This function returns a positive integer representing the number
@@ -68,7 +73,7 @@
 // restarted internally without propagating EINTR back to the caller. If there
 // were no bytes available to be read, this function returns -1 and sets errno
 // to EWOULDBLOCK. Neither |socket| nor |buf| may be NULL.
-ssize_t socket_read(const socket_t *socket, void *buf, size_t count);
+ssize_t socket_read(const socket_t* socket, void* buf, size_t count);
 
 // Writes up to |count| bytes from |buf| into |socket|. This function will not
 // block. Returns a positive integer representing the number of bytes written
@@ -80,32 +85,44 @@
 // internally without propagating EINTR back to the caller. If no bytes could
 // be written without blocking, this function will return -1 and set errno to
 // EWOULDBLOCK. Neither |socket| nor |buf| may be NULL.
-ssize_t socket_write(const socket_t *socket, const void *buf, size_t count);
+ssize_t socket_write(const socket_t* socket, const void* buf, size_t count);
 
 // This function performs the same write operation as |socket_write| and also
 // sends the file descriptor |fd| over the socket to a remote process. Ownership
-// of |fd| transfers to this function and the descriptor must not be used any longer.
+// of |fd| transfers to this function and the descriptor must not be used any
+// longer.
 // If |fd| is INVALID_FD, this function behaves the same as |socket_write|.
-ssize_t socket_write_and_transfer_fd(const socket_t *socket, const void *buf, size_t count, int fd);
+ssize_t socket_write_and_transfer_fd(const socket_t* socket, const void* buf,
+                                     size_t count, int fd);
 
-// Returns the number of bytes that can be read from |socket| without blocking. On error,
+// Returns the number of bytes that can be read from |socket| without blocking.
+// On error,
 // this function returns -1. |socket| may not be NULL.
 //
-// Note: this function should not be part of the socket interface. It is only provided as
-//       a stop-gap until we can refactor away code that depends on a priori knowledge of
-//       the byte count. Do not use this function unless you need it while refactoring
+// Note: this function should not be part of the socket interface. It is only
+// provided as
+//       a stop-gap until we can refactor away code that depends on a priori
+//       knowledge of
+//       the byte count. Do not use this function unless you need it while
+//       refactoring
 //       legacy bluedroid code.
-ssize_t socket_bytes_available(const socket_t *socket);
+ssize_t socket_bytes_available(const socket_t* socket);
 
-// Registers |socket| with the |reactor|. When the socket becomes readable, |read_cb|
-// will be called. When the socket becomes writeable, |write_cb| will be called. The
-// |context| parameter is passed, untouched, to each of the callback routines. Neither
-// |socket| nor |reactor| may be NULL. |read_cb|, |write_cb|, and |context| may be NULL.
-void socket_register(socket_t *socket, reactor_t *reactor, void *context, socket_cb read_cb, socket_cb write_cb);
+// Registers |socket| with the |reactor|. When the socket becomes readable,
+// |read_cb|
+// will be called. When the socket becomes writeable, |write_cb| will be called.
+// The
+// |context| parameter is passed, untouched, to each of the callback routines.
+// Neither
+// |socket| nor |reactor| may be NULL. |read_cb|, |write_cb|, and |context| may
+// be NULL.
+void socket_register(socket_t* socket, reactor_t* reactor, void* context,
+                     socket_cb read_cb, socket_cb write_cb);
 
-// Unregisters |socket| from whichever reactor it is registered with, if any. This
+// Unregisters |socket| from whichever reactor it is registered with, if any.
+// This
 // function is idempotent.
-void socket_unregister(socket_t *socket);
+void socket_unregister(socket_t* socket);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/socket_utils/socket_local.h b/osi/include/socket_utils/socket_local.h
index a44bb0c..08b20c3 100644
--- a/osi/include/socket_utils/socket_local.h
+++ b/osi/include/socket_utils/socket_local.h
@@ -36,8 +36,8 @@
  *
  * @return 0 on success or -1 on failure
  */
-int osi_socket_make_sockaddr_un(const char *name, int namespaceId,
-                                struct sockaddr_un *p_addr, socklen_t *alen);
+int osi_socket_make_sockaddr_un(const char* name, int namespaceId,
+                                struct sockaddr_un* p_addr, socklen_t* alen);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/socket_utils/sockets.h b/osi/include/socket_utils/sockets.h
index 5f0ac3a..4508a30 100644
--- a/osi/include/socket_utils/sockets.h
+++ b/osi/include/socket_utils/sockets.h
@@ -38,11 +38,11 @@
  * This is inline and not in libcutils proper because we want to use this in
  * third-party daemons with minimal modification.
  */
-static inline int osi_android_get_control_socket(const char *name) {
+static inline int osi_android_get_control_socket(const char* name) {
   char key[64];
   snprintf(key, sizeof(key), ANDROID_SOCKET_ENV_PREFIX "%s", name);
 
-  const char *val = getenv(key);
+  const char* val = getenv(key);
   if (!val) {
     return -1;
   }
@@ -66,12 +66,12 @@
 // Normal filesystem namespace
 #define ANDROID_SOCKET_NAMESPACE_FILESYSTEM 2
 
-extern int osi_socket_local_server(const char *name, int namespaceId, int type);
-extern int osi_socket_local_server_bind(int s, const char *name,
+extern int osi_socket_local_server(const char* name, int namespaceId, int type);
+extern int osi_socket_local_server_bind(int s, const char* name,
                                         int namespaceId);
-extern int osi_socket_local_client_connect(int fd, const char *name,
+extern int osi_socket_local_client_connect(int fd, const char* name,
                                            int namespaceId, int type);
-extern int osi_socket_local_client(const char *name, int namespaceId, int type);
+extern int osi_socket_local_client(const char* name, int namespaceId, int type);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/thread.h b/osi/include/thread.h
index 5ca0fa8..7f9ef80 100644
--- a/osi/include/thread.h
+++ b/osi/include/thread.h
@@ -30,54 +30,55 @@
 typedef struct reactor_t reactor_t;
 typedef struct thread_t thread_t;
 
-typedef void (*thread_fn)(void *context);
+typedef void (*thread_fn)(void* context);
 
 // Creates and starts a new thread with the given name. Only THREAD_NAME_MAX
 // bytes from |name| will be assigned to the newly-created thread. Returns a
 // thread object if the thread was successfully started, NULL otherwise. The
 // returned thread object must be freed with |thread_free|. |name| may not
 // be NULL.
-thread_t *thread_new(const char *name);
+thread_t* thread_new(const char* name);
 
 // Similar to |thread_new| but creates with a given queue |size|.
-thread_t *thread_new_sized(const char *name, size_t size);
+thread_t* thread_new_sized(const char* name, size_t size);
 
 // Frees the given |thread|. If the thread is still running, it is stopped
 // and the calling thread will block until |thread| terminates. |thread|
 // may be NULL.
-void thread_free(thread_t *thread);
+void thread_free(thread_t* thread);
 
 // Waits for |thread_stop|. Upon returning, the only other operations a caller
 // may perform on |thread| are |thread_free| and |thread_join|. |thread_join|
 // is idempotent and may be called from any thread. |thread| may not be NULL.
-void thread_join(thread_t *thread);
+void thread_join(thread_t* thread);
 
 // Call |func| with the argument |context| on |thread|. This function typically
 // does not block unless there are an excessive number of functions posted to
 // |thread| that have not been dispatched yet. Neither |thread| nor |func| may
 // be NULL. |context| may be NULL.
 // Return true on success, otherwise false.
-bool thread_post(thread_t *thread, thread_fn func, void *context);
+bool thread_post(thread_t* thread, thread_fn func, void* context);
 
 // Requests |thread| to stop. Only |thread_free| and |thread_name| may be called
 // after calling |thread_stop|. This function is guaranteed to not block.
 // |thread| may not be NULL.
-void thread_stop(thread_t *thread);
+void thread_stop(thread_t* thread);
 
 // Attempts to sets the |priority| of a given |thread|.
 // The |thread| has to be running for this call to succeed.
 // Returns true on success.
-bool thread_set_priority(thread_t *thread, int priority);
+bool thread_set_priority(thread_t* thread, int priority);
 
-// Returns true if the current thread is the same as the one represented by |thread|.
+// Returns true if the current thread is the same as the one represented by
+// |thread|.
 // |thread| may not be NULL.
-bool thread_is_self(const thread_t *thread);
+bool thread_is_self(const thread_t* thread);
 
 // Returns the reactor for the given |thread|. |thread| may not be NULL.
-reactor_t *thread_get_reactor(const thread_t *thread);
+reactor_t* thread_get_reactor(const thread_t* thread);
 
 // Returns the name of the given |thread|. |thread| may not be NULL.
-const char *thread_name(const thread_t *thread);
+const char* thread_name(const thread_t* thread);
 
 #ifdef __cplusplus
 }
diff --git a/osi/include/wakelock.h b/osi/include/wakelock.h
index e3cbfb0..0d8415f 100644
--- a/osi/include/wakelock.h
+++ b/osi/include/wakelock.h
@@ -18,8 +18,8 @@
 
 #pragma once
 
-#include <stdbool.h>
 #include <hardware/bluetooth.h>
+#include <stdbool.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -29,7 +29,7 @@
 // This function should be called when native kernel wakelocks are not used
 // directly. If this function is not called, or |callouts| is NULL, then native
 // kernel wakelocks will be used.
-void wakelock_set_os_callouts(bt_os_callouts_t *callouts);
+void wakelock_set_os_callouts(bt_os_callouts_t* callouts);
 
 // Acquire the Bluetooth wakelock.
 // The function is thread safe.
@@ -51,7 +51,7 @@
 // This is not guaranteed to have any effect after an alarm has been
 // set with alarm_set.
 // If |lock_path| or |unlock_path| are NULL, that path is not changed.
-void wakelock_set_paths(const char *lock_path, const char *unlock_path);
+void wakelock_set_paths(const char* lock_path, const char* unlock_path);
 
 // Dump wakelock-related debug info to the |fd| file descriptor.
 // The caller is responsible for closing the |fd|.
diff --git a/osi/src/alarm.cc b/osi/src/alarm.cc
index 390bb45..dfe7a85 100644
--- a/osi/src/alarm.cc
+++ b/osi/src/alarm.cc
@@ -58,7 +58,7 @@
 
 // Alarm-related information and statistics
 typedef struct {
-  const char *name;
+  const char* name;
   size_t scheduled_count;
   size_t canceled_count;
   size_t rescheduled_count;
@@ -79,16 +79,15 @@
   period_ms_t creation_time;
   period_ms_t period;
   period_ms_t deadline;
-  period_ms_t prev_deadline;    // Previous deadline - used for accounting of
-                                // periodic timers
+  period_ms_t prev_deadline;  // Previous deadline - used for accounting of
+                              // periodic timers
   bool is_periodic;
-  fixed_queue_t *queue;         // The processing queue to add this alarm to
+  fixed_queue_t* queue;  // The processing queue to add this alarm to
   alarm_callback_t callback;
-  void *data;
+  void* data;
   alarm_stats_t stats;
 };
 
-
 // If the next wakeup time is less than this threshold, we should acquire
 // a wakelock instead of setting a wake alarm so we're not bouncing in
 // and out of suspend frequently. This value is externally visible to allow
@@ -106,80 +105,75 @@
 // functions execute serially and not concurrently. As a result, this mutex
 // also protects the |alarms| list.
 static pthread_mutex_t monitor;
-static list_t *alarms;
+static list_t* alarms;
 static timer_t timer;
 static timer_t wakeup_timer;
 static bool timer_set;
 
 // All alarm callbacks are dispatched from |dispatcher_thread|
-static thread_t *dispatcher_thread;
+static thread_t* dispatcher_thread;
 static bool dispatcher_thread_active;
-static semaphore_t *alarm_expired;
+static semaphore_t* alarm_expired;
 
 // Default alarm callback thread and queue
-static thread_t *default_callback_thread;
-static fixed_queue_t *default_callback_queue;
+static thread_t* default_callback_thread;
+static fixed_queue_t* default_callback_queue;
 
-static alarm_t *alarm_new_internal(const char *name, bool is_periodic);
+static alarm_t* alarm_new_internal(const char* name, bool is_periodic);
 static bool lazy_initialize(void);
 static period_ms_t now(void);
-static void alarm_set_internal(alarm_t *alarm, period_ms_t period,
-                               alarm_callback_t cb, void *data,
-                               fixed_queue_t *queue);
-static void alarm_cancel_internal(alarm_t *alarm);
-static void remove_pending_alarm(alarm_t *alarm);
-static void schedule_next_instance(alarm_t *alarm);
+static void alarm_set_internal(alarm_t* alarm, period_ms_t period,
+                               alarm_callback_t cb, void* data,
+                               fixed_queue_t* queue);
+static void alarm_cancel_internal(alarm_t* alarm);
+static void remove_pending_alarm(alarm_t* alarm);
+static void schedule_next_instance(alarm_t* alarm);
 static void reschedule_root_alarm(void);
-static void alarm_queue_ready(fixed_queue_t *queue, void *context);
-static void timer_callback(void *data);
-static void callback_dispatch(void *context);
-static bool timer_create_internal(const clockid_t clock_id, timer_t *timer);
-static void update_scheduling_stats(alarm_stats_t *stats,
-                                    period_ms_t now_ms,
+static void alarm_queue_ready(fixed_queue_t* queue, void* context);
+static void timer_callback(void* data);
+static void callback_dispatch(void* context);
+static bool timer_create_internal(const clockid_t clock_id, timer_t* timer);
+static void update_scheduling_stats(alarm_stats_t* stats, period_ms_t now_ms,
                                     period_ms_t deadline_ms,
                                     period_ms_t execution_delta_ms);
 
-static void update_stat(stat_t *stat, period_ms_t delta)
-{
-  if (stat->max_ms < delta)
-    stat->max_ms = delta;
+static void update_stat(stat_t* stat, period_ms_t delta) {
+  if (stat->max_ms < delta) stat->max_ms = delta;
   stat->total_ms += delta;
   stat->count++;
 }
 
-alarm_t *alarm_new(const char *name) {
-  return alarm_new_internal(name, false);
-}
+alarm_t* alarm_new(const char* name) { return alarm_new_internal(name, false); }
 
-alarm_t *alarm_new_periodic(const char *name) {
+alarm_t* alarm_new_periodic(const char* name) {
   return alarm_new_internal(name, true);
 }
 
-static alarm_t *alarm_new_internal(const char *name, bool is_periodic) {
+static alarm_t* alarm_new_internal(const char* name, bool is_periodic) {
   // Make sure we have a list we can insert alarms into.
   if (!alarms && !lazy_initialize()) {
-    assert(false); // if initialization failed, we should not continue
+    assert(false);  // if initialization failed, we should not continue
     return NULL;
   }
 
   pthread_mutexattr_t attr;
   pthread_mutexattr_init(&attr);
 
-  alarm_t *ret = static_cast<alarm_t *>(osi_calloc(sizeof(alarm_t)));
+  alarm_t* ret = static_cast<alarm_t*>(osi_calloc(sizeof(alarm_t)));
 
   // Make this a recursive mutex to make it safe to call |alarm_cancel| from
   // within the callback function of the alarm.
   int error = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
   if (error) {
-    LOG_ERROR(LOG_TAG, "%s unable to create a recursive mutex: %s",
-              __func__, strerror(error));
+    LOG_ERROR(LOG_TAG, "%s unable to create a recursive mutex: %s", __func__,
+              strerror(error));
     goto error;
   }
 
   error = pthread_mutex_init(&ret->callback_lock, &attr);
   if (error) {
-    LOG_ERROR(LOG_TAG, "%s unable to initialize mutex: %s",
-              __func__, strerror(error));
+    LOG_ERROR(LOG_TAG, "%s unable to initialize mutex: %s", __func__,
+              strerror(error));
     goto error;
   }
 
@@ -196,45 +190,42 @@
   return NULL;
 }
 
-void alarm_free(alarm_t *alarm) {
-  if (!alarm)
-    return;
+void alarm_free(alarm_t* alarm) {
+  if (!alarm) return;
 
   alarm_cancel(alarm);
   pthread_mutex_destroy(&alarm->callback_lock);
-  osi_free((void *)alarm->stats.name);
+  osi_free((void*)alarm->stats.name);
   osi_free(alarm);
 }
 
-period_ms_t alarm_get_remaining_ms(const alarm_t *alarm) {
+period_ms_t alarm_get_remaining_ms(const alarm_t* alarm) {
   assert(alarm != NULL);
   period_ms_t remaining_ms = 0;
   period_ms_t just_now = now();
 
   pthread_mutex_lock(&monitor);
-  if (alarm->deadline > just_now)
-    remaining_ms = alarm->deadline - just_now;
+  if (alarm->deadline > just_now) remaining_ms = alarm->deadline - just_now;
   pthread_mutex_unlock(&monitor);
 
   return remaining_ms;
 }
 
-void alarm_set(alarm_t *alarm, period_ms_t interval_ms,
-               alarm_callback_t cb, void *data) {
+void alarm_set(alarm_t* alarm, period_ms_t interval_ms, alarm_callback_t cb,
+               void* data) {
   alarm_set_on_queue(alarm, interval_ms, cb, data, default_callback_queue);
 }
 
-void alarm_set_on_queue(alarm_t *alarm, period_ms_t interval_ms,
-                        alarm_callback_t cb, void *data,
-                        fixed_queue_t *queue) {
+void alarm_set_on_queue(alarm_t* alarm, period_ms_t interval_ms,
+                        alarm_callback_t cb, void* data, fixed_queue_t* queue) {
   assert(queue != NULL);
   alarm_set_internal(alarm, interval_ms, cb, data, queue);
 }
 
 // Runs in exclusion with alarm_cancel and timer_callback.
-static void alarm_set_internal(alarm_t *alarm, period_ms_t period,
-                               alarm_callback_t cb, void *data,
-                               fixed_queue_t *queue) {
+static void alarm_set_internal(alarm_t* alarm, period_ms_t period,
+                               alarm_callback_t cb, void* data,
+                               fixed_queue_t* queue) {
   assert(alarms != NULL);
   assert(alarm != NULL);
   assert(cb != NULL);
@@ -253,10 +244,9 @@
   pthread_mutex_unlock(&monitor);
 }
 
-void alarm_cancel(alarm_t *alarm) {
+void alarm_cancel(alarm_t* alarm) {
   assert(alarms != NULL);
-  if (!alarm)
-    return;
+  if (!alarm) return;
 
   pthread_mutex_lock(&monitor);
   alarm_cancel_internal(alarm);
@@ -269,8 +259,9 @@
 
 // Internal implementation of canceling an alarm.
 // The caller must hold the |monitor| lock.
-static void alarm_cancel_internal(alarm_t *alarm) {
-  bool needs_reschedule = (!list_is_empty(alarms) && list_front(alarms) == alarm);
+static void alarm_cancel_internal(alarm_t* alarm) {
+  bool needs_reschedule =
+      (!list_is_empty(alarms) && list_front(alarms) == alarm);
 
   remove_pending_alarm(alarm);
 
@@ -281,20 +272,17 @@
   alarm->stats.canceled_count++;
   alarm->queue = NULL;
 
-  if (needs_reschedule)
-    reschedule_root_alarm();
+  if (needs_reschedule) reschedule_root_alarm();
 }
 
-bool alarm_is_scheduled(const alarm_t *alarm) {
-  if ((alarms == NULL) || (alarm == NULL))
-    return false;
+bool alarm_is_scheduled(const alarm_t* alarm) {
+  if ((alarms == NULL) || (alarm == NULL)) return false;
   return (alarm->callback != NULL);
 }
 
 void alarm_cleanup(void) {
   // If lazy_initialize never ran there is nothing else to do
-  if (!alarms)
-    return;
+  if (!alarms) return;
 
   dispatcher_thread_active = false;
   semaphore_post(alarm_expired);
@@ -336,12 +324,10 @@
     goto error;
   }
 
-  if (!timer_create_internal(CLOCK_ID, &timer))
-    goto error;
+  if (!timer_create_internal(CLOCK_ID, &timer)) goto error;
   timer_initialized = true;
 
-  if (!timer_create_internal(CLOCK_ID_ALARM, &wakeup_timer))
-    goto error;
+  if (!timer_create_internal(CLOCK_ID_ALARM, &wakeup_timer)) goto error;
   wakeup_timer_initialized = true;
 
   alarm_expired = semaphore_new(0);
@@ -350,8 +336,8 @@
     goto error;
   }
 
-  default_callback_thread = thread_new_sized("alarm_default_callbacks",
-                                             SIZE_MAX);
+  default_callback_thread =
+      thread_new_sized("alarm_default_callbacks", SIZE_MAX);
   if (default_callback_thread == NULL) {
     LOG_ERROR(LOG_TAG, "%s unable to create default alarm callbacks thread.",
               __func__);
@@ -392,11 +378,9 @@
   semaphore_free(alarm_expired);
   alarm_expired = NULL;
 
-  if (wakeup_timer_initialized)
-    timer_delete(wakeup_timer);
+  if (wakeup_timer_initialized) timer_delete(wakeup_timer);
 
-  if (timer_initialized)
-    timer_delete(timer);
+  if (timer_initialized) timer_delete(timer);
 
   list_free(alarms);
   alarms = NULL;
@@ -411,8 +395,8 @@
 
   struct timespec ts;
   if (clock_gettime(CLOCK_ID, &ts) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to get current time: %s",
-              __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to get current time: %s", __func__,
+              strerror(errno));
     return 0;
   }
 
@@ -421,7 +405,7 @@
 
 // Remove alarm from internal alarm list and the processing queue
 // The caller must hold the |monitor| lock.
-static void remove_pending_alarm(alarm_t *alarm) {
+static void remove_pending_alarm(alarm_t* alarm) {
   list_remove(alarms, alarm);
   while (fixed_queue_try_remove_from_queue(alarm->queue, alarm) != NULL) {
     // Remove all repeated alarm instances from the queue.
@@ -430,12 +414,12 @@
 }
 
 // Must be called with monitor held
-static void schedule_next_instance(alarm_t *alarm) {
+static void schedule_next_instance(alarm_t* alarm) {
   // If the alarm is currently set and it's at the start of the list,
   // we'll need to re-schedule since we've adjusted the earliest deadline.
-  bool needs_reschedule = (!list_is_empty(alarms) && list_front(alarms) == alarm);
-  if (alarm->callback)
-    remove_pending_alarm(alarm);
+  bool needs_reschedule =
+      (!list_is_empty(alarms) && list_front(alarms) == alarm);
+  if (alarm->callback) remove_pending_alarm(alarm);
 
   // Calculate the next deadline for this alarm
   period_ms_t just_now = now();
@@ -446,19 +430,22 @@
 
   // Add it into the timer list sorted by deadline (earliest deadline first).
   if (list_is_empty(alarms) ||
-      ((alarm_t *)list_front(alarms))->deadline > alarm->deadline) {
+      ((alarm_t*)list_front(alarms))->deadline > alarm->deadline) {
     list_prepend(alarms, alarm);
   } else {
-    for (list_node_t *node = list_begin(alarms); node != list_end(alarms); node = list_next(node)) {
-      list_node_t *next = list_next(node);
-      if (next == list_end(alarms) || ((alarm_t *)list_node(next))->deadline > alarm->deadline) {
+    for (list_node_t* node = list_begin(alarms); node != list_end(alarms);
+         node = list_next(node)) {
+      list_node_t* next = list_next(node);
+      if (next == list_end(alarms) ||
+          ((alarm_t*)list_node(next))->deadline > alarm->deadline) {
         list_insert_after(alarms, node, alarm);
         break;
       }
     }
   }
 
-  // If the new alarm has the earliest deadline, we need to re-evaluate our schedule.
+  // If the new alarm has the earliest deadline, we need to re-evaluate our
+  // schedule.
   if (needs_reschedule ||
       (!list_is_empty(alarms) && list_front(alarms) == alarm)) {
     reschedule_root_alarm();
@@ -470,17 +457,16 @@
   assert(alarms != NULL);
 
   const bool timer_was_set = timer_set;
-  alarm_t *next;
+  alarm_t* next;
   int64_t next_expiration;
 
   // If used in a zeroed state, disarms the timer.
   struct itimerspec timer_time;
   memset(&timer_time, 0, sizeof(timer_time));
 
-  if (list_is_empty(alarms))
-    goto done;
+  if (list_is_empty(alarms)) goto done;
 
-  next = static_cast<alarm_t *>(list_front(alarms));
+  next = static_cast<alarm_t*>(list_front(alarms));
   next_expiration = next->deadline - now();
   if (next_expiration < TIMER_INTERVAL_FOR_WAKELOCK_IN_MS) {
     if (!timer_set) {
@@ -516,16 +502,16 @@
     struct itimerspec wakeup_time;
     memset(&wakeup_time, 0, sizeof(wakeup_time));
 
-
     wakeup_time.it_value.tv_sec = (next->deadline / 1000);
     wakeup_time.it_value.tv_nsec = (next->deadline % 1000) * 1000000LL;
     if (timer_settime(wakeup_timer, TIMER_ABSTIME, &wakeup_time, NULL) == -1)
-      LOG_ERROR(LOG_TAG, "%s unable to set wakeup timer: %s",
-                __func__, strerror(errno));
+      LOG_ERROR(LOG_TAG, "%s unable to set wakeup timer: %s", __func__,
+                strerror(errno));
   }
 
 done:
-  timer_set = timer_time.it_value.tv_sec != 0 || timer_time.it_value.tv_nsec != 0;
+  timer_set =
+      timer_time.it_value.tv_sec != 0 || timer_time.it_value.tv_nsec != 0;
   if (timer_was_set && !timer_set) {
     wakelock_release();
   }
@@ -548,13 +534,16 @@
     timer_gettime(timer, &time_to_expire);
     if (time_to_expire.it_value.tv_sec == 0 &&
         time_to_expire.it_value.tv_nsec == 0) {
-      LOG_DEBUG(LOG_TAG, "%s alarm expiration too close for posix timers, switching to guns", __func__);
+      LOG_DEBUG(
+          LOG_TAG,
+          "%s alarm expiration too close for posix timers, switching to guns",
+          __func__);
       semaphore_post(alarm_expired);
     }
   }
 }
 
-void alarm_register_processing_queue(fixed_queue_t *queue, thread_t *thread) {
+void alarm_register_processing_queue(fixed_queue_t* queue, thread_t* thread) {
   assert(queue != NULL);
   assert(thread != NULL);
 
@@ -562,7 +551,7 @@
                                alarm_queue_ready, NULL);
 }
 
-void alarm_unregister_processing_queue(fixed_queue_t *queue) {
+void alarm_unregister_processing_queue(fixed_queue_t* queue) {
   assert(alarms != NULL);
   assert(queue != NULL);
 
@@ -570,27 +559,25 @@
 
   // Cancel all alarms that are using this queue
   pthread_mutex_lock(&monitor);
-  for (list_node_t *node = list_begin(alarms); node != list_end(alarms); ) {
-    alarm_t *alarm = (alarm_t *)list_node(node);
+  for (list_node_t* node = list_begin(alarms); node != list_end(alarms);) {
+    alarm_t* alarm = (alarm_t*)list_node(node);
     node = list_next(node);
     // TODO: Each module is responsible for tearing down its alarms; currently,
     // this is not the case. In the future, this check should be replaced by
     // an assert.
-    if (alarm->queue == queue)
-      alarm_cancel_internal(alarm);
+    if (alarm->queue == queue) alarm_cancel_internal(alarm);
   }
   pthread_mutex_unlock(&monitor);
 }
 
-static void alarm_queue_ready(fixed_queue_t *queue,
-                              UNUSED_ATTR void *context) {
+static void alarm_queue_ready(fixed_queue_t* queue, UNUSED_ATTR void* context) {
   assert(queue != NULL);
 
   pthread_mutex_lock(&monitor);
-  alarm_t *alarm = (alarm_t *)fixed_queue_try_dequeue(queue);
+  alarm_t* alarm = (alarm_t*)fixed_queue_try_dequeue(queue);
   if (alarm == NULL) {
     pthread_mutex_unlock(&monitor);
-    return;             // The alarm was probably canceled
+    return;  // The alarm was probably canceled
   }
 
   //
@@ -599,7 +586,7 @@
   // alarms and active ones.
   //
   alarm_callback_t callback = alarm->callback;
-  void *data = alarm->data;
+  void* data = alarm->data;
   period_ms_t deadline = alarm->deadline;
   if (alarm->is_periodic) {
     // The periodic alarm has been rescheduled and alarm->deadline has been
@@ -627,7 +614,7 @@
 }
 
 // Callback function for wake alarms and our posix timer
-static void timer_callback(UNUSED_ATTR void *ptr) {
+static void timer_callback(UNUSED_ATTR void* ptr) {
   semaphore_post(alarm_expired);
 }
 
@@ -635,21 +622,20 @@
 //   (1) Receives a signal using |alarm_exired| that the alarm has expired
 //   (2) Dispatches the alarm callback for processing by the corresponding
 // thread for that alarm.
-static void callback_dispatch(UNUSED_ATTR void *context) {
+static void callback_dispatch(UNUSED_ATTR void* context) {
   while (true) {
     semaphore_wait(alarm_expired);
-    if (!dispatcher_thread_active)
-      break;
+    if (!dispatcher_thread_active) break;
 
     pthread_mutex_lock(&monitor);
-    alarm_t *alarm;
+    alarm_t* alarm;
 
     // Take into account that the alarm may get cancelled before we get to it.
     // We're done here if there are no alarms or the alarm at the front is in
     // the future. Release the monitor lock and exit right away since there's
     // nothing left to do.
     if (list_is_empty(alarms) ||
-        (alarm = static_cast<alarm_t *>(list_front(alarms)))->deadline > now()) {
+        (alarm = static_cast<alarm_t*>(list_front(alarms)))->deadline > now()) {
       reschedule_root_alarm();
       pthread_mutex_unlock(&monitor);
       continue;
@@ -673,7 +659,7 @@
   LOG_DEBUG(LOG_TAG, "%s Callback thread exited", __func__);
 }
 
-static bool timer_create_internal(const clockid_t clock_id, timer_t *timer) {
+static bool timer_create_internal(const clockid_t clock_id, timer_t* timer) {
   assert(timer != NULL);
 
   struct sigevent sigevent;
@@ -681,11 +667,17 @@
   sigevent.sigev_notify = SIGEV_THREAD;
   sigevent.sigev_notify_function = (void (*)(union sigval))timer_callback;
   if (timer_create(clock_id, &sigevent, timer) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to create timer with clock %d: %s",
-              __func__, clock_id, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to create timer with clock %d: %s", __func__,
+              clock_id, strerror(errno));
     if (clock_id == CLOCK_BOOTTIME_ALARM) {
-      LOG_ERROR(LOG_TAG, "The kernel might not have support for timer_create(CLOCK_BOOTTIME_ALARM): https://lwn.net/Articles/429925/");
-      LOG_ERROR(LOG_TAG, "See following patches: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/?qt=grep&q=CLOCK_BOOTTIME_ALARM");
+      LOG_ERROR(LOG_TAG,
+                "The kernel might not have support for "
+                "timer_create(CLOCK_BOOTTIME_ALARM): "
+                "https://lwn.net/Articles/429925/");
+      LOG_ERROR(LOG_TAG,
+                "See following patches: "
+                "https://git.kernel.org/cgit/linux/kernel/git/torvalds/"
+                "linux.git/log/?qt=grep&q=CLOCK_BOOTTIME_ALARM");
     }
     return false;
   }
@@ -693,11 +685,9 @@
   return true;
 }
 
-static void update_scheduling_stats(alarm_stats_t *stats,
-                                    period_ms_t now_ms,
+static void update_scheduling_stats(alarm_stats_t* stats, period_ms_t now_ms,
                                     period_ms_t deadline_ms,
-                                    period_ms_t execution_delta_ms)
-{
+                                    period_ms_t execution_delta_ms) {
   stats->total_updates++;
   stats->last_update_ms = now_ms;
 
@@ -714,21 +704,16 @@
   }
 }
 
-static void dump_stat(int fd, stat_t *stat, const char *description)
-{
-    period_ms_t average_time_ms = 0;
-    if (stat->count != 0)
-      average_time_ms = stat->total_ms / stat->count;
+static void dump_stat(int fd, stat_t* stat, const char* description) {
+  period_ms_t average_time_ms = 0;
+  if (stat->count != 0) average_time_ms = stat->total_ms / stat->count;
 
-    dprintf(fd, "%-51s: %llu / %llu / %llu\n",
-            description,
-            (unsigned long long)stat->total_ms,
-            (unsigned long long)stat->max_ms,
-            (unsigned long long)average_time_ms);
+  dprintf(fd, "%-51s: %llu / %llu / %llu\n", description,
+          (unsigned long long)stat->total_ms, (unsigned long long)stat->max_ms,
+          (unsigned long long)average_time_ms);
 }
 
-void alarm_debug_dump(int fd)
-{
+void alarm_debug_dump(int fd) {
   dprintf(fd, "\nBluetooth Alarms Statistics:\n");
 
   pthread_mutex_lock(&monitor);
@@ -744,10 +729,10 @@
   dprintf(fd, "  Total Alarms: %zu\n\n", list_length(alarms));
 
   // Dump info for each alarm
-  for (list_node_t *node = list_begin(alarms); node != list_end(alarms);
+  for (list_node_t* node = list_begin(alarms); node != list_end(alarms);
        node = list_next(node)) {
-    alarm_t *alarm = (alarm_t *)list_node(node);
-    alarm_stats_t *stats = &alarm->stats;
+    alarm_t* alarm = (alarm_t*)list_node(node);
+    alarm_stats_t* stats = &alarm->stats;
 
     dprintf(fd, "  Alarm : %s (%s)\n", stats->name,
             (alarm->is_periodic) ? "PERIODIC" : "SINGLE");
@@ -759,13 +744,12 @@
 
     dprintf(fd, "%-51s: %zu / %zu\n",
             "    Deviation counts (overdue/premature)",
-            stats->overdue_scheduling.count,
-            stats->premature_scheduling.count);
+            stats->overdue_scheduling.count, stats->premature_scheduling.count);
 
     dprintf(fd, "%-51s: %llu / %llu / %lld\n",
             "    Time in ms (since creation/interval/remaining)",
             (unsigned long long)(just_now - alarm->creation_time),
-            (unsigned long long) alarm->period,
+            (unsigned long long)alarm->period,
             (long long)(alarm->deadline - just_now));
 
     dump_stat(fd, &stats->callback_execution,
diff --git a/osi/src/allocation_tracker.cc b/osi/src/allocation_tracker.cc
index 4a35f30..7312cb2 100644
--- a/osi/src/allocation_tracker.cc
+++ b/osi/src/allocation_tracker.cc
@@ -32,7 +32,7 @@
 
 typedef struct {
   uint8_t allocator_id;
-  void *ptr;
+  void* ptr;
   size_t size;
   bool freed;
 } allocation_t;
@@ -45,12 +45,10 @@
 
 void allocation_tracker_init(void) {
   std::unique_lock<std::mutex> lock(tracker_lock);
-  if (enabled)
-    return;
+  if (enabled) return;
 
   // randomize the canary contents
-  for (size_t i = 0; i < canary_size; i++)
-     canary[i] = (char)osi_rand();
+  for (size_t i = 0; i < canary_size; i++) canary[i] = (char)osi_rand();
 
   LOG_DEBUG(LOG_TAG, "canary initialized");
 
@@ -60,8 +58,7 @@
 // Test function only. Do not call in the normal course of operations.
 void allocation_tracker_uninit(void) {
   std::unique_lock<std::mutex> lock(tracker_lock);
-  if (!enabled)
-    return;
+  if (!enabled) return;
 
   allocations.clear();
   enabled = false;
@@ -69,46 +66,47 @@
 
 void allocation_tracker_reset(void) {
   std::unique_lock<std::mutex> lock(tracker_lock);
-  if (!enabled)
-    return;
+  if (!enabled) return;
 
   allocations.clear();
 }
 
 size_t allocation_tracker_expect_no_allocations(void) {
   std::unique_lock<std::mutex> lock(tracker_lock);
-  if (!enabled)
-    return 0;
+  if (!enabled) return 0;
 
   size_t unfreed_memory_size = 0;
 
-  for (const auto &entry : allocations) {
-    allocation_t *allocation = entry.second;
+  for (const auto& entry : allocations) {
+    allocation_t* allocation = entry.second;
     if (!allocation->freed) {
-      unfreed_memory_size += allocation->size; // Report back the unfreed byte count
-      LOG_ERROR(LOG_TAG, "%s found unfreed allocation. address: 0x%zx size: %zd bytes", __func__, (uintptr_t)allocation->ptr, allocation->size);
+      unfreed_memory_size +=
+          allocation->size;  // Report back the unfreed byte count
+      LOG_ERROR(LOG_TAG,
+                "%s found unfreed allocation. address: 0x%zx size: %zd bytes",
+                __func__, (uintptr_t)allocation->ptr, allocation->size);
     }
   }
 
   return unfreed_memory_size;
 }
 
-void *allocation_tracker_notify_alloc(uint8_t allocator_id, void *ptr, size_t requested_size) {
-  char *return_ptr;
+void* allocation_tracker_notify_alloc(uint8_t allocator_id, void* ptr,
+                                      size_t requested_size) {
+  char* return_ptr;
   {
     std::unique_lock<std::mutex> lock(tracker_lock);
-    if (!enabled || !ptr)
-      return ptr;
+    if (!enabled || !ptr) return ptr;
 
-    return_ptr = ((char *)ptr) + canary_size;
+    return_ptr = ((char*)ptr) + canary_size;
 
     auto map_entry = allocations.find(return_ptr);
-    allocation_t *allocation;
+    allocation_t* allocation;
     if (map_entry != allocations.end()) {
       allocation = map_entry->second;
-      assert(allocation->freed); // Must have been freed before
+      assert(allocation->freed);  // Must have been freed before
     } else {
-      allocation = (allocation_t *)calloc(1, sizeof(allocation_t));
+      allocation = (allocation_t*)calloc(1, sizeof(allocation_t));
       allocations[return_ptr] = allocation;
     }
 
@@ -116,7 +114,6 @@
     allocation->freed = false;
     allocation->size = requested_size;
     allocation->ptr = return_ptr;
-
   }
 
   // Add the canary on both sides
@@ -126,21 +123,22 @@
   return return_ptr;
 }
 
-void *allocation_tracker_notify_free(UNUSED_ATTR uint8_t allocator_id, void *ptr) {
+void* allocation_tracker_notify_free(UNUSED_ATTR uint8_t allocator_id,
+                                     void* ptr) {
   std::unique_lock<std::mutex> lock(tracker_lock);
-  if (!enabled || !ptr)
-    return ptr;
+  if (!enabled || !ptr) return ptr;
 
   auto map_entry = allocations.find(ptr);
   assert(map_entry != allocations.end());
-  allocation_t *allocation = map_entry->second;
-  assert(allocation);                               // Must have been tracked before
-  assert(!allocation->freed);                       // Must not be a double free
-  assert(allocation->allocator_id == allocator_id); // Must be from the same allocator
+  allocation_t* allocation = map_entry->second;
+  assert(allocation);          // Must have been tracked before
+  assert(!allocation->freed);  // Must not be a double free
+  assert(allocation->allocator_id ==
+         allocator_id);  // Must be from the same allocator
   allocation->freed = true;
 
-  UNUSED_ATTR const char *beginning_canary = ((char *)ptr) - canary_size;
-  UNUSED_ATTR const char *end_canary = ((char *)ptr) + allocation->size;
+  UNUSED_ATTR const char* beginning_canary = ((char*)ptr) - canary_size;
+  UNUSED_ATTR const char* end_canary = ((char*)ptr) + allocation->size;
 
   for (size_t i = 0; i < canary_size; i++) {
     assert(beginning_canary[i] == canary[i]);
@@ -152,7 +150,7 @@
   // as the allocation entry will not be present.
   allocations.erase(ptr);
 
-  return ((char *)ptr) - canary_size;
+  return ((char*)ptr) - canary_size;
 }
 
 size_t allocation_tracker_resize_for_canary(size_t size) {
diff --git a/osi/src/allocator.cc b/osi/src/allocator.cc
index 9759803..aab1964 100644
--- a/osi/src/allocator.cc
+++ b/osi/src/allocator.cc
@@ -19,80 +19,66 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "osi/include/allocator.h"
 #include "osi/include/allocation_tracker.h"
+#include "osi/include/allocator.h"
 
 static const allocator_id_t alloc_allocator_id = 42;
 
-char *osi_strdup(const char *str) {
+char* osi_strdup(const char* str) {
   size_t size = strlen(str) + 1;  // + 1 for the null terminator
   size_t real_size = allocation_tracker_resize_for_canary(size);
-  void *ptr = malloc(real_size);
+  void* ptr = malloc(real_size);
   assert(ptr);
 
-  char *new_string = static_cast<char *>(allocation_tracker_notify_alloc(
-      alloc_allocator_id,
-      ptr,
-      size));
-  if (!new_string)
-    return NULL;
+  char* new_string = static_cast<char*>(
+      allocation_tracker_notify_alloc(alloc_allocator_id, ptr, size));
+  if (!new_string) return NULL;
 
   memcpy(new_string, str, size);
   return new_string;
 }
 
-char *osi_strndup(const char *str, size_t len) {
+char* osi_strndup(const char* str, size_t len) {
   size_t size = strlen(str);
-  if (len < size)
-    size = len;
+  if (len < size) size = len;
 
   size_t real_size = allocation_tracker_resize_for_canary(size + 1);
-  void *ptr = malloc(real_size);
+  void* ptr = malloc(real_size);
   assert(ptr);
 
-  char *new_string = static_cast<char *>(allocation_tracker_notify_alloc(
-      alloc_allocator_id,
-      ptr,
-      size + 1));
-  if (!new_string)
-    return NULL;
+  char* new_string = static_cast<char*>(
+      allocation_tracker_notify_alloc(alloc_allocator_id, ptr, size + 1));
+  if (!new_string) return NULL;
 
   memcpy(new_string, str, size);
   new_string[size] = '\0';
   return new_string;
 }
 
-void *osi_malloc(size_t size) {
+void* osi_malloc(size_t size) {
   size_t real_size = allocation_tracker_resize_for_canary(size);
-  void *ptr = malloc(real_size);
+  void* ptr = malloc(real_size);
   assert(ptr);
   return allocation_tracker_notify_alloc(alloc_allocator_id, ptr, size);
 }
 
-void *osi_calloc(size_t size) {
+void* osi_calloc(size_t size) {
   size_t real_size = allocation_tracker_resize_for_canary(size);
-  void *ptr = calloc(1, real_size);
+  void* ptr = calloc(1, real_size);
   assert(ptr);
   return allocation_tracker_notify_alloc(alloc_allocator_id, ptr, size);
 }
 
-void osi_free(void *ptr) {
+void osi_free(void* ptr) {
   free(allocation_tracker_notify_free(alloc_allocator_id, ptr));
 }
 
-void osi_free_and_reset(void **p_ptr)
-{
+void osi_free_and_reset(void** p_ptr) {
   assert(p_ptr != NULL);
   osi_free(*p_ptr);
   *p_ptr = NULL;
 }
 
-const allocator_t allocator_calloc = {
-  osi_calloc,
-  osi_free
-};
+const allocator_t allocator_calloc = {osi_calloc, osi_free};
 
-const allocator_t allocator_malloc = {
-  osi_malloc,
-  osi_free
-};
+const allocator_t allocator_malloc = {osi_malloc, osi_free};
diff --git a/osi/src/array.cc b/osi/src/array.cc
index 36df8ae..1248e92 100644
--- a/osi/src/array.cc
+++ b/osi/src/array.cc
@@ -31,18 +31,19 @@
   size_t element_size;
   size_t length;
   size_t capacity;
-  uint8_t *data;
+  uint8_t* data;
   uint8_t internal_storage[];
 };
 
-static bool grow(array_t *array);
+static bool grow(array_t* array);
 
 static const size_t INTERNAL_ELEMENTS = 16;
 
-array_t *array_new(size_t element_size) {
+array_t* array_new(size_t element_size) {
   assert(element_size > 0);
 
-  array_t *array = static_cast<array_t *>(osi_calloc(sizeof(array_t) + element_size * INTERNAL_ELEMENTS));
+  array_t* array = static_cast<array_t*>(
+      osi_calloc(sizeof(array_t) + element_size * INTERNAL_ELEMENTS));
 
   array->element_size = element_size;
   array->capacity = INTERNAL_ELEMENTS;
@@ -50,41 +51,40 @@
   return array;
 }
 
-void array_free(array_t *array) {
-  if (!array)
-    return;
+void array_free(array_t* array) {
+  if (!array) return;
 
-  if (array->data != array->internal_storage)
-    free(array->data);
+  if (array->data != array->internal_storage) free(array->data);
 
   osi_free(array);
 }
 
-void *array_ptr(const array_t *array) {
-  return array_at(array, 0);
-}
+void* array_ptr(const array_t* array) { return array_at(array, 0); }
 
-void *array_at(const array_t *array, size_t index) {
+void* array_at(const array_t* array, size_t index) {
   assert(array != NULL);
   assert(index < array->length);
   return array->data + (index * array->element_size);
 }
 
-size_t array_length(const array_t *array) {
+size_t array_length(const array_t* array) {
   assert(array != NULL);
   return array->length;
 }
 
-bool array_append_value(array_t *array, uint32_t value) {
+bool array_append_value(array_t* array, uint32_t value) {
   return array_append_ptr(array, &value);
 }
 
-bool array_append_ptr(array_t *array, void *data) {
+bool array_append_ptr(array_t* array, void* data) {
   assert(array != NULL);
   assert(data != NULL);
 
   if (array->length == array->capacity && !grow(array)) {
-    LOG_ERROR(LOG_TAG, "%s unable to grow array past current capacity of %zu elements of size %zu.", __func__, array->capacity, array->element_size);
+    LOG_ERROR(LOG_TAG,
+              "%s unable to grow array past current capacity of %zu elements "
+              "of size %zu.",
+              __func__, array->capacity, array->element_size);
     return false;
   }
 
@@ -93,18 +93,19 @@
   return true;
 }
 
-static bool grow(array_t *array) {
+static bool grow(array_t* array) {
   const size_t new_capacity = array->capacity + (array->capacity / 2);
   const bool is_moving = (array->data == array->internal_storage);
 
-  void *new_data = realloc(is_moving ? NULL : array->data, new_capacity * array->element_size);
-  if (!new_data)
-    return false;
+  void* new_data = realloc(is_moving ? NULL : array->data,
+                           new_capacity * array->element_size);
+  if (!new_data) return false;
 
   if (is_moving)
-    memcpy(new_data, array->internal_storage, array->length * array->element_size);
+    memcpy(new_data, array->internal_storage,
+           array->length * array->element_size);
 
-  array->data = static_cast<uint8_t *>(new_data);
+  array->data = static_cast<uint8_t*>(new_data);
   array->capacity = new_capacity;
   return true;
 }
diff --git a/osi/src/buffer.cc b/osi/src/buffer.cc
index c46d580..c66e37b 100644
--- a/osi/src/buffer.cc
+++ b/osi/src/buffer.cc
@@ -27,16 +27,17 @@
 #include "osi/include/log.h"
 
 struct buffer_t {
-  buffer_t *root;
+  buffer_t* root;
   size_t refcount;
   size_t length;
   uint8_t data[];
 };
 
-buffer_t *buffer_new(size_t size) {
+buffer_t* buffer_new(size_t size) {
   assert(size > 0);
 
-  buffer_t *buffer = static_cast<buffer_t *>(osi_calloc(sizeof(buffer_t) + size));
+  buffer_t* buffer =
+      static_cast<buffer_t*>(osi_calloc(sizeof(buffer_t) + size));
 
   buffer->root = buffer;
   buffer->refcount = 1;
@@ -45,17 +46,17 @@
   return buffer;
 }
 
-buffer_t *buffer_new_ref(const buffer_t *buf) {
+buffer_t* buffer_new_ref(const buffer_t* buf) {
   assert(buf != NULL);
   return buffer_new_slice(buf, buf->length);
 }
 
-buffer_t *buffer_new_slice(const buffer_t *buf, size_t slice_size) {
+buffer_t* buffer_new_slice(const buffer_t* buf, size_t slice_size) {
   assert(buf != NULL);
   assert(slice_size > 0);
   assert(slice_size <= buf->length);
 
-  buffer_t *ret = static_cast<buffer_t *>(osi_calloc(sizeof(buffer_t)));
+  buffer_t* ret = static_cast<buffer_t*>(osi_calloc(sizeof(buffer_t)));
 
   ret->root = buf->root;
   ret->refcount = SIZE_MAX;
@@ -66,14 +67,12 @@
   return ret;
 }
 
-void buffer_free(buffer_t *buffer) {
-  if (!buffer)
-    return;
+void buffer_free(buffer_t* buffer) {
+  if (!buffer) return;
 
   if (buffer->root != buffer) {
     // We're a leaf node. Delete the root node if we're the last referent.
-    if (--buffer->root->refcount == 0)
-      osi_free(buffer->root);
+    if (--buffer->root->refcount == 0) osi_free(buffer->root);
     osi_free(buffer);
   } else if (--buffer->refcount == 0) {
     // We're a root node. Roots are only deleted when their refcount goes to 0.
@@ -81,12 +80,12 @@
   }
 }
 
-void *buffer_ptr(const buffer_t *buf) {
+void* buffer_ptr(const buffer_t* buf) {
   assert(buf != NULL);
   return buf->root->data + buf->root->length - buf->length;
 }
 
-size_t buffer_length(const buffer_t *buf) {
+size_t buffer_length(const buffer_t* buf) {
   assert(buf != NULL);
   return buf->length;
 }
diff --git a/osi/src/compat.cc b/osi/src/compat.cc
index 44fe5a1..c228c75 100644
--- a/osi/src/compat.cc
+++ b/osi/src/compat.cc
@@ -35,11 +35,7 @@
 #include "osi/include/osi.h"
 
 #if __GLIBC__
-pid_t
-gettid(void)
-{
-  return syscall(SYS_gettid);
-}
+pid_t gettid(void) { return syscall(SYS_gettid); }
 #endif
 
 /* These functions from bionic
@@ -65,30 +61,26 @@
  * will be copied.  Always NUL terminates (unless siz == 0).
  * Returns strlen(src); if retval >= siz, truncation occurred.
  */
-size_t
-strlcpy(char *dst, const char *src, size_t siz)
-{
-  char *d = dst;
-  const char *s = src;
+size_t strlcpy(char* dst, const char* src, size_t siz) {
+  char* d = dst;
+  const char* s = src;
   size_t n = siz;
 
   /* Copy as many bytes as will fit */
   if (n != 0) {
     while (--n != 0) {
-      if ((*d++ = *s++) == '\0')
-        break;
+      if ((*d++ = *s++) == '\0') break;
     }
   }
 
   /* Not enough room in dst, add NUL and traverse rest of src */
   if (n == 0) {
-    if (siz != 0)
-      *d = '\0'; /* NUL-terminate dst */
+    if (siz != 0) *d = '\0'; /* NUL-terminate dst */
     while (*s++)
       ;
   }
 
-  return(s - src - 1); /* count does not include NUL */
+  return (s - src - 1); /* count does not include NUL */
 }
 #endif
 
@@ -100,22 +92,18 @@
  * Returns strlen(src) + MIN(siz, strlen(initial dst)).
  * If retval >= siz, truncation occurred.
  */
-size_t
-strlcat(char *dst, const char *src, size_t siz)
-{
-  char *d = dst;
-  const char *s = src;
+size_t strlcat(char* dst, const char* src, size_t siz) {
+  char* d = dst;
+  const char* s = src;
   size_t n = siz;
   size_t dlen;
 
   /* Find the end of dst and adjust bytes left but don't go past end */
-  while (n-- != 0 && *d != '\0')
-    d++;
+  while (n-- != 0 && *d != '\0') d++;
   dlen = d - dst;
   n = siz - dlen;
 
-  if (n == 0)
-    return (dlen + strlen(s));
+  if (n == 0) return (dlen + strlen(s));
 
   while (*s != '\0') {
     if (n != 1) {
diff --git a/osi/src/config.cc b/osi/src/config.cc
index df8beb0..fb3a6f7 100644
--- a/osi/src/config.cc
+++ b/osi/src/config.cc
@@ -28,42 +28,43 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include "osi/include/allocator.h"
 #include "osi/include/list.h"
 #include "osi/include/log.h"
 
 typedef struct {
-  char *key;
-  char *value;
+  char* key;
+  char* value;
 } entry_t;
 
 typedef struct {
-  char *name;
-  list_t *entries;
+  char* name;
+  list_t* entries;
 } section_t;
 
 struct config_t {
-  list_t *sections;
+  list_t* sections;
 };
 
 // Empty definition; this type is aliased to list_node_t.
 struct config_section_iter_t {};
 
-static bool config_parse(FILE *fp, config_t *config);
+static bool config_parse(FILE* fp, config_t* config);
 
-static section_t *section_new(const char *name);
-static void section_free(void *ptr);
-static section_t *section_find(const config_t *config, const char *section);
+static section_t* section_new(const char* name);
+static void section_free(void* ptr);
+static section_t* section_find(const config_t* config, const char* section);
 
-static entry_t *entry_new(const char *key, const char *value);
-static void entry_free(void *ptr);
-static entry_t *entry_find(const config_t *config, const char *section, const char *key);
+static entry_t* entry_new(const char* key, const char* value);
+static void entry_free(void* ptr);
+static entry_t* entry_find(const config_t* config, const char* section,
+                           const char* key);
 
-config_t *config_new_empty(void) {
-  config_t *config = static_cast<config_t *>(osi_calloc(sizeof(config_t)));
+config_t* config_new_empty(void) {
+  config_t* config = static_cast<config_t*>(osi_calloc(sizeof(config_t)));
 
   config->sections = list_new(section_free);
   if (!config->sections) {
@@ -78,16 +79,16 @@
   return NULL;
 }
 
-config_t *config_new(const char *filename) {
+config_t* config_new(const char* filename) {
   assert(filename != NULL);
 
-  config_t *config = config_new_empty();
-  if (!config)
-    return NULL;
+  config_t* config = config_new_empty();
+  if (!config) return NULL;
 
-  FILE *fp = fopen(filename, "rt");
+  FILE* fp = fopen(filename, "rt");
   if (!fp) {
-    LOG_ERROR(LOG_TAG, "%s unable to open file '%s': %s", __func__, filename, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to open file '%s': %s", __func__, filename,
+              strerror(errno));
     config_free(config);
     return NULL;
   }
@@ -101,22 +102,21 @@
   return config;
 }
 
-config_t *config_new_clone(const config_t *src) {
+config_t* config_new_clone(const config_t* src) {
   assert(src != NULL);
 
-  config_t *ret = config_new_empty();
+  config_t* ret = config_new_empty();
 
   assert(ret != NULL);
 
-  for (const list_node_t *node = list_begin(src->sections);
-       node != list_end(src->sections);
-       node = list_next(node)) {
-    section_t *sec = static_cast<section_t *>(list_node(node));
+  for (const list_node_t* node = list_begin(src->sections);
+       node != list_end(src->sections); node = list_next(node)) {
+    section_t* sec = static_cast<section_t*>(list_node(node));
 
-    for (const list_node_t *node_entry = list_begin(sec->entries);
+    for (const list_node_t* node_entry = list_begin(sec->entries);
          node_entry != list_end(sec->entries);
          node_entry = list_next(node_entry)) {
-      entry_t *entry = static_cast<entry_t *>(list_node(node_entry));
+      entry_t* entry = static_cast<entry_t*>(list_node(node_entry));
 
       config_set_string(ret, sec->name, entry->key, entry->value);
     }
@@ -125,22 +125,22 @@
   return ret;
 }
 
-void config_free(config_t *config) {
-  if (!config)
-    return;
+void config_free(config_t* config) {
+  if (!config) return;
 
   list_free(config->sections);
   osi_free(config);
 }
 
-bool config_has_section(const config_t *config, const char *section) {
+bool config_has_section(const config_t* config, const char* section) {
   assert(config != NULL);
   assert(section != NULL);
 
   return (section_find(config, section) != NULL);
 }
 
-bool config_has_key(const config_t *config, const char *section, const char *key) {
+bool config_has_key(const config_t* config, const char* section,
+                    const char* key) {
   assert(config != NULL);
   assert(section != NULL);
   assert(key != NULL);
@@ -148,60 +148,60 @@
   return (entry_find(config, section, key) != NULL);
 }
 
-int config_get_int(const config_t *config, const char *section, const char *key, int def_value) {
+int config_get_int(const config_t* config, const char* section, const char* key,
+                   int def_value) {
   assert(config != NULL);
   assert(section != NULL);
   assert(key != NULL);
 
-  entry_t *entry = entry_find(config, section, key);
-  if (!entry)
-    return def_value;
+  entry_t* entry = entry_find(config, section, key);
+  if (!entry) return def_value;
 
-  char *endptr;
+  char* endptr;
   int ret = strtol(entry->value, &endptr, 0);
   return (*endptr == '\0') ? ret : def_value;
 }
 
-bool config_get_bool(const config_t *config, const char *section, const char *key, bool def_value) {
+bool config_get_bool(const config_t* config, const char* section,
+                     const char* key, bool def_value) {
   assert(config != NULL);
   assert(section != NULL);
   assert(key != NULL);
 
-  entry_t *entry = entry_find(config, section, key);
-  if (!entry)
-    return def_value;
+  entry_t* entry = entry_find(config, section, key);
+  if (!entry) return def_value;
 
-  if (!strcmp(entry->value, "true"))
-    return true;
-  if (!strcmp(entry->value, "false"))
-    return false;
+  if (!strcmp(entry->value, "true")) return true;
+  if (!strcmp(entry->value, "false")) return false;
 
   return def_value;
 }
 
-const char *config_get_string(const config_t *config, const char *section, const char *key, const char *def_value) {
+const char* config_get_string(const config_t* config, const char* section,
+                              const char* key, const char* def_value) {
   assert(config != NULL);
   assert(section != NULL);
   assert(key != NULL);
 
-  entry_t *entry = entry_find(config, section, key);
-  if (!entry)
-    return def_value;
+  entry_t* entry = entry_find(config, section, key);
+  if (!entry) return def_value;
 
   return entry->value;
 }
 
-void config_set_int(config_t *config, const char *section, const char *key, int value) {
+void config_set_int(config_t* config, const char* section, const char* key,
+                    int value) {
   assert(config != NULL);
   assert(section != NULL);
   assert(key != NULL);
 
-  char value_str[32] = { 0 };
+  char value_str[32] = {0};
   snprintf(value_str, sizeof(value_str), "%d", value);
   config_set_string(config, section, key, value_str);
 }
 
-void config_set_bool(config_t *config, const char *section, const char *key, bool value) {
+void config_set_bool(config_t* config, const char* section, const char* key,
+                     bool value) {
   assert(config != NULL);
   assert(section != NULL);
   assert(key != NULL);
@@ -209,15 +209,17 @@
   config_set_string(config, section, key, value ? "true" : "false");
 }
 
-void config_set_string(config_t *config, const char *section, const char *key, const char *value) {
-  section_t *sec = section_find(config, section);
+void config_set_string(config_t* config, const char* section, const char* key,
+                       const char* value) {
+  section_t* sec = section_find(config, section);
   if (!sec) {
     sec = section_new(section);
     list_append(config->sections, sec);
   }
 
-  for (const list_node_t *node = list_begin(sec->entries); node != list_end(sec->entries); node = list_next(node)) {
-    entry_t *entry = static_cast<entry_t *>(list_node(node));
+  for (const list_node_t* node = list_begin(sec->entries);
+       node != list_end(sec->entries); node = list_next(node)) {
+    entry_t* entry = static_cast<entry_t*>(list_node(node));
     if (!strcmp(entry->key, key)) {
       osi_free(entry->value);
       entry->value = osi_strdup(value);
@@ -225,57 +227,56 @@
     }
   }
 
-  entry_t *entry = entry_new(key, value);
+  entry_t* entry = entry_new(key, value);
   list_append(sec->entries, entry);
 }
 
-bool config_remove_section(config_t *config, const char *section) {
+bool config_remove_section(config_t* config, const char* section) {
   assert(config != NULL);
   assert(section != NULL);
 
-  section_t *sec = section_find(config, section);
-  if (!sec)
-    return false;
+  section_t* sec = section_find(config, section);
+  if (!sec) return false;
 
   return list_remove(config->sections, sec);
 }
 
-bool config_remove_key(config_t *config, const char *section, const char *key) {
+bool config_remove_key(config_t* config, const char* section, const char* key) {
   assert(config != NULL);
   assert(section != NULL);
   assert(key != NULL);
 
-  section_t *sec = section_find(config, section);
-  entry_t *entry = entry_find(config, section, key);
-  if (!sec || !entry)
-    return false;
+  section_t* sec = section_find(config, section);
+  entry_t* entry = entry_find(config, section, key);
+  if (!sec || !entry) return false;
 
   return list_remove(sec->entries, entry);
 }
 
-const config_section_node_t *config_section_begin(const config_t *config) {
+const config_section_node_t* config_section_begin(const config_t* config) {
   assert(config != NULL);
-  return (const config_section_node_t *)list_begin(config->sections);
+  return (const config_section_node_t*)list_begin(config->sections);
 }
 
-const config_section_node_t *config_section_end(const config_t *config) {
+const config_section_node_t* config_section_end(const config_t* config) {
   assert(config != NULL);
-  return (const config_section_node_t *)list_end(config->sections);
+  return (const config_section_node_t*)list_end(config->sections);
 }
 
-const config_section_node_t *config_section_next(const config_section_node_t *node) {
+const config_section_node_t* config_section_next(
+    const config_section_node_t* node) {
   assert(node != NULL);
-  return (const config_section_node_t *)list_next((const list_node_t *)node);
+  return (const config_section_node_t*)list_next((const list_node_t*)node);
 }
 
-const char *config_section_name(const config_section_node_t *node) {
+const char* config_section_name(const config_section_node_t* node) {
   assert(node != NULL);
-  const list_node_t *lnode = (const list_node_t *)node;
-  const section_t *section = (const section_t *)list_node(lnode);
+  const list_node_t* lnode = (const list_node_t*)node;
+  const section_t* section = (const section_t*)list_node(lnode);
   return section->name;
 }
 
-bool config_save(const config_t *config, const char *filename) {
+bool config_save(const config_t* config, const char* filename) {
   assert(config != NULL);
   assert(filename != NULL);
   assert(*filename != '\0');
@@ -289,46 +290,53 @@
   // 4) Sync directory that has the conf file with fsync().
   //    This ensures directory entries are up-to-date.
   int dir_fd = -1;
-  FILE *fp = NULL;
+  FILE* fp = NULL;
 
   // Build temp config file based on config file (e.g. bt_config.conf.new).
-  static const char *temp_file_ext = ".new";
+  static const char* temp_file_ext = ".new";
   const int filename_len = strlen(filename);
   const int temp_filename_len = filename_len + strlen(temp_file_ext) + 1;
-  char *temp_filename = static_cast<char *>(osi_calloc(temp_filename_len));
+  char* temp_filename = static_cast<char*>(osi_calloc(temp_filename_len));
   snprintf(temp_filename, temp_filename_len, "%s%s", filename, temp_file_ext);
 
   // Extract directory from file path (e.g. /data/misc/bluedroid).
-  char *temp_dirname = osi_strdup(filename);
-  const char *directoryname = dirname(temp_dirname);
+  char* temp_dirname = osi_strdup(filename);
+  const char* directoryname = dirname(temp_dirname);
   if (!directoryname) {
-    LOG_ERROR(LOG_TAG, "%s error extracting directory from '%s': %s", __func__, filename, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s error extracting directory from '%s': %s", __func__,
+              filename, strerror(errno));
     goto error;
   }
 
   dir_fd = open(directoryname, O_RDONLY);
   if (dir_fd < 0) {
-    LOG_ERROR(LOG_TAG, "%s unable to open dir '%s': %s", __func__, directoryname, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to open dir '%s': %s", __func__,
+              directoryname, strerror(errno));
     goto error;
   }
 
   fp = fopen(temp_filename, "wt");
   if (!fp) {
-    LOG_ERROR(LOG_TAG, "%s unable to write file '%s': %s", __func__, temp_filename, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to write file '%s': %s", __func__,
+              temp_filename, strerror(errno));
     goto error;
   }
 
-  for (const list_node_t *node = list_begin(config->sections); node != list_end(config->sections); node = list_next(node)) {
-    const section_t *section = (const section_t *)list_node(node);
+  for (const list_node_t* node = list_begin(config->sections);
+       node != list_end(config->sections); node = list_next(node)) {
+    const section_t* section = (const section_t*)list_node(node);
     if (fprintf(fp, "[%s]\n", section->name) < 0) {
-      LOG_ERROR(LOG_TAG, "%s unable to write to file '%s': %s", __func__, temp_filename, strerror(errno));
+      LOG_ERROR(LOG_TAG, "%s unable to write to file '%s': %s", __func__,
+                temp_filename, strerror(errno));
       goto error;
     }
 
-    for (const list_node_t *enode = list_begin(section->entries); enode != list_end(section->entries); enode = list_next(enode)) {
-      const entry_t *entry = (const entry_t *)list_node(enode);
+    for (const list_node_t* enode = list_begin(section->entries);
+         enode != list_end(section->entries); enode = list_next(enode)) {
+      const entry_t* entry = (const entry_t*)list_node(enode);
       if (fprintf(fp, "%s = %s\n", entry->key, entry->value) < 0) {
-        LOG_ERROR(LOG_TAG, "%s unable to write to file '%s': %s", __func__, temp_filename, strerror(errno));
+        LOG_ERROR(LOG_TAG, "%s unable to write to file '%s': %s", __func__,
+                  temp_filename, strerror(errno));
         goto error;
       }
     }
@@ -336,42 +344,50 @@
     // Only add a separating newline if there are more sections.
     if (list_next(node) != list_end(config->sections)) {
       if (fputc('\n', fp) == EOF) {
-        LOG_ERROR(LOG_TAG, "%s unable to write to file '%s': %s", __func__, temp_filename, strerror(errno));
+        LOG_ERROR(LOG_TAG, "%s unable to write to file '%s': %s", __func__,
+                  temp_filename, strerror(errno));
         goto error;
       }
     }
   }
 
-  // Sync written temp file out to disk. fsync() is blocking until data makes it to disk.
+  // Sync written temp file out to disk. fsync() is blocking until data makes it
+  // to disk.
   if (fsync(fileno(fp)) < 0) {
-    LOG_WARN(LOG_TAG, "%s unable to fsync file '%s': %s", __func__, temp_filename, strerror(errno));
+    LOG_WARN(LOG_TAG, "%s unable to fsync file '%s': %s", __func__,
+             temp_filename, strerror(errno));
   }
 
   if (fclose(fp) == EOF) {
-    LOG_ERROR(LOG_TAG, "%s unable to close file '%s': %s", __func__, temp_filename, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to close file '%s': %s", __func__,
+              temp_filename, strerror(errno));
     goto error;
   }
   fp = NULL;
 
   // Change the file's permissions to Read/Write by User and Group
   if (chmod(temp_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to change file permissions '%s': %s", __func__, filename, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to change file permissions '%s': %s",
+              __func__, filename, strerror(errno));
     goto error;
   }
 
   // Rename written temp file to the actual config file.
   if (rename(temp_filename, filename) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to commit file '%s': %s", __func__, filename, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to commit file '%s': %s", __func__, filename,
+              strerror(errno));
     goto error;
   }
 
   // This should ensure the directory is updated as well.
   if (fsync(dir_fd) < 0) {
-    LOG_WARN(LOG_TAG, "%s unable to fsync dir '%s': %s", __func__, directoryname, strerror(errno));
+    LOG_WARN(LOG_TAG, "%s unable to fsync dir '%s': %s", __func__,
+             directoryname, strerror(errno));
   }
 
   if (close(dir_fd) < 0) {
-    LOG_ERROR(LOG_TAG, "%s unable to close dir '%s': %s", __func__, directoryname, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to close dir '%s': %s", __func__,
+              directoryname, strerror(errno));
     goto error;
   }
 
@@ -380,33 +396,29 @@
   return true;
 
 error:
-  // This indicates there is a write issue.  Unlink as partial data is not acceptable.
+  // This indicates there is a write issue.  Unlink as partial data is not
+  // acceptable.
   unlink(temp_filename);
-  if (fp)
-    fclose(fp);
-  if (dir_fd != -1)
-    close(dir_fd);
+  if (fp) fclose(fp);
+  if (dir_fd != -1) close(dir_fd);
   osi_free(temp_filename);
   osi_free(temp_dirname);
   return false;
 }
 
-static char *trim(char *str) {
-  while (isspace(*str))
-    ++str;
+static char* trim(char* str) {
+  while (isspace(*str)) ++str;
 
-  if (!*str)
-    return str;
+  if (!*str) return str;
 
-  char *end_str = str + strlen(str) - 1;
-  while (end_str > str && isspace(*end_str))
-    --end_str;
+  char* end_str = str + strlen(str) - 1;
+  while (end_str > str && isspace(*end_str)) --end_str;
 
   end_str[1] = '\0';
   return str;
 }
 
-static bool config_parse(FILE *fp, config_t *config) {
+static bool config_parse(FILE* fp, config_t* config) {
   assert(fp != NULL);
   assert(config != NULL);
 
@@ -416,25 +428,26 @@
   strcpy(section, CONFIG_DEFAULT_SECTION);
 
   while (fgets(line, sizeof(line), fp)) {
-    char *line_ptr = trim(line);
+    char* line_ptr = trim(line);
     ++line_num;
 
     // Skip blank and comment lines.
-    if (*line_ptr == '\0' || *line_ptr == '#')
-      continue;
+    if (*line_ptr == '\0' || *line_ptr == '#') continue;
 
     if (*line_ptr == '[') {
       size_t len = strlen(line_ptr);
       if (line_ptr[len - 1] != ']') {
-        LOG_DEBUG(LOG_TAG, "%s unterminated section name on line %d.", __func__, line_num);
+        LOG_DEBUG(LOG_TAG, "%s unterminated section name on line %d.", __func__,
+                  line_num);
         return false;
       }
       strncpy(section, line_ptr + 1, len - 2);
       section[len - 2] = '\0';
     } else {
-      char *split = strchr(line_ptr, '=');
+      char* split = strchr(line_ptr, '=');
       if (!split) {
-        LOG_DEBUG(LOG_TAG, "%s no key/value separator found on line %d.", __func__, line_num);
+        LOG_DEBUG(LOG_TAG, "%s no key/value separator found on line %d.",
+                  __func__, line_num);
         return false;
       }
 
@@ -445,63 +458,59 @@
   return true;
 }
 
-static section_t *section_new(const char *name) {
-  section_t *section = static_cast<section_t *>(osi_calloc(sizeof(section_t)));
+static section_t* section_new(const char* name) {
+  section_t* section = static_cast<section_t*>(osi_calloc(sizeof(section_t)));
 
   section->name = osi_strdup(name);
   section->entries = list_new(entry_free);
   return section;
 }
 
-static void section_free(void *ptr) {
-  if (!ptr)
-    return;
+static void section_free(void* ptr) {
+  if (!ptr) return;
 
-  section_t *section = static_cast<section_t *>(ptr);
+  section_t* section = static_cast<section_t*>(ptr);
   osi_free(section->name);
   list_free(section->entries);
   osi_free(section);
 }
 
-static section_t *section_find(const config_t *config, const char *section) {
-  for (const list_node_t *node = list_begin(config->sections);
+static section_t* section_find(const config_t* config, const char* section) {
+  for (const list_node_t* node = list_begin(config->sections);
        node != list_end(config->sections); node = list_next(node)) {
-    section_t *sec = static_cast<section_t *>(list_node(node));
-    if (!strcmp(sec->name, section))
-      return sec;
+    section_t* sec = static_cast<section_t*>(list_node(node));
+    if (!strcmp(sec->name, section)) return sec;
   }
 
   return NULL;
 }
 
-static entry_t *entry_new(const char *key, const char *value) {
-  entry_t *entry = static_cast<entry_t *>(osi_calloc(sizeof(entry_t)));
+static entry_t* entry_new(const char* key, const char* value) {
+  entry_t* entry = static_cast<entry_t*>(osi_calloc(sizeof(entry_t)));
 
   entry->key = osi_strdup(key);
   entry->value = osi_strdup(value);
   return entry;
 }
 
-static void entry_free(void *ptr) {
-  if (!ptr)
-    return;
+static void entry_free(void* ptr) {
+  if (!ptr) return;
 
-  entry_t *entry = static_cast<entry_t *>(ptr);
+  entry_t* entry = static_cast<entry_t*>(ptr);
   osi_free(entry->key);
   osi_free(entry->value);
   osi_free(entry);
 }
 
-static entry_t *entry_find(const config_t *config, const char *section, const char *key) {
-  section_t *sec = section_find(config, section);
-  if (!sec)
-    return NULL;
+static entry_t* entry_find(const config_t* config, const char* section,
+                           const char* key) {
+  section_t* sec = section_find(config, section);
+  if (!sec) return NULL;
 
-  for (const list_node_t *node = list_begin(sec->entries);
+  for (const list_node_t* node = list_begin(sec->entries);
        node != list_end(sec->entries); node = list_next(node)) {
-    entry_t *entry = static_cast<entry_t *>(list_node(node));
-    if (!strcmp(entry->key, key))
-      return entry;
+    entry_t* entry = static_cast<entry_t*>(list_node(node));
+    if (!strcmp(entry->key, key)) return entry;
   }
 
   return NULL;
diff --git a/osi/src/data_dispatcher.cc b/osi/src/data_dispatcher.cc
index c8705f9..e1a59cc 100644
--- a/osi/src/data_dispatcher.cc
+++ b/osi/src/data_dispatcher.cc
@@ -24,23 +24,25 @@
 #include <unordered_map>
 
 #include "osi/include/allocator.h"
-#include "osi/include/osi.h"
 #include "osi/include/log.h"
+#include "osi/include/osi.h"
 
 #define DEFAULT_TABLE_BUCKETS 10
 
-typedef std::unordered_map<data_dispatcher_type_t, fixed_queue_t*> DispatchTableMap;
+typedef std::unordered_map<data_dispatcher_type_t, fixed_queue_t*>
+    DispatchTableMap;
 
 struct data_dispatcher_t {
-  char *name;
-  DispatchTableMap *dispatch_table;
-  fixed_queue_t *default_queue; // We don't own this queue
+  char* name;
+  DispatchTableMap* dispatch_table;
+  fixed_queue_t* default_queue;  // We don't own this queue
 };
 
-data_dispatcher_t *data_dispatcher_new(const char *name) {
+data_dispatcher_t* data_dispatcher_new(const char* name) {
   assert(name != NULL);
 
-  data_dispatcher_t *ret = (data_dispatcher_t*)osi_calloc(sizeof(data_dispatcher_t));
+  data_dispatcher_t* ret =
+      (data_dispatcher_t*)osi_calloc(sizeof(data_dispatcher_t));
 
   ret->dispatch_table = new DispatchTableMap();
 
@@ -57,36 +59,38 @@
   return NULL;
 }
 
-void data_dispatcher_free(data_dispatcher_t *dispatcher) {
-  if (!dispatcher)
-    return;
+void data_dispatcher_free(data_dispatcher_t* dispatcher) {
+  if (!dispatcher) return;
 
   delete dispatcher->dispatch_table;
   osi_free(dispatcher->name);
   osi_free(dispatcher);
 }
 
-void data_dispatcher_register(data_dispatcher_t *dispatcher, data_dispatcher_type_t type, fixed_queue_t *queue) {
+void data_dispatcher_register(data_dispatcher_t* dispatcher,
+                              data_dispatcher_type_t type,
+                              fixed_queue_t* queue) {
   assert(dispatcher != NULL);
 
   if (queue)
     (*dispatcher->dispatch_table)[type] = queue;
   else
     dispatcher->dispatch_table->erase(type);
-
 }
 
-void data_dispatcher_register_default(data_dispatcher_t *dispatcher, fixed_queue_t *queue) {
+void data_dispatcher_register_default(data_dispatcher_t* dispatcher,
+                                      fixed_queue_t* queue) {
   assert(dispatcher != NULL);
 
   dispatcher->default_queue = queue;
 }
 
-bool data_dispatcher_dispatch(data_dispatcher_t *dispatcher, data_dispatcher_type_t type, void *data) {
+bool data_dispatcher_dispatch(data_dispatcher_t* dispatcher,
+                              data_dispatcher_type_t type, void* data) {
   assert(dispatcher != NULL);
   assert(data != NULL);
 
-  fixed_queue_t *queue;
+  fixed_queue_t* queue;
   auto iter = dispatcher->dispatch_table->find(type);
   if (iter == dispatcher->dispatch_table->end())
     queue = dispatcher->default_queue;
@@ -96,7 +100,9 @@
   if (queue)
     fixed_queue_enqueue(queue, data);
   else
-    LOG_WARN(LOG_TAG, "%s has no handler for type (%zd) in data dispatcher named: %s", __func__, type, dispatcher->name);
+    LOG_WARN(LOG_TAG,
+             "%s has no handler for type (%zd) in data dispatcher named: %s",
+             __func__, type, dispatcher->name);
 
   return queue != NULL;
 }
diff --git a/osi/src/eager_reader.cc b/osi/src/eager_reader.cc
index f2ef1be..0f4ff29 100644
--- a/osi/src/eager_reader.cc
+++ b/osi/src/eager_reader.cc
@@ -32,7 +32,7 @@
 #include "osi/include/reactor.h"
 
 #if !defined(EFD_SEMAPHORE)
-#  define EFD_SEMAPHORE (1 << 0)
+#define EFD_SEMAPHORE (1 << 0)
 #endif
 
 typedef struct {
@@ -42,47 +42,46 @@
 } data_buffer_t;
 
 struct eager_reader_t {
-  int bytes_available_fd; // semaphore mode eventfd which counts the number of available bytes
+  int bytes_available_fd;  // semaphore mode eventfd which counts the number of
+                           // available bytes
   int inbound_fd;
 
-  const allocator_t *allocator;
+  const allocator_t* allocator;
   size_t buffer_size;
-  fixed_queue_t *buffers;
-  data_buffer_t *current_buffer;
+  fixed_queue_t* buffers;
+  data_buffer_t* current_buffer;
 
-  thread_t *inbound_read_thread;
-  reactor_object_t *inbound_read_object;
+  thread_t* inbound_read_thread;
+  reactor_object_t* inbound_read_object;
 
-  reactor_object_t *outbound_registration;
+  reactor_object_t* outbound_registration;
   eager_reader_cb outbound_read_ready;
-  void *outbound_context;
+  void* outbound_context;
 };
 
-static bool has_byte(const eager_reader_t *reader);
-static void inbound_data_waiting(void *context);
-static void internal_outbound_read_ready(void *context);
+static bool has_byte(const eager_reader_t* reader);
+static void inbound_data_waiting(void* context);
+static void internal_outbound_read_ready(void* context);
 
-eager_reader_t *eager_reader_new(
-    int fd_to_read,
-    const allocator_t *allocator,
-    size_t buffer_size,
-    size_t max_buffer_count,
-    const char *thread_name) {
-
+eager_reader_t* eager_reader_new(int fd_to_read, const allocator_t* allocator,
+                                 size_t buffer_size, size_t max_buffer_count,
+                                 const char* thread_name) {
   assert(fd_to_read != INVALID_FD);
   assert(allocator != NULL);
   assert(buffer_size > 0);
   assert(max_buffer_count > 0);
   assert(thread_name != NULL && *thread_name != '\0');
 
-  eager_reader_t *ret = static_cast<eager_reader_t *>(osi_calloc(sizeof(eager_reader_t)));
+  eager_reader_t* ret =
+      static_cast<eager_reader_t*>(osi_calloc(sizeof(eager_reader_t)));
 
   ret->allocator = allocator;
   ret->inbound_fd = fd_to_read;
 
   ret->bytes_available_fd = eventfd(0, 0);
   if (ret->bytes_available_fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s unable to create output reading semaphore.", __func__);
+    LOG_ERROR(LOG_TAG, "%s unable to create output reading semaphore.",
+              __func__);
     goto error;
   }
 
@@ -100,13 +99,9 @@
     goto error;
   }
 
-  ret->inbound_read_object = reactor_register(
-    thread_get_reactor(ret->inbound_read_thread),
-    fd_to_read,
-    ret,
-    inbound_data_waiting,
-    NULL
-  );
+  ret->inbound_read_object =
+      reactor_register(thread_get_reactor(ret->inbound_read_thread), fd_to_read,
+                       ret, inbound_data_waiting, NULL);
 
   return ret;
 
@@ -115,9 +110,8 @@
   return NULL;
 }
 
-void eager_reader_free(eager_reader_t *reader) {
-  if (!reader)
-    return;
+void eager_reader_free(eager_reader_t* reader) {
+  if (!reader) return;
 
   eager_reader_unregister(reader);
 
@@ -130,15 +124,15 @@
 
   // Free the current buffer, because it's not in the queue
   // and won't be freed below
-  if (reader->current_buffer)
-    reader->allocator->free(reader->current_buffer);
+  if (reader->current_buffer) reader->allocator->free(reader->current_buffer);
 
   fixed_queue_free(reader->buffers, reader->allocator->free);
   thread_free(reader->inbound_read_thread);
   osi_free(reader);
 }
 
-void eager_reader_register(eager_reader_t *reader, reactor_t *reactor, eager_reader_cb read_cb, void *context) {
+void eager_reader_register(eager_reader_t* reader, reactor_t* reactor,
+                           eager_reader_cb read_cb, void* context) {
   assert(reader != NULL);
   assert(reactor != NULL);
   assert(read_cb != NULL);
@@ -148,10 +142,12 @@
 
   reader->outbound_read_ready = read_cb;
   reader->outbound_context = context;
-  reader->outbound_registration = reactor_register(reactor, reader->bytes_available_fd, reader, internal_outbound_read_ready, NULL);
+  reader->outbound_registration =
+      reactor_register(reactor, reader->bytes_available_fd, reader,
+                       internal_outbound_read_ready, NULL);
 }
 
-void eager_reader_unregister(eager_reader_t *reader) {
+void eager_reader_unregister(eager_reader_t* reader) {
   assert(reader != NULL);
 
   if (reader->outbound_registration) {
@@ -161,34 +157,38 @@
 }
 
 // SEE HEADER FOR THREAD SAFETY NOTE
-size_t eager_reader_read(eager_reader_t *reader, uint8_t *buffer, size_t max_size) {
+size_t eager_reader_read(eager_reader_t* reader, uint8_t* buffer,
+                         size_t max_size) {
   assert(reader != NULL);
   assert(buffer != NULL);
 
   // Poll to see if we have any bytes available before reading.
-  if (!has_byte(reader))
-    return 0;
+  if (!has_byte(reader)) return 0;
 
   // Find out how many bytes we have available in our various buffers.
   eventfd_t bytes_available;
   if (eventfd_read(reader->bytes_available_fd, &bytes_available) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to read semaphore for output data.", __func__);
+    LOG_ERROR(LOG_TAG, "%s unable to read semaphore for output data.",
+              __func__);
     return 0;
   }
 
-  if (max_size > bytes_available)
-    max_size = bytes_available;
+  if (max_size > bytes_available) max_size = bytes_available;
 
   size_t bytes_consumed = 0;
   while (bytes_consumed < max_size) {
     if (!reader->current_buffer)
-      reader->current_buffer = static_cast<data_buffer_t *>(fixed_queue_dequeue(reader->buffers));
+      reader->current_buffer =
+          static_cast<data_buffer_t*>(fixed_queue_dequeue(reader->buffers));
 
-    size_t bytes_to_copy = reader->current_buffer->length - reader->current_buffer->offset;
+    size_t bytes_to_copy =
+        reader->current_buffer->length - reader->current_buffer->offset;
     if (bytes_to_copy > (max_size - bytes_consumed))
       bytes_to_copy = max_size - bytes_consumed;
 
-    memcpy(&buffer[bytes_consumed], &reader->current_buffer->data[reader->current_buffer->offset], bytes_to_copy);
+    memcpy(&buffer[bytes_consumed],
+           &reader->current_buffer->data[reader->current_buffer->offset],
+           bytes_to_copy);
     bytes_consumed += bytes_to_copy;
     reader->current_buffer->offset += bytes_to_copy;
 
@@ -200,18 +200,20 @@
 
   bytes_available -= bytes_consumed;
   if (eventfd_write(reader->bytes_available_fd, bytes_available) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to write back bytes available for output data.", __func__);
+    LOG_ERROR(LOG_TAG,
+              "%s unable to write back bytes available for output data.",
+              __func__);
   }
 
   return bytes_consumed;
 }
 
-thread_t* eager_reader_get_read_thread(const eager_reader_t *reader) {
+thread_t* eager_reader_get_read_thread(const eager_reader_t* reader) {
   assert(reader != NULL);
   return reader->inbound_read_thread;
 }
 
-static bool has_byte(const eager_reader_t *reader) {
+static bool has_byte(const eager_reader_t* reader) {
   assert(reader != NULL);
 
   fd_set read_fds;
@@ -225,22 +227,23 @@
     timeout.tv_sec = 0;
     timeout.tv_usec = 0;
 
-    int ret = select(reader->bytes_available_fd + 1, &read_fds, NULL, NULL,
-                     &timeout);
-    if (ret == -1 && errno == EINTR)
-      continue;
+    int ret =
+        select(reader->bytes_available_fd + 1, &read_fds, NULL, NULL, &timeout);
+    if (ret == -1 && errno == EINTR) continue;
     break;
   }
 
   return FD_ISSET(reader->bytes_available_fd, &read_fds);
 }
 
-static void inbound_data_waiting(void *context) {
-  eager_reader_t *reader = (eager_reader_t *)context;
+static void inbound_data_waiting(void* context) {
+  eager_reader_t* reader = (eager_reader_t*)context;
 
-  data_buffer_t *buffer = (data_buffer_t *)reader->allocator->alloc(reader->buffer_size + sizeof(data_buffer_t));
+  data_buffer_t* buffer = (data_buffer_t*)reader->allocator->alloc(
+      reader->buffer_size + sizeof(data_buffer_t));
   if (!buffer) {
-    LOG_ERROR(LOG_TAG, "%s couldn't aquire memory for inbound data buffer.", __func__);
+    LOG_ERROR(LOG_TAG, "%s couldn't aquire memory for inbound data buffer.",
+              __func__);
     return;
   }
 
@@ -248,8 +251,8 @@
   buffer->offset = 0;
 
   ssize_t bytes_read;
-  OSI_NO_INTR(bytes_read = read(reader->inbound_fd, buffer->data,
-                                reader->buffer_size));
+  OSI_NO_INTR(bytes_read =
+                  read(reader->inbound_fd, buffer->data, reader->buffer_size));
   if (bytes_read > 0) {
     // Save the data for later
     buffer->length = bytes_read;
@@ -260,17 +263,19 @@
     eventfd_write(reader->bytes_available_fd, bytes_read);
   } else {
     if (bytes_read == 0)
-      LOG_WARN(LOG_TAG, "%s fd said bytes existed, but none were found.", __func__);
+      LOG_WARN(LOG_TAG, "%s fd said bytes existed, but none were found.",
+               __func__);
     else
-      LOG_WARN(LOG_TAG, "%s unable to read from file descriptor: %s", __func__, strerror(errno));
+      LOG_WARN(LOG_TAG, "%s unable to read from file descriptor: %s", __func__,
+               strerror(errno));
 
     reader->allocator->free(buffer);
   }
 }
 
-static void internal_outbound_read_ready(void *context) {
+static void internal_outbound_read_ready(void* context) {
   assert(context != NULL);
 
-  eager_reader_t *reader = (eager_reader_t *)context;
+  eager_reader_t* reader = (eager_reader_t*)context;
   reader->outbound_read_ready(reader, reader->outbound_context);
 }
diff --git a/osi/src/fixed_queue.cc b/osi/src/fixed_queue.cc
index e46ad50..a4cd08d 100644
--- a/osi/src/fixed_queue.cc
+++ b/osi/src/fixed_queue.cc
@@ -24,40 +24,38 @@
 #include "osi/include/fixed_queue.h"
 #include "osi/include/list.h"
 #include "osi/include/osi.h"
-#include "osi/include/semaphore.h"
 #include "osi/include/reactor.h"
+#include "osi/include/semaphore.h"
 
 typedef struct fixed_queue_t {
-  list_t *list;
-  semaphore_t *enqueue_sem;
-  semaphore_t *dequeue_sem;
+  list_t* list;
+  semaphore_t* enqueue_sem;
+  semaphore_t* dequeue_sem;
   pthread_mutex_t lock;
   size_t capacity;
 
-  reactor_object_t *dequeue_object;
+  reactor_object_t* dequeue_object;
   fixed_queue_cb dequeue_ready;
-  void *dequeue_context;
+  void* dequeue_context;
 } fixed_queue_t;
 
-static void internal_dequeue_ready(void *context);
+static void internal_dequeue_ready(void* context);
 
-fixed_queue_t *fixed_queue_new(size_t capacity) {
-  fixed_queue_t *ret = static_cast<fixed_queue_t *>(osi_calloc(sizeof(fixed_queue_t)));
+fixed_queue_t* fixed_queue_new(size_t capacity) {
+  fixed_queue_t* ret =
+      static_cast<fixed_queue_t*>(osi_calloc(sizeof(fixed_queue_t)));
 
   pthread_mutex_init(&ret->lock, NULL);
   ret->capacity = capacity;
 
   ret->list = list_new(NULL);
-  if (!ret->list)
-    goto error;
+  if (!ret->list) goto error;
 
   ret->enqueue_sem = semaphore_new(capacity);
-  if (!ret->enqueue_sem)
-    goto error;
+  if (!ret->enqueue_sem) goto error;
 
   ret->dequeue_sem = semaphore_new(0);
-  if (!ret->dequeue_sem)
-    goto error;
+  if (!ret->dequeue_sem) goto error;
 
   return ret;
 
@@ -66,14 +64,14 @@
   return NULL;
 }
 
-void fixed_queue_free(fixed_queue_t *queue, fixed_queue_free_cb free_cb) {
-  if (!queue)
-    return;
+void fixed_queue_free(fixed_queue_t* queue, fixed_queue_free_cb free_cb) {
+  if (!queue) return;
 
   fixed_queue_unregister_dequeue(queue);
 
   if (free_cb)
-    for (const list_node_t *node = list_begin(queue->list); node != list_end(queue->list); node = list_next(node))
+    for (const list_node_t* node = list_begin(queue->list);
+         node != list_end(queue->list); node = list_next(node))
       free_cb(list_node(node));
 
   list_free(queue->list);
@@ -83,21 +81,19 @@
   osi_free(queue);
 }
 
-void fixed_queue_flush(fixed_queue_t *queue, fixed_queue_free_cb free_cb) {
-  if (!queue)
-    return;
+void fixed_queue_flush(fixed_queue_t* queue, fixed_queue_free_cb free_cb) {
+  if (!queue) return;
 
   while (!fixed_queue_is_empty(queue)) {
-    void *data = fixed_queue_try_dequeue(queue);
+    void* data = fixed_queue_try_dequeue(queue);
     if (free_cb != NULL) {
       free_cb(data);
     }
   }
 }
 
-bool fixed_queue_is_empty(fixed_queue_t *queue) {
-  if (queue == NULL)
-    return true;
+bool fixed_queue_is_empty(fixed_queue_t* queue) {
+  if (queue == NULL) return true;
 
   pthread_mutex_lock(&queue->lock);
   bool is_empty = list_is_empty(queue->list);
@@ -106,9 +102,8 @@
   return is_empty;
 }
 
-size_t fixed_queue_length(fixed_queue_t *queue) {
-  if (queue == NULL)
-    return 0;
+size_t fixed_queue_length(fixed_queue_t* queue) {
+  if (queue == NULL) return 0;
 
   pthread_mutex_lock(&queue->lock);
   size_t length = list_length(queue->list);
@@ -117,13 +112,13 @@
   return length;
 }
 
-size_t fixed_queue_capacity(fixed_queue_t *queue) {
+size_t fixed_queue_capacity(fixed_queue_t* queue) {
   assert(queue != NULL);
 
   return queue->capacity;
 }
 
-void fixed_queue_enqueue(fixed_queue_t *queue, void *data) {
+void fixed_queue_enqueue(fixed_queue_t* queue, void* data) {
   assert(queue != NULL);
   assert(data != NULL);
 
@@ -136,13 +131,13 @@
   semaphore_post(queue->dequeue_sem);
 }
 
-void *fixed_queue_dequeue(fixed_queue_t *queue) {
+void* fixed_queue_dequeue(fixed_queue_t* queue) {
   assert(queue != NULL);
 
   semaphore_wait(queue->dequeue_sem);
 
   pthread_mutex_lock(&queue->lock);
-  void *ret = list_front(queue->list);
+  void* ret = list_front(queue->list);
   list_remove(queue->list, ret);
   pthread_mutex_unlock(&queue->lock);
 
@@ -151,12 +146,11 @@
   return ret;
 }
 
-bool fixed_queue_try_enqueue(fixed_queue_t *queue, void *data) {
+bool fixed_queue_try_enqueue(fixed_queue_t* queue, void* data) {
   assert(queue != NULL);
   assert(data != NULL);
 
-  if (!semaphore_try_wait(queue->enqueue_sem))
-    return false;
+  if (!semaphore_try_wait(queue->enqueue_sem)) return false;
 
   pthread_mutex_lock(&queue->lock);
   list_append(queue->list, data);
@@ -166,15 +160,13 @@
   return true;
 }
 
-void *fixed_queue_try_dequeue(fixed_queue_t *queue) {
-  if (queue == NULL)
-    return NULL;
+void* fixed_queue_try_dequeue(fixed_queue_t* queue) {
+  if (queue == NULL) return NULL;
 
-  if (!semaphore_try_wait(queue->dequeue_sem))
-    return NULL;
+  if (!semaphore_try_wait(queue->dequeue_sem)) return NULL;
 
   pthread_mutex_lock(&queue->lock);
-  void *ret = list_front(queue->list);
+  void* ret = list_front(queue->list);
   list_remove(queue->list, ret);
   pthread_mutex_unlock(&queue->lock);
 
@@ -183,31 +175,28 @@
   return ret;
 }
 
-void *fixed_queue_try_peek_first(fixed_queue_t *queue) {
-  if (queue == NULL)
-    return NULL;
+void* fixed_queue_try_peek_first(fixed_queue_t* queue) {
+  if (queue == NULL) return NULL;
 
   pthread_mutex_lock(&queue->lock);
-  void *ret = list_is_empty(queue->list) ? NULL : list_front(queue->list);
+  void* ret = list_is_empty(queue->list) ? NULL : list_front(queue->list);
   pthread_mutex_unlock(&queue->lock);
 
   return ret;
 }
 
-void *fixed_queue_try_peek_last(fixed_queue_t *queue) {
-  if (queue == NULL)
-    return NULL;
+void* fixed_queue_try_peek_last(fixed_queue_t* queue) {
+  if (queue == NULL) return NULL;
 
   pthread_mutex_lock(&queue->lock);
-  void *ret = list_is_empty(queue->list) ? NULL : list_back(queue->list);
+  void* ret = list_is_empty(queue->list) ? NULL : list_back(queue->list);
   pthread_mutex_unlock(&queue->lock);
 
   return ret;
 }
 
-void *fixed_queue_try_remove_from_queue(fixed_queue_t *queue, void *data) {
-  if (queue == NULL)
-    return NULL;
+void* fixed_queue_try_remove_from_queue(fixed_queue_t* queue, void* data) {
+  if (queue == NULL) return NULL;
 
   bool removed = false;
   pthread_mutex_lock(&queue->lock);
@@ -225,7 +214,7 @@
   return NULL;
 }
 
-list_t *fixed_queue_get_list(fixed_queue_t *queue) {
+list_t* fixed_queue_get_list(fixed_queue_t* queue) {
   assert(queue != NULL);
 
   // NOTE: This function is not thread safe, and there is no point for
@@ -233,18 +222,18 @@
   return queue->list;
 }
 
-
-int fixed_queue_get_dequeue_fd(const fixed_queue_t *queue) {
+int fixed_queue_get_dequeue_fd(const fixed_queue_t* queue) {
   assert(queue != NULL);
   return semaphore_get_fd(queue->dequeue_sem);
 }
 
-int fixed_queue_get_enqueue_fd(const fixed_queue_t *queue) {
+int fixed_queue_get_enqueue_fd(const fixed_queue_t* queue) {
   assert(queue != NULL);
   return semaphore_get_fd(queue->enqueue_sem);
 }
 
-void fixed_queue_register_dequeue(fixed_queue_t *queue, reactor_t *reactor, fixed_queue_cb ready_cb, void *context) {
+void fixed_queue_register_dequeue(fixed_queue_t* queue, reactor_t* reactor,
+                                  fixed_queue_cb ready_cb, void* context) {
   assert(queue != NULL);
   assert(reactor != NULL);
   assert(ready_cb != NULL);
@@ -254,16 +243,12 @@
 
   queue->dequeue_ready = ready_cb;
   queue->dequeue_context = context;
-  queue->dequeue_object = reactor_register(
-    reactor,
-    fixed_queue_get_dequeue_fd(queue),
-    queue,
-    internal_dequeue_ready,
-    NULL
-  );
+  queue->dequeue_object =
+      reactor_register(reactor, fixed_queue_get_dequeue_fd(queue), queue,
+                       internal_dequeue_ready, NULL);
 }
 
-void fixed_queue_unregister_dequeue(fixed_queue_t *queue) {
+void fixed_queue_unregister_dequeue(fixed_queue_t* queue) {
   assert(queue != NULL);
 
   if (queue->dequeue_object) {
@@ -272,9 +257,9 @@
   }
 }
 
-static void internal_dequeue_ready(void *context) {
+static void internal_dequeue_ready(void* context) {
   assert(context != NULL);
 
-  fixed_queue_t *queue = static_cast<fixed_queue_t *>(context);
+  fixed_queue_t* queue = static_cast<fixed_queue_t*>(context);
   queue->dequeue_ready(queue, queue->dequeue_context);
 }
diff --git a/osi/src/future.cc b/osi/src/future.cc
index 275d254..1b2f79b 100644
--- a/osi/src/future.cc
+++ b/osi/src/future.cc
@@ -29,18 +29,19 @@
 
 struct future_t {
   bool ready_can_be_called;
-  semaphore_t *semaphore; // NULL semaphore means immediate future
-  void *result;
+  semaphore_t* semaphore;  // NULL semaphore means immediate future
+  void* result;
 };
 
-static void future_free(future_t *future);
+static void future_free(future_t* future);
 
-future_t *future_new(void) {
-  future_t *ret = static_cast<future_t *>(osi_calloc(sizeof(future_t)));
+future_t* future_new(void) {
+  future_t* ret = static_cast<future_t*>(osi_calloc(sizeof(future_t)));
 
   ret->semaphore = semaphore_new(0);
   if (!ret->semaphore) {
-    LOG_ERROR(LOG_TAG, "%s unable to allocate memory for the semaphore.", __func__);
+    LOG_ERROR(LOG_TAG, "%s unable to allocate memory for the semaphore.",
+              __func__);
     goto error;
   }
 
@@ -51,15 +52,15 @@
   return NULL;
 }
 
-future_t *future_new_immediate(void *value) {
-  future_t *ret = static_cast<future_t *>(osi_calloc(sizeof(future_t)));
+future_t* future_new_immediate(void* value) {
+  future_t* ret = static_cast<future_t*>(osi_calloc(sizeof(future_t)));
 
   ret->result = value;
   ret->ready_can_be_called = false;
   return ret;
 }
 
-void future_ready(future_t *future, void *value) {
+void future_ready(future_t* future, void* value) {
   assert(future != NULL);
   assert(future->ready_can_be_called);
 
@@ -68,21 +69,19 @@
   semaphore_post(future->semaphore);
 }
 
-void *future_await(future_t *future) {
+void* future_await(future_t* future) {
   assert(future != NULL);
 
   // If the future is immediate, it will not have a semaphore
-  if (future->semaphore)
-    semaphore_wait(future->semaphore);
+  if (future->semaphore) semaphore_wait(future->semaphore);
 
-  void *result = future->result;
+  void* result = future->result;
   future_free(future);
   return result;
 }
 
-static void future_free(future_t *future) {
-  if (!future)
-    return;
+static void future_free(future_t* future) {
+  if (!future) return;
 
   semaphore_free(future->semaphore);
   osi_free(future);
diff --git a/osi/src/hash_map_utils.cc b/osi/src/hash_map_utils.cc
index f8a8dc9..3dfdc6e 100644
--- a/osi/src/hash_map_utils.cc
+++ b/osi/src/hash_map_utils.cc
@@ -27,27 +27,27 @@
 #include "osi/include/osi.h"
 
 std::unordered_map<std::string, std::string>
-hash_map_utils_new_from_string_params(const char *params) {
+hash_map_utils_new_from_string_params(const char* params) {
   assert(params != NULL);
 
   std::unordered_map<std::string, std::string> map;
 
-  char *str = osi_strdup(params);
+  char* str = osi_strdup(params);
   if (!str) return map;
 
   LOG_VERBOSE(LOG_TAG, "%s: source string: '%s'", __func__, str);
 
   // Parse |str| and add extracted key-and-value pair(s) in |map|.
   int items = 0;
-  char *tmpstr;
-  char *kvpair = strtok_r(str, ";", &tmpstr);
+  char* tmpstr;
+  char* kvpair = strtok_r(str, ";", &tmpstr);
   while (kvpair && *kvpair) {
-    char *eq = strchr(kvpair, '=');
+    char* eq = strchr(kvpair, '=');
 
     if (eq == kvpair) goto next_pair;
 
-    char *key;
-    char *value;
+    char* key;
+    char* value;
     if (eq) {
       key = osi_strndup(kvpair, eq - kvpair);
 
@@ -76,8 +76,8 @@
 }
 
 void hash_map_utils_dump_string_keys_string_values(
-    std::unordered_map<std::string, std::string> &map) {
-  for (const auto &ptr : map) {
+    std::unordered_map<std::string, std::string>& map) {
+  for (const auto& ptr : map) {
     LOG_INFO(LOG_TAG, "key: '%s' value: '%s'\n", ptr.first.c_str(),
              ptr.second.c_str());
   }
diff --git a/osi/src/list.cc b/osi/src/list.cc
index 9468579..e13c31e 100644
--- a/osi/src/list.cc
+++ b/osi/src/list.cc
@@ -5,128 +5,123 @@
 #include "osi/include/osi.h"
 
 struct list_node_t {
-  struct list_node_t *next;
-  void *data;
+  struct list_node_t* next;
+  void* data;
 };
 
 typedef struct list_t {
-  list_node_t *head;
-  list_node_t *tail;
+  list_node_t* head;
+  list_node_t* tail;
   size_t length;
   list_free_cb free_cb;
-  const allocator_t *allocator;
+  const allocator_t* allocator;
 } list_t;
 
-static list_node_t *list_free_node_(list_t *list, list_node_t *node);
+static list_node_t* list_free_node_(list_t* list, list_node_t* node);
 
-// Hidden constructor, only to be used by the hash map for the allocation tracker.
+// Hidden constructor, only to be used by the hash map for the allocation
+// tracker.
 // Behaves the same as |list_new|, except you get to specify the allocator.
-list_t *list_new_internal(list_free_cb callback, const allocator_t *zeroed_allocator) {
-  list_t *list = (list_t *)zeroed_allocator->alloc(sizeof(list_t));
-  if (!list)
-    return NULL;
+list_t* list_new_internal(list_free_cb callback,
+                          const allocator_t* zeroed_allocator) {
+  list_t* list = (list_t*)zeroed_allocator->alloc(sizeof(list_t));
+  if (!list) return NULL;
 
   list->free_cb = callback;
   list->allocator = zeroed_allocator;
   return list;
 }
 
-list_t *list_new(list_free_cb callback) {
+list_t* list_new(list_free_cb callback) {
   return list_new_internal(callback, &allocator_calloc);
 }
 
-void list_free(list_t *list) {
-  if (!list)
-    return;
+void list_free(list_t* list) {
+  if (!list) return;
 
   list_clear(list);
   list->allocator->free(list);
 }
 
-bool list_is_empty(const list_t *list) {
+bool list_is_empty(const list_t* list) {
   assert(list != NULL);
   return (list->length == 0);
 }
 
-bool list_contains(const list_t *list, const void *data) {
+bool list_contains(const list_t* list, const void* data) {
   assert(list != NULL);
   assert(data != NULL);
 
-  for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node)) {
-    if (list_node(node) == data)
-      return true;
+  for (const list_node_t* node = list_begin(list); node != list_end(list);
+       node = list_next(node)) {
+    if (list_node(node) == data) return true;
   }
 
   return false;
 }
 
-size_t list_length(const list_t *list) {
+size_t list_length(const list_t* list) {
   assert(list != NULL);
   return list->length;
 }
 
-void *list_front(const list_t *list) {
+void* list_front(const list_t* list) {
   assert(list != NULL);
   assert(!list_is_empty(list));
 
   return list->head->data;
 }
 
-void *list_back(const list_t *list) {
+void* list_back(const list_t* list) {
   assert(list != NULL);
   assert(!list_is_empty(list));
 
   return list->tail->data;
 }
 
-list_node_t *list_back_node(const list_t *list) {
+list_node_t* list_back_node(const list_t* list) {
   assert(list != NULL);
   assert(!list_is_empty(list));
 
   return list->tail;
 }
 
-bool list_insert_after(list_t *list, list_node_t *prev_node, void *data) {
+bool list_insert_after(list_t* list, list_node_t* prev_node, void* data) {
   assert(list != NULL);
   assert(prev_node != NULL);
   assert(data != NULL);
 
-  list_node_t *node = (list_node_t *)list->allocator->alloc(sizeof(list_node_t));
-  if (!node)
-    return false;
+  list_node_t* node = (list_node_t*)list->allocator->alloc(sizeof(list_node_t));
+  if (!node) return false;
 
   node->next = prev_node->next;
   node->data = data;
   prev_node->next = node;
-  if (list->tail == prev_node)
-    list->tail = node;
+  if (list->tail == prev_node) list->tail = node;
   ++list->length;
   return true;
 }
 
-bool list_prepend(list_t *list, void *data) {
+bool list_prepend(list_t* list, void* data) {
   assert(list != NULL);
   assert(data != NULL);
 
-  list_node_t *node = (list_node_t *)list->allocator->alloc(sizeof(list_node_t));
-  if (!node)
-    return false;
+  list_node_t* node = (list_node_t*)list->allocator->alloc(sizeof(list_node_t));
+  if (!node) return false;
   node->next = list->head;
   node->data = data;
   list->head = node;
-  if (list->tail == NULL)
-    list->tail = list->head;
+  if (list->tail == NULL) list->tail = list->head;
   ++list->length;
   return true;
 }
 
-bool list_append(list_t *list, void *data) {
+bool list_append(list_t* list, void* data) {
   assert(list != NULL);
   assert(data != NULL);
 
-  list_node_t *node = (list_node_t *)list->allocator->alloc(sizeof(list_node_t));
-  if (!node)
-    return false;
+  list_node_t* node = (list_node_t*)list->allocator->alloc(sizeof(list_node_t));
+  if (!node) return false;
   node->next = NULL;
   node->data = data;
   if (list->tail == NULL) {
@@ -140,82 +135,79 @@
   return true;
 }
 
-bool list_remove(list_t *list, void *data) {
+bool list_remove(list_t* list, void* data) {
   assert(list != NULL);
   assert(data != NULL);
 
-  if (list_is_empty(list))
-    return false;
+  if (list_is_empty(list)) return false;
 
   if (list->head->data == data) {
-    list_node_t *next = list_free_node_(list, list->head);
-    if (list->tail == list->head)
-      list->tail = next;
+    list_node_t* next = list_free_node_(list, list->head);
+    if (list->tail == list->head) list->tail = next;
     list->head = next;
     return true;
   }
 
-  for (list_node_t *prev = list->head, *node = list->head->next; node; prev = node, node = node->next)
+  for (list_node_t *prev = list->head, *node = list->head->next; node;
+       prev = node, node = node->next)
     if (node->data == data) {
       prev->next = list_free_node_(list, node);
-      if (list->tail == node)
-        list->tail = prev;
+      if (list->tail == node) list->tail = prev;
       return true;
     }
 
   return false;
 }
 
-void list_clear(list_t *list) {
+void list_clear(list_t* list) {
   assert(list != NULL);
-  for (list_node_t *node = list->head; node; )
+  for (list_node_t* node = list->head; node;)
     node = list_free_node_(list, node);
   list->head = NULL;
   list->tail = NULL;
   list->length = 0;
 }
 
-list_node_t *list_foreach(const list_t *list, list_iter_cb callback, void *context) {
+list_node_t* list_foreach(const list_t* list, list_iter_cb callback,
+                          void* context) {
   assert(list != NULL);
   assert(callback != NULL);
 
-  for (list_node_t *node = list->head; node; ) {
-    list_node_t *next = node->next;
-    if (!callback(node->data, context))
-      return node;
+  for (list_node_t* node = list->head; node;) {
+    list_node_t* next = node->next;
+    if (!callback(node->data, context)) return node;
     node = next;
   }
   return NULL;
 }
 
-list_node_t *list_begin(const list_t *list) {
+list_node_t* list_begin(const list_t* list) {
   assert(list != NULL);
   return list->head;
 }
 
-list_node_t *list_end(UNUSED_ATTR const list_t *list) {
+list_node_t* list_end(UNUSED_ATTR const list_t* list) {
   assert(list != NULL);
   return NULL;
 }
 
-list_node_t *list_next(const list_node_t *node) {
+list_node_t* list_next(const list_node_t* node) {
   assert(node != NULL);
   return node->next;
 }
 
-void *list_node(const list_node_t *node) {
+void* list_node(const list_node_t* node) {
   assert(node != NULL);
   return node->data;
 }
 
-static list_node_t *list_free_node_(list_t *list, list_node_t *node) {
+static list_node_t* list_free_node_(list_t* list, list_node_t* node) {
   assert(list != NULL);
   assert(node != NULL);
 
-  list_node_t *next = node->next;
+  list_node_t* next = node->next;
 
-  if (list->free_cb)
-    list->free_cb(node->data);
+  if (list->free_cb) list->free_cb(node->data);
   list->allocator->free(node);
   --list->length;
 
diff --git a/osi/src/metrics.cc b/osi/src/metrics.cc
index f90ea51..c161869 100644
--- a/osi/src/metrics.cc
+++ b/osi/src/metrics.cc
@@ -16,7 +16,6 @@
  *
  ******************************************************************************/
 
-
 #define LOG_TAG "bt_osi_metrics"
 
 #include "osi/include/metrics.h"
@@ -44,7 +43,7 @@
 using clearcut::connectivity::WakeEvent;
 using clearcut::connectivity::WakeEvent_WakeEventType;
 
-BluetoothLog *pending;
+BluetoothLog* pending;
 std::mutex log_lock;
 
 static void lazy_initialize(void) {
@@ -58,20 +57,17 @@
   std::lock_guard<std::mutex> lock(log_lock);
   lazy_initialize();
 
-  PairEvent *event = pending->add_pair_event();
+  PairEvent* event = pending->add_pair_event();
 
-  DeviceInfo *info = event->mutable_device_paired_with();
+  DeviceInfo* info = event->mutable_device_paired_with();
 
   info->set_device_class(device_class);
 
   DeviceInfo_DeviceType type = DeviceInfo::DEVICE_TYPE_UNKNOWN;
 
-  if (device_type == DEVICE_TYPE_BREDR)
-    type = DeviceInfo::DEVICE_TYPE_BREDR;
-  if (device_type == DEVICE_TYPE_LE)
-    type = DeviceInfo::DEVICE_TYPE_LE;
-  if (device_type == DEVICE_TYPE_DUMO)
-    type = DeviceInfo::DEVICE_TYPE_DUMO;
+  if (device_type == DEVICE_TYPE_BREDR) type = DeviceInfo::DEVICE_TYPE_BREDR;
+  if (device_type == DEVICE_TYPE_LE) type = DeviceInfo::DEVICE_TYPE_LE;
+  if (device_type == DEVICE_TYPE_DUMO) type = DeviceInfo::DEVICE_TYPE_DUMO;
 
   info->set_device_type(type);
 
@@ -80,54 +76,46 @@
   event->set_event_time_millis(timestamp_ms);
 }
 
-void metrics_wake_event(wake_event_type_t type, const char *requestor,
-                        const char *name, uint64_t timestamp_ms) {
+void metrics_wake_event(wake_event_type_t type, const char* requestor,
+                        const char* name, uint64_t timestamp_ms) {
   std::lock_guard<std::mutex> lock(log_lock);
   lazy_initialize();
 
-  WakeEvent *event = pending->add_wake_event();
+  WakeEvent* event = pending->add_wake_event();
 
   WakeEvent_WakeEventType waketype = WakeEvent::UNKNOWN;
 
-  if (type == WAKE_EVENT_ACQUIRED)
-    waketype = WakeEvent::ACQUIRED;
-  if (type == WAKE_EVENT_RELEASED)
-    waketype = WakeEvent::RELEASED;
+  if (type == WAKE_EVENT_ACQUIRED) waketype = WakeEvent::ACQUIRED;
+  if (type == WAKE_EVENT_RELEASED) waketype = WakeEvent::RELEASED;
 
   event->set_wake_event_type(waketype);
 
-  if (requestor)
-    event->set_requestor(requestor);
+  if (requestor) event->set_requestor(requestor);
 
-  if (name)
-    event->set_name(name);
+  if (name) event->set_name(name);
 
   event->set_event_time_millis(timestamp_ms);
 }
 
-void metrics_scan_event(bool start, const char *initator, scan_tech_t type,
+void metrics_scan_event(bool start, const char* initator, scan_tech_t type,
                         uint32_t results, uint64_t timestamp_ms) {
   std::lock_guard<std::mutex> lock(log_lock);
   lazy_initialize();
 
-  ScanEvent *event = pending->add_scan_event();
+  ScanEvent* event = pending->add_scan_event();
 
   if (start)
     event->set_scan_event_type(ScanEvent::SCAN_EVENT_START);
   else
     event->set_scan_event_type(ScanEvent::SCAN_EVENT_STOP);
 
-  if (initator)
-    event->set_initiator(initator);
+  if (initator) event->set_initiator(initator);
 
   ScanEvent::ScanTechnologyType scantype = ScanEvent::SCAN_TYPE_UNKNOWN;
 
-  if (type == SCAN_TECH_TYPE_LE)
-    scantype = ScanEvent::SCAN_TECH_TYPE_LE;
-  if (type == SCAN_TECH_TYPE_BREDR)
-    scantype = ScanEvent::SCAN_TECH_TYPE_BREDR;
-  if (type == SCAN_TECH_TYPE_BOTH)
-    scantype = ScanEvent::SCAN_TECH_TYPE_BOTH;
+  if (type == SCAN_TECH_TYPE_LE) scantype = ScanEvent::SCAN_TECH_TYPE_LE;
+  if (type == SCAN_TECH_TYPE_BREDR) scantype = ScanEvent::SCAN_TECH_TYPE_BREDR;
+  if (type == SCAN_TECH_TYPE_BOTH) scantype = ScanEvent::SCAN_TECH_TYPE_BOTH;
 
   event->set_scan_technology_type(scantype);
 
@@ -136,24 +124,20 @@
   event->set_event_time_millis(timestamp_ms);
 }
 
-void metrics_a2dp_session(int64_t session_duration_sec,
-                          const char *disconnect_reason,
-                          uint32_t device_class,
-                          int32_t media_timer_min_ms,
-                          int32_t media_timer_max_ms,
-                          int32_t media_timer_avg_ms,
-                          int32_t buffer_overruns_max_count,
-                          int32_t buffer_overruns_total,
-                          float buffer_underruns_average,
-                          int32_t buffer_underruns_count) {
+void metrics_a2dp_session(
+    int64_t session_duration_sec, const char* disconnect_reason,
+    uint32_t device_class, int32_t media_timer_min_ms,
+    int32_t media_timer_max_ms, int32_t media_timer_avg_ms,
+    int32_t buffer_overruns_max_count, int32_t buffer_overruns_total,
+    float buffer_underruns_average, int32_t buffer_underruns_count) {
   std::lock_guard<std::mutex> lock(log_lock);
   lazy_initialize();
 
-  BluetoothSession *bt_session = pending->add_session();
+  BluetoothSession* bt_session = pending->add_session();
 
   // Set connection type: for A2DP it is always BR/EDR
   BluetoothSession::ConnectionTechnologyType conn_type =
-    BluetoothSession::CONNECTION_TECHNOLOGY_TYPE_BREDR;
+      BluetoothSession::CONNECTION_TECHNOLOGY_TYPE_BREDR;
   bt_session->set_connection_technology_type(conn_type);
 
   bt_session->set_session_duration_sec(session_duration_sec);
@@ -161,11 +145,11 @@
     bt_session->set_disconnect_reason(disconnect_reason);
 
   // Set device: class and type are pre-defined
-  DeviceInfo *info = bt_session->mutable_device_connected_to();
+  DeviceInfo* info = bt_session->mutable_device_connected_to();
   info->set_device_class(device_class);
   info->set_device_type(DeviceInfo::DEVICE_TYPE_BREDR);
 
-  A2DPSession *a2dp_session = bt_session->mutable_a2dp_session();
+  A2DPSession* a2dp_session = bt_session->mutable_a2dp_session();
   a2dp_session->set_media_timer_min_millis(media_timer_min_ms);
   a2dp_session->set_media_timer_max_millis(media_timer_max_ms);
   a2dp_session->set_media_timer_avg_millis(media_timer_avg_ms);
diff --git a/osi/src/metrics_linux.cc b/osi/src/metrics_linux.cc
index 663ce92..64bf175 100644
--- a/osi/src/metrics_linux.cc
+++ b/osi/src/metrics_linux.cc
@@ -16,43 +16,38 @@
  *
  ******************************************************************************/
 
-
 #define LOG_TAG "bt_osi_metrics"
 
 #include "osi/include/metrics.h"
 
 void metrics_pair_event(uint32_t disconnect_reason, uint64_t timestamp_ms,
                         uint32_t device_class, device_type_t device_type) {
-  //TODO(jpawlowski): implement
+  // TODO(jpawlowski): implement
 }
 
-void metrics_wake_event(wake_event_type_t type, const char *requestor,
-                        const char *name, uint64_t timestamp_ms) {
-  //TODO(jpawlowski): implement
+void metrics_wake_event(wake_event_type_t type, const char* requestor,
+                        const char* name, uint64_t timestamp_ms) {
+  // TODO(jpawlowski): implement
 }
 
-void metrics_scan_event(bool start, const char *initator, scan_tech_t type,
+void metrics_scan_event(bool start, const char* initator, scan_tech_t type,
                         uint32_t results, uint64_t timestamp_ms) {
-  //TODO(jpawlowski): implement
+  // TODO(jpawlowski): implement
 }
 
-void metrics_a2dp_session(int64_t session_duration_sec,
-                          const char *disconnect_reason,
-                          uint32_t device_class,
-                          int32_t media_timer_min_ms,
-                          int32_t media_timer_max_ms,
-                          int32_t media_timer_avg_ms,
-                          int32_t buffer_overruns_max_count,
-                          int32_t buffer_overruns_total,
-                          float buffer_underruns_average,
-                          int32_t buffer_underruns_count) {
-  //TODO(jpawlowski): implement
+void metrics_a2dp_session(
+    int64_t session_duration_sec, const char* disconnect_reason,
+    uint32_t device_class, int32_t media_timer_min_ms,
+    int32_t media_timer_max_ms, int32_t media_timer_avg_ms,
+    int32_t buffer_overruns_max_count, int32_t buffer_overruns_total,
+    float buffer_underruns_average, int32_t buffer_underruns_count) {
+  // TODO(jpawlowski): implement
 }
 
 void metrics_write(int fd, bool clear) {
-  //TODO(jpawlowski): implement
+  // TODO(jpawlowski): implement
 }
 
 void metrics_print(int fd, bool clear) {
-  //TODO(jpawlowski): implement
+  // TODO(jpawlowski): implement
 }
diff --git a/osi/src/mutex.cc b/osi/src/mutex.cc
index b70e4eb..4cbb45f 100644
--- a/osi/src/mutex.cc
+++ b/osi/src/mutex.cc
@@ -31,14 +31,8 @@
   pthread_mutex_init(&global_lock, &attr);
 }
 
-void mutex_cleanup(void) {
-  pthread_mutex_destroy(&global_lock);
-}
+void mutex_cleanup(void) { pthread_mutex_destroy(&global_lock); }
 
-void mutex_global_lock(void) {
-  pthread_mutex_lock(&global_lock);
-}
+void mutex_global_lock(void) { pthread_mutex_lock(&global_lock); }
 
-void mutex_global_unlock(void) {
-  pthread_mutex_unlock(&global_lock);
-}
+void mutex_global_unlock(void) { pthread_mutex_unlock(&global_lock); }
diff --git a/osi/src/osi.cc b/osi/src/osi.cc
index b3f9c7f..f06ca60 100644
--- a/osi/src/osi.cc
+++ b/osi/src/osi.cc
@@ -23,8 +23,8 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <unistd.h>
 
 #include "osi/include/log.h"
@@ -47,8 +47,7 @@
 
   assert(read_bytes == sizeof(rand));
 
-  if (rand < 0)
-    rand = -rand;
+  if (rand < 0) rand = -rand;
 
   return rand;
 }
diff --git a/osi/src/properties.cc b/osi/src/properties.cc
index 10e1599..a484fd1 100644
--- a/osi/src/properties.cc
+++ b/osi/src/properties.cc
@@ -20,29 +20,27 @@
 
 #include "osi/include/properties.h"
 
-int osi_property_get(const char *key, char *value, const char *default_value) {
+int osi_property_get(const char* key, char* value, const char* default_value) {
 #if defined(OS_GENERIC)
-    /* For linux right now just return default value, if present */
-    int len = -1;
-    if (!default_value)
-      return len;
+  /* For linux right now just return default value, if present */
+  int len = -1;
+  if (!default_value) return len;
 
-    len = strlen(default_value);
-    if (len >= PROPERTY_VALUE_MAX)
-      len = PROPERTY_VALUE_MAX - 1;
+  len = strlen(default_value);
+  if (len >= PROPERTY_VALUE_MAX) len = PROPERTY_VALUE_MAX - 1;
 
-    memcpy(value, default_value, len);
-    value[len] = '\0';
-    return len;
+  memcpy(value, default_value, len);
+  value[len] = '\0';
+  return len;
 #else
-    return property_get(key, value, default_value);
+  return property_get(key, value, default_value);
 #endif  // defined(OS_GENERIC)
 }
 
-int osi_property_set(const char *key, const char *value) {
+int osi_property_set(const char* key, const char* value) {
 #if defined(OS_GENERIC)
-    return -1;
+  return -1;
 #else
-    return property_set(key, value);
+  return property_set(key, value);
 #endif  // defined(OS_GENERIC)
 }
diff --git a/osi/src/protos/bluetooth.proto b/osi/src/protos/bluetooth.proto
index 9a233ad..95266d8 100644
--- a/osi/src/protos/bluetooth.proto
+++ b/osi/src/protos/bluetooth.proto
@@ -7,12 +7,11 @@
 package clearcut.connectivity;
 
 option java_package = "com.google.wireless.android.play.playlog.connectivity";
-//option (datapol.file_vetting_status) = "latest";
+// option (datapol.file_vetting_status) = "latest";
 
 // import "storage/datapol/annotations/proto/semantic_annotations.proto";
 
 message BluetoothLog {
-
   // Session information that gets logged for every BT connection.
   repeated BluetoothSession session = 1;
 
@@ -28,18 +27,16 @@
 
 // The information about the device.
 message DeviceInfo {
-
   // Device type.
   enum DeviceType {
+    // Type is unknown.
+    DEVICE_TYPE_UNKNOWN = 0;
 
-     // Type is unknown.
-     DEVICE_TYPE_UNKNOWN = 0;
+    DEVICE_TYPE_BREDR = 1;
 
-     DEVICE_TYPE_BREDR = 1;
+    DEVICE_TYPE_LE = 2;
 
-     DEVICE_TYPE_LE = 2;
-
-     DEVICE_TYPE_DUMO = 3;
+    DEVICE_TYPE_DUMO = 3;
   }
 
   // Device class
@@ -52,15 +49,13 @@
 
 // Information that gets logged for every Bluetooth connection.
 message BluetoothSession {
-
   // Type of technology used in the connection.
   enum ConnectionTechnologyType {
+    CONNECTION_TECHNOLOGY_TYPE_UNKNOWN = 0;
 
-     CONNECTION_TECHNOLOGY_TYPE_UNKNOWN = 0;
+    CONNECTION_TECHNOLOGY_TYPE_LE = 1;
 
-     CONNECTION_TECHNOLOGY_TYPE_LE = 1;
-
-     CONNECTION_TECHNOLOGY_TYPE_BREDR = 2;
+    CONNECTION_TECHNOLOGY_TYPE_BREDR = 2;
   }
 
   // Duration of the session.
@@ -83,7 +78,6 @@
 }
 
 message RFCommSession {
-
   // bytes transmitted.
   optional int32 rx_bytes = 1;
 
@@ -93,7 +87,6 @@
 
 // Session information that gets logged for every A2DP session.
 message A2DPSession {
-
   // Media timer in milliseconds.
   optional int32 media_timer_min_millis = 1;
 
@@ -117,31 +110,29 @@
 }
 
 message PairEvent {
-
   // The reason for disconnecting
   // https://cs.corp.google.com/#android/system/bt/stack/include/hcidefs.h&q=failed_establish.
   optional int32 disconnect_reason = 1;
 
   // Pair event time
-  optional int64 event_time_millis = 2; // [(datapol.semantic_type) = ST_TIMESTAMP];
+  optional int64 event_time_millis =
+      2;  // [(datapol.semantic_type) = ST_TIMESTAMP];
 
   // The information about the device which it is paired to.
   optional DeviceInfo device_paired_with = 3;
 }
 
 message WakeEvent {
-
   // Information about the wake event type.
   enum WakeEventType {
+    // Type is unknown.
+    UNKNOWN = 0;
 
-     // Type is unknown.
-     UNKNOWN = 0;
+    // WakeLock was acquired.
+    ACQUIRED = 1;
 
-     // WakeLock was acquired.
-     ACQUIRED = 1;
-
-     // WakeLock was released.
-     RELEASED = 2;
+    // WakeLock was released.
+    RELEASED = 2;
   }
 
   // Information about the wake event type.
@@ -155,32 +146,30 @@
   optional string name = 3;
 
   // Time of the event.
-  optional int64 event_time_millis = 4; // [(datapol.semantic_type) = ST_TIMESTAMP];
+  optional int64 event_time_millis =
+      4;  // [(datapol.semantic_type) = ST_TIMESTAMP];
 }
 
 message ScanEvent {
-
   // Scan type.
   enum ScanTechnologyType {
+    // Scan Type is unknown.
+    SCAN_TYPE_UNKNOWN = 0;
 
-     // Scan Type is unknown.
-     SCAN_TYPE_UNKNOWN = 0;
+    SCAN_TECH_TYPE_LE = 1;
 
-     SCAN_TECH_TYPE_LE = 1;
+    SCAN_TECH_TYPE_BREDR = 2;
 
-     SCAN_TECH_TYPE_BREDR = 2;
-
-     SCAN_TECH_TYPE_BOTH = 3;
+    SCAN_TECH_TYPE_BOTH = 3;
   }
 
   // Scan event type.
   enum ScanEventType {
+    // Scan started.
+    SCAN_EVENT_START = 0;
 
-     // Scan started.
-     SCAN_EVENT_START = 0;
-
-     // Scan stopped.
-     SCAN_EVENT_STOP = 1;
+    // Scan stopped.
+    SCAN_EVENT_STOP = 1;
   }
 
   // Scan event type.
@@ -197,5 +186,6 @@
   optional int32 number_results = 4;
 
   // Time of the event.
-  optional int64 event_time_millis = 5; // [(datapol.semantic_type) = ST_TIMESTAMP];
+  optional int64 event_time_millis =
+      5;  // [(datapol.semantic_type) = ST_TIMESTAMP];
 }
diff --git a/osi/src/reactor.cc b/osi/src/reactor.cc
index 7388d52..b77809a 100644
--- a/osi/src/reactor.cc
+++ b/osi/src/reactor.cc
@@ -34,56 +34,62 @@
 #include "osi/include/log.h"
 
 #if !defined(EFD_SEMAPHORE)
-#  define EFD_SEMAPHORE (1 << 0)
+#define EFD_SEMAPHORE (1 << 0)
 #endif
 
 struct reactor_t {
   int epoll_fd;
   int event_fd;
   pthread_mutex_t list_lock;  // protects invalidation_list.
-  list_t *invalidation_list;  // reactor objects that have been unregistered.
+  list_t* invalidation_list;  // reactor objects that have been unregistered.
   pthread_t run_thread;       // the pthread on which reactor_run is executing.
   bool is_running;            // indicates whether |run_thread| is valid.
   bool object_removed;
 };
 
 struct reactor_object_t {
-  int fd;                              // the file descriptor to monitor for events.
-  void *context;                       // a context that's passed back to the *_ready functions.
-  reactor_t *reactor;                  // the reactor instance this object is registered with.
-  pthread_mutex_t lock;                // protects the lifetime of this object and all variables.
+  int fd;              // the file descriptor to monitor for events.
+  void* context;       // a context that's passed back to the *_ready functions.
+  reactor_t* reactor;  // the reactor instance this object is registered with.
+  pthread_mutex_t
+      lock;  // protects the lifetime of this object and all variables.
 
-  void (*read_ready)(void *context);   // function to call when the file descriptor becomes readable.
-  void (*write_ready)(void *context);  // function to call when the file descriptor becomes writeable.
+  void (*read_ready)(void* context);   // function to call when the file
+                                       // descriptor becomes readable.
+  void (*write_ready)(void* context);  // function to call when the file
+                                       // descriptor becomes writeable.
 };
 
-static reactor_status_t run_reactor(reactor_t *reactor, int iterations);
+static reactor_status_t run_reactor(reactor_t* reactor, int iterations);
 
 static const size_t MAX_EVENTS = 64;
 static const eventfd_t EVENT_REACTOR_STOP = 1;
 
-reactor_t *reactor_new(void) {
-  reactor_t *ret = (reactor_t *)osi_calloc(sizeof(reactor_t));
+reactor_t* reactor_new(void) {
+  reactor_t* ret = (reactor_t*)osi_calloc(sizeof(reactor_t));
 
   ret->epoll_fd = INVALID_FD;
   ret->event_fd = INVALID_FD;
 
   ret->epoll_fd = epoll_create(MAX_EVENTS);
   if (ret->epoll_fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s unable to create epoll instance: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to create epoll instance: %s", __func__,
+              strerror(errno));
     goto error;
   }
 
   ret->event_fd = eventfd(0, 0);
   if (ret->event_fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s unable to create eventfd: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to create eventfd: %s", __func__,
+              strerror(errno));
     goto error;
   }
 
   pthread_mutex_init(&ret->list_lock, NULL);
   ret->invalidation_list = list_new(NULL);
   if (!ret->invalidation_list) {
-    LOG_ERROR(LOG_TAG, "%s unable to allocate object invalidation list.", __func__);
+    LOG_ERROR(LOG_TAG, "%s unable to allocate object invalidation list.",
+              __func__);
     goto error;
   }
 
@@ -92,7 +98,8 @@
   event.events = EPOLLIN;
   event.data.ptr = NULL;
   if (epoll_ctl(ret->epoll_fd, EPOLL_CTL_ADD, ret->event_fd, &event) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to register eventfd with epoll set: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to register eventfd with epoll set: %s",
+              __func__, strerror(errno));
     goto error;
   }
 
@@ -103,9 +110,8 @@
   return NULL;
 }
 
-void reactor_free(reactor_t *reactor) {
-  if (!reactor)
-    return;
+void reactor_free(reactor_t* reactor) {
+  if (!reactor) return;
 
   list_free(reactor->invalidation_list);
   close(reactor->event_fd);
@@ -113,31 +119,30 @@
   osi_free(reactor);
 }
 
-reactor_status_t reactor_start(reactor_t *reactor) {
+reactor_status_t reactor_start(reactor_t* reactor) {
   assert(reactor != NULL);
   return run_reactor(reactor, 0);
 }
 
-reactor_status_t reactor_run_once(reactor_t *reactor) {
+reactor_status_t reactor_run_once(reactor_t* reactor) {
   assert(reactor != NULL);
   return run_reactor(reactor, 1);
 }
 
-void reactor_stop(reactor_t *reactor) {
+void reactor_stop(reactor_t* reactor) {
   assert(reactor != NULL);
 
   eventfd_write(reactor->event_fd, EVENT_REACTOR_STOP);
 }
 
-reactor_object_t *reactor_register(reactor_t *reactor,
-    int fd, void *context,
-    void (*read_ready)(void *context),
-    void (*write_ready)(void *context)) {
+reactor_object_t* reactor_register(reactor_t* reactor, int fd, void* context,
+                                   void (*read_ready)(void* context),
+                                   void (*write_ready)(void* context)) {
   assert(reactor != NULL);
   assert(fd != INVALID_FD);
 
-  reactor_object_t *object =
-      (reactor_object_t *)osi_calloc(sizeof(reactor_object_t));
+  reactor_object_t* object =
+      (reactor_object_t*)osi_calloc(sizeof(reactor_object_t));
 
   object->reactor = reactor;
   object->fd = fd;
@@ -148,14 +153,13 @@
 
   struct epoll_event event;
   memset(&event, 0, sizeof(event));
-  if (read_ready)
-    event.events |= (EPOLLIN | EPOLLRDHUP);
-  if (write_ready)
-    event.events |= EPOLLOUT;
+  if (read_ready) event.events |= (EPOLLIN | EPOLLRDHUP);
+  if (write_ready) event.events |= EPOLLOUT;
   event.data.ptr = object;
 
   if (epoll_ctl(reactor->epoll_fd, EPOLL_CTL_ADD, fd, &event) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to register fd %d to epoll set: %s", __func__, fd, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to register fd %d to epoll set: %s", __func__,
+              fd, strerror(errno));
     pthread_mutex_destroy(&object->lock);
     osi_free(object);
     return NULL;
@@ -164,21 +168,21 @@
   return object;
 }
 
-bool reactor_change_registration(reactor_object_t *object,
-    void (*read_ready)(void *context),
-    void (*write_ready)(void *context)) {
+bool reactor_change_registration(reactor_object_t* object,
+                                 void (*read_ready)(void* context),
+                                 void (*write_ready)(void* context)) {
   assert(object != NULL);
 
   struct epoll_event event;
   memset(&event, 0, sizeof(event));
-  if (read_ready)
-    event.events |= (EPOLLIN | EPOLLRDHUP);
-  if (write_ready)
-    event.events |= EPOLLOUT;
+  if (read_ready) event.events |= (EPOLLIN | EPOLLRDHUP);
+  if (write_ready) event.events |= EPOLLOUT;
   event.data.ptr = object;
 
-  if (epoll_ctl(object->reactor->epoll_fd, EPOLL_CTL_MOD, object->fd, &event) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to modify interest set for fd %d: %s", __func__, object->fd, strerror(errno));
+  if (epoll_ctl(object->reactor->epoll_fd, EPOLL_CTL_MOD, object->fd, &event) ==
+      -1) {
+    LOG_ERROR(LOG_TAG, "%s unable to modify interest set for fd %d: %s",
+              __func__, object->fd, strerror(errno));
     return false;
   }
 
@@ -190,15 +194,17 @@
   return true;
 }
 
-void reactor_unregister(reactor_object_t *obj) {
+void reactor_unregister(reactor_object_t* obj) {
   assert(obj != NULL);
 
-  reactor_t *reactor = obj->reactor;
+  reactor_t* reactor = obj->reactor;
 
   if (epoll_ctl(reactor->epoll_fd, EPOLL_CTL_DEL, obj->fd, NULL) == -1)
-    LOG_ERROR(LOG_TAG, "%s unable to unregister fd %d from epoll set: %s", __func__, obj->fd, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to unregister fd %d from epoll set: %s",
+              __func__, obj->fd, strerror(errno));
 
-  if (reactor->is_running && pthread_equal(pthread_self(), reactor->run_thread)) {
+  if (reactor->is_running &&
+      pthread_equal(pthread_self(), reactor->run_thread)) {
     reactor->object_removed = true;
     return;
   }
@@ -224,7 +230,7 @@
 // Runs the reactor loop for a maximum of |iterations|.
 // 0 |iterations| means loop forever.
 // |reactor| may not be NULL.
-static reactor_status_t run_reactor(reactor_t *reactor, int iterations) {
+static reactor_status_t run_reactor(reactor_t* reactor, int iterations) {
   assert(reactor != NULL);
 
   reactor->run_thread = pthread_self();
@@ -239,7 +245,8 @@
     int ret;
     OSI_NO_INTR(ret = epoll_wait(reactor->epoll_fd, events, MAX_EVENTS, -1));
     if (ret == -1) {
-      LOG_ERROR(LOG_TAG, "%s error in epoll_wait: %s", __func__, strerror(errno));
+      LOG_ERROR(LOG_TAG, "%s error in epoll_wait: %s", __func__,
+                strerror(errno));
       reactor->is_running = false;
       return REACTOR_STATUS_ERROR;
     }
@@ -255,7 +262,7 @@
         return REACTOR_STATUS_STOP;
       }
 
-      reactor_object_t *object = (reactor_object_t *)events[j].data.ptr;
+      reactor_object_t* object = (reactor_object_t*)events[j].data.ptr;
 
       pthread_mutex_lock(&reactor->list_lock);
       if (list_contains(reactor->invalidation_list, object)) {
@@ -268,9 +275,11 @@
       pthread_mutex_unlock(&reactor->list_lock);
 
       reactor->object_removed = false;
-      if (events[j].events & (EPOLLIN | EPOLLHUP | EPOLLRDHUP | EPOLLERR) && object->read_ready)
+      if (events[j].events & (EPOLLIN | EPOLLHUP | EPOLLRDHUP | EPOLLERR) &&
+          object->read_ready)
         object->read_ready(object->context);
-      if (!reactor->object_removed && events[j].events & EPOLLOUT && object->write_ready)
+      if (!reactor->object_removed && events[j].events & EPOLLOUT &&
+          object->write_ready)
         object->write_ready(object->context);
       pthread_mutex_unlock(&object->lock);
 
diff --git a/osi/src/ringbuffer.cc b/osi/src/ringbuffer.cc
index 67c8f54..3ab6023 100644
--- a/osi/src/ringbuffer.cc
+++ b/osi/src/ringbuffer.cc
@@ -25,94 +25,91 @@
 struct ringbuffer_t {
   size_t total;
   size_t available;
-  uint8_t *base;
-  uint8_t *head;
-  uint8_t *tail;
+  uint8_t* base;
+  uint8_t* head;
+  uint8_t* tail;
 };
 
 ringbuffer_t* ringbuffer_init(const size_t size) {
-  ringbuffer_t* p = static_cast<ringbuffer_t *>(osi_calloc(sizeof(ringbuffer_t)));
+  ringbuffer_t* p =
+      static_cast<ringbuffer_t*>(osi_calloc(sizeof(ringbuffer_t)));
 
-  p->base = static_cast<uint8_t *>(osi_calloc(size));
+  p->base = static_cast<uint8_t*>(osi_calloc(size));
   p->head = p->tail = p->base;
   p->total = p->available = size;
 
   return p;
 }
 
-void ringbuffer_free(ringbuffer_t *rb) {
-  if (rb != NULL)
-    osi_free(rb->base);
+void ringbuffer_free(ringbuffer_t* rb) {
+  if (rb != NULL) osi_free(rb->base);
   osi_free(rb);
 }
 
-size_t ringbuffer_available(const ringbuffer_t *rb) {
+size_t ringbuffer_available(const ringbuffer_t* rb) {
   assert(rb);
   return rb->available;
 }
 
-size_t ringbuffer_size(const ringbuffer_t *rb) {
+size_t ringbuffer_size(const ringbuffer_t* rb) {
   assert(rb);
   return rb->total - rb->available;
 }
 
-size_t ringbuffer_insert(ringbuffer_t *rb, const uint8_t *p, size_t length) {
+size_t ringbuffer_insert(ringbuffer_t* rb, const uint8_t* p, size_t length) {
   assert(rb);
   assert(p);
 
-  if (length > ringbuffer_available(rb))
-    length = ringbuffer_available(rb);
+  if (length > ringbuffer_available(rb)) length = ringbuffer_available(rb);
 
   for (size_t i = 0; i != length; ++i) {
     *rb->tail++ = *p++;
-    if (rb->tail >= (rb->base + rb->total))
-      rb->tail = rb->base;
+    if (rb->tail >= (rb->base + rb->total)) rb->tail = rb->base;
   }
 
   rb->available -= length;
   return length;
 }
 
-size_t ringbuffer_delete(ringbuffer_t *rb, size_t length) {
+size_t ringbuffer_delete(ringbuffer_t* rb, size_t length) {
   assert(rb);
 
-  if (length > ringbuffer_size(rb))
-    length = ringbuffer_size(rb);
+  if (length > ringbuffer_size(rb)) length = ringbuffer_size(rb);
 
   rb->head += length;
-  if (rb->head >= (rb->base + rb->total))
-    rb->head -= rb->total;
+  if (rb->head >= (rb->base + rb->total)) rb->head -= rb->total;
 
   rb->available += length;
   return length;
 }
 
-size_t ringbuffer_peek(const ringbuffer_t *rb, off_t offset, uint8_t *p, size_t length) {
+size_t ringbuffer_peek(const ringbuffer_t* rb, off_t offset, uint8_t* p,
+                       size_t length) {
   assert(rb);
   assert(p);
   assert(offset >= 0);
   assert((size_t)offset <= ringbuffer_size(rb));
 
-  uint8_t *b = ((rb->head - rb->base + offset) % rb->total) + rb->base;
-  const size_t bytes_to_copy = (offset + length > ringbuffer_size(rb)) ? ringbuffer_size(rb) - offset : length;
+  uint8_t* b = ((rb->head - rb->base + offset) % rb->total) + rb->base;
+  const size_t bytes_to_copy = (offset + length > ringbuffer_size(rb))
+                                   ? ringbuffer_size(rb) - offset
+                                   : length;
 
   for (size_t copied = 0; copied < bytes_to_copy; ++copied) {
     *p++ = *b++;
-    if (b >= (rb->base + rb->total))
-      b = rb->base;
+    if (b >= (rb->base + rb->total)) b = rb->base;
   }
 
   return bytes_to_copy;
 }
 
-size_t ringbuffer_pop(ringbuffer_t *rb, uint8_t *p, size_t length) {
+size_t ringbuffer_pop(ringbuffer_t* rb, uint8_t* p, size_t length) {
   assert(rb);
   assert(p);
 
   const size_t copied = ringbuffer_peek(rb, 0, p, length);
   rb->head += copied;
-  if (rb->head >= (rb->base + rb->total))
-    rb->head -= rb->total;
+  if (rb->head >= (rb->base + rb->total)) rb->head -= rb->total;
 
   rb->available += copied;
   return copied;
diff --git a/osi/src/semaphore.cc b/osi/src/semaphore.cc
index d24d38b..8760958 100644
--- a/osi/src/semaphore.cc
+++ b/osi/src/semaphore.cc
@@ -33,75 +33,78 @@
 #include "osi/include/osi.h"
 
 #if !defined(EFD_SEMAPHORE)
-#  define EFD_SEMAPHORE (1 << 0)
+#define EFD_SEMAPHORE (1 << 0)
 #endif
 
 struct semaphore_t {
   int fd;
 };
 
-semaphore_t *semaphore_new(unsigned int value) {
-  semaphore_t *ret = static_cast<semaphore_t *>(osi_malloc(sizeof(semaphore_t)));
+semaphore_t* semaphore_new(unsigned int value) {
+  semaphore_t* ret = static_cast<semaphore_t*>(osi_malloc(sizeof(semaphore_t)));
   ret->fd = eventfd(value, EFD_SEMAPHORE);
   if (ret->fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s unable to allocate semaphore: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to allocate semaphore: %s", __func__,
+              strerror(errno));
     osi_free(ret);
     ret = NULL;
   }
   return ret;
 }
 
-void semaphore_free(semaphore_t *semaphore) {
-  if (!semaphore)
-    return;
+void semaphore_free(semaphore_t* semaphore) {
+  if (!semaphore) return;
 
-  if (semaphore->fd != INVALID_FD)
-    close(semaphore->fd);
+  if (semaphore->fd != INVALID_FD) close(semaphore->fd);
   osi_free(semaphore);
 }
 
-void semaphore_wait(semaphore_t *semaphore) {
+void semaphore_wait(semaphore_t* semaphore) {
   assert(semaphore != NULL);
   assert(semaphore->fd != INVALID_FD);
 
   eventfd_t value;
   if (eventfd_read(semaphore->fd, &value) == -1)
-    LOG_ERROR(LOG_TAG, "%s unable to wait on semaphore: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to wait on semaphore: %s", __func__,
+              strerror(errno));
 }
 
-bool semaphore_try_wait(semaphore_t *semaphore) {
+bool semaphore_try_wait(semaphore_t* semaphore) {
   assert(semaphore != NULL);
   assert(semaphore->fd != INVALID_FD);
 
   int flags = fcntl(semaphore->fd, F_GETFL);
   if (flags == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to get flags for semaphore fd: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to get flags for semaphore fd: %s", __func__,
+              strerror(errno));
     return false;
   }
   if (fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to set O_NONBLOCK for semaphore fd: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to set O_NONBLOCK for semaphore fd: %s",
+              __func__, strerror(errno));
     return false;
   }
 
   bool rc = true;
   eventfd_t value;
-  if (eventfd_read(semaphore->fd, &value) == -1)
-    rc = false;
+  if (eventfd_read(semaphore->fd, &value) == -1) rc = false;
 
   if (fcntl(semaphore->fd, F_SETFL, flags) == -1)
-    LOG_ERROR(LOG_TAG, "%s unable to restore flags for semaphore fd: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to restore flags for semaphore fd: %s",
+              __func__, strerror(errno));
   return rc;
 }
 
-void semaphore_post(semaphore_t *semaphore) {
+void semaphore_post(semaphore_t* semaphore) {
   assert(semaphore != NULL);
   assert(semaphore->fd != INVALID_FD);
 
   if (eventfd_write(semaphore->fd, 1ULL) == -1)
-    LOG_ERROR(LOG_TAG, "%s unable to post to semaphore: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to post to semaphore: %s", __func__,
+              strerror(errno));
 }
 
-int semaphore_get_fd(const semaphore_t *semaphore) {
+int semaphore_get_fd(const semaphore_t* semaphore) {
   assert(semaphore != NULL);
   assert(semaphore->fd != INVALID_FD);
   return semaphore->fd;
diff --git a/osi/src/socket.cc b/osi/src/socket.cc
index 166c2ce..7370246 100644
--- a/osi/src/socket.cc
+++ b/osi/src/socket.cc
@@ -39,94 +39,98 @@
 
 struct socket_t {
   int fd;
-  reactor_object_t *reactor_object;
+  reactor_object_t* reactor_object;
   socket_cb read_ready;
   socket_cb write_ready;
-  void *context;                     // Not owned, do not free.
+  void* context;  // Not owned, do not free.
 };
 
-static void internal_read_ready(void *context);
-static void internal_write_ready(void *context);
+static void internal_read_ready(void* context);
+static void internal_write_ready(void* context);
 
-socket_t *socket_new(void) {
-  socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t));
+socket_t* socket_new(void) {
+  socket_t* ret = (socket_t*)osi_calloc(sizeof(socket_t));
   int enable = 1;
 
   ret->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
   if (ret->fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s unable to create socket: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to create socket: %s", __func__,
+              strerror(errno));
     goto error;
   }
 
-  if (setsockopt(ret->fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to set SO_REUSEADDR: %s", __func__, strerror(errno));
+  if (setsockopt(ret->fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) ==
+      -1) {
+    LOG_ERROR(LOG_TAG, "%s unable to set SO_REUSEADDR: %s", __func__,
+              strerror(errno));
     goto error;
   }
 
   return ret;
 
 error:;
-  if (ret)
-    close(ret->fd);
+  if (ret) close(ret->fd);
   osi_free(ret);
   return NULL;
 }
 
-socket_t *socket_new_from_fd(int fd) {
+socket_t* socket_new_from_fd(int fd) {
   assert(fd != INVALID_FD);
 
-  socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t));
+  socket_t* ret = (socket_t*)osi_calloc(sizeof(socket_t));
 
   ret->fd = fd;
   return ret;
 }
 
-void socket_free(socket_t *socket) {
-  if (!socket)
-    return;
+void socket_free(socket_t* socket) {
+  if (!socket) return;
 
   socket_unregister(socket);
   close(socket->fd);
   osi_free(socket);
 }
 
-bool socket_listen(const socket_t *socket, port_t port) {
+bool socket_listen(const socket_t* socket, port_t port) {
   assert(socket != NULL);
 
   struct sockaddr_in addr;
   addr.sin_family = AF_INET;
   addr.sin_addr.s_addr = htonl(LOCALHOST_);
   addr.sin_port = htons(port);
-  if (bind(socket->fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to bind socket to port %u: %s", __func__, port, strerror(errno));
+  if (bind(socket->fd, (struct sockaddr*)&addr, sizeof(addr)) == -1) {
+    LOG_ERROR(LOG_TAG, "%s unable to bind socket to port %u: %s", __func__,
+              port, strerror(errno));
     return false;
   }
 
   if (listen(socket->fd, 10) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to listen on port %u: %s", __func__, port, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to listen on port %u: %s", __func__, port,
+              strerror(errno));
     return false;
   }
 
   return true;
 }
 
-socket_t *socket_accept(const socket_t *socket) {
+socket_t* socket_accept(const socket_t* socket) {
   assert(socket != NULL);
 
   int fd;
   OSI_NO_INTR(fd = accept(socket->fd, NULL, NULL));
   if (fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s unable to accept socket: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to accept socket: %s", __func__,
+              strerror(errno));
     return NULL;
   }
 
-  socket_t *ret = (socket_t *)osi_calloc(sizeof(socket_t));
+  socket_t* ret = (socket_t*)osi_calloc(sizeof(socket_t));
 
   ret->fd = fd;
   return ret;
 }
 
-ssize_t socket_read(const socket_t *socket, void *buf, size_t count) {
+ssize_t socket_read(const socket_t* socket, void* buf, size_t count) {
   assert(socket != NULL);
   assert(buf != NULL);
 
@@ -136,7 +140,7 @@
   return ret;
 }
 
-ssize_t socket_write(const socket_t *socket, const void *buf, size_t count) {
+ssize_t socket_write(const socket_t* socket, const void* buf, size_t count) {
   assert(socket != NULL);
   assert(buf != NULL);
 
@@ -146,18 +150,18 @@
   return ret;
 }
 
-ssize_t socket_write_and_transfer_fd(const socket_t *socket, const void *buf, size_t count, int fd) {
+ssize_t socket_write_and_transfer_fd(const socket_t* socket, const void* buf,
+                                     size_t count, int fd) {
   assert(socket != NULL);
   assert(buf != NULL);
 
-  if (fd == INVALID_FD)
-    return socket_write(socket, buf, count);
+  if (fd == INVALID_FD) return socket_write(socket, buf, count);
 
   struct msghdr msg;
   struct iovec iov;
   char control_buf[CMSG_SPACE(sizeof(int))];
 
-  iov.iov_base = (void *)buf;
+  iov.iov_base = (void*)buf;
   iov.iov_len = count;
 
   msg.msg_iov = &iov;
@@ -167,11 +171,11 @@
   msg.msg_name = NULL;
   msg.msg_namelen = 0;
 
-  struct cmsghdr *header = CMSG_FIRSTHDR(&msg);
+  struct cmsghdr* header = CMSG_FIRSTHDR(&msg);
   header->cmsg_level = SOL_SOCKET;
   header->cmsg_type = SCM_RIGHTS;
   header->cmsg_len = CMSG_LEN(sizeof(int));
-  *(int *)CMSG_DATA(header) = fd;
+  *(int*)CMSG_DATA(header) = fd;
 
   ssize_t ret;
   OSI_NO_INTR(ret = sendmsg(socket->fd, &msg, MSG_DONTWAIT));
@@ -180,16 +184,16 @@
   return ret;
 }
 
-ssize_t socket_bytes_available(const socket_t *socket) {
+ssize_t socket_bytes_available(const socket_t* socket) {
   assert(socket != NULL);
 
   int size = 0;
-  if (ioctl(socket->fd, FIONREAD, &size) == -1)
-    return -1;
+  if (ioctl(socket->fd, FIONREAD, &size) == -1) return -1;
   return size;
 }
 
-void socket_register(socket_t *socket, reactor_t *reactor, void *context, socket_cb read_cb, socket_cb write_cb) {
+void socket_register(socket_t* socket, reactor_t* reactor, void* context,
+                     socket_cb read_cb, socket_cb write_cb) {
   assert(socket != NULL);
 
   // Make sure the socket isn't currently registered.
@@ -199,30 +203,30 @@
   socket->write_ready = write_cb;
   socket->context = context;
 
-  void (*read_fn)(void *) = (read_cb != NULL) ? internal_read_ready : NULL;
-  void (*write_fn)(void *) = (write_cb != NULL) ? internal_write_ready : NULL;
+  void (*read_fn)(void*) = (read_cb != NULL) ? internal_read_ready : NULL;
+  void (*write_fn)(void*) = (write_cb != NULL) ? internal_write_ready : NULL;
 
-  socket->reactor_object = reactor_register(reactor, socket->fd, socket, read_fn, write_fn);
+  socket->reactor_object =
+      reactor_register(reactor, socket->fd, socket, read_fn, write_fn);
 }
 
-void socket_unregister(socket_t *socket) {
+void socket_unregister(socket_t* socket) {
   assert(socket != NULL);
 
-  if (socket->reactor_object)
-    reactor_unregister(socket->reactor_object);
+  if (socket->reactor_object) reactor_unregister(socket->reactor_object);
   socket->reactor_object = NULL;
 }
 
-static void internal_read_ready(void *context) {
+static void internal_read_ready(void* context) {
   assert(context != NULL);
 
-  socket_t *socket = static_cast<socket_t *>(context);
+  socket_t* socket = static_cast<socket_t*>(context);
   socket->read_ready(socket, socket->context);
 }
 
-static void internal_write_ready(void *context) {
+static void internal_write_ready(void* context) {
   assert(context != NULL);
 
-  socket_t *socket = static_cast<socket_t *>(context);
+  socket_t* socket = static_cast<socket_t*>(context);
   socket->write_ready(socket, socket->context);
 }
diff --git a/osi/src/socket_utils/README b/osi/src/socket_utils/README
index 07a28bd..9ed210a 100644
--- a/osi/src/socket_utils/README
+++ b/osi/src/socket_utils/README
@@ -14,23 +14,28 @@
  * limitations under the License.
  */
 
-The sources in this folder re-implement some of the sources in libcutils/sockets
-to provide a short-term solution eliminating libcutils dependency from
-system/bt. Once a long-term platform-independent abstraction is presented, these
-sources and the corresponding headers should be removed.
+The sources in this folder re -
+    implement some of the sources in libcutils / sockets to provide a short -
+    term solution eliminating libcutils dependency from system /
+        bt.Once a long -
+    term platform - independent abstraction is presented,
+    these sources and the corresponding headers should be removed.
 
-Note that only a part of the source files are pulled from libcutils/sockets, and
-"osi_" prefix is added to all functions. The developers who want to pull sockets
-sources other than the existing ones must put the sources in this folder and
-refactor the functions as well.
+        Note that only a part of the source files are pulled from libcutils /
+        sockets,
+    and"osi_" prefix is added to all functions
+            .The developers who want to pull sockets sources other than the
+                existing ones must put the sources in this folder and refactor
+                    the functions as well.
 
-The current sources include:
+        The current sources include :
 
-[Headers]
- - osi/include/socket_utils/sockets.h
- - osi/include/socket_utils/socket_local.h
-[Source files]
- - osi/src/socket_utils/socket_local_client.cc
- - osi/src/socket_utils/socket_local_server.cc
+        [Headers] -
+        osi / include / socket_utils / sockets.h -
+        osi / include / socket_utils / socket_local.h[Source files] -
+        osi / src / socket_utils / socket_local_client.cc -
+        osi / src / socket_utils /
+            socket_local_server
+                .cc
 
-Please update the above list if adding more sources.
+                    Please update the above list if adding more sources.
diff --git a/osi/src/socket_utils/socket_local_client.cc b/osi/src/socket_utils/socket_local_client.cc
index 73a828c..7338407 100644
--- a/osi/src/socket_utils/socket_local_client.cc
+++ b/osi/src/socket_utils/socket_local_client.cc
@@ -25,14 +25,14 @@
 #include <unistd.h>
 
 #include "osi/include/osi.h"
-#include "osi/include/socket_utils/sockets.h"
 #include "osi/include/socket_utils/socket_local.h"
+#include "osi/include/socket_utils/sockets.h"
 
 #define LISTEN_BACKLOG 4
 
 /* Documented in header file. */
-int osi_socket_make_sockaddr_un(const char *name, int namespaceId,
-                                struct sockaddr_un *p_addr, socklen_t *alen) {
+int osi_socket_make_sockaddr_un(const char* name, int namespaceId,
+                                struct sockaddr_un* p_addr, socklen_t* alen) {
   memset(p_addr, 0, sizeof(*p_addr));
   size_t namelen;
 
@@ -109,7 +109,7 @@
  *
  * Used by AndroidSocketImpl
  */
-int osi_socket_local_client_connect(int fd, const char *name, int namespaceId,
+int osi_socket_local_client_connect(int fd, const char* name, int namespaceId,
                                     int type UNUSED_ATTR) {
   struct sockaddr_un addr;
   socklen_t alen;
@@ -121,7 +121,7 @@
     goto error;
   }
 
-  OSI_NO_INTR(err = connect(fd, (struct sockaddr *)&addr, alen));
+  OSI_NO_INTR(err = connect(fd, (struct sockaddr*)&addr, alen));
   if (err < 0) {
     goto error;
   }
@@ -136,7 +136,7 @@
  * connect to peer named "name"
  * returns fd or -1 on error
  */
-int osi_socket_local_client(const char *name, int namespaceId, int type) {
+int osi_socket_local_client(const char* name, int namespaceId, int type) {
   int s;
 
   s = socket(AF_LOCAL, type, 0);
diff --git a/osi/src/socket_utils/socket_local_server.cc b/osi/src/socket_utils/socket_local_server.cc
index 79f1790..9bfdf54 100644
--- a/osi/src/socket_utils/socket_local_server.cc
+++ b/osi/src/socket_utils/socket_local_server.cc
@@ -19,14 +19,14 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/socket.h>
-#include <sys/un.h>
 #include <sys/select.h>
+#include <sys/socket.h>
 #include <sys/types.h>
+#include <sys/un.h>
 #include <unistd.h>
 
-#include "osi/include/socket_utils/sockets.h"
 #include "osi/include/socket_utils/socket_local.h"
+#include "osi/include/socket_utils/sockets.h"
 
 #define LISTEN_BACKLOG 4
 
@@ -39,7 +39,7 @@
  *
  * Does not call listen()
  */
-int osi_socket_local_server_bind(int s, const char *name, int namespaceId) {
+int osi_socket_local_server_bind(int s, const char* name, int namespaceId) {
   struct sockaddr_un addr;
   socklen_t alen;
   int n;
@@ -65,7 +65,7 @@
   n = 1;
   setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &n, sizeof(n));
 
-  if (bind(s, (struct sockaddr *)&addr, alen) < 0) {
+  if (bind(s, (struct sockaddr*)&addr, alen) < 0) {
     return -1;
   }
 
@@ -77,7 +77,7 @@
  *
  *  Returns fd on success, -1 on fail
  */
-int osi_socket_local_server(const char *name, int namespaceId, int type) {
+int osi_socket_local_server(const char* name, int namespaceId, int type) {
   int err;
   int s;
 
diff --git a/osi/src/thread.cc b/osi/src/thread.cc
index 6c9fab7..92017a3 100644
--- a/osi/src/thread.cc
+++ b/osi/src/thread.cc
@@ -42,45 +42,42 @@
   pthread_t pthread;
   pid_t tid;
   char name[THREAD_NAME_MAX + 1];
-  reactor_t *reactor;
-  fixed_queue_t *work_queue;
+  reactor_t* reactor;
+  fixed_queue_t* work_queue;
 };
 
 struct start_arg {
-  thread_t *thread;
-  semaphore_t *start_sem;
+  thread_t* thread;
+  semaphore_t* start_sem;
   int error;
 };
 
 typedef struct {
   thread_fn func;
-  void *context;
+  void* context;
 } work_item_t;
 
-static void *run_thread(void *start_arg);
-static void work_queue_read_cb(void *context);
+static void* run_thread(void* start_arg);
+static void work_queue_read_cb(void* context);
 
 static const size_t DEFAULT_WORK_QUEUE_CAPACITY = 128;
 
-thread_t *thread_new_sized(const char *name, size_t work_queue_capacity) {
+thread_t* thread_new_sized(const char* name, size_t work_queue_capacity) {
   assert(name != NULL);
   assert(work_queue_capacity != 0);
 
-  thread_t *ret = static_cast<thread_t *>(osi_calloc(sizeof(thread_t)));
+  thread_t* ret = static_cast<thread_t*>(osi_calloc(sizeof(thread_t)));
 
   ret->reactor = reactor_new();
-  if (!ret->reactor)
-    goto error;
+  if (!ret->reactor) goto error;
 
   ret->work_queue = fixed_queue_new(work_queue_capacity);
-  if (!ret->work_queue)
-    goto error;
+  if (!ret->work_queue) goto error;
 
   // Start is on the stack, but we use a semaphore, so it's safe
   struct start_arg start;
   start.start_sem = semaphore_new(0);
-  if (!start.start_sem)
-    goto error;
+  if (!start.start_sem) goto error;
 
   strncpy(ret->name, name, THREAD_NAME_MAX);
   start.thread = ret;
@@ -89,8 +86,7 @@
   semaphore_wait(start.start_sem);
   semaphore_free(start.start_sem);
 
-  if (start.error)
-    goto error;
+  if (start.error) goto error;
 
   return ret;
 
@@ -103,13 +99,12 @@
   return NULL;
 }
 
-thread_t *thread_new(const char *name) {
+thread_t* thread_new(const char* name) {
   return thread_new_sized(name, DEFAULT_WORK_QUEUE_CAPACITY);
 }
 
-void thread_free(thread_t *thread) {
-  if (!thread)
-    return;
+void thread_free(thread_t* thread) {
+  if (!thread) return;
 
   thread_stop(thread);
   thread_join(thread);
@@ -119,7 +114,7 @@
   osi_free(thread);
 }
 
-void thread_join(thread_t *thread) {
+void thread_join(thread_t* thread) {
   assert(thread != NULL);
 
   // TODO(zachoverflow): use a compare and swap when ready
@@ -129,7 +124,7 @@
   }
 }
 
-bool thread_post(thread_t *thread, thread_fn func, void *context) {
+bool thread_post(thread_t* thread, thread_fn func, void* context) {
   assert(thread != NULL);
   assert(func != NULL);
 
@@ -139,71 +134,74 @@
 
   // Queue item is freed either when the queue itself is destroyed
   // or when the item is removed from the queue for dispatch.
-  work_item_t *item = (work_item_t *)osi_malloc(sizeof(work_item_t));
+  work_item_t* item = (work_item_t*)osi_malloc(sizeof(work_item_t));
   item->func = func;
   item->context = context;
   fixed_queue_enqueue(thread->work_queue, item);
   return true;
 }
 
-void thread_stop(thread_t *thread) {
+void thread_stop(thread_t* thread) {
   assert(thread != NULL);
   reactor_stop(thread->reactor);
 }
 
-bool thread_set_priority(thread_t *thread, int priority) {
-  if (!thread)
-    return false;
+bool thread_set_priority(thread_t* thread, int priority) {
+  if (!thread) return false;
 
   const int rc = setpriority(PRIO_PROCESS, thread->tid, priority);
   if (rc < 0) {
-    LOG_ERROR(LOG_TAG, "%s unable to set thread priority %d for tid %d, error %d",
-      __func__, priority, thread->tid, rc);
+    LOG_ERROR(LOG_TAG,
+              "%s unable to set thread priority %d for tid %d, error %d",
+              __func__, priority, thread->tid, rc);
     return false;
   }
 
   return true;
 }
 
-bool thread_is_self(const thread_t *thread) {
+bool thread_is_self(const thread_t* thread) {
   assert(thread != NULL);
   return !!pthread_equal(pthread_self(), thread->pthread);
 }
 
-reactor_t *thread_get_reactor(const thread_t *thread) {
+reactor_t* thread_get_reactor(const thread_t* thread) {
   assert(thread != NULL);
   return thread->reactor;
 }
 
-const char *thread_name(const thread_t *thread) {
+const char* thread_name(const thread_t* thread) {
   assert(thread != NULL);
   return thread->name;
 }
 
-static void *run_thread(void *start_arg) {
+static void* run_thread(void* start_arg) {
   assert(start_arg != NULL);
 
-  struct start_arg *start = static_cast<struct start_arg *>(start_arg);
-  thread_t *thread = start->thread;
+  struct start_arg* start = static_cast<struct start_arg*>(start_arg);
+  thread_t* thread = start->thread;
 
   assert(thread != NULL);
 
   if (prctl(PR_SET_NAME, (unsigned long)thread->name) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to set thread name: %s", __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to set thread name: %s", __func__,
+              strerror(errno));
     start->error = errno;
     semaphore_post(start->start_sem);
     return NULL;
   }
   thread->tid = gettid();
 
-  LOG_WARN(LOG_TAG, "%s: thread id %d, thread name %s started", __func__, thread->tid, thread->name);
+  LOG_WARN(LOG_TAG, "%s: thread id %d, thread name %s started", __func__,
+           thread->tid, thread->name);
 
   semaphore_post(start->start_sem);
 
   int fd = fixed_queue_get_dequeue_fd(thread->work_queue);
-  void *context = thread->work_queue;
+  void* context = thread->work_queue;
 
-  reactor_object_t *work_queue_object = reactor_register(thread->reactor, fd, context, work_queue_read_cb, NULL);
+  reactor_object_t* work_queue_object =
+      reactor_register(thread->reactor, fd, context, work_queue_read_cb, NULL);
   reactor_start(thread->reactor);
   reactor_unregister(work_queue_object);
 
@@ -211,26 +209,29 @@
   // This allows a caller to safely tear down by enqueuing a teardown
   // work item and then joining the thread.
   size_t count = 0;
-  work_item_t *item = static_cast<work_item_t *>(fixed_queue_try_dequeue(thread->work_queue));
+  work_item_t* item =
+      static_cast<work_item_t*>(fixed_queue_try_dequeue(thread->work_queue));
   while (item && count <= fixed_queue_capacity(thread->work_queue)) {
     item->func(item->context);
     osi_free(item);
-    item = static_cast<work_item_t *>(fixed_queue_try_dequeue(thread->work_queue));
+    item =
+        static_cast<work_item_t*>(fixed_queue_try_dequeue(thread->work_queue));
     ++count;
   }
 
   if (count > fixed_queue_capacity(thread->work_queue))
     LOG_DEBUG(LOG_TAG, "%s growing event queue on shutdown.", __func__);
 
-  LOG_WARN(LOG_TAG, "%s: thread id %d, thread name %s exited", __func__, thread->tid, thread->name);
+  LOG_WARN(LOG_TAG, "%s: thread id %d, thread name %s exited", __func__,
+           thread->tid, thread->name);
   return NULL;
 }
 
-static void work_queue_read_cb(void *context) {
+static void work_queue_read_cb(void* context) {
   assert(context != NULL);
 
-  fixed_queue_t *queue = (fixed_queue_t *)context;
-  work_item_t *item = static_cast<work_item_t *>(fixed_queue_dequeue(queue));
+  fixed_queue_t* queue = (fixed_queue_t*)context;
+  work_item_t* item = static_cast<work_item_t*>(fixed_queue_dequeue(queue));
   item->func(item->context);
   osi_free(item);
 }
diff --git a/osi/src/time.cc b/osi/src/time.cc
index c432a28..a36d411 100644
--- a/osi/src/time.cc
+++ b/osi/src/time.cc
@@ -23,7 +23,7 @@
 #include "osi/include/time.h"
 
 uint32_t time_get_os_boottime_ms(void) {
-  return (uint32_t) (time_get_os_boottime_us() / 1000);
+  return (uint32_t)(time_get_os_boottime_us() / 1000);
 }
 
 uint64_t time_get_os_boottime_us(void) {
@@ -31,5 +31,5 @@
   clock_gettime(CLOCK_BOOTTIME, &ts_now);
 
   return ((uint64_t)ts_now.tv_sec * 1000000L) +
-    ((uint64_t)ts_now.tv_nsec / 1000);
+         ((uint64_t)ts_now.tv_nsec / 1000);
 }
diff --git a/osi/src/wakelock.cc b/osi/src/wakelock.cc
index 534f82a..777aa8c 100644
--- a/osi/src/wakelock.cc
+++ b/osi/src/wakelock.cc
@@ -26,8 +26,8 @@
 #include <limits.h>
 #include <pthread.h>
 #include <string.h>
-#include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
 
@@ -41,11 +41,11 @@
 #include "osi/include/thread.h"
 #include "osi/include/wakelock.h"
 
-static bt_os_callouts_t *wakelock_os_callouts = NULL;
+static bt_os_callouts_t* wakelock_os_callouts = NULL;
 static bool is_native = true;
 
 static const clockid_t CLOCK_ID = CLOCK_BOOTTIME;
-static const char *WAKE_LOCK_ID = "bluetooth_timer";
+static const char* WAKE_LOCK_ID = "bluetooth_timer";
 static const std::string DEFAULT_WAKE_LOCK_PATH = "/sys/power/wake_lock";
 static const std::string DEFAULT_WAKE_UNLOCK_PATH = "/sys/power/wake_unlock";
 static std::string wake_lock_path;
@@ -89,12 +89,11 @@
 static void update_wakelock_acquired_stats(bt_status_t acquired_status);
 static void update_wakelock_released_stats(bt_status_t released_status);
 
-void wakelock_set_os_callouts(bt_os_callouts_t *callouts)
-{
+void wakelock_set_os_callouts(bt_os_callouts_t* callouts) {
   wakelock_os_callouts = callouts;
   is_native = (wakelock_os_callouts == NULL);
-  LOG_INFO(LOG_TAG, "%s set to %s",
-           __func__, (is_native)? "native" : "non-native");
+  LOG_INFO(LOG_TAG, "%s set to %s", __func__,
+           (is_native) ? "native" : "non-native");
 }
 
 bool wakelock_acquire(void) {
@@ -116,7 +115,8 @@
 }
 
 static bt_status_t wakelock_acquire_callout(void) {
-  return static_cast<bt_status_t>(wakelock_os_callouts->acquire_wake_lock(WAKE_LOCK_ID));
+  return static_cast<bt_status_t>(
+      wakelock_os_callouts->acquire_wake_lock(WAKE_LOCK_ID));
 }
 
 static bt_status_t wakelock_acquire_native(void) {
@@ -133,13 +133,13 @@
   long lock_name_len = strlen(WAKE_LOCK_ID);
   locked_id_len = write(wake_lock_fd, WAKE_LOCK_ID, lock_name_len);
   if (locked_id_len == -1) {
-    LOG_ERROR(LOG_TAG, "%s wake lock not acquired: %s",
-              __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s wake lock not acquired: %s", __func__,
+              strerror(errno));
     return BT_STATUS_FAIL;
   } else if (locked_id_len < lock_name_len) {
     // TODO (jamuraa): this is weird. maybe we should release and retry.
-    LOG_WARN(LOG_TAG, "%s wake lock truncated to %zd chars",
-             __func__, locked_id_len);
+    LOG_WARN(LOG_TAG, "%s wake lock truncated to %zd chars", __func__,
+             locked_id_len);
   }
   return BT_STATUS_SUCCESS;
 }
@@ -160,7 +160,8 @@
 }
 
 static bt_status_t wakelock_release_callout(void) {
-  return static_cast<bt_status_t>(wakelock_os_callouts->release_wake_lock(WAKE_LOCK_ID));
+  return static_cast<bt_status_t>(
+      wakelock_os_callouts->release_wake_lock(WAKE_LOCK_ID));
 }
 
 static bt_status_t wakelock_release_native(void) {
@@ -171,8 +172,8 @@
 
   ssize_t wrote_name_len = write(wake_unlock_fd, WAKE_LOCK_ID, locked_id_len);
   if (wrote_name_len == -1) {
-    LOG_ERROR(LOG_TAG, "%s can't release wake lock: %s",
-              __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s can't release wake lock: %s", __func__,
+              strerror(errno));
   } else if (wrote_name_len < locked_id_len) {
     LOG_ERROR(LOG_TAG, "%s lock release only wrote %zd, assuming released",
               __func__, wrote_name_len);
@@ -184,29 +185,26 @@
   pthread_mutex_init(&monitor, NULL);
   reset_wakelock_stats();
 
-  if (is_native)
-    wakelock_initialize_native();
+  if (is_native) wakelock_initialize_native();
 }
 
 static void wakelock_initialize_native(void) {
   LOG_DEBUG(LOG_TAG, "%s opening wake locks", __func__);
 
-  if (wake_lock_path.empty())
-    wake_lock_path = DEFAULT_WAKE_LOCK_PATH;
+  if (wake_lock_path.empty()) wake_lock_path = DEFAULT_WAKE_LOCK_PATH;
 
   wake_lock_fd = open(wake_lock_path.c_str(), O_RDWR | O_CLOEXEC);
   if (wake_lock_fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s can't open wake lock %s: %s",
-              __func__, wake_lock_path.c_str(), strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s can't open wake lock %s: %s", __func__,
+              wake_lock_path.c_str(), strerror(errno));
   }
 
-  if (wake_unlock_path.empty())
-    wake_unlock_path = DEFAULT_WAKE_UNLOCK_PATH;
+  if (wake_unlock_path.empty()) wake_unlock_path = DEFAULT_WAKE_UNLOCK_PATH;
 
   wake_unlock_fd = open(wake_unlock_path.c_str(), O_RDWR | O_CLOEXEC);
   if (wake_unlock_fd == INVALID_FD) {
-    LOG_ERROR(LOG_TAG, "%s can't open wake unlock %s: %s",
-              __func__, wake_unlock_path.c_str(), strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s can't open wake unlock %s: %s", __func__,
+              wake_unlock_path.c_str(), strerror(errno));
   }
 }
 
@@ -217,19 +215,17 @@
   pthread_mutex_destroy(&monitor);
 }
 
-void wakelock_set_paths(const char *lock_path, const char *unlock_path) {
-  if (lock_path)
-    wake_lock_path = lock_path;
+void wakelock_set_paths(const char* lock_path, const char* unlock_path) {
+  if (lock_path) wake_lock_path = lock_path;
 
-  if (unlock_path)
-    wake_unlock_path = unlock_path;
+  if (unlock_path) wake_unlock_path = unlock_path;
 }
 
 static period_ms_t now(void) {
   struct timespec ts;
   if (clock_gettime(CLOCK_ID, &ts) == -1) {
-    LOG_ERROR(LOG_TAG, "%s unable to get current time: %s",
-              __func__, strerror(errno));
+    LOG_ERROR(LOG_TAG, "%s unable to get current time: %s", __func__,
+              strerror(errno));
     return 0;
   }
 
@@ -349,27 +345,26 @@
 
   if (wakelock_stats.is_acquired) {
     delta_ms = now_ms - wakelock_stats.last_acquired_timestamp_ms;
-    if (delta_ms > max_interval)
-      max_interval = delta_ms;
-    if (delta_ms < min_interval)
-      min_interval = delta_ms;
+    if (delta_ms > max_interval) max_interval = delta_ms;
+    if (delta_ms < min_interval) min_interval = delta_ms;
     last_interval = delta_ms;
   }
   period_ms_t total_interval =
-    wakelock_stats.total_acquired_interval_ms + delta_ms;
+      wakelock_stats.total_acquired_interval_ms + delta_ms;
 
   if (wakelock_stats.acquired_count > 0)
     ave_interval = total_interval / wakelock_stats.acquired_count;
 
   dprintf(fd, "\nBluetooth Wakelock Statistics:\n");
   dprintf(fd, "  Is acquired                    : %s\n",
-          wakelock_stats.is_acquired? "true" : "false");
+          wakelock_stats.is_acquired ? "true" : "false");
   dprintf(fd, "  Acquired/released count        : %zu / %zu\n",
           wakelock_stats.acquired_count, wakelock_stats.released_count);
   dprintf(fd, "  Acquired/released error count  : %zu / %zu\n",
           wakelock_stats.acquired_errors, wakelock_stats.released_errors);
   dprintf(fd, "  Last acquire/release error code: %d / %d\n",
-          wakelock_stats.last_acquired_error, wakelock_stats.last_released_error);
+          wakelock_stats.last_acquired_error,
+          wakelock_stats.last_released_error);
   dprintf(fd, "  Last acquired time (ms)        : %llu\n",
           (unsigned long long)last_interval);
   dprintf(fd, "  Acquired time min/max/avg (ms) : %llu / %llu / %llu\n",
@@ -377,9 +372,9 @@
           (unsigned long long)ave_interval);
   dprintf(fd, "  Total acquired time (ms)       : %llu\n",
           (unsigned long long)total_interval);
-  dprintf(fd, "  Total run time (ms)            : %llu\n",
-          (unsigned long long)(now_ms - wakelock_stats.last_reset_timestamp_ms));
+  dprintf(
+      fd, "  Total run time (ms)            : %llu\n",
+      (unsigned long long)(now_ms - wakelock_stats.last_reset_timestamp_ms));
 
-  if (lock_error == 0)
-    pthread_mutex_unlock(&monitor);
+  if (lock_error == 0) pthread_mutex_unlock(&monitor);
 }
diff --git a/osi/test/AlarmTestHarness.cc b/osi/test/AlarmTestHarness.cc
index 286a3e1..ee6aaa3 100644
--- a/osi/test/AlarmTestHarness.cc
+++ b/osi/test/AlarmTestHarness.cc
@@ -25,24 +25,18 @@
 
 static bool is_wake_lock_acquired = false;
 
-static int acquire_wake_lock_cb(const char *lock_name)
-{
+static int acquire_wake_lock_cb(const char* lock_name) {
   is_wake_lock_acquired = true;
   return BT_STATUS_SUCCESS;
 }
 
-static int release_wake_lock_cb(const char *lock_name)
-{
+static int release_wake_lock_cb(const char* lock_name) {
   is_wake_lock_acquired = false;
   return BT_STATUS_SUCCESS;
 }
 
 static bt_os_callouts_t bt_wakelock_callouts = {
-  sizeof(bt_os_callouts_t),
-  NULL,
-  acquire_wake_lock_cb,
-  release_wake_lock_cb
-};
+    sizeof(bt_os_callouts_t), NULL, acquire_wake_lock_cb, release_wake_lock_cb};
 
 void AlarmTestHarness::SetUp() {
   AllocationTestHarness::SetUp();
@@ -60,6 +54,4 @@
   AllocationTestHarness::TearDown();
 }
 
-bool AlarmTestHarness::WakeLockHeld() {
-  return is_wake_lock_acquired;
-}
+bool AlarmTestHarness::WakeLockHeld() { return is_wake_lock_acquired; }
diff --git a/osi/test/AlarmTestHarness.h b/osi/test/AlarmTestHarness.h
index d37ded0..39dd218 100644
--- a/osi/test/AlarmTestHarness.h
+++ b/osi/test/AlarmTestHarness.h
@@ -23,11 +23,11 @@
 extern int64_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS;
 
 class AlarmTestHarness : public AllocationTestHarness {
-  protected:
-    virtual void SetUp();
-    virtual void TearDown();
+ protected:
+  virtual void SetUp();
+  virtual void TearDown();
 
-  public:
-    // Returns true if a wake lock is held.
-    bool WakeLockHeld();
+ public:
+  // Returns true if a wake lock is held.
+  bool WakeLockHeld();
 };
diff --git a/osi/test/AllocationTestHarness.cc b/osi/test/AllocationTestHarness.cc
index 5386237..8df097f 100644
--- a/osi/test/AllocationTestHarness.cc
+++ b/osi/test/AllocationTestHarness.cc
@@ -28,5 +28,6 @@
 }
 
 void AllocationTestHarness::TearDown() {
-  EXPECT_EQ(0U, allocation_tracker_expect_no_allocations()) << "not all memory freed";
+  EXPECT_EQ(0U, allocation_tracker_expect_no_allocations())
+      << "not all memory freed";
 }
diff --git a/osi/test/AllocationTestHarness.h b/osi/test/AllocationTestHarness.h
index 65fc0b0..cbf29d8 100644
--- a/osi/test/AllocationTestHarness.h
+++ b/osi/test/AllocationTestHarness.h
@@ -21,7 +21,7 @@
 #include <gtest/gtest.h>
 
 class AllocationTestHarness : public ::testing::Test {
-  protected:
-    virtual void SetUp();
-    virtual void TearDown();
+ protected:
+  virtual void SetUp();
+  virtual void TearDown();
 };
diff --git a/osi/test/alarm_test.cc b/osi/test/alarm_test.cc
index 331a043..dd4bbc1 100644
--- a/osi/test/alarm_test.cc
+++ b/osi/test/alarm_test.cc
@@ -26,63 +26,58 @@
 #include "osi/include/semaphore.h"
 #include "osi/include/thread.h"
 
-static semaphore_t *semaphore;
+static semaphore_t* semaphore;
 static int cb_counter;
 static int cb_misordered_counter;
 
 static const uint64_t EPSILON_MS = 50;
 
-static void msleep(uint64_t ms) {
-  usleep(ms * 1000);
-}
+static void msleep(uint64_t ms) { usleep(ms * 1000); }
 
 class AlarmTest : public AlarmTestHarness {
-  protected:
-    virtual void SetUp() {
-      AlarmTestHarness::SetUp();
-      cb_counter = 0;
-      cb_misordered_counter = 0;
+ protected:
+  virtual void SetUp() {
+    AlarmTestHarness::SetUp();
+    cb_counter = 0;
+    cb_misordered_counter = 0;
 
-      semaphore = semaphore_new(0);
-    }
+    semaphore = semaphore_new(0);
+  }
 
-    virtual void TearDown() {
-      semaphore_free(semaphore);
-      AlarmTestHarness::TearDown();
-    }
+  virtual void TearDown() {
+    semaphore_free(semaphore);
+    AlarmTestHarness::TearDown();
+  }
 };
 
-static void cb(UNUSED_ATTR void *data) {
+static void cb(UNUSED_ATTR void* data) {
   ++cb_counter;
   semaphore_post(semaphore);
 }
 
-static void ordered_cb(void *data) {
+static void ordered_cb(void* data) {
   int i = PTR_TO_INT(data);
-  if (i != cb_counter)
-    cb_misordered_counter++;
+  if (i != cb_counter) cb_misordered_counter++;
   ++cb_counter;
   semaphore_post(semaphore);
 }
 
 TEST_F(AlarmTest, test_new_free_simple) {
-  alarm_t *alarm = alarm_new("alarm_test.test_new_free_simple");
+  alarm_t* alarm = alarm_new("alarm_test.test_new_free_simple");
   ASSERT_TRUE(alarm != NULL);
   alarm_free(alarm);
 }
 
-TEST_F(AlarmTest, test_free_null) {
-  alarm_free(NULL);
-}
+TEST_F(AlarmTest, test_free_null) { alarm_free(NULL); }
 
 TEST_F(AlarmTest, test_simple_cancel) {
-  alarm_t *alarm = alarm_new("alarm_test.test_simple_cancel");
+  alarm_t* alarm = alarm_new("alarm_test.test_simple_cancel");
   alarm_cancel(alarm);
   alarm_free(alarm);
 }
 
 TEST_F(AlarmTest, test_cancel) {
-  alarm_t *alarm = alarm_new("alarm_test.test_cancel");
+  alarm_t* alarm = alarm_new("alarm_test.test_cancel");
   alarm_set(alarm, 10, cb, NULL);
   alarm_cancel(alarm);
 
@@ -94,7 +89,7 @@
 }
 
 TEST_F(AlarmTest, test_cancel_idempotent) {
-  alarm_t *alarm = alarm_new("alarm_test.test_cancel_idempotent");
+  alarm_t* alarm = alarm_new("alarm_test.test_cancel_idempotent");
   alarm_set(alarm, 10, cb, NULL);
   alarm_cancel(alarm);
   alarm_cancel(alarm);
@@ -103,7 +98,7 @@
 }
 
 TEST_F(AlarmTest, test_set_short) {
-  alarm_t *alarm = alarm_new("alarm_test.test_set_short");
+  alarm_t* alarm = alarm_new("alarm_test.test_set_short");
 
   alarm_set(alarm, 10, cb, NULL);
 
@@ -119,7 +114,7 @@
 }
 
 TEST_F(AlarmTest, test_set_short_periodic) {
-  alarm_t *alarm = alarm_new_periodic("alarm_test.test_set_short_periodic");
+  alarm_t* alarm = alarm_new_periodic("alarm_test.test_set_short_periodic");
 
   alarm_set(alarm, 10, cb, NULL);
 
@@ -139,7 +134,7 @@
 }
 
 TEST_F(AlarmTest, test_set_zero_periodic) {
-  alarm_t *alarm = alarm_new_periodic("alarm_test.test_set_zero_periodic");
+  alarm_t* alarm = alarm_new_periodic("alarm_test.test_set_zero_periodic");
 
   alarm_set(alarm, 0, cb, NULL);
 
@@ -158,7 +153,7 @@
 }
 
 TEST_F(AlarmTest, test_set_long) {
-  alarm_t *alarm = alarm_new("alarm_test.test_set_long");
+  alarm_t* alarm = alarm_new("alarm_test.test_set_long");
   alarm_set(alarm, TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb, NULL);
 
   EXPECT_EQ(cb_counter, 0);
@@ -173,10 +168,8 @@
 }
 
 TEST_F(AlarmTest, test_set_short_short) {
-  alarm_t *alarm[2] = {
-    alarm_new("alarm_test.test_set_short_short_0"),
-    alarm_new("alarm_test.test_set_short_short_1")
-  };
+  alarm_t* alarm[2] = {alarm_new("alarm_test.test_set_short_short_0"),
+                       alarm_new("alarm_test.test_set_short_short_1")};
 
   alarm_set(alarm[0], 10, cb, NULL);
   alarm_set(alarm[1], 20, cb, NULL);
@@ -199,13 +192,12 @@
 }
 
 TEST_F(AlarmTest, test_set_short_long) {
-  alarm_t *alarm[2] = {
-    alarm_new("alarm_test.test_set_short_long_0"),
-    alarm_new("alarm_test.test_set_short_long_1")
-  };
+  alarm_t* alarm[2] = {alarm_new("alarm_test.test_set_short_long_0"),
+                       alarm_new("alarm_test.test_set_short_long_1")};
 
   alarm_set(alarm[0], 10, cb, NULL);
-  alarm_set(alarm[1], 10 + TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb, NULL);
+  alarm_set(alarm[1], 10 + TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb,
+            NULL);
 
   EXPECT_EQ(cb_counter, 0);
   EXPECT_TRUE(WakeLockHeld());
@@ -225,13 +217,12 @@
 }
 
 TEST_F(AlarmTest, test_set_long_long) {
-  alarm_t *alarm[2] = {
-    alarm_new("alarm_test.test_set_long_long_0"),
-    alarm_new("alarm_test.test_set_long_long_1")
-  };
+  alarm_t* alarm[2] = {alarm_new("alarm_test.test_set_long_long_0"),
+                       alarm_new("alarm_test.test_set_long_long_1")};
 
   alarm_set(alarm[0], TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb, NULL);
-  alarm_set(alarm[1], 2 * (TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS), cb, NULL);
+  alarm_set(alarm[1], 2 * (TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS), cb,
+            NULL);
 
   EXPECT_EQ(cb_counter, 0);
   EXPECT_FALSE(WakeLockHeld());
@@ -251,9 +242,9 @@
 }
 
 TEST_F(AlarmTest, test_is_scheduled) {
-  alarm_t *alarm = alarm_new("alarm_test.test_is_scheduled");
+  alarm_t* alarm = alarm_new("alarm_test.test_is_scheduled");
 
-  EXPECT_FALSE(alarm_is_scheduled((alarm_t *)NULL));
+  EXPECT_FALSE(alarm_is_scheduled((alarm_t*)NULL));
   EXPECT_FALSE(alarm_is_scheduled(alarm));
   alarm_set(alarm, TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb, NULL);
   EXPECT_TRUE(alarm_is_scheduled(alarm));
@@ -272,11 +263,11 @@
 
 // Test whether the callbacks are invoked in the expected order
 TEST_F(AlarmTest, test_callback_ordering) {
-  alarm_t *alarms[100];
+  alarm_t* alarms[100];
 
   for (int i = 0; i < 100; i++) {
-    const std::string alarm_name = "alarm_test.test_callback_ordering[" +
-      std::to_string(i) + "]";
+    const std::string alarm_name =
+        "alarm_test.test_callback_ordering[" + std::to_string(i) + "]";
     alarms[i] = alarm_new(alarm_name.c_str());
   }
 
@@ -291,8 +282,7 @@
   EXPECT_EQ(cb_counter, 100);
   EXPECT_EQ(cb_misordered_counter, 0);
 
-  for (int i = 0; i < 100; i++)
-    alarm_free(alarms[i]);
+  for (int i = 0; i < 100; i++) alarm_free(alarms[i]);
 
   EXPECT_FALSE(WakeLockHeld());
 }
@@ -300,16 +290,16 @@
 // Test whether the callbacks are involed in the expected order on a
 // separate queue.
 TEST_F(AlarmTest, test_callback_ordering_on_queue) {
-  alarm_t *alarms[100];
-  fixed_queue_t *queue = fixed_queue_new(SIZE_MAX);
-  thread_t *thread = thread_new("timers.test_callback_ordering_on_queue.thread");
+  alarm_t* alarms[100];
+  fixed_queue_t* queue = fixed_queue_new(SIZE_MAX);
+  thread_t* thread =
+      thread_new("timers.test_callback_ordering_on_queue.thread");
 
   alarm_register_processing_queue(queue, thread);
 
   for (int i = 0; i < 100; i++) {
     const std::string alarm_name =
-      "alarm_test.test_callback_ordering_on_queue[" +
-      std::to_string(i) + "]";
+        "alarm_test.test_callback_ordering_on_queue[" + std::to_string(i) + "]";
     alarms[i] = alarm_new(alarm_name.c_str());
   }
 
@@ -324,8 +314,7 @@
   EXPECT_EQ(cb_counter, 100);
   EXPECT_EQ(cb_misordered_counter, 0);
 
-  for (int i = 0; i < 100; i++)
-    alarm_free(alarms[i]);
+  for (int i = 0; i < 100; i++) alarm_free(alarms[i]);
 
   EXPECT_FALSE(WakeLockHeld());
 
@@ -337,17 +326,17 @@
 // Test whether unregistering a processing queue cancels all timers using
 // that queue.
 TEST_F(AlarmTest, test_unregister_processing_queue) {
-  alarm_t *alarms[100];
-  fixed_queue_t *queue = fixed_queue_new(SIZE_MAX);
-  thread_t *thread =
-    thread_new("timers.test_unregister_processing_queue.thread");
+  alarm_t* alarms[100];
+  fixed_queue_t* queue = fixed_queue_new(SIZE_MAX);
+  thread_t* thread =
+      thread_new("timers.test_unregister_processing_queue.thread");
 
   alarm_register_processing_queue(queue, thread);
 
   for (int i = 0; i < 100; i++) {
     const std::string alarm_name =
-      "alarm_test.test_unregister_processing_queue[" +
-      std::to_string(i) + "]";
+        "alarm_test.test_unregister_processing_queue[" + std::to_string(i) +
+        "]";
     alarms[i] = alarm_new(alarm_name.c_str());
   }
 
@@ -356,7 +345,8 @@
     alarm_set_on_queue(alarms[i], 100, ordered_cb, INT_TO_PTR(i), queue);
   }
   for (int i = 50; i < 100; i++) {
-    alarm_set_on_queue(alarms[i], 1000 * 1000, ordered_cb, INT_TO_PTR(i), queue);
+    alarm_set_on_queue(alarms[i], 1000 * 1000, ordered_cb, INT_TO_PTR(i),
+                       queue);
   }
 
   // Wait until half of the timers have expired
@@ -395,17 +385,17 @@
 // Test whether unregistering a processing queue cancels all periodic timers
 // using that queue.
 TEST_F(AlarmTest, test_periodic_unregister_processing_queue) {
-  alarm_t *alarms[5];
-  fixed_queue_t *queue = fixed_queue_new(SIZE_MAX);
-  thread_t *thread =
-    thread_new("timers.test_periodic_unregister_processing_queue.thread");
+  alarm_t* alarms[5];
+  fixed_queue_t* queue = fixed_queue_new(SIZE_MAX);
+  thread_t* thread =
+      thread_new("timers.test_periodic_unregister_processing_queue.thread");
 
   alarm_register_processing_queue(queue, thread);
 
   for (int i = 0; i < 5; i++) {
     const std::string alarm_name =
-      "alarm_test.test_periodic_unregister_processing_queue[" +
-      std::to_string(i) + "]";
+        "alarm_test.test_periodic_unregister_processing_queue[" +
+        std::to_string(i) + "]";
     alarms[i] = alarm_new_periodic(alarm_name.c_str());
   }
 
@@ -453,9 +443,9 @@
 // Try to catch any race conditions between the timer callback and |alarm_free|.
 TEST_F(AlarmTest, test_callback_free_race) {
   for (int i = 0; i < 1000; ++i) {
-    const std::string alarm_name = "alarm_test.test_callback_free_race[" +
-      std::to_string(i) + "]";
-    alarm_t *alarm = alarm_new(alarm_name.c_str());
+    const std::string alarm_name =
+        "alarm_test.test_callback_free_race[" + std::to_string(i) + "]";
+    alarm_t* alarm = alarm_new(alarm_name.c_str());
     alarm_set(alarm, 0, cb, NULL);
     alarm_free(alarm);
   }
diff --git a/osi/test/allocation_tracker_test.cc b/osi/test/allocation_tracker_test.cc
index ce465e9..cf979cb 100644
--- a/osi/test/allocation_tracker_test.cc
+++ b/osi/test/allocation_tracker_test.cc
@@ -25,14 +25,16 @@
 static const allocator_id_t allocator_id = 5;
 
 TEST(AllocationTrackerTest, test_uninit_no_bad_effects) {
-  void *dummy_allocation = malloc(4);
+  void* dummy_allocation = malloc(4);
 
   // Ensure uninitialized state (previous tests may have called init)
   allocation_tracker_uninit();
 
   EXPECT_EQ(4U, allocation_tracker_resize_for_canary(4));
   allocation_tracker_notify_alloc(allocator_id, dummy_allocation, 4);
-  EXPECT_EQ(0U, allocation_tracker_expect_no_allocations()); // should not have registered an allocation
+  EXPECT_EQ(0U, allocation_tracker_expect_no_allocations());  // should not have
+                                                              // registered an
+                                                              // allocation
   allocation_tracker_notify_free(allocator_id, dummy_allocation);
   EXPECT_EQ(0U, allocation_tracker_expect_no_allocations());
 
@@ -46,11 +48,15 @@
   size_t with_canary_size = allocation_tracker_resize_for_canary(4);
   EXPECT_TRUE(with_canary_size > 4);
 
-  void *dummy_allocation = malloc(with_canary_size);
-  void *useable_ptr = allocation_tracker_notify_alloc(allocator_id, dummy_allocation, 4);
+  void* dummy_allocation = malloc(with_canary_size);
+  void* useable_ptr =
+      allocation_tracker_notify_alloc(allocator_id, dummy_allocation, 4);
   EXPECT_TRUE(useable_ptr > dummy_allocation);
-  EXPECT_EQ(4U, allocation_tracker_expect_no_allocations()); // should have registered the allocation
-  void *freeable_ptr = allocation_tracker_notify_free(allocator_id, useable_ptr);
+  EXPECT_EQ(4U, allocation_tracker_expect_no_allocations());  // should have
+                                                              // registered the
+                                                              // allocation
+  void* freeable_ptr =
+      allocation_tracker_notify_free(allocator_id, useable_ptr);
   EXPECT_EQ(dummy_allocation, freeable_ptr);
   EXPECT_EQ(0U, allocation_tracker_expect_no_allocations());
 
diff --git a/osi/test/allocator_test.cc b/osi/test/allocator_test.cc
index ca408fa..9dc6302 100644
--- a/osi/test/allocator_test.cc
+++ b/osi/test/allocator_test.cc
@@ -28,7 +28,7 @@
 TEST_F(AllocatorTest, test_osi_strndup) {
   char str[] = "IloveBluetooth";
   size_t len = strlen(str);
-  char *copy_str = NULL;
+  char* copy_str = NULL;
 
   // len == 0
   copy_str = osi_strndup(str, 0);
diff --git a/osi/test/array_test.cc b/osi/test/array_test.cc
index 5c1e1b4..2addadc 100644
--- a/osi/test/array_test.cc
+++ b/osi/test/array_test.cc
@@ -7,64 +7,56 @@
 class ArrayTest : public AllocationTestHarness {};
 
 TEST_F(ArrayTest, test_new_free_simple) {
-  array_t *array = array_new(4);
+  array_t* array = array_new(4);
   ASSERT_TRUE(array != NULL);
   array_free(array);
 }
 
-TEST_F(ArrayTest, test_free_null) {
-  array_free(NULL);
-}
+TEST_F(ArrayTest, test_free_null) { array_free(NULL); }
 
 TEST_F(ArrayTest, test_invalid_ptr) {
-  array_t *array = array_new(4);
+  array_t* array = array_new(4);
   EXPECT_DEATH(array_ptr(array), "");
   array_free(array);
 }
 
 TEST_F(ArrayTest, test_invalid_at) {
-  array_t *array = array_new(4);
+  array_t* array = array_new(4);
   EXPECT_DEATH(array_at(array, 1), "");
   array_free(array);
 }
 
 TEST_F(ArrayTest, test_append_value) {
-  array_t *array = array_new(sizeof(int));
+  array_t* array = array_new(sizeof(int));
   for (int i = 0; i < 100; ++i) {
     array_append_value(array, i * i);
   }
   for (int i = 0; i < 100; ++i) {
-    EXPECT_EQ(*(int *)array_at(array, i), i * i);
+    EXPECT_EQ(*(int*)array_at(array, i), i * i);
   }
   array_free(array);
 }
 
 TEST_F(ArrayTest, test_append_ptr) {
   int items[100];
-  array_t *array = array_new(sizeof(int));
+  array_t* array = array_new(sizeof(int));
   for (int i = 0; i < 100; ++i) {
     items[i] = i * i;
     array_append_ptr(array, &items[i]);
   }
   for (int i = 0; i < 100; ++i) {
-    EXPECT_EQ(*(int *)array_at(array, i), i * i);
+    EXPECT_EQ(*(int*)array_at(array, i), i * i);
   }
   array_free(array);
 }
 
 TEST_F(ArrayTest, test_large_element) {
   char strings[][128] = {
-    "string 1",
-    "string 2",
-    "string 3",
-    "string 4",
-    "string 5",
-    "string 6",
-    "string 7",
-    "string 8",
+      "string 1", "string 2", "string 3", "string 4",
+      "string 5", "string 6", "string 7", "string 8",
   };
 
-  array_t *array = array_new(128);
+  array_t* array = array_new(128);
   for (int i = 0; i < 100; ++i) {
     array_append_ptr(array, strings[i % 8]);
   }
diff --git a/osi/test/config_test.cc b/osi/test/config_test.cc
index 3348880..6712222 100644
--- a/osi/test/config_test.cc
+++ b/osi/test/config_test.cc
@@ -6,7 +6,7 @@
 
 static const char CONFIG_FILE[] = "/data/local/tmp/config_test.conf";
 static const char CONFIG_FILE_CONTENT[] =
-"                                                                                    \n\
+    "                                                                                    \n\
 first_key=value                                                                      \n\
                                                                                      \n\
 # Device ID (DID) configuration                                                      \n\
@@ -47,65 +47,66 @@
 ";
 
 class ConfigTest : public AllocationTestHarness {
-  protected:
-    virtual void SetUp() {
-      AllocationTestHarness::SetUp();
-      FILE *fp = fopen(CONFIG_FILE, "wt");
-      fwrite(CONFIG_FILE_CONTENT, 1, sizeof(CONFIG_FILE_CONTENT), fp);
-      fclose(fp);
-    }
+ protected:
+  virtual void SetUp() {
+    AllocationTestHarness::SetUp();
+    FILE* fp = fopen(CONFIG_FILE, "wt");
+    fwrite(CONFIG_FILE_CONTENT, 1, sizeof(CONFIG_FILE_CONTENT), fp);
+    fclose(fp);
+  }
 };
 
 TEST_F(ConfigTest, config_new_empty) {
-  config_t *config = config_new_empty();
+  config_t* config = config_new_empty();
   EXPECT_TRUE(config != NULL);
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_new_no_file) {
-  config_t *config = config_new("/meow");
+  config_t* config = config_new("/meow");
   EXPECT_TRUE(config == NULL);
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_new) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_TRUE(config != NULL);
   config_free(config);
 }
 
-TEST_F(ConfigTest, config_free_null) {
-  config_free(NULL);
-}
+TEST_F(ConfigTest, config_free_null) { config_free(NULL); }
 
 TEST_F(ConfigTest, config_new_clone) {
-  config_t *config = config_new(CONFIG_FILE);
-  config_t *clone = config_new_clone(config);
+  config_t* config = config_new(CONFIG_FILE);
+  config_t* clone = config_new_clone(config);
 
   config_set_string(clone, CONFIG_DEFAULT_SECTION, "first_key", "not_value");
 
-  EXPECT_STRNE(config_get_string(config, CONFIG_DEFAULT_SECTION, "first_key", "one"),
-               config_get_string(clone, CONFIG_DEFAULT_SECTION, "first_key", "one"));
+  EXPECT_STRNE(
+      config_get_string(config, CONFIG_DEFAULT_SECTION, "first_key", "one"),
+      config_get_string(clone, CONFIG_DEFAULT_SECTION, "first_key", "one"));
 
   config_free(config);
   config_free(clone);
 }
 
 TEST_F(ConfigTest, config_has_section) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_TRUE(config_has_section(config, "DID"));
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_has_key_in_default_section) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_TRUE(config_has_key(config, CONFIG_DEFAULT_SECTION, "first_key"));
-  EXPECT_STREQ(config_get_string(config, CONFIG_DEFAULT_SECTION, "first_key", "meow"), "value");
+  EXPECT_STREQ(
+      config_get_string(config, CONFIG_DEFAULT_SECTION, "first_key", "meow"),
+      "value");
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_has_keys) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_TRUE(config_has_key(config, "DID", "recordNumber"));
   EXPECT_TRUE(config_has_key(config, "DID", "primaryRecord"));
   EXPECT_TRUE(config_has_key(config, "DID", "productId"));
@@ -114,7 +115,7 @@
 }
 
 TEST_F(ConfigTest, config_no_bad_keys) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_FALSE(config_has_key(config, "DID_BAD", "primaryRecord"));
   EXPECT_FALSE(config_has_key(config, "DID", "primaryRecord_BAD"));
   EXPECT_FALSE(config_has_key(config, CONFIG_DEFAULT_SECTION, "primaryRecord"));
@@ -122,19 +123,19 @@
 }
 
 TEST_F(ConfigTest, config_get_int_version) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_EQ(config_get_int(config, "DID", "version", 0), 0x1436);
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_get_int_default) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_EQ(config_get_int(config, "DID", "primaryRecord", 123), 123);
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_remove_section) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_TRUE(config_remove_section(config, "DID"));
   EXPECT_FALSE(config_has_section(config, "DID"));
   EXPECT_FALSE(config_has_key(config, "DID", "productId"));
@@ -142,13 +143,13 @@
 }
 
 TEST_F(ConfigTest, config_remove_section_missing) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_FALSE(config_remove_section(config, "not a section"));
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_remove_key) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_EQ(config_get_int(config, "DID", "productId", 999), 0x1200);
   EXPECT_TRUE(config_remove_key(config, "DID", "productId"));
   EXPECT_FALSE(config_has_key(config, "DID", "productId"));
@@ -156,7 +157,7 @@
 }
 
 TEST_F(ConfigTest, config_remove_key_missing) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_EQ(config_get_int(config, "DID", "productId", 999), 0x1200);
   EXPECT_TRUE(config_remove_key(config, "DID", "productId"));
   EXPECT_EQ(config_get_int(config, "DID", "productId", 999), 999);
@@ -164,30 +165,30 @@
 }
 
 TEST_F(ConfigTest, config_section_begin) {
-  config_t *config = config_new(CONFIG_FILE);
-  const config_section_node_t *section = config_section_begin(config);
+  config_t* config = config_new(CONFIG_FILE);
+  const config_section_node_t* section = config_section_begin(config);
   EXPECT_TRUE(section != NULL);
-  const char *section_name = config_section_name(section);
+  const char* section_name = config_section_name(section);
   EXPECT_TRUE(section != NULL);
   EXPECT_TRUE(!strcmp(section_name, CONFIG_DEFAULT_SECTION));
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_section_next) {
-  config_t *config = config_new(CONFIG_FILE);
-  const config_section_node_t *section = config_section_begin(config);
+  config_t* config = config_new(CONFIG_FILE);
+  const config_section_node_t* section = config_section_begin(config);
   EXPECT_TRUE(section != NULL);
   section = config_section_next(section);
   EXPECT_TRUE(section != NULL);
-  const char *section_name = config_section_name(section);
+  const char* section_name = config_section_name(section);
   EXPECT_TRUE(section != NULL);
   EXPECT_TRUE(!strcmp(section_name, "DID"));
   config_free(config);
 }
 
 TEST_F(ConfigTest, config_section_end) {
-  config_t *config = config_new(CONFIG_FILE);
-  const config_section_node_t * section = config_section_begin(config);
+  config_t* config = config_new(CONFIG_FILE);
+  const config_section_node_t* section = config_section_begin(config);
   section = config_section_next(section);
   section = config_section_next(section);
   EXPECT_EQ(section, config_section_end(config));
@@ -195,7 +196,7 @@
 }
 
 TEST_F(ConfigTest, config_save_basic) {
-  config_t *config = config_new(CONFIG_FILE);
+  config_t* config = config_new(CONFIG_FILE);
   EXPECT_TRUE(config_save(config, CONFIG_FILE));
   config_free(config);
 }
diff --git a/osi/test/data_dispatcher_test.cc b/osi/test/data_dispatcher_test.cc
index 9f00bb4..cc7d78d 100644
--- a/osi/test/data_dispatcher_test.cc
+++ b/osi/test/data_dispatcher_test.cc
@@ -22,22 +22,23 @@
 static char dummy_data_1[42] = "testing is good for your sanity";
 
 TEST_F(DataDispatcherTest, test_new_free_simple) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
   ASSERT_TRUE(dispatcher != NULL);
   data_dispatcher_free(dispatcher);
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_single_to_nowhere) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
-  EXPECT_FALSE(data_dispatcher_dispatch(dispatcher, DUMMY_TYPE_0, dummy_data_0));
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
+  EXPECT_FALSE(
+      data_dispatcher_dispatch(dispatcher, DUMMY_TYPE_0, dummy_data_0));
   data_dispatcher_free(dispatcher);
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_single_to_single) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register a queue
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
@@ -46,7 +47,7 @@
 
   // Did we get it?
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue));
-  EXPECT_STREQ(dummy_data_0, (char *)fixed_queue_try_dequeue(dummy_queue));
+  EXPECT_STREQ(dummy_data_0, (char*)fixed_queue_try_dequeue(dummy_queue));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   fixed_queue_free(dummy_queue, NULL);
@@ -54,11 +55,11 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_single_to_multiple) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register two queues
-  fixed_queue_t *dummy_queue0 = fixed_queue_new(DUMMY_QUEUE_SIZE);
-  fixed_queue_t *dummy_queue1 = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue0 = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue1 = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue0);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_1, dummy_queue1);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue0));
@@ -70,7 +71,7 @@
   // Did we get it?
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue0));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue1));
-  EXPECT_STREQ(dummy_data_0, (char *)fixed_queue_try_dequeue(dummy_queue0));
+  EXPECT_STREQ(dummy_data_0, (char*)fixed_queue_try_dequeue(dummy_queue0));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue0));
 
   fixed_queue_free(dummy_queue0, NULL);
@@ -79,11 +80,11 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_single_to_default) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register two queues, a default and a typed one
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
-  fixed_queue_t *default_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* default_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue);
   data_dispatcher_register_default(dispatcher, default_queue);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
@@ -95,7 +96,7 @@
   // Did we get it?
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
   EXPECT_FALSE(fixed_queue_is_empty(default_queue));
-  EXPECT_STREQ(dummy_data_1, (char *)fixed_queue_try_dequeue(default_queue));
+  EXPECT_STREQ(dummy_data_1, (char*)fixed_queue_try_dequeue(default_queue));
   EXPECT_TRUE(fixed_queue_is_empty(default_queue));
 
   fixed_queue_free(dummy_queue, NULL);
@@ -104,10 +105,10 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_multiple_to_single) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register a queue
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
@@ -117,9 +118,9 @@
 
   // Did we get it?
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue));
-  EXPECT_STREQ(dummy_data_0, (char *)fixed_queue_try_dequeue(dummy_queue));
+  EXPECT_STREQ(dummy_data_0, (char*)fixed_queue_try_dequeue(dummy_queue));
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue));
-  EXPECT_STREQ(dummy_data_1, (char *)fixed_queue_try_dequeue(dummy_queue));
+  EXPECT_STREQ(dummy_data_1, (char*)fixed_queue_try_dequeue(dummy_queue));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   fixed_queue_free(dummy_queue, NULL);
@@ -127,11 +128,11 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_multiple_to_multiple) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register two queues
-  fixed_queue_t *dummy_queue0 = fixed_queue_new(DUMMY_QUEUE_SIZE);
-  fixed_queue_t *dummy_queue1 = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue0 = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue1 = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue0);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_1, dummy_queue1);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue0));
@@ -144,8 +145,8 @@
   // Did we get it?
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue0));
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue1));
-  EXPECT_STREQ(dummy_data_0, (char *)fixed_queue_try_dequeue(dummy_queue0));
-  EXPECT_STREQ(dummy_data_1, (char *)fixed_queue_try_dequeue(dummy_queue1));
+  EXPECT_STREQ(dummy_data_0, (char*)fixed_queue_try_dequeue(dummy_queue0));
+  EXPECT_STREQ(dummy_data_1, (char*)fixed_queue_try_dequeue(dummy_queue1));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue0));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue1));
 
@@ -155,11 +156,11 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_single_to_single_reregistered) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register a queue, then reregister
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
-  fixed_queue_t *dummy_queue_reregistered = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue_reregistered = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue_reregistered);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
@@ -171,7 +172,8 @@
   // Did we get it?
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue_reregistered));
-  EXPECT_STREQ(dummy_data_0, (char *)fixed_queue_try_dequeue(dummy_queue_reregistered));
+  EXPECT_STREQ(dummy_data_0,
+               (char*)fixed_queue_try_dequeue(dummy_queue_reregistered));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue_reregistered));
 
   fixed_queue_free(dummy_queue, NULL);
@@ -180,15 +182,16 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_single_to_reregistered_null) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register a queue
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, dummy_queue);
   data_dispatcher_register(dispatcher, DUMMY_TYPE_0, NULL);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
-  EXPECT_FALSE(data_dispatcher_dispatch(dispatcher, DUMMY_TYPE_0, dummy_data_0));
+  EXPECT_FALSE(
+      data_dispatcher_dispatch(dispatcher, DUMMY_TYPE_0, dummy_data_0));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   fixed_queue_free(dummy_queue, NULL);
@@ -196,15 +199,16 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_single_to_default_reregistered_null) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register a queue
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register_default(dispatcher, dummy_queue);
   data_dispatcher_register_default(dispatcher, NULL);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
-  EXPECT_FALSE(data_dispatcher_dispatch(dispatcher, DUMMY_TYPE_0, dummy_data_0));
+  EXPECT_FALSE(
+      data_dispatcher_dispatch(dispatcher, DUMMY_TYPE_0, dummy_data_0));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   fixed_queue_free(dummy_queue, NULL);
@@ -212,19 +216,20 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_edge_zero) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register a queue
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, TYPE_EDGE_CASE_ZERO, dummy_queue);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   // Send data to the queue
-  EXPECT_TRUE(data_dispatcher_dispatch(dispatcher, TYPE_EDGE_CASE_ZERO, dummy_data_0));
+  EXPECT_TRUE(
+      data_dispatcher_dispatch(dispatcher, TYPE_EDGE_CASE_ZERO, dummy_data_0));
 
   // Did we get it?
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue));
-  EXPECT_STREQ(dummy_data_0, (char *)fixed_queue_try_dequeue(dummy_queue));
+  EXPECT_STREQ(dummy_data_0, (char*)fixed_queue_try_dequeue(dummy_queue));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   fixed_queue_free(dummy_queue, NULL);
@@ -232,19 +237,20 @@
 }
 
 TEST_F(DataDispatcherTest, test_dispatch_edge_max) {
-  data_dispatcher_t *dispatcher = data_dispatcher_new("test_dispatcher");
+  data_dispatcher_t* dispatcher = data_dispatcher_new("test_dispatcher");
 
   // Register a queue
-  fixed_queue_t *dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
+  fixed_queue_t* dummy_queue = fixed_queue_new(DUMMY_QUEUE_SIZE);
   data_dispatcher_register(dispatcher, TYPE_EDGE_CASE_MAX, dummy_queue);
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   // Send data to the queue
-  EXPECT_TRUE(data_dispatcher_dispatch(dispatcher, TYPE_EDGE_CASE_MAX, dummy_data_0));
+  EXPECT_TRUE(
+      data_dispatcher_dispatch(dispatcher, TYPE_EDGE_CASE_MAX, dummy_data_0));
 
   // Did we get it?
   EXPECT_FALSE(fixed_queue_is_empty(dummy_queue));
-  EXPECT_STREQ(dummy_data_0, (char *)fixed_queue_try_dequeue(dummy_queue));
+  EXPECT_STREQ(dummy_data_0, (char*)fixed_queue_try_dequeue(dummy_queue));
   EXPECT_TRUE(fixed_queue_is_empty(dummy_queue));
 
   fixed_queue_free(dummy_queue, NULL);
diff --git a/osi/test/eager_reader_test.cc b/osi/test/eager_reader_test.cc
index e69905e..58f1bb4 100644
--- a/osi/test/eager_reader_test.cc
+++ b/osi/test/eager_reader_test.cc
@@ -31,59 +31,61 @@
 
 #define BUFFER_SIZE 32
 
-static const char *small_data = "white chocolate lindor truffles";
-static const char *large_data =
-  "Let him make him examine and thoroughly sift everything he reads, and "
-  "lodge nothing in his fancy upon simple authority and upon trust. "
-  "Aristotle's principles will then be no more principles to him, than those "
-  "of Epicurus and the Stoics: let this diversity of opinions be propounded "
-  "to, and laid before him; he will himself choose, if he be able; if not, "
-  "he will remain in doubt. "
-  ""
-  "   \"Che non men the saver, dubbiar m' aggrata.\" "
-  "   [\"I love to doubt, as well as to know.\"--Dante, Inferno, xi. 93] "
-  ""
-  "for, if he embrace the opinions of Xenophon and Plato, by his own reason, "
-  "they will no more be theirs, but become his own.  Who follows another, "
-  "follows nothing, finds nothing, nay, is inquisitive after nothing. "
-  ""
-  "   \"Non sumus sub rege; sibi quisque se vindicet.\" "
-  "   [\"We are under no king; let each vindicate himself.\" --Seneca, Ep.,33] "
-  ""
-  "let him, at least, know that he knows.  it will be necessary that he "
-  "imbibe their knowledge, not that he be corrupted with their precepts; "
-  "and no matter if he forget where he had his learning, provided he know "
-  "how to apply it to his own use.  truth and reason are common to every "
-  "one, and are no more his who spake them first, than his who speaks them "
-  "after: 'tis no more according to plato, than according to me, since both "
-  "he and i equally see and understand them.  bees cull their several sweets "
-  "from this flower and that blossom, here and there where they find them, "
-  "but themselves afterwards make the honey, which is all and purely their "
-  "own, and no more thyme and marjoram: so the several fragments he borrows "
-  "from others, he will transform and shuffle together to compile a work "
-  "that shall be absolutely his own; that is to say, his judgment: "
-  "his instruction, labour and study, tend to nothing else but to form that. ";
+static const char* small_data = "white chocolate lindor truffles";
+static const char* large_data =
+    "Let him make him examine and thoroughly sift everything he reads, and "
+    "lodge nothing in his fancy upon simple authority and upon trust. "
+    "Aristotle's principles will then be no more principles to him, than those "
+    "of Epicurus and the Stoics: let this diversity of opinions be propounded "
+    "to, and laid before him; he will himself choose, if he be able; if not, "
+    "he will remain in doubt. "
+    ""
+    "   \"Che non men the saver, dubbiar m' aggrata.\" "
+    "   [\"I love to doubt, as well as to know.\"--Dante, Inferno, xi. 93] "
+    ""
+    "for, if he embrace the opinions of Xenophon and Plato, by his own reason, "
+    "they will no more be theirs, but become his own.  Who follows another, "
+    "follows nothing, finds nothing, nay, is inquisitive after nothing. "
+    ""
+    "   \"Non sumus sub rege; sibi quisque se vindicet.\" "
+    "   [\"We are under no king; let each vindicate himself.\" --Seneca, "
+    "Ep.,33] "
+    ""
+    "let him, at least, know that he knows.  it will be necessary that he "
+    "imbibe their knowledge, not that he be corrupted with their precepts; "
+    "and no matter if he forget where he had his learning, provided he know "
+    "how to apply it to his own use.  truth and reason are common to every "
+    "one, and are no more his who spake them first, than his who speaks them "
+    "after: 'tis no more according to plato, than according to me, since both "
+    "he and i equally see and understand them.  bees cull their several sweets "
+    "from this flower and that blossom, here and there where they find them, "
+    "but themselves afterwards make the honey, which is all and purely their "
+    "own, and no more thyme and marjoram: so the several fragments he borrows "
+    "from others, he will transform and shuffle together to compile a work "
+    "that shall be absolutely his own; that is to say, his judgment: "
+    "his instruction, labour and study, tend to nothing else but to form "
+    "that. ";
 
-static semaphore_t *done;
+static semaphore_t* done;
 
 class EagerReaderTest : public AllocationTestHarness {
-  protected:
-    virtual void SetUp() {
-      AllocationTestHarness::SetUp();
-      pipe(pipefd);
-      done = semaphore_new(0);
-    }
+ protected:
+  virtual void SetUp() {
+    AllocationTestHarness::SetUp();
+    pipe(pipefd);
+    done = semaphore_new(0);
+  }
 
-    virtual void TearDown() {
-      semaphore_free(done);
-      AllocationTestHarness::TearDown();
-    }
+  virtual void TearDown() {
+    semaphore_free(done);
+    AllocationTestHarness::TearDown();
+  }
 
-    int pipefd[2];
+  int pipefd[2];
 };
 
-static void expect_data(eager_reader_t *reader, void *context) {
-  char *data = (char *)context;
+static void expect_data(eager_reader_t* reader, void* context) {
+  char* data = (char*)context;
   int length = strlen(data);
 
   for (int i = 0; i < length; i++) {
@@ -95,8 +97,8 @@
   semaphore_post(done);
 }
 
-static void expect_data_multibyte(eager_reader_t *reader, void *context) {
-  char *data = (char *)context;
+static void expect_data_multibyte(eager_reader_t* reader, void* context) {
+  char* data = (char*)context;
   size_t length = strlen(data);
 
   for (size_t i = 0; i < length;) {
@@ -113,16 +115,19 @@
 }
 
 TEST_F(EagerReaderTest, test_new_free_simple) {
-  eager_reader_t *reader = eager_reader_new(pipefd[0], &allocator_malloc, BUFFER_SIZE, SIZE_MAX, "test_thread");
+  eager_reader_t* reader = eager_reader_new(
+      pipefd[0], &allocator_malloc, BUFFER_SIZE, SIZE_MAX, "test_thread");
   ASSERT_TRUE(reader != NULL);
   eager_reader_free(reader);
 }
 
 TEST_F(EagerReaderTest, test_small_data) {
-  eager_reader_t *reader = eager_reader_new(pipefd[0], &allocator_malloc, BUFFER_SIZE, SIZE_MAX, "test_thread");
+  eager_reader_t* reader = eager_reader_new(
+      pipefd[0], &allocator_malloc, BUFFER_SIZE, SIZE_MAX, "test_thread");
 
-  thread_t *read_thread = thread_new("read_thread");
-  eager_reader_register(reader, thread_get_reactor(read_thread), expect_data, (void *)small_data);
+  thread_t* read_thread = thread_new("read_thread");
+  eager_reader_register(reader, thread_get_reactor(read_thread), expect_data,
+                        (void*)small_data);
 
   write(pipefd[1], small_data, strlen(small_data));
 
@@ -132,10 +137,12 @@
 }
 
 TEST_F(EagerReaderTest, test_large_data_multibyte) {
-  eager_reader_t *reader = eager_reader_new(pipefd[0], &allocator_malloc, BUFFER_SIZE, SIZE_MAX, "test_thread");
+  eager_reader_t* reader = eager_reader_new(
+      pipefd[0], &allocator_malloc, BUFFER_SIZE, SIZE_MAX, "test_thread");
 
-  thread_t *read_thread = thread_new("read_thread");
-  eager_reader_register(reader, thread_get_reactor(read_thread), expect_data_multibyte, (void *)large_data);
+  thread_t* read_thread = thread_new("read_thread");
+  eager_reader_register(reader, thread_get_reactor(read_thread),
+                        expect_data_multibyte, (void*)large_data);
 
   write(pipefd[1], large_data, strlen(large_data));
 
diff --git a/osi/test/fixed_queue_test.cc b/osi/test/fixed_queue_test.cc
index 030241b..56917ef 100644
--- a/osi/test/fixed_queue_test.cc
+++ b/osi/test/fixed_queue_test.cc
@@ -11,18 +11,17 @@
 #include "osi/include/thread.h"
 
 static const size_t TEST_QUEUE_SIZE = 10;
-static const char *DUMMY_DATA_STRING = "Dummy data string";
-static const char *DUMMY_DATA_STRING1 = "Dummy data string1";
-static const char *DUMMY_DATA_STRING2 = "Dummy data string2";
-static const char *DUMMY_DATA_STRING3 = "Dummy data string3";
-static future_t *received_message_future = NULL;
+static const char* DUMMY_DATA_STRING = "Dummy data string";
+static const char* DUMMY_DATA_STRING1 = "Dummy data string1";
+static const char* DUMMY_DATA_STRING2 = "Dummy data string2";
+static const char* DUMMY_DATA_STRING3 = "Dummy data string3";
+static future_t* received_message_future = NULL;
 
 static int test_queue_entry_free_counter = 0;
 
 // Test whether a file descriptor |fd| is readable.
 // Return true if the file descriptor is readable, otherwise false.
-static bool is_fd_readable(int fd)
-{
+static bool is_fd_readable(int fd) {
   fd_set rfds;
   struct timeval tv;
 
@@ -38,17 +37,13 @@
 }
 
 // Function for performing dequeue operations from the queue when is ready
-static void
-fixed_queue_ready(fixed_queue_t *queue, UNUSED_ATTR void *context)
-{
-  void *msg = fixed_queue_try_dequeue(queue);
+static void fixed_queue_ready(fixed_queue_t* queue, UNUSED_ATTR void* context) {
+  void* msg = fixed_queue_try_dequeue(queue);
   EXPECT_TRUE(msg != NULL);
   future_ready(received_message_future, msg);
 }
 
-static void
-test_queue_entry_free_cb(void *data)
-{
+static void test_queue_entry_free_cb(void* data) {
   // Don't free the data, because we are testing only whether the callback
   // is called.
   test_queue_entry_free_counter++;
@@ -57,7 +52,7 @@
 class FixedQueueTest : public AllocationTestHarness {};
 
 TEST_F(FixedQueueTest, test_fixed_queue_new_free) {
-  fixed_queue_t *queue;
+  fixed_queue_t* queue;
 
   // Test a corner case: queue of size 0
   queue = fixed_queue_new(0);
@@ -85,7 +80,7 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_flush) {
-  fixed_queue_t *queue;
+  fixed_queue_t* queue;
 
   // Test a corner case: queue of size 0 and no callback to free entries
   queue = fixed_queue_new(0);
@@ -104,9 +99,9 @@
   // Test a queue of some size and no callback to free entries
   queue = fixed_queue_new(TEST_QUEUE_SIZE);
   EXPECT_TRUE(queue != NULL);
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING1);
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING2);
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING3);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING1);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING2);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING3);
   EXPECT_FALSE(fixed_queue_is_empty(queue));
   fixed_queue_flush(queue, NULL);
   EXPECT_TRUE(fixed_queue_is_empty(queue));
@@ -116,9 +111,9 @@
   test_queue_entry_free_counter = 0;
   queue = fixed_queue_new(TEST_QUEUE_SIZE);
   EXPECT_TRUE(queue != NULL);
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING1);
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING2);
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING3);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING1);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING2);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING3);
   EXPECT_FALSE(fixed_queue_is_empty(queue));
   fixed_queue_flush(queue, test_queue_entry_free_cb);
   EXPECT_TRUE(test_queue_entry_free_counter == 3);
@@ -127,7 +122,7 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_is_empty) {
-  fixed_queue_t *queue;
+  fixed_queue_t* queue;
 
   // Test a NULL queue
   EXPECT_TRUE(fixed_queue_is_empty(NULL));
@@ -138,7 +133,7 @@
   EXPECT_TRUE(fixed_queue_is_empty(queue));
 
   // Test a non-empty queue
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING);
   EXPECT_FALSE(fixed_queue_is_empty(queue));
 
   // Test an empty dequeued queue
@@ -149,7 +144,7 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_length) {
-  fixed_queue_t *queue;
+  fixed_queue_t* queue;
 
   // Test a NULL queue
   EXPECT_EQ((size_t)0, fixed_queue_length(NULL));
@@ -160,7 +155,7 @@
   EXPECT_EQ((size_t)0, fixed_queue_length(queue));
 
   // Test a non-empty queue
-  fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING);
+  fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING);
   EXPECT_EQ((size_t)1, fixed_queue_length(queue));
 
   // Test an empty dequeued queue
@@ -171,7 +166,7 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_capacity) {
-  fixed_queue_t *queue;
+  fixed_queue_t* queue;
 
   // Test a corner case: queue of size 0
   queue = fixed_queue_new(0);
@@ -199,27 +194,27 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_enqueue_dequeue) {
-  fixed_queue_t *queue = fixed_queue_new(TEST_QUEUE_SIZE);
+  fixed_queue_t* queue = fixed_queue_new(TEST_QUEUE_SIZE);
   ASSERT_TRUE(queue != NULL);
 
   // Test blocking enqueue and blocking dequeue
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING);
   EXPECT_EQ((size_t)1, fixed_queue_length(queue));
   EXPECT_EQ(DUMMY_DATA_STRING, fixed_queue_dequeue(queue));
   EXPECT_EQ((size_t)0, fixed_queue_length(queue));
 
   // Test non-blocking enqueue and non-blocking dequeue
-  EXPECT_TRUE(fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING));
+  EXPECT_TRUE(fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING));
   EXPECT_EQ((size_t)1, fixed_queue_length(queue));
   EXPECT_EQ(DUMMY_DATA_STRING, fixed_queue_try_dequeue(queue));
   EXPECT_EQ((size_t)0, fixed_queue_length(queue));
 
   // Test non-blocking enqueue beyond queue capacity
   for (size_t i = 0; i < TEST_QUEUE_SIZE; i++) {
-    EXPECT_TRUE(fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING));
+    EXPECT_TRUE(fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING));
   }
   // The next enqueue operation is beyond the queue capacity, so it should fail
-  EXPECT_FALSE(fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING));
+  EXPECT_FALSE(fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING));
 
   // Test non-blocking dequeue from a queue that is full to max capacity
   for (size_t i = 0; i < TEST_QUEUE_SIZE; i++) {
@@ -236,7 +231,7 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_try_peek_first_last) {
-  fixed_queue_t *queue = fixed_queue_new(TEST_QUEUE_SIZE);
+  fixed_queue_t* queue = fixed_queue_new(TEST_QUEUE_SIZE);
   ASSERT_TRUE(queue != NULL);
 
   // Test peek first/last from a NULL queue
@@ -248,17 +243,17 @@
   EXPECT_EQ(NULL, fixed_queue_try_peek_last(queue));
 
   // Test peek first/last from a queue with one element
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING1);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING1);
   EXPECT_EQ(DUMMY_DATA_STRING1, fixed_queue_try_peek_first(queue));
   EXPECT_EQ(DUMMY_DATA_STRING1, fixed_queue_try_peek_last(queue));
 
   // Test peek first/last from a queue with two elements
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING2);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING2);
   EXPECT_EQ(DUMMY_DATA_STRING1, fixed_queue_try_peek_first(queue));
   EXPECT_EQ(DUMMY_DATA_STRING2, fixed_queue_try_peek_last(queue));
 
   // Test peek first/last from a queue with three elements
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING3);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING3);
   EXPECT_EQ(DUMMY_DATA_STRING1, fixed_queue_try_peek_first(queue));
   EXPECT_EQ(DUMMY_DATA_STRING3, fixed_queue_try_peek_last(queue));
 
@@ -266,38 +261,38 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_try_remove_from_queue) {
-  fixed_queue_t *queue = fixed_queue_new(TEST_QUEUE_SIZE);
+  fixed_queue_t* queue = fixed_queue_new(TEST_QUEUE_SIZE);
   ASSERT_TRUE(queue != NULL);
 
   // Test removing from a NULL queue
-  EXPECT_EQ(NULL, fixed_queue_try_remove_from_queue(NULL,
-                                        (void *)DUMMY_DATA_STRING));
+  EXPECT_EQ(NULL,
+            fixed_queue_try_remove_from_queue(NULL, (void*)DUMMY_DATA_STRING));
 
   // Test removing from an empty queue
-  EXPECT_EQ(NULL, fixed_queue_try_remove_from_queue(queue,
-                                        (void *)DUMMY_DATA_STRING));
+  EXPECT_EQ(NULL,
+            fixed_queue_try_remove_from_queue(queue, (void*)DUMMY_DATA_STRING));
 
   // Test removing a queued string from a queue
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING1);
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING2);
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING3);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING1);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING2);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING3);
   EXPECT_EQ((size_t)3, fixed_queue_length(queue));
-  EXPECT_EQ(DUMMY_DATA_STRING2, fixed_queue_try_remove_from_queue(queue,
-                                        (void *)DUMMY_DATA_STRING2));
+  EXPECT_EQ(DUMMY_DATA_STRING2, fixed_queue_try_remove_from_queue(
+                                    queue, (void*)DUMMY_DATA_STRING2));
   EXPECT_EQ((size_t)2, fixed_queue_length(queue));
   // Removing again should fail
   EXPECT_EQ(NULL, fixed_queue_try_remove_from_queue(queue,
-                                        (void *)DUMMY_DATA_STRING2));
+                                                    (void*)DUMMY_DATA_STRING2));
 
   // Test removing a non-queued string from a queue
-  EXPECT_EQ(NULL, fixed_queue_try_remove_from_queue(queue,
-                                        (void *)DUMMY_DATA_STRING));
+  EXPECT_EQ(NULL,
+            fixed_queue_try_remove_from_queue(queue, (void*)DUMMY_DATA_STRING));
 
   fixed_queue_free(queue, NULL);
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_get_enqueue_dequeue_fd) {
-  fixed_queue_t *queue = fixed_queue_new(TEST_QUEUE_SIZE);
+  fixed_queue_t* queue = fixed_queue_new(TEST_QUEUE_SIZE);
   ASSERT_TRUE(queue != NULL);
 
   // Test validity of enqueue and dequeue file descriptors
@@ -315,7 +310,7 @@
 
   // Test the file descriptors of a non-empty queue
   // Both the enqueue_fd and dequeue_fd should be readable
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING);
   EXPECT_TRUE(is_fd_readable(enqueue_fd));
   EXPECT_TRUE(is_fd_readable(dequeue_fd));
   fixed_queue_dequeue(queue);
@@ -323,7 +318,7 @@
   // Test the file descriptors of a full queue
   // Only the dequeue_fd should be readable
   for (size_t i = 0; i < TEST_QUEUE_SIZE; i++) {
-    EXPECT_TRUE(fixed_queue_try_enqueue(queue, (void *)DUMMY_DATA_STRING));
+    EXPECT_TRUE(fixed_queue_try_enqueue(queue, (void*)DUMMY_DATA_STRING));
   }
   EXPECT_FALSE(is_fd_readable(enqueue_fd));
   EXPECT_TRUE(is_fd_readable(dequeue_fd));
@@ -332,23 +327,21 @@
 }
 
 TEST_F(FixedQueueTest, test_fixed_queue_register_dequeue) {
-  fixed_queue_t *queue = fixed_queue_new(TEST_QUEUE_SIZE);
+  fixed_queue_t* queue = fixed_queue_new(TEST_QUEUE_SIZE);
   ASSERT_TRUE(queue != NULL);
 
   received_message_future = future_new();
   ASSERT_TRUE(received_message_future != NULL);
 
-  thread_t *worker_thread = thread_new("test_fixed_queue_worker_thread");
+  thread_t* worker_thread = thread_new("test_fixed_queue_worker_thread");
   ASSERT_TRUE(worker_thread != NULL);
 
-  fixed_queue_register_dequeue(queue,
-                               thread_get_reactor(worker_thread),
-                               fixed_queue_ready,
-                               NULL);
+  fixed_queue_register_dequeue(queue, thread_get_reactor(worker_thread),
+                               fixed_queue_ready, NULL);
 
   // Add a message to the queue, and expect to receive it
-  fixed_queue_enqueue(queue, (void *)DUMMY_DATA_STRING);
-  const char *msg = (const char *)future_await(received_message_future);
+  fixed_queue_enqueue(queue, (void*)DUMMY_DATA_STRING);
+  const char* msg = (const char*)future_await(received_message_future);
   EXPECT_EQ(DUMMY_DATA_STRING, msg);
 
   fixed_queue_unregister_dequeue(queue);
diff --git a/osi/test/future_test.cc b/osi/test/future_test.cc
index 9da8c82..fe5e7fd 100644
--- a/osi/test/future_test.cc
+++ b/osi/test/future_test.cc
@@ -24,20 +24,21 @@
 #include "osi/include/osi.h"
 #include "osi/include/thread.h"
 
-static const char *pass_back_data0 = "fancy a sandwich? it's a fancy sandwich";
-static const char *pass_back_data1 = "what kind of ice cream truck plays the worst christmas song of all time?";
+static const char* pass_back_data0 = "fancy a sandwich? it's a fancy sandwich";
+static const char* pass_back_data1 =
+    "what kind of ice cream truck plays the worst christmas song of all time?";
 
 class FutureTest : public AllocationTestHarness {};
 
-static void post_to_future(void *context) {
-  future_ready((future_t *)context, (void *)pass_back_data0);
+static void post_to_future(void* context) {
+  future_ready((future_t*)context, (void*)pass_back_data0);
 }
 
 TEST_F(FutureTest, test_future_non_immediate) {
-  future_t *future = future_new();
+  future_t* future = future_new();
   ASSERT_TRUE(future != NULL);
 
-  thread_t *worker_thread = thread_new("worker thread");
+  thread_t* worker_thread = thread_new("worker thread");
   thread_post(worker_thread, post_to_future, future);
 
   EXPECT_EQ(pass_back_data0, future_await(future));
@@ -46,7 +47,7 @@
 }
 
 TEST_F(FutureTest, test_future_immediate) {
-  future_t *future = future_new_immediate((void *)pass_back_data1);
+  future_t* future = future_new_immediate((void*)pass_back_data1);
   ASSERT_TRUE(future != NULL);
   EXPECT_EQ(pass_back_data1, future_await(future));
 }
diff --git a/osi/test/hash_map_utils_test.cc b/osi/test/hash_map_utils_test.cc
index 987a328..0e483e5 100644
--- a/osi/test/hash_map_utils_test.cc
+++ b/osi/test/hash_map_utils_test.cc
@@ -27,9 +27,7 @@
 
 class HashMapUtilsTest : public AllocationTestHarness {
  protected:
-  virtual void SetUp() {
-    AllocationTestHarness::SetUp();
-  }
+  virtual void SetUp() { AllocationTestHarness::SetUp(); }
   virtual void TearDown() {
     map.clear();
     AllocationTestHarness::TearDown();
diff --git a/osi/test/list_test.cc b/osi/test/list_test.cc
index af28b8d..a4d1b6f 100644
--- a/osi/test/list_test.cc
+++ b/osi/test/list_test.cc
@@ -8,7 +8,7 @@
 class ListTest : public AllocationTestHarness {};
 
 TEST_F(ListTest, test_new_free_simple) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   ASSERT_TRUE(list != NULL);
   list_free(list);
 }
@@ -19,19 +19,19 @@
 }
 
 TEST_F(ListTest, test_empty_list_is_empty) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   EXPECT_TRUE(list_is_empty(list));
   list_free(list);
 }
 
 TEST_F(ListTest, test_empty_list_has_no_length) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   EXPECT_EQ(list_length(list), 0U);
   list_free(list);
 }
 
 TEST_F(ListTest, test_simple_list_prepend) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   EXPECT_TRUE(list_prepend(list, &list));
   EXPECT_FALSE(list_is_empty(list));
   EXPECT_EQ(list_length(list), 1U);
@@ -39,7 +39,7 @@
 }
 
 TEST_F(ListTest, test_simple_list_append) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   EXPECT_TRUE(list_append(list, &list));
   EXPECT_FALSE(list_is_empty(list));
   EXPECT_EQ(list_length(list), 1U);
@@ -47,17 +47,17 @@
 }
 
 TEST_F(ListTest, test_list_remove_found) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   list_append(list, &list);
   EXPECT_TRUE(list_remove(list, &list));
   EXPECT_TRUE(list_is_empty(list));
-  EXPECT_EQ(list_length(list),  0U);
+  EXPECT_EQ(list_length(list), 0U);
   list_free(list);
 }
 
 TEST_F(ListTest, test_list_remove_not_found) {
   int x;
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   list_append(list, &list);
   EXPECT_FALSE(list_remove(list, &x));
   EXPECT_FALSE(list_is_empty(list));
@@ -66,11 +66,10 @@
 }
 
 TEST_F(ListTest, test_list_front) {
-  int x[] = { 1, 2, 3, 4, 5 };
-  list_t *list = list_new(NULL);
+  int x[] = {1, 2, 3, 4, 5};
+  list_t* list = list_new(NULL);
 
-  for (size_t i = 0; i < ARRAY_SIZE(x); ++i)
-    list_append(list, &x[i]);
+  for (size_t i = 0; i < ARRAY_SIZE(x); ++i) list_append(list, &x[i]);
 
   EXPECT_EQ(list_front(list), &x[0]);
 
@@ -78,11 +77,10 @@
 }
 
 TEST_F(ListTest, test_list_back) {
-  int x[] = { 1, 2, 3, 4, 5 };
-  list_t *list = list_new(NULL);
+  int x[] = {1, 2, 3, 4, 5};
+  list_t* list = list_new(NULL);
 
-  for (size_t i = 0; i < ARRAY_SIZE(x); ++i)
-    list_append(list, &x[i]);
+  for (size_t i = 0; i < ARRAY_SIZE(x); ++i) list_append(list, &x[i]);
 
   EXPECT_EQ(list_back(list), &x[ARRAY_SIZE(x) - 1]);
 
@@ -90,11 +88,10 @@
 }
 
 TEST_F(ListTest, test_list_clear) {
-  int x[] = { 1, 2, 3, 4, 5 };
-  list_t *list = list_new(NULL);
+  int x[] = {1, 2, 3, 4, 5};
+  list_t* list = list_new(NULL);
 
-  for (size_t i = 0; i < ARRAY_SIZE(x); ++i)
-    list_append(list, &x[i]);
+  for (size_t i = 0; i < ARRAY_SIZE(x); ++i) list_append(list, &x[i]);
 
   list_clear(list);
   EXPECT_TRUE(list_is_empty(list));
@@ -104,74 +101,73 @@
 }
 
 TEST_F(ListTest, test_list_append_multiple) {
-  int x[] = { 1, 2, 3, 4, 5 };
-  list_t *list = list_new(NULL);
+  int x[] = {1, 2, 3, 4, 5};
+  list_t* list = list_new(NULL);
 
-  for (size_t i = 0; i < ARRAY_SIZE(x); ++i)
-    list_append(list, &x[i]);
+  for (size_t i = 0; i < ARRAY_SIZE(x); ++i) list_append(list, &x[i]);
 
   int i = 0;
-  for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node), ++i)
+  for (const list_node_t *node = list_begin(list); node != list_end(list);
+       node = list_next(node), ++i)
     EXPECT_EQ(list_node(node), &x[i]);
 
   list_free(list);
 }
 
 TEST_F(ListTest, test_list_prepend_multiple) {
-  int x[] = { 1, 2, 3, 4, 5 };
-  list_t *list = list_new(NULL);
+  int x[] = {1, 2, 3, 4, 5};
+  list_t* list = list_new(NULL);
 
-  for (size_t i = 0; i < ARRAY_SIZE(x); ++i)
-    list_prepend(list, &x[i]);
+  for (size_t i = 0; i < ARRAY_SIZE(x); ++i) list_prepend(list, &x[i]);
 
   int i = ARRAY_SIZE(x) - 1;
-  for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node), --i)
+  for (const list_node_t *node = list_begin(list); node != list_end(list);
+       node = list_next(node), --i)
     EXPECT_EQ(list_node(node), &x[i]);
 
   list_free(list);
 }
 
 TEST_F(ListTest, test_list_begin_empty_list) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   EXPECT_EQ(list_begin(list), list_end(list));
   list_free(list);
 }
 
 TEST_F(ListTest, test_list_next) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
   list_append(list, &list);
   EXPECT_NE(list_begin(list), list_end(list));
   EXPECT_EQ(list_next(list_begin(list)), list_end(list));
   list_free(list);
 }
 
-static bool list_callback_sum(void *data, void *context) {
+static bool list_callback_sum(void* data, void* context) {
   assert(data);
   assert(context);
-  int *sum = (int *)context;
-  int *value = (int *)data;
+  int* sum = (int*)context;
+  int* value = (int*)data;
   *sum += *value;
   return true;
 }
 
-static bool list_callback_find_int(void *data, void *context) {
+static bool list_callback_find_int(void* data, void* context) {
   assert(data);
   assert(context);
-  return (*(int *)data != *(int *)context);
+  return (*(int*)data != *(int*)context);
 }
 
 TEST_F(ListTest, test_list_foreach_full) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
 
   // Fill in test data
-  int x[] = { 1, 2, 3, 4, 5 };
-  for (size_t i = 0; i < ARRAY_SIZE(x); ++i)
-    list_append(list, &x[i]);
+  int x[] = {1, 2, 3, 4, 5};
+  for (size_t i = 0; i < ARRAY_SIZE(x); ++i) list_append(list, &x[i]);
   EXPECT_EQ(list_length(list), (size_t)5);
 
   // Test complete iteration
   int sum = 0;
-  list_node_t *rc = list_foreach(list, list_callback_sum, &sum);
+  list_node_t* rc = list_foreach(list, list_callback_sum, &sum);
   EXPECT_EQ(sum, 15);
   EXPECT_TRUE(rc == NULL);
 
@@ -179,31 +175,30 @@
 }
 
 TEST_F(ListTest, test_list_foreach_partial) {
-  list_t *list = list_new(NULL);
+  list_t* list = list_new(NULL);
 
   // Fill in test data
-  int x[] = { 1, 2, 3, 4, 5 };
-  for (size_t i = 0; i < ARRAY_SIZE(x); ++i)
-    list_append(list, &x[i]);
+  int x[] = {1, 2, 3, 4, 5};
+  for (size_t i = 0; i < ARRAY_SIZE(x); ++i) list_append(list, &x[i]);
   EXPECT_EQ(list_length(list), (size_t)5);
 
   // Test partial iteration
   int find = 4;
-  list_node_t *rc = list_foreach(list, list_callback_find_int, &find);
+  list_node_t* rc = list_foreach(list, list_callback_find_int, &find);
   EXPECT_TRUE(rc != NULL);
-  int *rc_val = (int *)list_node(rc);
+  int* rc_val = (int*)list_node(rc);
   EXPECT_TRUE(*rc_val == 4);
 
   find = 1;
   rc = list_foreach(list, list_callback_find_int, &find);
   EXPECT_TRUE(rc != NULL);
-  rc_val = (int *)list_node(rc);
+  rc_val = (int*)list_node(rc);
   EXPECT_TRUE(*rc_val == 1);
 
   find = 5;
   rc = list_foreach(list, list_callback_find_int, &find);
   EXPECT_TRUE(rc != NULL);
-  rc_val = (int *)list_node(rc);
+  rc_val = (int*)list_node(rc);
   EXPECT_TRUE(*rc_val == 5);
 
   find = 0;
diff --git a/osi/test/reactor_test.cc b/osi/test/reactor_test.cc
index 4f8a0bd..0164227 100644
--- a/osi/test/reactor_test.cc
+++ b/osi/test/reactor_test.cc
@@ -13,8 +13,8 @@
 static pthread_t thread;
 static volatile bool thread_running;
 
-static void *reactor_thread(void *ptr) {
-  reactor_t *reactor = (reactor_t *)ptr;
+static void* reactor_thread(void* ptr) {
+  reactor_t* reactor = (reactor_t*)ptr;
 
   thread_running = true;
   reactor_start(reactor);
@@ -23,34 +23,30 @@
   return NULL;
 }
 
-static void spawn_reactor_thread(reactor_t *reactor) {
+static void spawn_reactor_thread(reactor_t* reactor) {
   int ret = pthread_create(&thread, NULL, reactor_thread, reactor);
   EXPECT_EQ(ret, 0);
 }
 
-static void join_reactor_thread() {
-  pthread_join(thread, NULL);
-}
+static void join_reactor_thread() { pthread_join(thread, NULL); }
 
 TEST_F(ReactorTest, reactor_new) {
-  reactor_t *reactor = reactor_new();
+  reactor_t* reactor = reactor_new();
   EXPECT_TRUE(reactor != NULL);
   reactor_free(reactor);
 }
 
-TEST_F(ReactorTest, reactor_free_null) {
-  reactor_free(NULL);
-}
+TEST_F(ReactorTest, reactor_free_null) { reactor_free(NULL); }
 
 TEST_F(ReactorTest, reactor_stop_start) {
-  reactor_t *reactor = reactor_new();
+  reactor_t* reactor = reactor_new();
   reactor_stop(reactor);
   reactor_start(reactor);
   reactor_free(reactor);
 }
 
 TEST_F(ReactorTest, reactor_repeated_stop_start) {
-  reactor_t *reactor = reactor_new();
+  reactor_t* reactor = reactor_new();
   for (int i = 0; i < 10; ++i) {
     reactor_stop(reactor);
     reactor_start(reactor);
@@ -59,7 +55,7 @@
 }
 
 TEST_F(ReactorTest, reactor_start_wait_stop) {
-  reactor_t *reactor = reactor_new();
+  reactor_t* reactor = reactor_new();
 
   spawn_reactor_thread(reactor);
   usleep(50 * 1000);
@@ -73,18 +69,18 @@
 }
 
 typedef struct {
-  reactor_t *reactor;
-  reactor_object_t *object;
+  reactor_t* reactor;
+  reactor_object_t* object;
 } unregister_arg_t;
 
-static void unregister_cb(void *context) {
-  unregister_arg_t *arg = (unregister_arg_t *)context;
+static void unregister_cb(void* context) {
+  unregister_arg_t* arg = (unregister_arg_t*)context;
   reactor_unregister(arg->object);
   reactor_stop(arg->reactor);
 }
 
 TEST_F(ReactorTest, reactor_unregister_from_callback) {
-  reactor_t *reactor = reactor_new();
+  reactor_t* reactor = reactor_new();
 
   int fd = eventfd(0, 0);
   unregister_arg_t arg;
@@ -100,11 +96,11 @@
 }
 
 TEST_F(ReactorTest, reactor_unregister_from_separate_thread) {
-  reactor_t *reactor = reactor_new();
+  reactor_t* reactor = reactor_new();
 
   int fd = eventfd(0, 0);
 
-  reactor_object_t *object = reactor_register(reactor, fd, NULL, NULL, NULL);
+  reactor_object_t* object = reactor_register(reactor, fd, NULL, NULL, NULL);
   spawn_reactor_thread(reactor);
   usleep(50 * 1000);
   reactor_unregister(object);
diff --git a/osi/test/ringbuffer_test.cc b/osi/test/ringbuffer_test.cc
index f4ae86a..3475973 100644
--- a/osi/test/ringbuffer_test.cc
+++ b/osi/test/ringbuffer_test.cc
@@ -1,10 +1,10 @@
 #include <gtest/gtest.h>
 
-#include "osi/include/ringbuffer.h"
 #include "osi/include/osi.h"
+#include "osi/include/ringbuffer.h"
 
 TEST(RingbufferTest, test_new_simple) {
-  ringbuffer_t *rb = ringbuffer_init(4096);
+  ringbuffer_t* rb = ringbuffer_init(4096);
   ASSERT_TRUE(rb != NULL);
   EXPECT_EQ((size_t)4096, ringbuffer_available(rb));
   EXPECT_EQ((size_t)0, ringbuffer_size(rb));
@@ -12,16 +12,17 @@
 }
 
 TEST(RingbufferTest, test_insert_basic) {
-  ringbuffer_t *rb = ringbuffer_init(16);
+  ringbuffer_t* rb = ringbuffer_init(16);
 
-  uint8_t buffer[10] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A};
+  uint8_t buffer[10] = {0x01, 0x02, 0x03, 0x04, 0x05,
+                        0x06, 0x07, 0x08, 0x09, 0x0A};
   ringbuffer_insert(rb, buffer, 10);
   EXPECT_EQ((size_t)10, ringbuffer_size(rb));
   EXPECT_EQ((size_t)6, ringbuffer_available(rb));
 
   uint8_t peek[10] = {0};
   size_t peeked = ringbuffer_peek(rb, 0, peek, 10);
-  EXPECT_EQ((size_t)10, ringbuffer_size(rb)); // Ensure size doesn't change
+  EXPECT_EQ((size_t)10, ringbuffer_size(rb));  // Ensure size doesn't change
   EXPECT_EQ((size_t)6, ringbuffer_available(rb));
   EXPECT_EQ((size_t)10, peeked);
   ASSERT_TRUE(0 == memcmp(buffer, peek, peeked));
@@ -30,7 +31,7 @@
 }
 
 TEST(RingbufferTest, test_insert_full) {
-  ringbuffer_t *rb = ringbuffer_init(5);
+  ringbuffer_t* rb = ringbuffer_init(5);
 
   uint8_t aa[] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA};
   uint8_t bb[] = {0xBB, 0xBB, 0xBB, 0xBB, 0xBB};
@@ -57,7 +58,7 @@
 }
 
 TEST(RingbufferTest, test_multi_insert_delete) {
-  ringbuffer_t *rb = ringbuffer_init(16);
+  ringbuffer_t* rb = ringbuffer_init(16);
   EXPECT_EQ((size_t)16, ringbuffer_available(rb));
   EXPECT_EQ((size_t)0, ringbuffer_size(rb));
 
@@ -74,7 +75,8 @@
   EXPECT_EQ((size_t)3, ringbuffer_available(rb));
   EXPECT_EQ((size_t)13, ringbuffer_size(rb));
 
-  uint8_t content[] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB};
+  uint8_t content[] = {0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
+                       0xAA, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB};
   uint8_t peek[16] = {0};
   size_t peeked = ringbuffer_peek(rb, 0, peek, 16);
   EXPECT_EQ((size_t)13, peeked);
@@ -108,7 +110,7 @@
 
   // Add more again to check head motion
 
-  uint8_t dd[] = { 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD };
+  uint8_t dd[] = {0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD, 0xDD};
   added = ringbuffer_insert(rb, dd, sizeof(dd));
   EXPECT_EQ((size_t)8, added);
   EXPECT_EQ((size_t)1, ringbuffer_available(rb));
@@ -121,7 +123,7 @@
 
   // Add small token
 
-  uint8_t ae[] = { 0xAE, 0xAE, 0xAE };
+  uint8_t ae[] = {0xAE, 0xAE, 0xAE};
   added = ringbuffer_insert(rb, ae, sizeof(ae));
   EXPECT_EQ((size_t)13, ringbuffer_available(rb));
 
diff --git a/osi/test/semaphore_test.cc b/osi/test/semaphore_test.cc
index e52b2d6..711ae49 100644
--- a/osi/test/semaphore_test.cc
+++ b/osi/test/semaphore_test.cc
@@ -2,8 +2,8 @@
 
 #include "AllocationTestHarness.h"
 
-#include <unistd.h>
 #include <sys/select.h>
+#include <unistd.h>
 
 #include "osi/include/osi.h"
 #include "osi/include/reactor.h"
@@ -11,32 +11,32 @@
 #include "osi/include/thread.h"
 
 struct SemaphoreTestSequenceHelper {
-  semaphore_t *semaphore;
+  semaphore_t* semaphore;
   int counter;
 };
 
 namespace {
-  void sleep_then_increment_counter(void *context) {
-    SemaphoreTestSequenceHelper *helper =
-            reinterpret_cast<SemaphoreTestSequenceHelper*>(context);
-    assert(helper);
-    assert(helper->semaphore);
-    sleep(1);
-    ++helper->counter;
-    semaphore_post(helper->semaphore);
-  }
-} // namespace
+void sleep_then_increment_counter(void* context) {
+  SemaphoreTestSequenceHelper* helper =
+      reinterpret_cast<SemaphoreTestSequenceHelper*>(context);
+  assert(helper);
+  assert(helper->semaphore);
+  sleep(1);
+  ++helper->counter;
+  semaphore_post(helper->semaphore);
+}
+}  // namespace
 
 class SemaphoreTest : public AllocationTestHarness {};
 
 TEST_F(SemaphoreTest, test_new_simple) {
-  semaphore_t *semaphore = semaphore_new(0);
+  semaphore_t* semaphore = semaphore_new(0);
   ASSERT_TRUE(semaphore != NULL);
   semaphore_free(semaphore);
 }
 
 TEST_F(SemaphoreTest, test_new_with_value) {
-  semaphore_t *semaphore = semaphore_new(3);
+  semaphore_t* semaphore = semaphore_new(3);
   ASSERT_TRUE(semaphore != NULL);
 
   EXPECT_TRUE(semaphore_try_wait(semaphore));
@@ -48,7 +48,7 @@
 }
 
 TEST_F(SemaphoreTest, test_try_wait) {
-  semaphore_t *semaphore = semaphore_new(0);
+  semaphore_t* semaphore = semaphore_new(0);
   ASSERT_TRUE(semaphore != NULL);
 
   EXPECT_FALSE(semaphore_try_wait(semaphore));
@@ -60,7 +60,7 @@
 }
 
 TEST_F(SemaphoreTest, test_wait_after_post) {
-  semaphore_t *semaphore = semaphore_new(0);
+  semaphore_t* semaphore = semaphore_new(0);
   ASSERT_TRUE(semaphore != NULL);
   semaphore_post(semaphore);
   semaphore_wait(semaphore);
@@ -68,17 +68,17 @@
 }
 
 TEST_F(SemaphoreTest, test_ensure_wait) {
-  semaphore_t *semaphore = semaphore_new(0);
+  semaphore_t* semaphore = semaphore_new(0);
   ASSERT_TRUE(semaphore != NULL);
-  thread_t *thread = thread_new("semaphore_test_thread");
+  thread_t* thread = thread_new("semaphore_test_thread");
   ASSERT_TRUE(thread != NULL);
 
   EXPECT_FALSE(semaphore_try_wait(semaphore));
   SemaphoreTestSequenceHelper sequence_helper = {semaphore, 0};
   thread_post(thread, sleep_then_increment_counter, &sequence_helper);
   semaphore_wait(semaphore);
-  EXPECT_EQ(sequence_helper.counter, 1) <<
-      "semaphore_wait() did not wait for counter to increment";
+  EXPECT_EQ(sequence_helper.counter, 1)
+      << "semaphore_wait() did not wait for counter to increment";
 
   semaphore_free(semaphore);
   thread_free(thread);
diff --git a/osi/test/test_stubs.h b/osi/test/test_stubs.h
index 9f8a607..007d9a4 100644
--- a/osi/test/test_stubs.h
+++ b/osi/test/test_stubs.h
@@ -25,15 +25,16 @@
 // Helper macros for stubbing out functions and modules for testing.
 
 // Stub out a function, with call counting and mode awareness
-#define STUB_FUNCTION(ret, name, params) \
-  UNUSED_ATTR static int name##_callcount; \
-  static ret name params { \
+#define STUB_FUNCTION(ret, name, params)                 \
+  UNUSED_ATTR static int name##_callcount;               \
+  static ret name params {                               \
     UNUSED_ATTR int _local_callcount = name##_callcount; \
     name##_callcount++;
 
 // Expect a certain number of calls to the specified stub function
-#define EXPECT_CALL_COUNT(name, count) \
-  EXPECT_EQ((count), (name##_callcount)) << "expected " #name " to be called " #count " times"
+#define EXPECT_CALL_COUNT(name, count)   \
+  EXPECT_EQ((count), (name##_callcount)) \
+      << "expected " #name " to be called " #count " times"
 
 // Reset the call count for the specificed stub function
 #define RESET_CALL_COUNT(name) ((name##_callcount) = 0)
@@ -41,10 +42,9 @@
 // Use this in a stub function to catch unexpected calls.
 // Prints out a nice message including the call count, the
 // stub function name, and the mode index (sadly no mode name)
-#define UNEXPECTED_CALL EXPECT_TRUE(false) \
-  << "unexpected call " << _local_callcount \
-  << " to " << __func__ \
-  << " during mode " << (int)_current_mode
+#define UNEXPECTED_CALL                                                  \
+  EXPECT_TRUE(false) << "unexpected call " << _local_callcount << " to " \
+                     << __func__ << " during mode " << (int)_current_mode
 
 #define MODE_IS(mode) (_current_mode == (mode))
 
@@ -53,7 +53,8 @@
 #define OVERLOAD_SELECT(NAME, NUM) OVERLOAD_CAT(NAME##_, NUM)
 #define OVERLOAD_GET_COUNT(_1, _2, _3, _4, _5, _6, COUNT, ...) COUNT
 #define OVERLOAD_VA_SIZE(...) OVERLOAD_GET_COUNT(__VA_ARGS__, 6, 5, 4, 3, 2, 1)
-#define OVERLOAD_OF(NAME, ...) OVERLOAD_SELECT(NAME, OVERLOAD_VA_SIZE(__VA_ARGS__))(__VA_ARGS__)
+#define OVERLOAD_OF(NAME, ...) \
+  OVERLOAD_SELECT(NAME, OVERLOAD_VA_SIZE(__VA_ARGS__))(__VA_ARGS__)
 
 // Use this to branch stub function execution to a specific mode or modes.
 // Treat it like an if statement. For example:
@@ -62,18 +63,18 @@
 // DURING(midday_snack, midnight_snack) EXPECT_EQ(chocolate, food);
 #define DURING(...) OVERLOAD_OF(DURING, __VA_ARGS__)
 
-#define DURING_1(mode0) \
-  if (MODE_IS(mode0))
-#define DURING_2(mode0, mode1) \
-  if (MODE_IS(mode0) || MODE_IS(mode1))
+#define DURING_1(mode0) if (MODE_IS(mode0))
+#define DURING_2(mode0, mode1) if (MODE_IS(mode0) || MODE_IS(mode1))
 #define DURING_3(mode0, mode1, mode2) \
   if (MODE_IS(mode0) || MODE_IS(mode1) || MODE_IS(mode2))
 #define DURING_4(mode0, mode1, mode2, mode3) \
   if (MODE_IS(mode0) || MODE_IS(mode1) || MODE_IS(mode2) || MODE_IS(mode3))
-#define DURING_5(mode0, mode1, mode2, mode3, mode4) \
-  if (MODE_IS(mode0) || MODE_IS(mode1) || MODE_IS(mode2) || MODE_IS(mode3) || MODE_IS(mode4))
-#define DURING_6(mode0, mode1, mode2, mode3, mode4, mode5) \
-  if (MODE_IS(mode0) || MODE_IS(mode1) || MODE_IS(mode2) || MODE_IS(mode3) || MODE_IS(mode4) || MODE_IS(mode5))
+#define DURING_5(mode0, mode1, mode2, mode3, mode4)                           \
+  if (MODE_IS(mode0) || MODE_IS(mode1) || MODE_IS(mode2) || MODE_IS(mode3) || \
+      MODE_IS(mode4))
+#define DURING_6(mode0, mode1, mode2, mode3, mode4, mode5)                    \
+  if (MODE_IS(mode0) || MODE_IS(mode1) || MODE_IS(mode2) || MODE_IS(mode3) || \
+      MODE_IS(mode4) || MODE_IS(mode5))
 
 // Use this to branch stub function exeuction to a specific call
 // count index (zero based). Treat it like an if statement.
@@ -88,14 +89,13 @@
 //   AT_CALL(1) EXPECT_EQ(bacon_wrapped_bacon, food);
 //   AT_CALL(1) EXPECT_EQ(chocolate_covered_fake_blueberries, food);
 // }
-#define AT_CALL(index) \
-  if (_local_callcount == (index))
+#define AT_CALL(index) if (_local_callcount == (index))
 
 // Declare all the available test modes for the DURING clauses
 // For example:
 //
 // DECLARE_TEST_MODES(breakfast, lunch, dinner);
-#define DECLARE_TEST_MODES(...) \
+#define DECLARE_TEST_MODES(...)               \
   typedef enum { __VA_ARGS__ } _test_modes_t; \
   static _test_modes_t _current_mode;
 
diff --git a/osi/test/thread_test.cc b/osi/test/thread_test.cc
index 8f0904f..debf250 100644
--- a/osi/test/thread_test.cc
+++ b/osi/test/thread_test.cc
@@ -4,54 +4,54 @@
 
 #include <sys/select.h>
 
+#include "osi/include/osi.h"
 #include "osi/include/reactor.h"
 #include "osi/include/thread.h"
-#include "osi/include/osi.h"
 
 class ThreadTest : public AllocationTestHarness {};
 
 TEST_F(ThreadTest, test_new_simple) {
-  thread_t *thread = thread_new("test_thread");
+  thread_t* thread = thread_new("test_thread");
   ASSERT_TRUE(thread != NULL);
   thread_free(thread);
 }
 
 TEST_F(ThreadTest, test_free_simple) {
-  thread_t *thread = thread_new("test_thread");
+  thread_t* thread = thread_new("test_thread");
   thread_free(thread);
 }
 
 TEST_F(ThreadTest, test_name) {
-  thread_t *thread = thread_new("test_name");
+  thread_t* thread = thread_new("test_name");
   ASSERT_STREQ(thread_name(thread), "test_name");
   thread_free(thread);
 }
 
 TEST_F(ThreadTest, test_long_name) {
-  thread_t *thread = thread_new("0123456789abcdef");
+  thread_t* thread = thread_new("0123456789abcdef");
   ASSERT_STREQ("0123456789abcdef", thread_name(thread));
   thread_free(thread);
 }
 
 TEST_F(ThreadTest, test_very_long_name) {
-  thread_t *thread = thread_new("0123456789abcdefg");
+  thread_t* thread = thread_new("0123456789abcdefg");
   ASSERT_STREQ("0123456789abcdef", thread_name(thread));
   thread_free(thread);
 }
 
-static void thread_is_self_fn(void *context) {
-  thread_t *thread = (thread_t *)context;
+static void thread_is_self_fn(void* context) {
+  thread_t* thread = (thread_t*)context;
   EXPECT_TRUE(thread_is_self(thread));
 }
 
 TEST_F(ThreadTest, test_thread_is_self) {
-  thread_t *thread = thread_new("test_thread");
+  thread_t* thread = thread_new("test_thread");
   thread_post(thread, thread_is_self_fn, thread);
   thread_free(thread);
 }
 
 TEST_F(ThreadTest, test_thread_is_not_self) {
-  thread_t *thread = thread_new("test_thread");
+  thread_t* thread = thread_new("test_thread");
   EXPECT_FALSE(thread_is_self(thread));
   thread_free(thread);
 }
diff --git a/osi/test/wakelock_test.cc b/osi/test/wakelock_test.cc
index 24e49ca..f62eb80 100644
--- a/osi/test/wakelock_test.cc
+++ b/osi/test/wakelock_test.cc
@@ -18,10 +18,10 @@
 
 #include <gtest/gtest.h>
 
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 
 #include "osi/include/wakelock.h"
 
@@ -29,39 +29,33 @@
 
 static bool is_wake_lock_acquired = false;
 
-static int acquire_wake_lock_cb(const char *lock_name)
-{
+static int acquire_wake_lock_cb(const char* lock_name) {
   is_wake_lock_acquired = true;
   return BT_STATUS_SUCCESS;
 }
 
-static int release_wake_lock_cb(const char *lock_name)
-{
+static int release_wake_lock_cb(const char* lock_name) {
   is_wake_lock_acquired = false;
   return BT_STATUS_SUCCESS;
 }
 
 static bt_os_callouts_t bt_wakelock_callouts = {
-  sizeof(bt_os_callouts_t),
-  NULL,
-  acquire_wake_lock_cb,
-  release_wake_lock_cb
-};
+    sizeof(bt_os_callouts_t), NULL, acquire_wake_lock_cb, release_wake_lock_cb};
 
 class WakelockTest : public AllocationTestHarness {
-protected:
+ protected:
   virtual void SetUp() {
     AllocationTestHarness::SetUp();
 
-  // TODO (jamuraa): maybe use base::CreateNewTempDirectory instead?
+// TODO (jamuraa): maybe use base::CreateNewTempDirectory instead?
 #if defined(OS_GENERIC)
     tmp_dir_ = "/tmp/btwlXXXXXX";
 #else
     tmp_dir_ = "/data/local/tmp/btwlXXXXXX";
-#endif // !defined(OS_GENERIC)
+#endif  // !defined(OS_GENERIC)
 
-    char *buffer = const_cast<char *>(tmp_dir_.c_str());
-    char *dtemp = mkdtemp(buffer);
+    char* buffer = const_cast<char*>(tmp_dir_.c_str());
+    char* dtemp = mkdtemp(buffer);
     if (!dtemp) {
       perror("Can't make wake lock test directory: ");
       assert(false);
@@ -105,10 +99,10 @@
 
     assert(lock_stat.st_size >= unlock_stat.st_size);
 
-    void *lock_file = mmap(nullptr, lock_stat.st_size, PROT_READ,
-                           MAP_PRIVATE, lock_fd, 0);
+    void* lock_file =
+        mmap(nullptr, lock_stat.st_size, PROT_READ, MAP_PRIVATE, lock_fd, 0);
 
-    void *unlock_file = mmap(nullptr, unlock_stat.st_size, PROT_READ,
+    void* unlock_file = mmap(nullptr, unlock_stat.st_size, PROT_READ,
                              MAP_PRIVATE, unlock_fd, 0);
 
     if (memcmp(lock_file, unlock_file, unlock_stat.st_size) == 0) {
@@ -147,7 +141,7 @@
 }
 
 TEST_F(WakelockTest, test_set_paths) {
-  wakelock_set_os_callouts(NULL);       // Make sure we use native wakelocks
+  wakelock_set_os_callouts(NULL);  // Make sure we use native wakelocks
   wakelock_set_paths(lock_path_.c_str(), unlock_path_.c_str());
 
   // Initially, the wakelock is not acquired