journal-remote: Use "event" instead of "events"

We use singular "event" everywhere else, so let's use it here as well.
This commit is contained in:
Daan De Meyer 2024-04-11 09:58:58 +02:00
parent dcd332ae00
commit b50e9011d0
6 changed files with 22 additions and 22 deletions

View file

@ -451,7 +451,7 @@ static int setup_microhttpd_server(RemoteServer *s,
if (epoll_fd < 0) if (epoll_fd < 0)
return log_error_errno(SYNTHETIC_ERRNO(EUCLEAN), "μhttp epoll fd is invalid"); return log_error_errno(SYNTHETIC_ERRNO(EUCLEAN), "μhttp epoll fd is invalid");
r = sd_event_add_io(s->events, &d->io_event, r = sd_event_add_io(s->event, &d->io_event,
epoll_fd, EPOLLIN, epoll_fd, EPOLLIN,
dispatch_http_event, d); dispatch_http_event, d);
if (r < 0) if (r < 0)
@ -461,7 +461,7 @@ static int setup_microhttpd_server(RemoteServer *s,
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to set source name: %m"); return log_error_errno(r, "Failed to set source name: %m");
r = sd_event_add_time(s->events, &d->timer_event, r = sd_event_add_time(s->event, &d->timer_event,
CLOCK_MONOTONIC, UINT64_MAX, 0, CLOCK_MONOTONIC, UINT64_MAX, 0,
null_timer_event_handler, d); null_timer_event_handler, d);
if (r < 0) if (r < 0)
@ -562,7 +562,7 @@ static int create_remoteserver(
if (r < 0) if (r < 0)
return r; return r;
r = sd_event_set_signal_exit(s->events, true); r = sd_event_set_signal_exit(s->event, true);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to install SIGINT/SIGTERM handlers: %m"); return log_error_errno(r, "Failed to install SIGINT/SIGTERM handlers: %m");
@ -1110,7 +1110,7 @@ static int run(int argc, char **argv) {
if (r < 0) if (r < 0)
return r; return r;
r = sd_event_set_watchdog(s.events, true); r = sd_event_set_watchdog(s.event, true);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to enable watchdog: %m"); return log_error_errno(r, "Failed to enable watchdog: %m");
@ -1122,13 +1122,13 @@ static int run(int argc, char **argv) {
notify_message = notify_start(NOTIFY_READY, NOTIFY_STOPPING); notify_message = notify_start(NOTIFY_READY, NOTIFY_STOPPING);
while (s.active) { while (s.active) {
r = sd_event_get_state(s.events); r = sd_event_get_state(s.event);
if (r < 0) if (r < 0)
return r; return r;
if (r == SD_EVENT_FINISHED) if (r == SD_EVENT_FINISHED)
break; break;
r = sd_event_run(s.events, -1); r = sd_event_run(s.event, -1);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to run event loop: %m"); return log_error_errno(r, "Failed to run event loop: %m");
} }

View file

@ -257,19 +257,19 @@ int journal_remote_add_source(RemoteServer *s, int fd, char* name, bool own_name
return r; return r;
} }
r = sd_event_add_io(s->events, &source->event, r = sd_event_add_io(s->event, &source->event,
fd, EPOLLIN|EPOLLRDHUP|EPOLLPRI, fd, EPOLLIN|EPOLLRDHUP|EPOLLPRI,
dispatch_raw_source_event, source); dispatch_raw_source_event, source);
if (r == 0) { if (r == 0) {
/* Add additional source for buffer processing. It will be /* Add additional source for buffer processing. It will be
* enabled later. */ * enabled later. */
r = sd_event_add_defer(s->events, &source->buffer_event, r = sd_event_add_defer(s->event, &source->buffer_event,
dispatch_raw_source_until_block, source); dispatch_raw_source_until_block, source);
if (r == 0) if (r == 0)
r = sd_event_source_set_enabled(source->buffer_event, SD_EVENT_OFF); r = sd_event_source_set_enabled(source->buffer_event, SD_EVENT_OFF);
} else if (r == -EPERM) { } else if (r == -EPERM) {
log_debug("Falling back to sd_event_add_defer for fd:%d (%s)", fd, name); log_debug("Falling back to sd_event_add_defer for fd:%d (%s)", fd, name);
r = sd_event_add_defer(s->events, &source->event, r = sd_event_add_defer(s->event, &source->event,
dispatch_blocking_source_event, source); dispatch_blocking_source_event, source);
if (r == 0) if (r == 0)
r = sd_event_source_set_enabled(source->event, SD_EVENT_ON); r = sd_event_source_set_enabled(source->event, SD_EVENT_ON);
@ -301,7 +301,7 @@ int journal_remote_add_raw_socket(RemoteServer *s, int fd) {
assert(s); assert(s);
assert(fd >= 0); assert(fd >= 0);
r = sd_event_add_io(s->events, &s->listen_event, r = sd_event_add_io(s->event, &s->listen_event,
fd, EPOLLIN, fd, EPOLLIN,
dispatch_raw_connection_event, s); dispatch_raw_connection_event, s);
if (r < 0) if (r < 0)
@ -347,7 +347,7 @@ int journal_remote_server_init(
else else
assert_not_reached(); assert_not_reached();
r = sd_event_default(&s->events); r = sd_event_default(&s->event);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to allocate event loop: %m"); return log_error_errno(r, "Failed to allocate event loop: %m");
@ -376,7 +376,7 @@ void journal_remote_server_destroy(RemoteServer *s) {
hashmap_free(s->writers); hashmap_free(s->writers);
sd_event_source_unref(s->listen_event); sd_event_source_unref(s->listen_event);
sd_event_unref(s->events); sd_event_unref(s->event);
if (s == journal_remote_server_global) if (s == journal_remote_server_global)
journal_remote_server_global = NULL; journal_remote_server_global = NULL;

View file

@ -29,7 +29,7 @@ struct RemoteServer {
RemoteSource **sources; RemoteSource **sources;
size_t active; size_t active;
sd_event *events; sd_event *event;
sd_event_source *listen_event; sd_event_source *listen_event;
Hashmap *writers; Hashmap *writers;

View file

@ -388,7 +388,7 @@ int open_journal_for_upload(Uploader *u,
else else
u->timeout = JOURNAL_UPLOAD_POLL_TIMEOUT; u->timeout = JOURNAL_UPLOAD_POLL_TIMEOUT;
r = sd_event_add_io(u->events, &u->input_event, r = sd_event_add_io(u->event, &u->input_event,
fd, events, dispatch_journal_input, u); fd, events, dispatch_journal_input, u);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to register input event: %m"); return log_error_errno(r, "Failed to register input event: %m");

View file

@ -364,7 +364,7 @@ static int open_file_for_upload(Uploader *u, const char *filename) {
u->input = fd; u->input = fd;
if (arg_follow != 0) { if (arg_follow != 0) {
r = sd_event_add_io(u->events, &u->input_event, r = sd_event_add_io(u->event, &u->input_event,
fd, EPOLLIN, dispatch_fd_input, u); fd, EPOLLIN, dispatch_fd_input, u);
if (r < 0) { if (r < 0) {
if (r != -EPERM || arg_follow > 0) if (r != -EPERM || arg_follow > 0)
@ -413,11 +413,11 @@ static int setup_uploader(Uploader *u, const char *url, const char *state_file)
u->state_file = state_file; u->state_file = state_file;
r = sd_event_default(&u->events); r = sd_event_default(&u->event);
if (r < 0) if (r < 0)
return log_error_errno(r, "sd_event_default failed: %m"); return log_error_errno(r, "sd_event_default failed: %m");
r = sd_event_set_signal_exit(u->events, true); r = sd_event_set_signal_exit(u->event, true);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to install SIGINT/SIGTERM handlers: %m"); return log_error_errno(r, "Failed to install SIGINT/SIGTERM handlers: %m");
@ -443,7 +443,7 @@ static void destroy_uploader(Uploader *u) {
close_fd_input(u); close_fd_input(u);
close_journal_input(u); close_journal_input(u);
sd_event_unref(u->events); sd_event_unref(u->event);
} }
static int perform_upload(Uploader *u) { static int perform_upload(Uploader *u) {
@ -782,7 +782,7 @@ static int run(int argc, char **argv) {
if (r < 0) if (r < 0)
return r; return r;
sd_event_set_watchdog(u.events, true); sd_event_set_watchdog(u.event, true);
r = check_cursor_updating(&u); r = check_cursor_updating(&u);
if (r < 0) if (r < 0)
@ -810,7 +810,7 @@ static int run(int argc, char **argv) {
NOTIFY_STOPPING); NOTIFY_STOPPING);
for (;;) { for (;;) {
r = sd_event_get_state(u.events); r = sd_event_get_state(u.event);
if (r < 0) if (r < 0)
return r; return r;
if (r == SD_EVENT_FINISHED) if (r == SD_EVENT_FINISHED)
@ -837,7 +837,7 @@ static int run(int argc, char **argv) {
return r; return r;
} }
r = sd_event_run(u.events, u.timeout); r = sd_event_run(u.event, u.timeout);
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to run event loop: %m"); return log_error_errno(r, "Failed to run event loop: %m");
} }

View file

@ -24,7 +24,7 @@ typedef enum {
} entry_state; } entry_state;
typedef struct Uploader { typedef struct Uploader {
sd_event *events; sd_event *event;
char *url; char *url;
CURL *easy; CURL *easy;