You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.1 KiB
101 lines
4.1 KiB
From cae4b6abbd66770e6761f6bd47f85cf271cc870b Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Wed, 4 Jan 2023 16:32:51 +0100
|
|
Subject: [PATCH] resolved: add some line-breaks/comments
|
|
|
|
Let's make this a bit more readable.
|
|
|
|
(cherry picked from commit 5707fb12978e6818afba379b803da307050f541b)
|
|
|
|
Related: #2161260
|
|
---
|
|
src/resolve/resolvectl.c | 20 +++++++++++++++-----
|
|
src/resolve/resolved-bus.c | 12 ++++++++++--
|
|
2 files changed, 25 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
|
|
index 2fd6c4914f..1cb16430e4 100644
|
|
--- a/src/resolve/resolvectl.c
|
|
+++ b/src/resolve/resolvectl.c
|
|
@@ -1217,7 +1217,11 @@ static int read_dns_server_one(sd_bus_message *m, bool with_ifindex, bool extend
|
|
assert(m);
|
|
assert(ret);
|
|
|
|
- r = sd_bus_message_enter_container(m, 'r', with_ifindex ? (extended ? "iiayqs" : "iiay") : (extended ? "iayqs" : "iay"));
|
|
+ r = sd_bus_message_enter_container(
|
|
+ m,
|
|
+ 'r',
|
|
+ with_ifindex ? (extended ? "iiayqs" : "iiay") :
|
|
+ (extended ? "iayqs" : "iay"));
|
|
if (r <= 0)
|
|
return r;
|
|
|
|
@@ -1262,7 +1266,6 @@ static int read_dns_server_one(sd_bus_message *m, bool with_ifindex, bool extend
|
|
return r;
|
|
|
|
*ret = TAKE_PTR(pretty);
|
|
-
|
|
return 1;
|
|
}
|
|
|
|
@@ -1731,7 +1734,14 @@ static int status_ifindex(sd_bus *bus, int ifindex, const char *name, StatusMode
|
|
return 0;
|
|
}
|
|
|
|
-static int map_global_dns_servers_internal(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata, bool extended) {
|
|
+static int map_global_dns_servers_internal(
|
|
+ sd_bus *bus,
|
|
+ const char *member,
|
|
+ sd_bus_message *m,
|
|
+ sd_bus_error *error,
|
|
+ void *userdata,
|
|
+ bool extended) {
|
|
+
|
|
char ***l = ASSERT_PTR(userdata);
|
|
int r;
|
|
|
|
@@ -1768,11 +1778,11 @@ static int map_global_dns_servers_internal(sd_bus *bus, const char *member, sd_b
|
|
}
|
|
|
|
static int map_global_dns_servers(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
|
|
- return map_global_dns_servers_internal(bus, member, m, error, userdata, false);
|
|
+ return map_global_dns_servers_internal(bus, member, m, error, userdata, /* extended= */ false);
|
|
}
|
|
|
|
static int map_global_dns_servers_ex(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
|
|
- return map_global_dns_servers_internal(bus, member, m, error, userdata, true);
|
|
+ return map_global_dns_servers_internal(bus, member, m, error, userdata, /* extended= */ true);
|
|
}
|
|
|
|
static int map_global_current_dns_server(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {
|
|
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
|
|
index 2e3941da39..c818e1d52f 100644
|
|
--- a/src/resolve/resolved-bus.c
|
|
+++ b/src/resolve/resolved-bus.c
|
|
@@ -1371,7 +1371,11 @@ static int bus_method_resolve_service(sd_bus_message *message, void *userdata, s
|
|
return 1;
|
|
}
|
|
|
|
-int bus_dns_server_append(sd_bus_message *reply, DnsServer *s, bool with_ifindex, bool extended) {
|
|
+int bus_dns_server_append(
|
|
+ sd_bus_message *reply,
|
|
+ DnsServer *s,
|
|
+ bool with_ifindex, /* include "ifindex" field */
|
|
+ bool extended) { /* also include port number and server name */
|
|
int r;
|
|
|
|
assert(reply);
|
|
@@ -1390,7 +1394,11 @@ int bus_dns_server_append(sd_bus_message *reply, DnsServer *s, bool with_ifindex
|
|
}
|
|
}
|
|
|
|
- r = sd_bus_message_open_container(reply, 'r', with_ifindex ? (extended ? "iiayqs" : "iiay") : (extended ? "iayqs" : "iay"));
|
|
+ r = sd_bus_message_open_container(
|
|
+ reply,
|
|
+ 'r',
|
|
+ with_ifindex ? (extended ? "iiayqs" : "iiay") :
|
|
+ (extended ? "iayqs" : "iay"));
|
|
if (r < 0)
|
|
return r;
|
|
|