Skip to content

Commit

Permalink
Whitespace refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik committed Aug 21, 2021
1 parent 3b02209 commit 89c004a
Show file tree
Hide file tree
Showing 65 changed files with 635 additions and 650 deletions.
3 changes: 1 addition & 2 deletions lib/inc/Recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ namespace sairedis
static std::string getTimestamp();

void recordStats(
_In_ bool enable);
_In_ bool enable);

private: // recording helpers

Expand Down Expand Up @@ -423,7 +423,6 @@ namespace sairedis
void recordLine(
_In_ const std::string& line);


private:

bool m_performLogRotate;
Expand Down
2 changes: 1 addition & 1 deletion lib/inc/SwitchContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ namespace sairedis
std::map<sai_object_id_t, std::shared_ptr<Switch>> m_switchMap;

};
};
}
34 changes: 17 additions & 17 deletions lib/inc/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ namespace sairedis

public:

/**
* @brief Clear OID values.
*
* For every OID attribute on list will set their oids to
* SAI_NULL_OBJECT_ID. This is handy, since when performing GET
* operation, user may not clear allocated LIST, and GET also serializes
* full list contents, so exact buffer will be deserialized on syncd side.
*
* This operation is more for a convenience use, but we should
* create serialize and deserialize special for GET operation.
*/
static void clearOidValues(
_In_ sai_object_type_t objectType,
_In_ uint32_t attrCount,
_Out_ sai_attribute_t *attrList);
/**
* @brief Clear OID values.
*
* For every OID attribute on list will set their oids to
* SAI_NULL_OBJECT_ID. This is handy, since when performing GET
* operation, user may not clear allocated LIST, and GET also serializes
* full list contents, so exact buffer will be deserialized on syncd side.
*
* This operation is more for a convenience use, but we should
* create serialize and deserialize special for GET operation.
*/
static void clearOidValues(
_In_ sai_object_type_t objectType,
_In_ uint32_t attrCount,
_Out_ sai_attribute_t *attrList);

static void clearOidList(
_Out_ sai_object_list_t& list);
static void clearOidList(
_Out_ sai_object_list_t& list);
};
}
1 change: 0 additions & 1 deletion lib/inc/ZeroMQChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,5 @@ namespace sairedis
void* m_ntfContext;

void* m_ntfSocket;

};
}
2 changes: 2 additions & 0 deletions lib/src/RedisVidIndexGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ RedisVidIndexGenerator::RedisVidIndexGenerator(
m_vidCounterName(vidCounterName)
{
SWSS_LOG_ENTER();

// empty
}

uint64_t RedisVidIndexGenerator::increment()
Expand Down
1 change: 0 additions & 1 deletion lib/src/SkipRecordAttrContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,3 @@ bool SkipRecordAttrContainer::canSkipRecording(

return true;
}

8 changes: 0 additions & 8 deletions lib/src/sai_redis_macsec.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
#include "sai_redis.h"

REDIS_GENERIC_QUAD(MACSEC,macsec);

REDIS_GENERIC_QUAD(MACSEC_PORT,macsec_port);
REDIS_GENERIC_STATS(MACSEC_PORT,macsec_port);

REDIS_GENERIC_QUAD(MACSEC_FLOW,macsec_flow);
REDIS_GENERIC_STATS(MACSEC_FLOW,macsec_flow);

REDIS_GENERIC_QUAD(MACSEC_SC,macsec_sc);
REDIS_GENERIC_STATS(MACSEC_SC,macsec_sc);

REDIS_GENERIC_QUAD(MACSEC_SA,macsec_sa);
REDIS_GENERIC_STATS(MACSEC_SA,macsec_sa);

const sai_macsec_api_t redis_macsec_api = {

REDIS_GENERIC_QUAD_API(macsec)

REDIS_GENERIC_QUAD_API(macsec_port)
REDIS_GENERIC_STATS_API(macsec_port)

REDIS_GENERIC_QUAD_API(macsec_flow)
REDIS_GENERIC_STATS_API(macsec_flow)

REDIS_GENERIC_QUAD_API(macsec_sc)
REDIS_GENERIC_STATS_API(macsec_sc)

REDIS_GENERIC_QUAD_API(macsec_sa)
REDIS_GENERIC_STATS_API(macsec_sa)
};
1 change: 0 additions & 1 deletion lib/src/sai_redis_nat.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "sai_redis.h"

REDIS_BULK_QUAD_ENTRY(NAT_ENTRY,nat_entry);

REDIS_GENERIC_QUAD_ENTRY(NAT_ENTRY,nat_entry);
REDIS_GENERIC_QUAD(NAT_ZONE_COUNTER,nat_zone_counter);

Expand Down
1 change: 0 additions & 1 deletion lib/src/sai_redis_nexthopgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

REDIS_BULK_CREATE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members);
REDIS_BULK_REMOVE(NEXT_HOP_GROUP_MEMBER,next_hop_group_members);

