Skip to content

Commit 69a980e

Browse files
Fixing compilation issue in 32-bit arch (marvell-armhf) (#1280)
Replaced %l variants with PRI. Replaced %lu with %zu for size_t Signed-off-by: Sabareesh Kumar Anandan <[email protected]>
1 parent 4798584 commit 69a980e

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

cfgmgr/natmgr.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -5049,7 +5049,7 @@ void NatMgr::doStaticNatTask(Consumer &consumer)
50495049
/* Ensure the key size is 1 otherwise ignore */
50505050
if (keys.size() != STATIC_NAT_KEY_SIZE)
50515051
{
5052-
SWSS_LOG_ERROR("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
5052+
SWSS_LOG_ERROR("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
50535053
it = consumer.m_toSync.erase(it);
50545054
continue;
50555055
}
@@ -5366,7 +5366,7 @@ void NatMgr::doStaticNaptTask(Consumer &consumer)
53665366
/* Ensure the key size is 3 otherwise ignore */
53675367
if (keys.size() != STATIC_NAPT_KEY_SIZE)
53685368
{
5369-
SWSS_LOG_ERROR("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
5369+
SWSS_LOG_ERROR("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
53705370
it = consumer.m_toSync.erase(it);
53715371
continue;
53725372
}
@@ -5707,7 +5707,7 @@ void NatMgr::doNatPoolTask(Consumer &consumer)
57075707
/* Ensure the key size is 1 otherwise ignore */
57085708
if (keys.size() != POOL_TABLE_KEY_SIZE)
57095709
{
5710-
SWSS_LOG_ERROR("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
5710+
SWSS_LOG_ERROR("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
57115711
it = consumer.m_toSync.erase(it);
57125712
continue;
57135713
}
@@ -5766,7 +5766,7 @@ void NatMgr::doNatPoolTask(Consumer &consumer)
57665766
/* Ensure the Pool name length is not more than 32 otherwise ignore */
57675767
if (key.length() > 32)
57685768
{
5769-
SWSS_LOG_ERROR("Invalid pool name length - %lu, skipping %s", key.length(), key.c_str());
5769+
SWSS_LOG_ERROR("Invalid pool name length - %zu, skipping %s", key.length(), key.c_str());
57705770
it = consumer.m_toSync.erase(it);
57715771
continue;
57725772
}
@@ -5791,7 +5791,7 @@ void NatMgr::doNatPoolTask(Consumer &consumer)
57915791
/* Ensure the ip range size is not more than 2, otherwise ignore */
57925792
if (nat_ip_range.size() > 2)
57935793
{
5794-
SWSS_LOG_ERROR("Invalid nat ip range size %lu, skipping %s", nat_ip_range.size(), key.c_str());
5794+
SWSS_LOG_ERROR("Invalid nat ip range size %zu, skipping %s", nat_ip_range.size(), key.c_str());
57955795
it = consumer.m_toSync.erase(it);
57965796
continue;
57975797
}
@@ -5876,7 +5876,7 @@ void NatMgr::doNatPoolTask(Consumer &consumer)
58765876
/* Ensure the port range size is not more than 2, otherwise ignore */
58775877
if (nat_port_range.size() > 2)
58785878
{
5879-
SWSS_LOG_ERROR("Invalid nat port range size %lu, skipping %s", nat_port_range.size(), key.c_str());
5879+
SWSS_LOG_ERROR("Invalid nat port range size %zu, skipping %s", nat_port_range.size(), key.c_str());
58805880
it = consumer.m_toSync.erase(it);
58815881
continue;
58825882
}
@@ -6094,15 +6094,15 @@ void NatMgr::doNatBindingTask(Consumer &consumer)
60946094
/* Ensure the key size is 1 otherwise ignore */
60956095
if (keys.size() != BINDING_TABLE_KEY_SIZE)
60966096
{
6097-
SWSS_LOG_ERROR("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
6097+
SWSS_LOG_ERROR("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
60986098
it = consumer.m_toSync.erase(it);
60996099
continue;
61006100
}
61016101

61026102
/* Ensure the Binding name length is not more than 32 otherwise ignore */
61036103
if (key.length() > 32)
61046104
{
6105-
SWSS_LOG_ERROR("Invalid binding name length - %lu, skipping %s", key.length(), key.c_str());
6105+
SWSS_LOG_ERROR("Invalid binding name length - %zu, skipping %s", key.length(), key.c_str());
61066106
it = consumer.m_toSync.erase(it);
61076107
continue;
61086108
}
@@ -6226,7 +6226,7 @@ void NatMgr::doNatBindingTask(Consumer &consumer)
62266226
/* Ensure the Pool name length is not more than 32 otherwise ignore */
62276227
if (nat_pool.length() > 32)
62286228
{
6229-
SWSS_LOG_ERROR("Invalid pool name length - %lu, skipping %s", nat_pool.length(), key.c_str());
6229+
SWSS_LOG_ERROR("Invalid pool name length - %zu, skipping %s", nat_pool.length(), key.c_str());
62306230
it = consumer.m_toSync.erase(it);
62316231
continue;
62326232
}
@@ -6604,13 +6604,13 @@ void NatMgr::doNatIpInterfaceTask(Consumer &consumer)
66046604
/* Ensure the key size is 2 or 1, otherwise ignore */
66056605
if ((keys.size() != L3_INTERFACE_KEY_SIZE) and (keys.size() != L3_INTERFACE_ZONE_SIZE))
66066606
{
6607-
SWSS_LOG_INFO("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
6607+
SWSS_LOG_INFO("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
66086608
it = consumer.m_toSync.erase(it);
66096609
continue;
66106610
}
66116611
else
66126612
{
6613-
SWSS_LOG_INFO("Key size %lu for %s", keys.size(), key.c_str());
6613+
SWSS_LOG_INFO("Key size %zu for %s", keys.size(), key.c_str());
66146614
}
66156615

66166616
/* Ensure the key starts with "Vlan" or "Ethernet" or "PortChannel" or "Loopback", otherwise ignore */
@@ -6849,7 +6849,7 @@ void NatMgr::doNatIpInterfaceTask(Consumer &consumer)
68496849
}
68506850
else
68516851
{
6852-
SWSS_LOG_INFO("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
6852+
SWSS_LOG_INFO("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
68536853
}
68546854
it = consumer.m_toSync.erase(it);
68556855
}
@@ -6935,7 +6935,7 @@ void NatMgr::doNatIpInterfaceTask(Consumer &consumer)
69356935
}
69366936
else
69376937
{
6938-
SWSS_LOG_INFO("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
6938+
SWSS_LOG_INFO("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
69396939
}
69406940
it = consumer.m_toSync.erase(it);
69416941
}
@@ -6971,7 +6971,7 @@ void NatMgr::doNatAclTableTask(Consumer &consumer)
69716971
/* Ensure the key size is 1 otherwise ignore */
69726972
if (keys.size() != ACL_TABLE_KEY_SIZE)
69736973
{
6974-
SWSS_LOG_INFO("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
6974+
SWSS_LOG_INFO("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
69756975
it = consumer.m_toSync.erase(it);
69766976
continue;
69776977
}
@@ -7112,7 +7112,7 @@ void NatMgr::doNatAclRuleTask(Consumer &consumer)
71127112
/* Ensure the key size is 2 otherwise ignore */
71137113
if (keys.size() != ACL_RULE_TABLE_KEY_SIZE)
71147114
{
7115-
SWSS_LOG_INFO("Invalid key size %lu, skipping %s", keys.size(), key.c_str());
7115+
SWSS_LOG_INFO("Invalid key size %zu, skipping %s", keys.size(), key.c_str());
71167116
it = consumer.m_toSync.erase(it);
71177117
continue;
71187118
}
@@ -7239,7 +7239,7 @@ void NatMgr::doNatAclRuleTask(Consumer &consumer)
72397239
/* Ensure the port range size is valid, otherwise ignore */
72407240
if (port_range.size() != L4_PORT_RANGE_SIZE)
72417241
{
7242-
SWSS_LOG_INFO("Invalid port range size %lu for Matching Port Range Field, skipping %s", port_range.size(), key.c_str());
7242+
SWSS_LOG_INFO("Invalid port range size %zu for Matching Port Range Field, skipping %s", port_range.size(), key.c_str());
72437243
isNatAclRuleNotValid = true;
72447244
break;
72457245
}

orchagent/natorch.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -3312,7 +3312,7 @@ bool NatOrch::getNatCounters(const NatEntry::iterator &iter)
33123312
{
33133313
if (status != SAI_STATUS_SUCCESS)
33143314
{
3315-
SWSS_LOG_ERROR("Failed to get Counters for SNAT entry [src-ip %s], bytes = %lu, pkts = %lu", ipAddr.to_string().c_str(),
3315+
SWSS_LOG_ERROR("Failed to get Counters for SNAT entry [src-ip %s], bytes = %" PRIu64 ", pkts = %" PRIu64 "", ipAddr.to_string().c_str(),
33163316
nat_entry_attr[0].value.u64, nat_entry_attr[1].value.u64);
33173317
}
33183318
else
@@ -3325,7 +3325,7 @@ bool NatOrch::getNatCounters(const NatEntry::iterator &iter)
33253325
{
33263326
if (status != SAI_STATUS_SUCCESS)
33273327
{
3328-
SWSS_LOG_ERROR("Failed to get Counters for DNAT entry [dst-ip %s], bytes = %lu, pkts = %lu", ipAddr.to_string().c_str(),
3328+
SWSS_LOG_ERROR("Failed to get Counters for DNAT entry [dst-ip %s], bytes = %" PRIu64 ", pkts = %" PRIu64 "", ipAddr.to_string().c_str(),
33293329
nat_entry_attr[0].value.u64, nat_entry_attr[1].value.u64);
33303330
}
33313331
else
@@ -3376,7 +3376,7 @@ bool NatOrch::getTwiceNatCounters(const TwiceNatEntry::iterator &iter)
33763376
status = sai_nat_api->get_nat_entry_attribute(&dbl_nat_entry, attr_count, nat_entry_attr);
33773377
if (status != SAI_STATUS_SUCCESS)
33783378
{
3379-
SWSS_LOG_ERROR("Failed to get Counters for Twice NAT entry [src-ip %s, dst-ip %s], bytes = %lu, pkts = %lu",
3379+
SWSS_LOG_ERROR("Failed to get Counters for Twice NAT entry [src-ip %s, dst-ip %s], bytes = %" PRIu64 ", pkts = %" PRIu64 "",
33803380
key.src_ip.to_string().c_str(), key.dst_ip.to_string().c_str(),
33813381
nat_entry_attr[0].value.u64, nat_entry_attr[1].value.u64);
33823382
}
@@ -3521,7 +3521,7 @@ bool NatOrch::getNaptCounters(const NaptEntry::iterator &iter)
35213521
{
35223522
if (status != SAI_STATUS_SUCCESS)
35233523
{
3524-
SWSS_LOG_ERROR("Failed to get Counters for SNAPT entry for [proto %s, src-ip %s, src-port %d], bytes = %lu, pkts = %lu",
3524+
SWSS_LOG_ERROR("Failed to get Counters for SNAPT entry for [proto %s, src-ip %s, src-port %d], bytes = %" PRIu64 ", pkts = %" PRIu64 "",
35253525
naptKey.prototype.c_str(), naptKey.ip_address.to_string().c_str(), naptKey.l4_port,
35263526
nat_entry_attr[0].value.u64, nat_entry_attr[1].value.u64);
35273527
}
@@ -3535,7 +3535,7 @@ bool NatOrch::getNaptCounters(const NaptEntry::iterator &iter)
35353535
{
35363536
if (status != SAI_STATUS_SUCCESS)
35373537
{
3538-
SWSS_LOG_ERROR("Failed to get Counters for DNAPT entry for [proto %s, dst-ip %s, dst-port %d], bytes = %lu, pkts = %lu",
3538+
SWSS_LOG_ERROR("Failed to get Counters for DNAPT entry for [proto %s, dst-ip %s, dst-port %d], bytes = %" PRIu64 ", pkts = %" PRIu64 "",
35393539
naptKey.prototype.c_str(), naptKey.ip_address.to_string().c_str(), naptKey.l4_port,
35403540
nat_entry_attr[0].value.u64, nat_entry_attr[1].value.u64);
35413541
}
@@ -4732,7 +4732,7 @@ void NatOrch::debugdumpALL()
47324732
SWSS_DEBUG_PRINT(m_dbgCompName, "%8d. IP: %s", count, ipAddr.to_string().c_str());
47334733
SWSS_DEBUG_PRINT(m_dbgCompName, " Translated IP: %s, NAT Type: %s, Entry Type: %s",
47344734
value.translated_ip.to_string().c_str(), value.nat_type.c_str(), value.entry_type.c_str());
4735-
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %ld secs, Added-to-Hw: %s",
4735+
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %" PRId64 " secs, Added-to-Hw: %s",
47364736
(value.ageOutTime - time_now.tv_sec), ((value.addedToHw) ? "Yes" : "No"));
47374737
natIter++;
47384738
}
@@ -4751,7 +4751,7 @@ void NatOrch::debugdumpALL()
47514751
SWSS_DEBUG_PRINT(m_dbgCompName, " Translated IP: %s, L4 Port: %d, NAT Type: %s, Entry Type: %s",
47524752
naptValue.translated_ip.to_string().c_str(), naptValue.translated_l4_port,
47534753
naptValue.nat_type.c_str(), naptValue.entry_type.c_str());
4754-
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %ld secs, Added-to-Hw: %s",
4754+
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %" PRId64 " secs, Added-to-Hw: %s",
47554755
(naptValue.ageOutTime - time_now.tv_sec), ((naptValue.addedToHw) ? "Yes" : "No"));
47564756
naptIter++;
47574757
}
@@ -4771,7 +4771,7 @@ void NatOrch::debugdumpALL()
47714771
SWSS_DEBUG_PRINT(m_dbgCompName, " Translated Src IP: %s, Dst IP: %s, Entry Type: %s",
47724772
twiceNatValue.translated_src_ip.to_string().c_str(), twiceNatValue.translated_dst_ip.to_string().c_str(),
47734773
twiceNatValue.entry_type.c_str());
4774-
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %ld secs, Added-to-Hw: %s",
4774+
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %" PRId64 " secs, Added-to-Hw: %s",
47754775
(twiceNatValue.ageOutTime - time_now.tv_sec), ((twiceNatValue.addedToHw) ? "Yes" : "No"));
47764776
twiceNatIter++;
47774777
}
@@ -4793,7 +4793,7 @@ void NatOrch::debugdumpALL()
47934793
twiceNaptValue.translated_src_ip.to_string().c_str(), twiceNaptValue.translated_src_l4_port,
47944794
twiceNaptValue.translated_dst_ip.to_string().c_str(), twiceNaptValue.translated_dst_l4_port,
47954795
twiceNaptValue.entry_type.c_str());
4796-
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %ld secs, Added-to-Hw: %s",
4796+
SWSS_DEBUG_PRINT(m_dbgCompName, " Age-out time: %" PRId64 " secs, Added-to-Hw: %s",
47974797
(twiceNaptValue.ageOutTime - time_now.tv_sec), ((twiceNaptValue.addedToHw) ? "Yes" : "No"));
47984798
twiceNaptIter++;
47994799
}

orchagent/portsorch.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,7 @@ void PortsOrch::removePortFromPortListMap(sai_object_id_t port_id)
17731773
{
17741774
if (it->second == port_id)
17751775
{
1776-
SWSS_LOG_NOTICE("Removing port-id %lx from port list map", port_id);
1776+
SWSS_LOG_NOTICE("Removing port-id %" PRIx64 " from port list map", port_id);
17771777
it = m_portListLaneMap.erase(it);
17781778
break;
17791779
}
@@ -2276,15 +2276,15 @@ void PortsOrch::doPortTask(Consumer &consumer)
22762276
// port is part of at-least one VLAN.
22772277
// Ideally this should be tracked by SAI redis.
22782278
// Until then, let this snippet be here.
2279-
SWSS_LOG_WARN("Cannot remove port as bridge port OID is present %lx", bridge_port_oid);
2279+
SWSS_LOG_WARN("Cannot remove port as bridge port OID is present %" PRIx64 , bridge_port_oid);
22802280
it++;
22812281
continue;
22822282
}
22832283

22842284
if (m_portList[alias].m_init)
22852285
{
22862286
deInitPort(alias, port_id);
2287-
SWSS_LOG_NOTICE("Removing hostif %lx for Port %s", hif_id, alias.c_str());
2287+
SWSS_LOG_NOTICE("Removing hostif %" PRIx64 " for Port %s", hif_id, alias.c_str());
22882288
sai_status_t status = sai_hostif_api->remove_hostif(hif_id);
22892289
if (status != SAI_STATUS_SUCCESS)
22902290
{

0 commit comments

Comments
 (0)