Skip to content

Commit

Permalink
Revert some style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bocon13 committed Nov 8, 2021
1 parent 52129ca commit bb18468
Show file tree
Hide file tree
Showing 15 changed files with 269 additions and 271 deletions.
26 changes: 13 additions & 13 deletions cfgmgr/buffermgrd.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include "buffermgr.h"
#include "buffermgrdyn.h"
#include <unistd.h>
#include <getopt.h>
#include <vector>
#include <mutex>
#include "dbconnector.h"
#include "select.h"
#include "exec.h"
#include "json.h"
#include "json.hpp"
#include "schema.h"
#include "select.h"
#include "buffermgr.h"
#include "buffermgrdyn.h"
#include <fstream>
#include <getopt.h>
#include <iostream>
#include <mutex>
#include <unistd.h>
#include <vector>
#include "json.h"
#include "json.hpp"

using namespace std;
using namespace swss;
Expand Down Expand Up @@ -56,7 +56,7 @@ void dump_db_item(KeyOpFieldsValuesTuple &db_item)
SWSS_LOG_DEBUG("\toperation: %s", kfvOp(db_item).c_str());
SWSS_LOG_DEBUG("\thash: %s", kfvKey(db_item).c_str());
SWSS_LOG_DEBUG("\tfields: [");
for (auto fv : kfvFieldsValues(db_item))
for (auto fv: kfvFieldsValues(db_item))
SWSS_LOG_DEBUG("\t\tfield: %s value: %s", fvField(fv).c_str(), fvValue(fv).c_str());
SWSS_LOG_DEBUG("\t]");
SWSS_LOG_DEBUG("]");
Expand Down Expand Up @@ -119,7 +119,7 @@ int main(int argc, char **argv)

SWSS_LOG_NOTICE("--- Starting buffermgrd ---");

while ((opt = getopt(argc, argv, "l:a:p:h")) != -1)
while ((opt = getopt(argc, argv, "l:a:p:h")) != -1 )
{
switch (opt)
{
Expand Down Expand Up @@ -162,7 +162,7 @@ int main(int argc, char **argv)

if (!peripherial_table_file.empty())
{
// Load the json file containing the PERIPHERIAL_TABLE
//Load the json file containing the PERIPHERIAL_TABLE
db_items_ptr = load_json(peripherial_table_file);
if (nullptr != db_items_ptr)
write_to_state_db(db_items_ptr);
Expand Down Expand Up @@ -240,7 +240,7 @@ int main(int argc, char **argv)
c->execute();
}
}
catch (const std::exception &e)
catch(const std::exception &e)
{
SWSS_LOG_ERROR("Runtime error: %s", e.what());
}
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/coppmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <unistd.h>
#include <vector>

#include "coppmgr.h"
#include "exec.h"
#include "coppmgr.h"
#include "schema.h"
#include "select.h"
#include "warm_restart.h"
Expand Down
14 changes: 7 additions & 7 deletions cfgmgr/intfmgrd.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <unistd.h>
#include <vector>
#include <mutex>
#include "dbconnector.h"
#include "select.h"
#include "exec.h"
#include "intfmgr.h"
#include "schema.h"
#include "select.h"
#include "warm_restart.h"
#include "intfmgr.h"
#include <fstream>
#include <iostream>
#include <mutex>
#include <unistd.h>
#include <vector>
#include "warm_restart.h"

using namespace std;
using namespace swss;
Expand Down Expand Up @@ -94,7 +94,7 @@ int main(int argc, char **argv)
c->execute();
}
}
catch (const std::exception &e)
catch(const std::exception &e)
{
SWSS_LOG_ERROR("Runtime error: %s", e.what());
}
Expand Down
19 changes: 10 additions & 9 deletions cfgmgr/macsecmgrd.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include <algorithm>
#include <unistd.h>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <mutex>
#include <sstream>
#include <unistd.h>
#include <vector>
#include <algorithm>

