add .clang-format

Change-Id: I7c2a527b4751a560703a61fcbe9638b150546af5
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/sensorhandler.h b/sensorhandler.h
index d6426f6..3f2fd99 100644
--- a/sensorhandler.h
+++ b/sensorhandler.h
@@ -1,19 +1,21 @@
 #ifndef __HOST_IPMI_SEN_HANDLER_H__
 #define __HOST_IPMI_SEN_HANDLER_H__
 
-#include <stdint.h>
 #include "types.hpp"
+
+#include <stdint.h>
+
 #include "host-ipmid/ipmid-api.h"
 
 // IPMI commands for net functions.
 enum ipmi_netfn_sen_cmds
 {
     IPMI_CMD_GET_DEVICE_SDR_INFO = 0x20,
-    IPMI_CMD_GET_DEVICE_SDR      = 0x21,
-    IPMI_CMD_RESERVE_DEVICE_SDR_REPO   = 0x22,
+    IPMI_CMD_GET_DEVICE_SDR = 0x21,
+    IPMI_CMD_RESERVE_DEVICE_SDR_REPO = 0x22,
     IPMI_CMD_GET_SENSOR_READING = 0x2D,
-    IPMI_CMD_GET_SENSOR_TYPE    = 0x2F,
-    IPMI_CMD_SET_SENSOR         = 0x30,
+    IPMI_CMD_GET_SENSOR_TYPE = 0x2F,
+    IPMI_CMD_SET_SENSOR = 0x30,
     IPMI_CMD_GET_SENSOR_THRESHOLDS = 0x27,
 };
 
@@ -30,26 +32,27 @@
 // Discrete sensor types.
 enum ipmi_sensor_types
 {
-    IPMI_SENSOR_TEMP    = 0x01,
+    IPMI_SENSOR_TEMP = 0x01,
     IPMI_SENSOR_VOLTAGE = 0x02,
     IPMI_SENSOR_CURRENT = 0x03,
-    IPMI_SENSOR_FAN     = 0x04,
-    IPMI_SENSOR_TPM     = 0xCC,
+    IPMI_SENSOR_FAN = 0x04,
+    IPMI_SENSOR_TPM = 0xCC,
 };
 
 #define MAX_DBUS_PATH 128
-struct dbus_interface_t {
-    uint8_t  sensornumber;
-    uint8_t  sensortype;
+struct dbus_interface_t
+{
+    uint8_t sensornumber;
+    uint8_t sensortype;
 
-    char  bus[MAX_DBUS_PATH];
-    char  path[MAX_DBUS_PATH];
-    char  interface[MAX_DBUS_PATH];
+    char bus[MAX_DBUS_PATH];
+    char path[MAX_DBUS_PATH];
+    char interface[MAX_DBUS_PATH];
 };
 
-int set_sensor_dbus_state_s(uint8_t , const char *, const char *);
-int set_sensor_dbus_state_y(uint8_t , const char *, const uint8_t);
-int find_openbmc_path(uint8_t , dbus_interface_t *);
+int set_sensor_dbus_state_s(uint8_t, const char*, const char*);
+int set_sensor_dbus_state_y(uint8_t, const char*, const uint8_t);
+int find_openbmc_path(uint8_t, dbus_interface_t*);
 
 ipmi_ret_t ipmi_sen_get_sdr(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
                             ipmi_request_t request, ipmi_response_t response,
@@ -78,7 +81,7 @@
 // raw value for this call.
 inline bool get_count(void* req)
 {
-    return (bool)((uint64_t)(req) & 1);
+    return (bool)((uint64_t)(req)&1);
 }
 } // namespace request
 
@@ -229,19 +232,19 @@
 inline void set_owner_id_address(uint8_t addr, SensorDataRecordKey* key)
 {
     key->owner_id &= 0x01;
-    key->owner_id |= addr<<1;
+    key->owner_id |= addr << 1;
 };
 
 inline void set_owner_lun(uint8_t lun, SensorDataRecordKey* key)
 {
     key->owner_lun &= ~0x03;
-    key->owner_lun |= (lun&0x03);
+    key->owner_lun |= (lun & 0x03);
 };
 
 inline void set_owner_lun_channel(uint8_t channel, SensorDataRecordKey* key)
 {
     key->owner_lun &= 0x0f;
-    key->owner_lun |= ((channel & 0xf)<<4);
+    key->owner_lun |= ((channel & 0xf) << 4);
 };
 
 } // namespace key
