1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 08:26:52 +03:00

dbus-unit: use BUS_DEFINE_PROPERTY_GET* macros

This commit is contained in:
Yu Watanabe 2018-05-11 18:11:18 +09:00
parent 6bfb45bea4
commit cb7f88fcf4

View File

@ -33,6 +33,12 @@ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_collect_mode, collect_mode, Col
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_load_state, unit_load_state, UnitLoadState);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_job_mode, job_mode, JobMode);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_emergency_action, emergency_action, EmergencyAction);
static BUS_DEFINE_PROPERTY_GET(property_get_description, "s", Unit, unit_description);
static BUS_DEFINE_PROPERTY_GET2(property_get_active_state, "s", Unit, unit_active_state, unit_active_state_to_string);
static BUS_DEFINE_PROPERTY_GET(property_get_sub_state, "s", Unit, unit_sub_state_to_string);
static BUS_DEFINE_PROPERTY_GET2(property_get_unit_file_state, "s", Unit, unit_get_unit_file_state, unit_file_state_to_string);
static BUS_DEFINE_PROPERTY_GET(property_get_can_reload, "b", Unit, unit_can_reload);
static BUS_DEFINE_PROPERTY_GET(property_get_need_daemon_reload, "b", Unit, unit_need_daemon_reload);
static int property_get_names(
sd_bus *bus,
@ -162,60 +168,6 @@ static int property_get_requires_mounts_for(
return sd_bus_message_close_container(reply);
}
static int property_get_description(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Unit *u = userdata;
assert(bus);
assert(reply);
assert(u);
return sd_bus_message_append(reply, "s", unit_description(u));
}
static int property_get_active_state(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Unit *u = userdata;
assert(bus);
assert(reply);
assert(u);
return sd_bus_message_append(reply, "s", unit_active_state_to_string(unit_active_state(u)));
}
static int property_get_sub_state(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Unit *u = userdata;
assert(bus);
assert(reply);
assert(u);
return sd_bus_message_append(reply, "s", unit_sub_state_to_string(u));
}
static int property_get_unit_file_preset(
sd_bus *bus,
const char *path,
@ -239,24 +191,6 @@ static int property_get_unit_file_preset(
r > 0 ? "enabled" : "disabled");
}
static int property_get_unit_file_state(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Unit *u = userdata;
assert(bus);
assert(reply);
assert(u);
return sd_bus_message_append(reply, "s", unit_file_state_to_string(unit_get_unit_file_state(u)));
}
static int property_get_can_start(
sd_bus *bus,
const char *path,
@ -293,24 +227,6 @@ static int property_get_can_stop(
return sd_bus_message_append(reply, "b", unit_can_stop(u) && !u->refuse_manual_stop);
}
static int property_get_can_reload(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Unit *u = userdata;
assert(bus);
assert(reply);
assert(u);
return sd_bus_message_append(reply, "b", unit_can_reload(u));
}
static int property_get_can_isolate(
sd_bus *bus,
const char *path,
@ -355,24 +271,6 @@ static int property_get_job(
return sd_bus_message_append(reply, "(uo)", u->job->id, p);
}
static int property_get_need_daemon_reload(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
Unit *u = userdata;
assert(bus);
assert(reply);
assert(u);
return sd_bus_message_append(reply, "b", unit_need_daemon_reload(u));
}
static int property_get_conditions(
sd_bus *bus,
const char *path,