Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e150297c authored by Bernie Innocenti's avatar Bernie Innocenti
Browse files

Avoid pass-by-reference in C-style ABI of libnetd_resolv

This is in preparation to enabling the ABI checker on libnetd_resolv.

Switching resolv_init()'s argument from reference to pointer is
technically an ABI change, but in practice most calling conventions
pass pointers and references exactly the same way (I verified only
aarch64).

Test: as follows:
  - build libnetd_resolv
  - install on system with old netd binary
  - reboot
  - atest resolv_integration_test

Bug: 133117690
Merged-In: Iebf385036010b4065afe74209a9f7cf021ca5a20
Change-Id: I5f5c987271f3dadd94085e591c68e365482b9b3a
(cherry picked from commit 3a221bdedb249666bcb195173e7f853d5d3ab512)
parent 8e884554
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -24,13 +24,13 @@
#include "DnsResolverService.h"
#include "resolv_private.h"

bool resolv_init(const ResolverNetdCallbacks& callbacks) {
bool resolv_init(const ResolverNetdCallbacks* callbacks) {
    android::base::InitLogging(/*argv=*/nullptr);
    android::base::SetDefaultTag("libnetd_resolv");
    LOG(INFO) << __func__ << ": Initializing resolver";
    resolv_set_log_severity(android::base::WARNING);

    android::net::gResNetdCallbacks = callbacks;
    android::net::gResNetdCallbacks = *callbacks;
    android::net::gDnsResolv = android::net::DnsResolver::getInstance();
    return android::net::gDnsResolv->start();
}
+1 −1
Original line number Diff line number Diff line
@@ -148,6 +148,6 @@ int resolv_set_log_severity(uint32_t logSeverity);
LIBNETD_RESOLV_PUBLIC bool resolv_has_nameservers(unsigned netid);

// Set callbacks and bring DnsResolver up.
LIBNETD_RESOLV_PUBLIC bool resolv_init(const ResolverNetdCallbacks& callbacks);
LIBNETD_RESOLV_PUBLIC bool resolv_init(const ResolverNetdCallbacks* callbacks);

#endif  // NETD_RESOLV_RESOLV_H