mirror of
https://github.com/systemd/systemd.git
synced 2025-01-31 05:47:30 +03:00
bus-map-properties: Use bus_log_parse_error_debug()
This commit is contained in:
parent
a78d1ef596
commit
3743ea3f62
@ -2,6 +2,7 @@
|
||||
|
||||
#include "bus-map-properties.h"
|
||||
#include "alloc-util.h"
|
||||
#include "bus-util.h"
|
||||
#include "strv.h"
|
||||
#include "bus-message.h"
|
||||
|
||||
@ -13,7 +14,7 @@ int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_err
|
||||
|
||||
r = sd_bus_message_read_array(m, SD_BUS_TYPE_BYTE, &v, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
if (n == 0)
|
||||
*p = SD_ID128_NULL;
|
||||
@ -32,11 +33,11 @@ int bus_map_strv_sort(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus
|
||||
|
||||
r = sd_bus_message_read_strv_extend(m, &l);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
r = strv_extend_strv(p, l, false);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
strv_sort(*p);
|
||||
return 0;
|
||||
@ -48,7 +49,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
|
||||
|
||||
r = sd_bus_message_peek_type(m, &type, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
switch (type) {
|
||||
|
||||
@ -59,7 +60,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
|
||||
|
||||
r = sd_bus_message_read_basic(m, type, &s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
if (isempty(s))
|
||||
s = NULL;
|
||||
@ -77,7 +78,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
|
||||
|
||||
r = sd_bus_message_read_strv_extend(m, &l);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
return strv_extend_strv(p, l, false);
|
||||
}
|
||||
@ -87,7 +88,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
|
||||
|
||||
r = sd_bus_message_read_basic(m, type, &b);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
if (flags & BUS_MAP_BOOLEAN_AS_BOOL)
|
||||
*(bool*) userdata = b;
|
||||
@ -103,7 +104,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
|
||||
|
||||
r = sd_bus_message_read_basic(m, type, &u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
*p = u;
|
||||
return 0;
|
||||
@ -115,7 +116,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
|
||||
|
||||
r = sd_bus_message_read_basic(m, type, &t);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
*p = t;
|
||||
return 0;
|
||||
@ -126,7 +127,7 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, unsigne
|
||||
|
||||
r = sd_bus_message_read_basic(m, type, &d);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
*p = d;
|
||||
return 0;
|
||||
@ -149,7 +150,7 @@ int bus_message_map_all_properties(
|
||||
|
||||
r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "{sv}");
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
while ((r = sd_bus_message_enter_container(m, SD_BUS_TYPE_DICT_ENTRY, "sv")) > 0) {
|
||||
const struct bus_properties_map *prop;
|
||||
@ -160,7 +161,7 @@ int bus_message_map_all_properties(
|
||||
|
||||
r = sd_bus_message_read_basic(m, SD_BUS_TYPE_STRING, &member);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
for (i = 0, prop = NULL; map[i].member; i++)
|
||||
if (streq(map[i].member, member)) {
|
||||
@ -171,11 +172,11 @@ int bus_message_map_all_properties(
|
||||
if (prop) {
|
||||
r = sd_bus_message_peek_type(m, NULL, &contents);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
r = sd_bus_message_enter_container(m, SD_BUS_TYPE_VARIANT, contents);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
v = (uint8_t *)userdata + prop->offset;
|
||||
if (map[i].set)
|
||||
@ -183,25 +184,29 @@ int bus_message_map_all_properties(
|
||||
else
|
||||
r = map_basic(sd_bus_message_get_bus(m), member, m, flags, error, v);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
} else {
|
||||
r = sd_bus_message_skip(m, "v");
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
}
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
}
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
return sd_bus_message_exit_container(m);
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error_debug(r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int bus_map_all_properties(
|
||||
|
Loading…
x
Reference in New Issue
Block a user