Rename struct __res_params to res_params

The double-underscore prefixes are a leftover from when this code lived
in bionic. Now we're slowly getting rid of them...

Also cleanup transitive includes a bit.

Test: atest resolv_integration_test resolv_unit_test
Change-Id: I65ed8aed273be4af37a982a167f364a1f33f9a36
diff --git a/server/CommandListener.cpp b/server/CommandListener.cpp
index 0c750e0..0369cce 100644
--- a/server/CommandListener.cpp
+++ b/server/CommandListener.cpp
@@ -652,8 +652,8 @@
         return false;
     }
     int end = argc;
-    __res_params params = {};
-    const __res_params* paramsPtr = nullptr;
+    res_params params = {};
+    const res_params* paramsPtr = nullptr;
     if (end > 6 && !strcmp(argv[end - 2], "--params")) {
         const char* paramsStr = argv[end - 1];
         end -= 2;
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp
index 50e1275..b3297bb 100644
--- a/server/NetworkController.cpp
+++ b/server/NetworkController.cpp
@@ -29,12 +29,11 @@
 #include "log/log.h"
 
 #include <android-base/strings.h>
+#include <cutils/misc.h>  // FIRST_APPLICATION_UID
 #include <netd_resolv/resolv.h>
 #include <netd_resolv/resolv_stub.h>
 #include "android/net/INetd.h"
 
-#include "cutils/misc.h"
-
 #include "Controllers.h"
 #include "DummyNetwork.h"
 #include "DumpWriter.h"
diff --git a/server/ResolverController.cpp b/server/ResolverController.cpp
index 0e9fc7d..c8bf967 100644
--- a/server/ResolverController.cpp
+++ b/server/ResolverController.cpp
@@ -119,7 +119,8 @@
 }  // namespace
 
 int ResolverController::setDnsServers(unsigned netId, const char* searchDomains,
-        const char** servers, int numservers, const __res_params* params) {
+                                      const char** servers, int numservers,
+                                      const res_params* params) {
     if (DBG) {
         ALOGD("setDnsServers netId = %u, numservers = %d", netId, numservers);
     }
@@ -139,7 +140,7 @@
 }
 
 int ResolverController::getDnsInfo(unsigned netId, std::vector<std::string>* servers,
-                                   std::vector<std::string>* domains, __res_params* params,
+                                   std::vector<std::string>* domains, res_params* params,
                                    std::vector<android::net::ResolverStats>* stats,
                                    std::vector<int32_t>* wait_for_pending_req_timeout_count) {
     using android::net::ResolverStats;
@@ -160,7 +161,7 @@
     res_stats res_stats[MAXNS];
     servers->clear();
     domains->clear();
-    *params = __res_params{};
+    *params = res_params{};
     stats->clear();
     int res_wait_for_pending_req_timeout_count;
     int revision_id = RESOLV_STUB.android_net_res_stats_get_info_for_net(
@@ -274,7 +275,7 @@
         }
     }
 
-    __res_params res_params = {};
+    res_params res_params = {};
     res_params.sample_validity = params[INetd::RESOLVER_PARAMS_SAMPLE_VALIDITY];
     res_params.success_threshold = params[INetd::RESOLVER_PARAMS_SUCCESS_THRESHOLD];
     res_params.min_samples = params[INetd::RESOLVER_PARAMS_MIN_SAMPLES];
@@ -319,7 +320,7 @@
                                         std::vector<int32_t>* wait_for_pending_req_timeout_count) {
     using android::net::ResolverStats;
     using android::net::INetd;
-    __res_params res_params;
+    res_params res_params;
     std::vector<ResolverStats> res_stats;
     int ret = getDnsInfo(netId, servers, domains, &res_params, &res_stats,
                          wait_for_pending_req_timeout_count);
@@ -382,7 +383,7 @@
     using android::net::ResolverStats;
     std::vector<std::string> servers;
     std::vector<std::string> domains;
-    __res_params params = {};
+    res_params params = {};
     std::vector<ResolverStats> stats;
     std::vector<int32_t> wait_for_pending_req_timeout_count(1, 0);
     time_t now = time(nullptr);
diff --git a/server/ResolverController.h b/server/ResolverController.h
index 6d8b741..3cb841c 100644
--- a/server/ResolverController.h
+++ b/server/ResolverController.h
@@ -23,7 +23,7 @@
 #include "Dns64Configuration.h"
 #include "netdutils/InternetAddresses.h"
 
-struct __res_params;
+struct res_params;
 
 namespace android {
 namespace net {
@@ -41,12 +41,12 @@
 
     // TODO: delete this function
     int setDnsServers(unsigned netId, const char* searchDomains, const char** servers,
-            int numservers, const __res_params* params);
+                      int numservers, const res_params* params);
 
     int clearDnsServers(unsigned netid);
 
     int getDnsInfo(unsigned netId, std::vector<std::string>* servers,
-                   std::vector<std::string>* domains, __res_params* params,
+                   std::vector<std::string>* domains, res_params* params,
                    std::vector<android::net::ResolverStats>* stats,
                    std::vector<int32_t>* wait_for_pending_req_timeout_count);
 
diff --git a/server/binder/android/net/INetd.aidl b/server/binder/android/net/INetd.aidl
index 34ec7a1..b257867 100644
--- a/server/binder/android/net/INetd.aidl
+++ b/server/binder/android/net/INetd.aidl
@@ -191,8 +191,8 @@
      * @param servers the DNS servers to configure for the network.
      * @param domains the search domains to configure.
      * @param params the params to set. This array contains RESOLVER_PARAMS_COUNT integers that
-     *   encode the contents of Bionic's __res_params struct, i.e. sample_validity is stored at
-     *   position RESOLVER_PARAMS_SAMPLE_VALIDITY, etc.
+     *   encode the contents of the res_params struct, i.e. sample_validity is stored at position
+     *   RESOLVER_PARAMS_SAMPLE_VALIDITY, etc.
      * @param tlsName The TLS subject name to require for all servers, or empty if there is none.
      * @param tlsServers the DNS servers to configure for strict mode Private DNS.
      * @param tlsFingerprints An array containing TLS public key fingerprints (pins) of which each
@@ -223,7 +223,7 @@
      * @param servers the DNS servers that are currently configured for the network.
      * @param domains the search domains currently configured.
      * @param tlsServers the DNS-over-TLS servers that are currently configured for the network.
-     * @param params the resolver parameters configured, i.e. the contents of __res_params in order.
+     * @param params the resolver parameters configured, i.e. the contents of res_params in order.
      * @param stats the stats for each server in the order specified by RESOLVER_STATS_XXX
      *         constants, serialized as an int array. The contents of this array are the number of
      *         <ul>