REDIS_GENERIC_QUAD(NEXT_HOP_GROUP,next_hop_group);
REDIS_GENERIC_QUAD(NEXT_HOP_GROUP_MEMBER,next_hop_group_member);

Expand Down
1 change: 0 additions & 1 deletion lib/src/sai_redis_segmentroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

REDIS_BULK_CREATE(SEGMENTROUTE_SIDLIST,segmentroute_sidlists);
REDIS_BULK_REMOVE(SEGMENTROUTE_SIDLIST,segmentroute_sidlists);

REDIS_GENERIC_QUAD(SEGMENTROUTE_SIDLIST,segmentroute_sidlist);

const sai_segmentroute_api_t redis_segmentroute_api = {
Expand Down
1 change: 0 additions & 1 deletion lib/src/sai_redis_stp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

REDIS_BULK_CREATE(STP_PORT,stp_ports);
REDIS_BULK_REMOVE(STP_PORT,stp_ports);

REDIS_GENERIC_QUAD(STP,stp);
REDIS_GENERIC_QUAD(STP_PORT,stp_port);

Expand Down
1 change: 0 additions & 1 deletion lib/src/sai_redis_vlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

REDIS_BULK_CREATE(VLAN_MEMBER,vlan_members);
REDIS_BULK_REMOVE(VLAN_MEMBER,vlan_members);

REDIS_GENERIC_QUAD(VLAN,vlan);
REDIS_GENERIC_QUAD(VLAN_MEMBER,vlan_member);
REDIS_GENERIC_STATS(VLAN,vlan);
Expand Down
1 change: 0 additions & 1 deletion meta/AttrKeyMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,3 @@ std::vector<std::string> AttrKeyMap::getAllKeys() const

return vec;
}

1 change: 0 additions & 1 deletion meta/AttrKeyMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ namespace saimeta
*/
std::unordered_map<std::string, std::string> m_map;
};

}
66 changes: 33 additions & 33 deletions meta/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,50 @@ std::string Globals::getHardwareInfo(
{
SWSS_LOG_ENTER();

auto *attr = sai_metadata_get_attr_by_id(
SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO,
attrCount,
attrList);
auto *attr = sai_metadata_get_attr_by_id(
SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO,
attrCount,
attrList);

if (attr == NULL)
{
return "";
}
if (attr == NULL)
{
return "";
}

auto& s8list = attr->value.s8list;
auto& s8list = attr->value.s8list;

if (s8list.count == 0)
{
return "";
}
if (s8list.count == 0)
{
return "";
}

if (s8list.list == NULL)
{
SWSS_LOG_WARN("SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO s8list.list is NULL! but count is %u", s8list.count);
if (s8list.list == NULL)
{
SWSS_LOG_WARN("SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO s8list.list is NULL! but count is %u", s8list.count);

return "";
}
return "";
}

uint32_t count = s8list.count;
uint32_t count = s8list.count;

if (count > SAI_MAX_HARDWARE_ID_LEN)
{
SWSS_LOG_WARN("SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO s8list.count (%u) > SAI_MAX_HARDWARE_ID_LEN (%d), LIMITING !!",
count,
SAI_MAX_HARDWARE_ID_LEN);
if (count > SAI_MAX_HARDWARE_ID_LEN)
{
SWSS_LOG_WARN("SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO s8list.count (%u) > SAI_MAX_HARDWARE_ID_LEN (%d), LIMITING !!",
count,
SAI_MAX_HARDWARE_ID_LEN);

count = SAI_MAX_HARDWARE_ID_LEN;
}
count = SAI_MAX_HARDWARE_ID_LEN;
}

// check actual length, since buffer may contain nulls
auto actualLength = strnlen((const char*)s8list.list, count);
// check actual length, since buffer may contain nulls
auto actualLength = strnlen((const char*)s8list.list, count);

if (actualLength != count)
{
SWSS_LOG_WARN("SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO s8list.list is null padded");
}
if (actualLength != count)
{
SWSS_LOG_WARN("SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO s8list.list is null padded");
}

return std::string((const char*)s8list.list, actualLength);
return std::string((const char*)s8list.list, actualLength);
}

std::string Globals::joinFieldValues(
Expand Down
Loading

0 comments on commit 89c004a

Please sign in to comment.