@@ -252,13 +255,13 @@
  */
 struct GetSensorThresholdsResponse
 {
-    uint8_t validMask;          //!< valid mask
-    uint8_t lowerNonCritical;   //!< lower non-critical threshold
-    uint8_t lowerCritical;      //!< lower critical threshold
-    uint8_t lowerNonRecoverable;//!< lower non-recoverable threshold
-    uint8_t upperNonCritical;   //!< upper non-critical threshold
-    uint8_t upperCritical;      //!< upper critical threshold
-    uint8_t upperNonRecoverable;//!< upper non-recoverable threshold
+    uint8_t validMask;           //!< valid mask
+    uint8_t lowerNonCritical;    //!< lower non-critical threshold
+    uint8_t lowerCritical;       //!< lower critical threshold
+    uint8_t lowerNonRecoverable; //!< lower non-recoverable threshold
+    uint8_t upperNonCritical;    //!< upper non-critical threshold
+    uint8_t upperCritical;       //!< upper critical threshold
+    uint8_t upperNonRecoverable; //!< upper non-recoverable threshold
 } __attribute__((packed));
 
 // Body - full record
@@ -274,8 +277,8 @@
     uint8_t sensor_capabilities; // no macro support
     uint8_t sensor_type;
     uint8_t event_reading_type;
-    uint8_t supported_assertions[2]; // no macro support
-    uint8_t supported_deassertions[2]; // no macro support
+    uint8_t supported_assertions[2];          // no macro support
+    uint8_t supported_deassertions[2];        // no macro support
     uint8_t discrete_reading_setting_mask[2]; // no macro support
     uint8_t sensor_units_1;
     uint8_t sensor_units_2_base;
@@ -287,7 +290,7 @@
     uint8_t b_msb_and_accuracy_lsb;
     uint8_t accuracy_and_sensor_direction;
     uint8_t r_b_exponents;
-    uint8_t analog_characteristic_flags; //no macro support
+    uint8_t analog_characteristic_flags; // no macro support
     uint8_t nominal_reading;
     uint8_t normal_max;
     uint8_t normal_min;
@@ -329,145 +332,137 @@
 inline void set_entity_instance_number(uint8_t n,
                                        SensorDataFullRecordBody* body)
 {
-    body->entity_instance &= 1<<7;
-    body->entity_instance |= (n & ~(1<<7));
+    body->entity_instance &= 1 << 7;
+    body->entity_instance |= (n & ~(1 << 7));
 };
 inline void set_entity_physical_entity(SensorDataFullRecordBody* body)
 {
-    body->entity_instance &= ~(1<<7);
+    body->entity_instance &= ~(1 << 7);
 };
 inline void set_entity_logical_container(SensorDataFullRecordBody* body)
 {
-    body->entity_instance |= 1<<7;
+    body->entity_instance |= 1 << 7;
 };
 
-inline void sensor_scanning_state(bool enabled,
-                                  SensorDataFullRecordBody* body)
+inline void sensor_scanning_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<0;
+        body->sensor_initialization |= 1 << 0;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<0);
+        body->sensor_initialization &= ~(1 << 0);
     };
 };
-inline void event_generation_state(bool enabled,
-                                   SensorDataFullRecordBody* body)
+inline void event_generation_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<1;
+        body->sensor_initialization |= 1 << 1;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<1);
+        body->sensor_initialization &= ~(1 << 1);
     }
 };
-inline void init_types_state(bool enabled,
-                             SensorDataFullRecordBody* body)
+inline void init_types_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<2;
+        body->sensor_initialization |= 1 << 2;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<2);
+        body->sensor_initialization &= ~(1 << 2);
     }
 };
-inline void init_hyst_state(bool enabled,
-                            SensorDataFullRecordBody* body)
+inline void init_hyst_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<3;
+        body->sensor_initialization |= 1 << 3;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<3);
+        body->sensor_initialization &= ~(1 << 3);
     }
 };
-inline void init_thresh_state(bool enabled,
-                              SensorDataFullRecordBody* body)
+inline void init_thresh_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<4;
+        body->sensor_initialization |= 1 << 4;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<4);
+        body->sensor_initialization &= ~(1 << 4);
     }
 };
-inline void init_events_state(bool enabled,
-                              SensorDataFullRecordBody* body)
+inline void init_events_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<5;
+        body->sensor_initialization |= 1 << 5;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<5);
+        body->sensor_initialization &= ~(1 << 5);
     }
 };
-inline void init_scanning_state(bool enabled,
-                                SensorDataFullRecordBody* body)
+inline void init_scanning_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<6;
+        body->sensor_initialization |= 1 << 6;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<6);
+        body->sensor_initialization &= ~(1 << 6);
     }
 };