#include <exec.h>
#include <logger.h>
#include <macaddress.h>
#include <producerstatetable.h>
#include <select.h>
#include <shellcmd.h>
#include <macaddress.h>
#include <exec.h>
#include <tokenize.h>
#include <shellcmd.h>
#include <warm_restart.h>
#include <select.h>

#include "macsecmgr.h"

Expand Down Expand Up @@ -45,6 +45,7 @@ string gResponsePublisherRecordFile;
/* Global database mutex */
mutex gDbMutex;


int main(int argc, char **argv)
{

Expand Down Expand Up @@ -93,7 +94,7 @@ int main(int argc, char **argv)
c->execute();
}
}
catch (const std::exception &e)
catch(const std::exception &e)
{
SWSS_LOG_ERROR("Runtime error: %s", e.what());
}
Expand Down
84 changes: 42 additions & 42 deletions cfgmgr/natmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
* limitations under the License.
*/

#include <unistd.h>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <mutex>
#include <algorithm>
#include <signal.h>
#include "dbconnector.h"
#include "select.h"
#include "exec.h"
#include "schema.h"
#include "macaddress.h"
#include "natmgr.h"
#include "notificationproducer.h"
#include "producerstatetable.h"
#include "schema.h"
#include "select.h"
#include "notificationproducer.h"
#include "natmgr.h"
#include "shellcmd.h"
#include "warm_restart.h"
#include <algorithm>
#include <fstream>
#include <iostream>
#include <mutex>
#include <signal.h>
#include <sstream>
#include <unistd.h>
#include <vector>

using namespace std;
using namespace swss;
Expand All @@ -47,28 +47,28 @@ using namespace swss;
* Once Orch class refactoring is done, these global variables
* should be removed from here.
*/
int gBatchSize = 0;
bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
mutex gDbMutex;
NatMgr *natmgr = NULL;

NotificationConsumer *timeoutNotificationsConsumer = NULL;
NotificationConsumer *flushNotificationsConsumer = NULL;
int gBatchSize = 0;
bool gSwssRecord = false;
bool gLogRotate = false;
ofstream gRecordOfs;
string gRecordFile;
bool gResponsePublisherRecord = false;
bool gResponsePublisherLogRotate = false;
ofstream gResponsePublisherRecordOfs;
string gResponsePublisherRecordFile;
mutex gDbMutex;
NatMgr *natmgr = NULL;

NotificationConsumer *timeoutNotificationsConsumer = NULL;
NotificationConsumer *flushNotificationsConsumer = NULL;

std::shared_ptr<swss::NotificationProducer> cleanupNotifier;

void sigterm_handler(int signo)
{
int ret = 0;
std::string res;
const std::string conntrackFlush = "conntrack -F";
const std::string conntrackFlush = "conntrack -F";

SWSS_LOG_NOTICE("Got SIGTERM");

Expand All @@ -88,7 +88,7 @@ void sigterm_handler(int signo)

cleanupNotifier->send("nat_cleanup", "all", entry);
}

