From 46823152ea5e2d0f888fa25ba6b4b1896e4e89b9 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Sat, 26 Aug 2017 11:56:43 +1200 Subject: [PATCH] Rename functions to be consistent with #93 --- backend/backend.c | 4 ++-- backend/multi/backend.c | 2 +- backend/session/direct-ipc.c | 2 +- backend/session/direct.c | 10 +++++----- backend/session/logind.c | 8 ++++---- backend/session/session.c | 8 ++++---- include/backend/session/direct-ipc.h | 2 +- include/wlr/backend/session.h | 4 ++-- include/wlr/backend/session/interface.h | 4 ++-- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/backend/backend.c b/backend/backend.c index 790a14b3..9a3fd036 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -85,7 +85,7 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display) { // Attempt DRM+libinput - struct wlr_session *session = wlr_session_start(display); + struct wlr_session *session = wlr_session_create(display); if (!session) { wlr_log(L_ERROR, "Failed to start a DRM session"); return NULL; @@ -131,6 +131,6 @@ error_gpu: error_udev: wlr_udev_destroy(udev); error_session: - wlr_session_finish(session); + wlr_session_destroy(session); return NULL; } diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 33b26a0a..9bb596e5 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -36,7 +36,7 @@ static void multi_backend_destroy(struct wlr_backend *_backend) { free(sub); } list_free(backend->backends); - wlr_session_finish(backend->session); + wlr_session_destroy(backend->session); wlr_udev_destroy(backend->udev); free(backend); } diff --git a/backend/session/direct-ipc.c b/backend/session/direct-ipc.c index 71e22148..5f1494a6 100644 --- a/backend/session/direct-ipc.c +++ b/backend/session/direct-ipc.c @@ -212,7 +212,7 @@ void direct_ipc_finish(int sock, pid_t pid) { waitpid(pid, NULL, 0); } -int direct_ipc_start(pid_t *pid_out) { +int direct_ipc_init(pid_t *pid_out) { if (!have_permissions()) { return -1; } diff --git a/backend/session/direct.c b/backend/session/direct.c index 82aa8e00..0a08bfd6 100644 --- a/backend/session/direct.c +++ b/backend/session/direct.c @@ -79,7 +79,7 @@ static bool direct_change_vt(struct wlr_session *base, unsigned vt) { return ioctl(session->tty_fd, VT_ACTIVATE, (int)vt) == 0; } -static void direct_session_finish(struct wlr_session *base) { +static void direct_session_destroy(struct wlr_session *base) { struct direct_session *session = wl_container_of(base, session, base); struct vt_mode mode = { .mode = VT_AUTO, @@ -196,14 +196,14 @@ error: return false; } -static struct wlr_session *direct_session_start(struct wl_display *disp) { +static struct wlr_session *direct_session_create(struct wl_display *disp) { struct direct_session *session = calloc(1, sizeof(*session)); if (!session) { wlr_log_errno(L_ERROR, "Allocation failed"); return NULL; } - session->sock = direct_ipc_start(&session->child); + session->sock = direct_ipc_init(&session->child); if (session->sock == -1) { goto error_session; } @@ -236,8 +236,8 @@ error_session: } const struct session_impl session_direct = { - .start = direct_session_start, - .finish = direct_session_finish, + .create = direct_session_create, + .destroy = direct_session_destroy, .open = direct_session_open, .close = direct_session_close, .change_vt = direct_change_vt, diff --git a/backend/session/logind.c b/backend/session/logind.c index 20d9b5ed..6b93ff67 100644 --- a/backend/session/logind.c +++ b/backend/session/logind.c @@ -204,7 +204,7 @@ static void release_control(struct logind_session *session) { sd_bus_message_unref(msg); } -static void logind_session_finish(struct wlr_session *base) { +static void logind_session_destroy(struct wlr_session *base) { struct logind_session *session = wl_container_of(base, session, base); release_control(session); @@ -316,7 +316,7 @@ static int dbus_event(int fd, uint32_t mask, void *data) { return 1; } -static struct wlr_session *logind_session_start(struct wl_display *disp) { +static struct wlr_session *logind_session_create(struct wl_display *disp) { int ret; struct logind_session *session = calloc(1, sizeof(*session)); if (!session) { @@ -390,8 +390,8 @@ error: } const struct session_impl session_logind = { - .start = logind_session_start, - .finish = logind_session_finish, + .create = logind_session_create, + .destroy = logind_session_destroy, .open = logind_take_device, .close = logind_release_device, .change_vt = logind_change_vt, diff --git a/backend/session/session.c b/backend/session/session.c index a07d3cda..24a1f538 100644 --- a/backend/session/session.c +++ b/backend/session/session.c @@ -15,11 +15,11 @@ static const struct session_impl *impls[] = { NULL, }; -struct wlr_session *wlr_session_start(struct wl_display *disp) { +struct wlr_session *wlr_session_create(struct wl_display *disp) { const struct session_impl **iter; for (iter = impls; *iter; ++iter) { - struct wlr_session *session = (*iter)->start(disp); + struct wlr_session *session = (*iter)->create(disp); if (session) { return session; } @@ -29,12 +29,12 @@ struct wlr_session *wlr_session_start(struct wl_display *disp) { return NULL; } -void wlr_session_finish(struct wlr_session *session) { +void wlr_session_destroy(struct wlr_session *session) { if (!session) { return; } - session->impl->finish(session); + session->impl->destroy(session); }; int wlr_session_open_file(struct wlr_session *session, const char *path) { diff --git a/include/backend/session/direct-ipc.h b/include/backend/session/direct-ipc.h index 96504f04..2189d6fa 100644 --- a/include/backend/session/direct-ipc.h +++ b/include/backend/session/direct-ipc.h @@ -7,6 +7,6 @@ int direct_ipc_open(int sock, const char *path); void direct_ipc_setmaster(int sock, int fd); void direct_ipc_dropmaster(int sock, int fd); void direct_ipc_finish(int sock, pid_t pid); -int direct_ipc_start(pid_t *pid_out); +int direct_ipc_init(pid_t *pid_out); #endif diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h index 7961e620..24854431 100644 --- a/include/wlr/backend/session.h +++ b/include/wlr/backend/session.h @@ -31,14 +31,14 @@ struct wlr_session { * * Returns NULL on error. */ -struct wlr_session *wlr_session_start(struct wl_display *disp); +struct wlr_session *wlr_session_create(struct wl_display *disp); /* * Closes a previously opened session and restores the virtual terminal. * You should call wlr_session_close_file on each files you opened * with wlr_session_open_file before you call this. */ -void wlr_session_finish(struct wlr_session *session); +void wlr_session_destroy(struct wlr_session *session); /* * Opens the file at path. diff --git a/include/wlr/backend/session/interface.h b/include/wlr/backend/session/interface.h index 16814446..1a029c54 100644 --- a/include/wlr/backend/session/interface.h +++ b/include/wlr/backend/session/interface.h @@ -4,8 +4,8 @@ #include struct session_impl { - struct wlr_session *(*start)(struct wl_display *disp); - void (*finish)(struct wlr_session *session); + struct wlr_session *(*create)(struct wl_display *disp); + void (*destroy)(struct wlr_session *session); int (*open)(struct wlr_session *session, const char *path); void (*close)(struct wlr_session *session, int fd); bool (*change_vt)(struct wlr_session *session, unsigned vt);