Merge "TrafficController - trivialize dump()" into main am: a5af3e3e5e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2717698
Change-Id: Ie437ff95e90258a7153ab42f372021f5cb84efc0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/service/native/TrafficController.cpp b/service/native/TrafficController.cpp
index dd5b01e..3828389 100644
--- a/service/native/TrafficController.cpp
+++ b/service/native/TrafficController.cpp
@@ -576,44 +576,12 @@
}
}
-std::string getMapStatus(const base::unique_fd& map_fd, const char* path) {
- if (map_fd.get() < 0) {
- return StringPrintf("map fd lost");
- }
- if (access(path, F_OK) != 0) {
- return StringPrintf("map not pinned to location: %s", path);
- }
- return StringPrintf("OK");
-}
-
void TrafficController::dump(int fd, bool verbose __unused) {
std::lock_guard guard(mMutex);
DumpWriter dw(fd);
ScopedIndent indentTop(dw);
dw.println("TrafficController");
-
- ScopedIndent indentPreBpfModule(dw);
-
- dw.blankline();
- dw.println("mCookieTagMap status: %s",
- getMapStatus(mCookieTagMap.getMap(), COOKIE_TAG_MAP_PATH).c_str());
- dw.println("mUidCounterSetMap status: %s",
- getMapStatus(mUidCounterSetMap.getMap(), UID_COUNTERSET_MAP_PATH).c_str());
- dw.println("mAppUidStatsMap status: %s",
- getMapStatus(mAppUidStatsMap.getMap(), APP_UID_STATS_MAP_PATH).c_str());
- dw.println("mStatsMapA status: %s",
- getMapStatus(mStatsMapA.getMap(), STATS_MAP_A_PATH).c_str());
- dw.println("mStatsMapB status: %s",
- getMapStatus(mStatsMapB.getMap(), STATS_MAP_B_PATH).c_str());
- dw.println("mIfaceIndexNameMap status: %s",
- getMapStatus(mIfaceIndexNameMap.getMap(), IFACE_INDEX_NAME_MAP_PATH).c_str());
- dw.println("mIfaceStatsMap status: %s",
- getMapStatus(mIfaceStatsMap.getMap(), IFACE_STATS_MAP_PATH).c_str());
- dw.println("mConfigurationMap status: %s",
- getMapStatus(mConfigurationMap.getMap(), CONFIGURATION_MAP_PATH).c_str());
- dw.println("mUidOwnerMap status: %s",
- getMapStatus(mUidOwnerMap.getMap(), UID_OWNER_MAP_PATH).c_str());
}
} // namespace net
diff --git a/service/native/include/TrafficController.h b/service/native/include/TrafficController.h
index cb6c836..d610d25 100644
--- a/service/native/include/TrafficController.h
+++ b/service/native/include/TrafficController.h
@@ -33,8 +33,6 @@
class TrafficController {
public:
- static constexpr char DUMP_KEYWORD[] = "trafficcontroller";
-
/*
* Initialize the whole controller
*/