Skip to content

Commit

Permalink
Apply clang-format to all files changed so far
Browse files Browse the repository at this point in the history
  • Loading branch information
ol-imorozko committed Sep 25, 2024
1 parent cddad22 commit 877bc6f
Show file tree
Hide file tree
Showing 58 changed files with 92 additions and 133 deletions.
4 changes: 2 additions & 2 deletions autotest/autotest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <arpa/inet.h>
#include <pcap.h>
#include <cstring>
#include <pcap.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -409,7 +409,7 @@ class TextDumper
class PcapDumper
{
public:
PcapDumper(std::string path, int capsize = MAX_PACK_LEN) :
PcapDumper(std::string path, int capsize = MAX_PACK_LEN) :
tmpFilePath(std::move(path)), pcap(pcap_open_dead(DLT_EN10MB, capsize))
{

Expand Down
1 change: 0 additions & 1 deletion autotest/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <csignal>


#include "common/result.h"

#include "autotest.h"
Expand Down
2 changes: 1 addition & 1 deletion cli/balancer.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void service(std::string module_string,
for (const auto& [service_key, service_value] : services)
{
const auto& [virtual_ip, proto, virtual_port] = service_key;
YANET_UNUSED const auto& [scheduler, version, nap_connections, packets, bytes] = service_value;
YANET_UNUSED const auto& [scheduler, version, nap_connections, packets, bytes] = service_value;

auto proto_string = controlplane::balancer::from_proto(proto);

Expand Down
4 changes: 0 additions & 4 deletions cli/develop.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

#include "helper.h"



namespace develop::dataplane
{

Expand Down Expand Up @@ -365,5 +363,3 @@ void tsc_monitoring()
}

}


4 changes: 2 additions & 2 deletions cli/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void get(const std::string& route_name,

for (const auto& item : response)
{
YANET_UNUSED const auto& [ingress_physical_ports, prefix, nexthop, egress_interface, labels] = item;
YANET_UNUSED const auto& [ingress_physical_ports, prefix, nexthop, egress_interface, labels] = item;

table.insert(ingress_physical_ports,
nexthop.is_default() ? std::string("") : nexthop.toString(),
Expand Down Expand Up @@ -188,7 +188,7 @@ void get(const std::string& route_name,

for (const auto& item : response)
{
YANET_UNUSED const auto& [ingress_physical_ports, prefix, nexthop, label, egress_interface, peer, weight_percent] = item;
YANET_UNUSED const auto& [ingress_physical_ports, prefix, nexthop, label, egress_interface, peer, weight_percent] = item;

double percent = (double)100.0 * weight_percent;

Expand Down
4 changes: 2 additions & 2 deletions cli/telegraf.h
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ void main_counters()
{
std::vector<influxdb_format::value_t> values;
auto* buffer = common::sdp::ShiftBuffer<uint64_t*>(worker_info.buffer,
sdp_data.metadata_worker.start_counters);
sdp_data.metadata_worker.start_counters);
for (const auto& [name, index] : sdp_data.metadata_worker.counter_positions)
{
values.emplace_back(name.data(), buffer[index]);
Expand All @@ -710,7 +710,7 @@ void main_counters()
{
std::vector<influxdb_format::value_t> values;
auto* buffer = common::sdp::ShiftBuffer<uint64_t*>(worker_info.buffer,
sdp_data.metadata_worker.start_counters);
sdp_data.metadata_worker.start_counters);
for (const auto& [name, index] : sdp_data.metadata_worker_gc.counter_positions)
{
values.emplace_back(name.data(), buffer[index]);
Expand Down
1 change: 0 additions & 1 deletion common/balancer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include <cstdint>
namespace balancer
{
Expand Down
6 changes: 2 additions & 4 deletions common/controlplaneconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ class config_t
namespace balancer
{

[[maybe_unused]]
static uint8_t to_proto(const std::string& string)
[[maybe_unused]] static uint8_t to_proto(const std::string& string)
{
if (string == "tcp")
{
Expand All @@ -265,8 +264,7 @@ static uint8_t to_proto(const std::string& string)
return 0;
}

[[maybe_unused]]
constexpr const char* from_proto(const uint8_t& proto)
[[maybe_unused]] constexpr const char* from_proto(const uint8_t& proto)
{
switch (proto)
{
Expand Down
1 change: 0 additions & 1 deletion common/define.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <set>
#include <vector>


#define YANET_UNUSED [[maybe_unused]]

#define YANET_LOG_PRINT(msg, args...) fprintf(stdout, msg, ##args)
Expand Down
2 changes: 0 additions & 2 deletions common/icp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "result.h"
#include "type.h"


namespace common::icp
{

Expand Down Expand Up @@ -1020,4 +1019,3 @@ using response = std::variant<std::tuple<>,
convert::response,
counters_stat::response>;
}

1 change: 0 additions & 1 deletion common/icp_proto.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


namespace common::icp_proto
{
constexpr inline char socketPath[] = "/run/yanet/protocontrolplane.sock";
Expand Down
1 change: 0 additions & 1 deletion common/idp.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include <array>
#include <map>
#include <set>
Expand Down
1 change: 0 additions & 1 deletion common/neighbor.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include <cstdint>
namespace common::neighbor
{
Expand Down
4 changes: 2 additions & 2 deletions common/refarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class refarray_t
return false;
}

YANET_UNUSED auto& [refcount, id] = it->second;
YANET_UNUSED auto& [refcount, id] = it->second;

refcount++;

Expand Down Expand Up @@ -104,7 +104,7 @@ class refarray_t
}

const auto& value = it->second;
YANET_UNUSED auto& [refcount, values_id] = values[value];
YANET_UNUSED auto& [refcount, values_id] = values[value];

refcount--;
if (refcount)
Expand Down
1 change: 0 additions & 1 deletion common/result.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include <cstdint>

namespace common
Expand Down
6 changes: 3 additions & 3 deletions common/rpc_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RpcController : public google::protobuf::RpcController
{
public:
RpcController() { _reset(); }
~RpcController() override = default;
~RpcController() override = default;

virtual void Reset()
{
Expand All @@ -25,9 +25,9 @@ class RpcController : public google::protobuf::RpcController
error_code_ = reason;
}
[[nodiscard]] virtual std::string ErrorText() const { return error_code_; }
virtual void StartCancel() {};
virtual void StartCancel(){};
[[nodiscard]] virtual bool IsCanceled() const { return false; };
virtual void NotifyOnCancel(::google::protobuf::Closure* /* callback */) {};
virtual void NotifyOnCancel(::google::protobuf::Closure* /* callback */){};

private:
bool is_failed_;
Expand Down
1 change: 0 additions & 1 deletion common/scheduler.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include <cstdint>
namespace balancer
{
Expand Down
4 changes: 2 additions & 2 deletions common/sdpclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class SdpClient
if (!core_id.has_value() || worker_core_id == core_id)
{
auto* counters = common::sdp::ShiftBuffer<uint64_t*>(worker_info.buffer,
sdp_data.metadata_worker.start_counters);
sdp_data.metadata_worker.start_counters);
result[worker_core_id] = counters[index];
}
}
Expand All @@ -194,7 +194,7 @@ class SdpClient
if (!core_id.has_value() || worker_core_id == core_id)
{
auto* counters = common::sdp::ShiftBuffer<uint64_t*>(worker_info.buffer,
sdp_data.metadata_worker.start_counters);
sdp_data.metadata_worker.start_counters);
result[worker_core_id] = counters[index];
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/sendrecv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <string>

#include <google/protobuf/message.h>
#include <cstring>
#include <google/protobuf/message.h>
#include <sys/socket.h>
#include <unistd.h>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion common/shared_memory.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <cstring>
#include <fcntl.h>
#include <numa.h>
#include <numaif.h>
#include <optional>
#include <cstring>
#include <sys/mman.h>
#include <sys/shm.h>
#include <sys/stat.h>
Expand Down
1 change: 0 additions & 1 deletion common/stream.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include <map>
#include <memory>
#include <optional>
Expand Down
4 changes: 0 additions & 4 deletions common/tsc_deltas.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#define YANET_TSC_BINS_SHIFT 2
#define YANET_TSC_BINS_N 4



namespace dataplane::perf
{

Expand Down Expand Up @@ -110,5 +108,3 @@ static_assert(std::is_pod_v<tsc_deltas> == true,
"tsc structure is not pod");

}


4 changes: 1 addition & 3 deletions common/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
#include <memory.h>
#include <nlohmann/json.hpp>

#include "config.release.h"
#include "ctree.h"
#include "define.h"
#include "stream.h"
#include "uint128.h"
#include "config.release.h"

using tCoreId = uint32_t;
using tSocketId = uint32_t;
Expand Down Expand Up @@ -1983,7 +1983,6 @@ constexpr ipv6_prefix_t ipv6_prefix_default = {ipv6_address_default, 0};

//


namespace worker::stats
{
struct common
Expand Down Expand Up @@ -2032,7 +2031,6 @@ struct port
};
}


namespace worker_gc
{
struct stats_t
Expand Down
2 changes: 1 addition & 1 deletion controlplane/acl/bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct bitset_t
}

[[nodiscard]] std::tuple<size_t, bool> minAnd(const bitset_t& p1,
const bitset_t& p2) const
const bitset_t& p2) const
{
for (size_t i = std::max(std::max(first_one, p1.first_one), p2.first_one); i < size; ++i)
{
Expand Down
1 change: 0 additions & 1 deletion controlplane/acl/dict.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include "bitset.h"
#include "network.h"
#include "rule.h"
Expand Down
5 changes: 2 additions & 3 deletions controlplane/acl_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ class tree_t
for (const auto& [key, value] : warp_chunk_ids)
{
const auto& [prev_address, prev_mask] = key;
YANET_UNUSED const auto& [prev_shift, prev_warp_chunk_id] = value;
YANET_UNUSED const auto& [prev_shift, prev_warp_chunk_id] = value;

type_t shared_shadow_mask = warp_shadow_mask & (prev_mask & (prev_mask + 1));

Expand Down Expand Up @@ -561,8 +561,7 @@ class tree_t
for (const auto& [map_key, map_value] : warp_chunk_ids)
{
const auto& [warp_address, warp_mask] = map_key;
YANET_UNUSED const auto& [shift, warp_chunk_id] = map_value;

YANET_UNUSED const auto& [shift, warp_chunk_id] = map_value;

type_t warp_shadow_mask = warp_mask & (warp_mask + 1);

Expand Down
14 changes: 7 additions & 7 deletions controlplane/balancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,13 @@ void balancer_t::Real(
for (const auto& real : req->reals())
{
request.emplace_back(real.module(),
convert_to_ip_address(real.virtual_ip()),
real.proto() == common::icp_proto::NetProto::tcp ? IPPROTO_TCP : IPPROTO_UDP,
real.virtual_port_opt_case() == common::icp_proto::BalancerRealRequest_Real::VirtualPortOptCase::kVirtualPort ? std::make_optional(real.virtual_port()) : std::nullopt,
convert_to_ip_address(real.real_ip()),
real.real_port_opt_case() == common::icp_proto::BalancerRealRequest_Real::RealPortOptCase::kRealPort ? std::make_optional(real.real_port()) : std::nullopt,
real.enable(),
real.weight_opt_case() == common::icp_proto::BalancerRealRequest_Real::WeightOptCase::kWeight ? std::make_optional(real.weight()) : std::nullopt);
convert_to_ip_address(real.virtual_ip()),
real.proto() == common::icp_proto::NetProto::tcp ? IPPROTO_TCP : IPPROTO_UDP,
real.virtual_port_opt_case() == common::icp_proto::BalancerRealRequest_Real::VirtualPortOptCase::kVirtualPort ? std::make_optional(real.virtual_port()) : std::nullopt,
convert_to_ip_address(real.real_ip()),
real.real_port_opt_case() == common::icp_proto::BalancerRealRequest_Real::RealPortOptCase::kRealPort ? std::make_optional(real.real_port()) : std::nullopt,
real.enable(),
real.weight_opt_case() == common::icp_proto::BalancerRealRequest_Real::WeightOptCase::kWeight ? std::make_optional(real.weight()) : std::nullopt);
}

balancer_real(request);
Expand Down
1 change: 0 additions & 1 deletion controlplane/bus.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once


#include "module.h"

namespace controlplane::module
Expand Down
5 changes: 2 additions & 3 deletions controlplane/configconverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <netinet/ip_icmp.h>

#include "acl.h"
#include "errors.h"
#include "configconverter.h"
#include "errors.h"

eResult config_converter_t::process(uint32_t serial)
{
Expand Down Expand Up @@ -1057,8 +1057,7 @@ void config_converter_t::acl_rules_nat64stateless_ingress(controlplane::base::ac
for (const auto& [key, value] : nat64stateless.translations)
{
const auto& [ipv6Address, ipv6DestinationAddress, ingressPortRange] = key;
YANET_UNUSED const auto& [ipv4Address, egressPortRange, translationId] = value;

YANET_UNUSED const auto& [ipv4Address, egressPortRange, translationId] = value;

flow.data.nat64stateless.translationId = translationId;
flow_icmp.data.nat64stateless.translationId = translationId;
Expand Down
4 changes: 2 additions & 2 deletions controlplane/configconverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class config_converter_t
{
public:
config_converter_t(cControlPlane* controlplane,
controlplane::base_t baseNext,
common::idp::limits::response limits) :
controlplane::base_t baseNext,
common::idp::limits::response limits) :
controlplane(controlplane),
baseNext(std::move(baseNext)),
limits(std::move(limits))
Expand Down
Loading

0 comments on commit 877bc6f

Please sign in to comment.