1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00

sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()

To mirror the recent name change of the concept for sd_bus objects,
follow the same logic for sd_event_source objects, too.
This commit is contained in:
Lennart Poettering 2014-11-04 16:27:05 +01:00
parent e80afdb3e4
commit 356779df90
11 changed files with 47 additions and 61 deletions

View File

@ -398,7 +398,7 @@ static int add_source(RemoteServer *s, int fd, char* name, bool own_name) {
goto error;
}
r = sd_event_source_set_name(source->event, name);
r = sd_event_source_set_description(source->event, name);
if (r < 0) {
log_error("Failed to set source name for fd:%d: %s", fd, strerror(-r));
goto error;
@ -426,7 +426,7 @@ static int add_raw_socket(RemoteServer *s, int fd) {
snprintf(name, sizeof(name), "raw-socket-%d", fd);
r = sd_event_source_set_name(s->listen_event, name);
r = sd_event_source_set_description(s->listen_event, name);
if (r < 0)
return r;
@ -724,7 +724,7 @@ static int setup_microhttpd_server(RemoteServer *s,
goto error;
}
r = sd_event_source_set_name(d->event, "epoll-fd");
r = sd_event_source_set_description(d->event, "epoll-fd");
if (r < 0) {
log_error("Failed to set source name: %s", strerror(-r));
goto error;
@ -803,7 +803,7 @@ static int setup_signals(RemoteServer *s) {
if (r < 0)
return r;
r = sd_event_source_set_name(s->sigterm_event, "sigterm");
r = sd_event_source_set_description(s->sigterm_event, "sigterm");
if (r < 0)
return r;
@ -811,7 +811,7 @@ static int setup_signals(RemoteServer *s) {
if (r < 0)
return r;
r = sd_event_source_set_name(s->sigint_event, "sigint");
r = sd_event_source_set_description(s->sigint_event, "sigint");
if (r < 0)
return r;

View File

@ -723,8 +723,7 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
if (r < 0)
goto error;
r = sd_event_source_set_name(client->timeout_resend,
"dhcp4-resend-timer");
r = sd_event_source_set_description(client->timeout_resend, "dhcp4-resend-timer");
if (r < 0)
goto error;
@ -801,8 +800,7 @@ static int client_initialize_io_events(sd_dhcp_client *client,
if (r < 0)
goto error;
r = sd_event_source_set_name(client->receive_message,
"dhcp4-receive-message");
r = sd_event_source_set_description(client->receive_message, "dhcp4-receive-message");
if (r < 0)
goto error;
@ -832,8 +830,7 @@ static int client_initialize_time_events(sd_dhcp_client *client) {
r = sd_event_source_set_priority(client->timeout_resend,
client->event_priority);
r = sd_event_source_set_name(client->timeout_resend,
"dhcp4-resend-timer");
r = sd_event_source_set_description(client->timeout_resend, "dhcp4-resend-timer");
if (r < 0)
goto error;
@ -1149,8 +1146,7 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
r = sd_event_source_set_name(client->timeout_expire,
"dhcp4-lifetime");
r = sd_event_source_set_description(client->timeout_expire, "dhcp4-lifetime");
if (r < 0)
return r;
@ -1177,8 +1173,7 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
r = sd_event_source_set_name(client->timeout_t2,
"dhcp4-t2-timeout");
r = sd_event_source_set_description(client->timeout_t2, "dhcp4-t2-timeout");
if (r < 0)
return r;
@ -1204,8 +1199,7 @@ static int client_set_lease_timeouts(sd_dhcp_client *client) {
if (r < 0)
return r;
r = sd_event_source_set_name(client->timeout_t1,
"dhcp4-t1-timer");
r = sd_event_source_set_description(client->timeout_t1, "dhcp4-t1-timer");
if (r < 0)
return r;
@ -1250,8 +1244,7 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message,
if (r < 0)
goto error;
r = sd_event_source_set_name(client->timeout_resend,
"dhcp4-resend-timer");
r = sd_event_source_set_description(client->timeout_resend, "dhcp4-resend-timer");
if (r < 0)
goto error;
} else if (r == -ENOMSG)

View File

@ -590,8 +590,7 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
if (r < 0)
goto error;
r = sd_event_source_set_name(client->timeout_resend,
"dhcp6-resend-timer");
r = sd_event_source_set_description(client->timeout_resend, "dhcp6-resend-timer");
if (r < 0)
goto error;
@ -614,8 +613,7 @@ static int client_timeout_resend(sd_event_source *s, uint64_t usec,
if (r < 0)
goto error;
r = sd_event_source_set_name(client->timeout_resend_expire,
"dhcp6-resend-expire-timer");
r = sd_event_source_set_description(client->timeout_resend_expire, "dhcp6-resend-expire-timer");
if (r < 0)
goto error;
}
@ -1010,8 +1008,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
r = sd_event_source_set_name(client->receive_message,
"dhcp6-receive-message");
r = sd_event_source_set_description(client->receive_message, "dhcp6-receive-message");
if (r < 0)
return r;
@ -1059,8 +1056,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
r = sd_event_source_set_name(client->lease->ia.timeout_t1,
"dhcp6-t1-timeout");
r = sd_event_source_set_description(client->lease->ia.timeout_t1, "dhcp6-t1-timeout");
if (r < 0)
return r;
@ -1084,8 +1080,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
r = sd_event_source_set_name(client->lease->ia.timeout_t2,
"dhcp6-t2-timeout");
r = sd_event_source_set_description(client->lease->ia.timeout_t2, "dhcp6-t2-timeout");
if (r < 0)
return r;
@ -1108,8 +1103,7 @@ static int client_start(sd_dhcp6_client *client, enum DHCP6State state)
if (r < 0)
return r;
r = sd_event_source_set_name(client->timeout_resend,
"dhcp6-resend-timeout");
r = sd_event_source_set_description(client->timeout_resend, "dhcp6-resend-timeout");
if (r < 0)
return r;

View File

@ -278,7 +278,7 @@ static int icmp6_router_solicitation_timeout(sd_event_source *s, uint64_t usec,
return 0;
}
r = sd_event_source_set_name(nd->timeout, "icmp6-timeout");
r = sd_event_source_set_description(nd->timeout, "icmp6-timeout");
if (r < 0) {
icmp6_nd_notify(nd, r);
return 0;
@ -328,7 +328,7 @@ int sd_icmp6_router_solicitation_start(sd_icmp6_nd *nd) {
if (r < 0)
goto error;
r = sd_event_source_set_name(nd->recv, "icmp6-receive-message");
r = sd_event_source_set_description(nd->recv, "icmp6-receive-message");
if (r < 0)
goto error;
@ -341,7 +341,7 @@ int sd_icmp6_router_solicitation_start(sd_icmp6_nd *nd) {
if (r < 0)
goto error;
r = sd_event_source_set_name(nd->timeout, "icmp6-timeout");
r = sd_event_source_set_description(nd->timeout, "icmp6-timeout");
error:
if (r < 0)
icmp6_nd_init(nd);

View File

@ -353,7 +353,7 @@ static void ipv4ll_run_state_machine(sd_ipv4ll *ll, IPv4LLTrigger trigger, void
if (r < 0)
goto out;
r = sd_event_source_set_name(ll->timer, "ipv4ll-timer");
r = sd_event_source_set_description(ll->timer, "ipv4ll-timer");
if (r < 0)
goto out;
}
@ -564,7 +564,7 @@ int sd_ipv4ll_start (sd_ipv4ll *ll) {
if (r < 0)
goto out;
r = sd_event_source_set_name(ll->receive_message, "ipv4ll-receive-message");
r = sd_event_source_set_description(ll->receive_message, "ipv4ll-receive-message");
if (r < 0)
goto out;
@ -581,7 +581,7 @@ int sd_ipv4ll_start (sd_ipv4ll *ll) {
if (r < 0)
goto out;
r = sd_event_source_set_name(ll->timer, "ipv4ll-timer");
r = sd_event_source_set_description(ll->timer, "ipv4ll-timer");
out:
if (r < 0)
ipv4ll_stop(ll, IPV4LL_EVENT_STOP);

View File

@ -387,8 +387,8 @@ global:
sd_event_get_watchdog;
sd_event_source_ref;
sd_event_source_unref;
sd_event_source_set_name;
sd_event_source_get_name;
sd_event_source_set_description;
sd_event_source_get_description;
sd_event_source_set_prepare;
sd_event_source_get_pending;
sd_event_source_get_priority;

View File

@ -3015,7 +3015,7 @@ static int attach_io_events(sd_bus *bus) {
if (r < 0)
return r;
r = sd_event_source_set_name(bus->input_io_event_source, "bus-input");
r = sd_event_source_set_description(bus->input_io_event_source, "bus-input");
} else
r = sd_event_source_set_io_fd(bus->input_io_event_source, bus->input_fd);
@ -3034,7 +3034,7 @@ static int attach_io_events(sd_bus *bus) {
if (r < 0)
return r;
r = sd_event_source_set_name(bus->input_io_event_source, "bus-output");
r = sd_event_source_set_description(bus->input_io_event_source, "bus-output");
} else
r = sd_event_source_set_io_fd(bus->output_io_event_source, bus->output_fd);
@ -3087,7 +3087,7 @@ _public_ int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
if (r < 0)
goto fail;
r = sd_event_source_set_name(bus->time_event_source, "bus-time");
r = sd_event_source_set_description(bus->time_event_source, "bus-time");
if (r < 0)
goto fail;
@ -3095,7 +3095,7 @@ _public_ int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
if (r < 0)
goto fail;
r = sd_event_source_set_name(bus->quit_event_source, "bus-exit");
r = sd_event_source_set_description(bus->quit_event_source, "bus-exit");
if (r < 0)
goto fail;

View File

@ -66,7 +66,7 @@ struct sd_event_source {
void *userdata;
sd_event_handler_t prepare;
char *name;
char *description;
EventSourceType type:5;
int enabled:3;
@ -737,7 +737,7 @@ static void source_free(sd_event_source *s) {
assert(s);
source_disconnect(s);
free(s->name);
free(s->description);
free(s);
}
@ -1253,18 +1253,17 @@ _public_ sd_event_source* sd_event_source_unref(sd_event_source *s) {
return NULL;
}
_public_ int sd_event_source_set_name(sd_event_source *s, const char *name) {
_public_ int sd_event_source_set_description(sd_event_source *s, const char *description) {
assert_return(s, -EINVAL);
return free_and_strdup(&s->name, name);
return free_and_strdup(&s->description, description);
}
_public_ int sd_event_source_get_name(sd_event_source *s, const char **name) {
_public_ int sd_event_source_get_description(sd_event_source *s, const char **description) {
assert_return(s, -EINVAL);
assert_return(name, -EINVAL);
*name = s->name;
assert_return(description, -EINVAL);
*description = s->description;
return 0;
}
@ -2152,8 +2151,8 @@ static int source_dispatch(sd_event_source *s) {
s->dispatching = false;
if (r < 0) {
if (s->name)
log_debug("Event source '%s' returned error, disabling: %s", s->name, strerror(-r));
if (s->description)
log_debug("Event source '%s' returned error, disabling: %s", s->description, strerror(-r));
else
log_debug("Event source %p returned error, disabling: %s", s, strerror(-r));
}
@ -2190,8 +2189,8 @@ static int event_prepare(sd_event *e) {
s->dispatching = false;
if (r < 0) {
if (s->name)
log_debug("Prepare callback of event source '%s' returned error, disabling: %s", s->name, strerror(-r));
if (s->description)
log_debug("Prepare callback of event source '%s' returned error, disabling: %s", s->description, strerror(-r));
else
log_debug("Prepare callback of event source %p returned error, disabling: %s", s, strerror(-r));
}

View File

@ -859,7 +859,7 @@ int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) {
if (r < 0)
goto fail;
r = sd_event_source_set_name(rtnl->io_event_source, "rtnl-receive-message");
r = sd_event_source_set_description(rtnl->io_event_source, "rtnl-receive-message");
if (r < 0)
goto fail;
@ -875,7 +875,7 @@ int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) {
if (r < 0)
goto fail;
r = sd_event_source_set_name(rtnl->time_event_source, "rtnl-timer");
r = sd_event_source_set_description(rtnl->time_event_source, "rtnl-timer");
if (r < 0)
goto fail;
@ -883,7 +883,7 @@ int sd_rtnl_attach_event(sd_rtnl *rtnl, sd_event *event, int priority) {
if (r < 0)
goto fail;
r = sd_event_source_set_name(rtnl->exit_event_source, "rtnl-exit");
r = sd_event_source_set_description(rtnl->exit_event_source, "rtnl-exit");
if (r < 0)
goto fail;

View File

@ -368,7 +368,7 @@ int manager_udev_listen(Manager *m) {
if (r < 0)
return r;
r = sd_event_source_set_name(m->udev_event_source, "networkd-udev");
r = sd_event_source_set_description(m->udev_event_source, "networkd-udev");
if (r < 0)
return r;

View File

@ -109,8 +109,8 @@ sd_event *sd_event_source_get_event(sd_event_source *s);
void* sd_event_source_get_userdata(sd_event_source *s);
void* sd_event_source_set_userdata(sd_event_source *s, void *userdata);
int sd_event_source_set_name(sd_event_source *s, const char *name);
int sd_event_source_get_name(sd_event_source *s, const char **name);
int sd_event_source_set_description(sd_event_source *s, const char *description);
int sd_event_source_get_description(sd_event_source *s, const char **description);
int sd_event_source_set_prepare(sd_event_source *s, sd_event_handler_t callback);
int sd_event_source_get_pending(sd_event_source *s);
int sd_event_source_get_priority(sd_event_source *s, int64_t *priority);