if (natmgr)
{
natmgr->removeStaticNatIptables();
Expand Down Expand Up @@ -138,7 +138,7 @@ int main(int argc, char **argv)
natmgr = new NatMgr(&cfgDb, &appDb, &stateDb, cfg_tables);

natmgr->isPortInitDone(&appDb);

std::vector<Orch *> cfgOrchList = {natmgr};

swss::Select s;
Expand Down Expand Up @@ -168,24 +168,24 @@ int main(int argc, char **argv)

if (sel == timeoutNotificationsConsumer)
{
std::string op;
std::string data;
std::vector<swss::FieldValueTuple> values;
std::string op;
std::string data;
std::vector<swss::FieldValueTuple> values;

timeoutNotificationsConsumer->pop(op, data, values);
natmgr->timeoutNotifications(op, data);
continue;
timeoutNotificationsConsumer->pop(op, data, values);
natmgr->timeoutNotifications(op, data);
continue;
}

if (sel == flushNotificationsConsumer)
{
std::string op;
std::string data;
std::vector<swss::FieldValueTuple> values;
std::string op;
std::string data;
std::vector<swss::FieldValueTuple> values;

flushNotificationsConsumer->pop(op, data, values);
natmgr->flushNotifications(op, data);
continue;
flushNotificationsConsumer->pop(op, data, values);
natmgr->flushNotifications(op, data);
continue;
}

if (ret == Select::TIMEOUT)
Expand All @@ -198,7 +198,7 @@ int main(int argc, char **argv)
c->execute();
}
}
catch (const std::exception &e)
catch(const std::exception &e)
{
SWSS_LOG_ERROR("Runtime error: %s", e.what());
}
Expand Down
18 changes: 9 additions & 9 deletions cfgmgr/nbrmgrd.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <chrono>
#include <fstream>
#include <iostream>
#include <mutex>
#include <unistd.h>
#include <vector>
#include <mutex>
#include <fstream>
#include <iostream>
#include <chrono>

#include "select.h"
#include "exec.h"
#include "nbrmgr.h"
#include "schema.h"
#include "select.h"
#include "nbrmgr.h"
#include "warm_restart.h"

using namespace std;
Expand Down Expand Up @@ -67,8 +67,8 @@ int main(int argc, char **argv)
chrono::steady_clock::time_point starttime = chrono::steady_clock::now();
while (!nbrmgr.isNeighRestoreDone())
{
chrono::duration<double> time_span =
chrono::duration_cast<chrono::duration<double>>(chrono::steady_clock::now() - starttime);
chrono::duration<double> time_span = chrono::duration_cast<chrono::duration<double>>
(chrono::steady_clock::now() - starttime);
int pasttime = int(time_span.count());
SWSS_LOG_INFO("Kernel neighbor table restoration waited for %d seconds", pasttime);
if (pasttime > RESTORE_NEIGH_WAIT_TIME_OUT)
Expand Down Expand Up @@ -110,7 +110,7 @@ int main(int argc, char **argv)
c->execute();
}
}
catch (const std::exception &e)
catch(const std::exception &e)
{
SWSS_LOG_ERROR("Runtime error: %s", e.what());
}
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/sflowmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <vector>

#include "exec.h"
#include "sflowmgr.h"
#include "schema.h"
#include "select.h"
#include "sflowmgr.h"

using namespace std;
using namespace swss;
Expand Down
4 changes: 2 additions & 2 deletions cfgmgr/teammgrd.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <fstream>

#include "teammgr.h"
#include "netdispatcher.h"
#include "netlink.h"
#include "select.h"
#include "teammgr.h"
#include "warm_restart.h"
#include <signal.h>

Expand Down Expand Up @@ -64,7 +64,7 @@ int main(int argc, char **argv)
vector<Orch *> cfgOrchList = {&teammgr};

Select s;
for (Orch *o : cfgOrchList)
for (Orch *o: cfgOrchList)
{
s.addSelectables(o->getSelectables());
}
Expand Down
12 changes: 6 additions & 6 deletions cfgmgr/tunnelmgrd.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include <algorithm>
#include <unistd.h>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <mutex>
#include <sstream>
#include <unistd.h>
#include <vector>
#include <algorithm>

#include "dbconnector.h"
#include "select.h"
#include "exec.h"
#include "schema.h"
#include "select.h"
#include "tunnelmgr.h"

using namespace std;
Expand Down Expand Up @@ -86,7 +86,7 @@ int main(int argc, char **argv)
c->execute();
}
}
catch (const std::exception &e)
catch(const std::exception &e)
{
SWSS_LOG_ERROR("Runtime error: %s", e.what());
}
Expand Down
Loading

0 comments on commit bb18468

Please sign in to comment.