-inline void init_settable_state(bool enabled,
-                                SensorDataFullRecordBody* body)
+inline void init_settable_state(bool enabled, SensorDataFullRecordBody* body)
 {
     if (enabled)
     {
-        body->sensor_initialization |= 1<<7;
+        body->sensor_initialization |= 1 << 7;
     }
     else
     {
-        body->sensor_initialization &= ~(1<<7);
+        body->sensor_initialization &= ~(1 << 7);
     }
 };
 
 inline void set_percentage(SensorDataFullRecordBody* body)
 {
-    body->sensor_units_1 |= 1<<0;
+    body->sensor_units_1 |= 1 << 0;
 };
 inline void unset_percentage(SensorDataFullRecordBody* body)
 {
-    body->sensor_units_1 &= ~(1<<0);
+    body->sensor_units_1 &= ~(1 << 0);
 };
 inline void set_modifier_operation(uint8_t op, SensorDataFullRecordBody* body)
 {
-    body->sensor_units_1 &= ~(3<<1);
-    body->sensor_units_1 |= (op & 0x3)<<1;
+    body->sensor_units_1 &= ~(3 << 1);
+    body->sensor_units_1 |= (op & 0x3) << 1;
 };
 inline void set_rate_unit(uint8_t unit, SensorDataFullRecordBody* body)
 {
-    body->sensor_units_1 &= ~(7<<3);
-    body->sensor_units_1 |= (unit & 0x7)<<3;
+    body->sensor_units_1 &= ~(7 << 3);
+    body->sensor_units_1 |= (unit & 0x7) << 3;
 };
 inline void set_analog_data_format(uint8_t format,
                                    SensorDataFullRecordBody* body)
 {
-    body->sensor_units_1 &= ~(3<<6);
-    body->sensor_units_1 |= (format & 0x3)<<6;
+    body->sensor_units_1 &= ~(3 << 6);
+    body->sensor_units_1 |= (format & 0x3) << 6;
 };
 
 inline void set_m(uint16_t m, SensorDataFullRecordBody* body)
 {
     body->m_lsb = m & 0xff;
-    body->m_msb_and_tolerance &= ~(3<<6);
-    body->m_msb_and_tolerance |= ((m & (3<<8)) >> 2);
+    body->m_msb_and_tolerance &= ~(3 << 6);
+    body->m_msb_and_tolerance |= ((m & (3 << 8)) >> 2);
 };
 inline void set_tolerance(uint8_t tol, SensorDataFullRecordBody* body)
 {
@@ -478,8 +473,8 @@
 inline void set_b(uint16_t b, SensorDataFullRecordBody* body)
 {
     body->b_lsb = b & 0xff;
-    body->b_msb_and_accuracy_lsb &= ~(3<<6);
-    body->b_msb_and_accuracy_lsb |= ((b & (3<<8)) >> 2);
+    body->b_msb_and_accuracy_lsb &= ~(3 << 6);
+    body->b_msb_and_accuracy_lsb |= ((b & (3 << 8)) >> 2);
 };
 inline void set_accuracy(uint16_t acc, SensorDataFullRecordBody* body)
 {
@@ -492,12 +487,12 @@
 };
 inline void set_accuracy_exp(uint8_t exp, SensorDataFullRecordBody* body)
 {
-    body->accuracy_and_sensor_direction &= ~(3<<2);
-    body->accuracy_and_sensor_direction |= (exp & 3)<<2;
+    body->accuracy_and_sensor_direction &= ~(3 << 2);
+    body->accuracy_and_sensor_direction |= (exp & 3) << 2;
 };
 inline void set_sensor_dir(uint8_t dir, SensorDataFullRecordBody* body)
 {
-    body->accuracy_and_sensor_direction &= ~(3<<0);
+    body->accuracy_and_sensor_direction &= ~(3 << 0);
     body->accuracy_and_sensor_direction |= (dir & 3);
 };
 
@@ -509,7 +504,7 @@
 inline void set_r_exp(uint8_t exp, SensorDataFullRecordBody* body)
 {
     body->r_b_exponents &= 0x0f;
-    body->r_b_exponents |= (exp & 0x0f)<<4;
+    body->r_b_exponents |= (exp & 0x0f) << 4;
 };
 
 inline void set_id_strlen(uint8_t len, SensorDataFullRecordBody* body)
@@ -517,14 +512,14 @@
     body->id_string_info &= ~(0x1f);
     body->id_string_info |= len & 0x1f;
 };
-inline uint8_t get_id_strlen( SensorDataFullRecordBody* body)
+inline uint8_t get_id_strlen(SensorDataFullRecordBody* body)
 {
     return body->id_string_info & 0x1f;
 };
 inline void set_id_type(uint8_t type, SensorDataFullRecordBody* body)
 {
-    body->id_string_info &= ~(3<<6);
-    body->id_string_info |= (type & 0x3)<<6;
+    body->id_string_info &= ~(3 << 6);
+    body->id_string_info |= (type & 0x3) << 6;
 };
 
 inline void set_device_id_strlen(uint8_t len, SensorDataFruRecordBody* body)
@@ -577,7 +572,7 @@
     SensorDataFruRecordBody body;
 } __attribute__((packed));
 
-} // get_sdr
+} // namespace get_sdr
 
 namespace ipmi
 {