weston-log-wayland: Rename weston_debug_stream to weston_log_wayland

No changes in functionality have been made.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 5 years ago
parent 69e7571e63
commit 967a6c2d4e
  1. 57
      libweston/weston-log-wayland.c

@ -41,26 +41,29 @@
/** A debug stream created by a client /** A debug stream created by a client
* *
* A client provides a file descriptor for the server to write debug * A client provides a file descriptor for the server to write debug messages
* messages into. A weston_debug_stream is associated to one * into. A weston_log_debug_wayland is associated to one weston_log_scope via the
* weston_log_scope via the scope name, and the scope provides the messages. * scope name, and the scope provides the messages. There can be several
* There can be several streams for the same scope, all streams getting the * streams for the same scope, all streams getting the same messages.
* same messages. *
* The following is specific to weston-debug protocol.
* Subscription/unsubscription takes place in the stream_create(), respectively
* in stream_destroy().
*/ */
struct weston_debug_stream { struct weston_log_debug_wayland {
struct weston_log_subscriber base; struct weston_log_subscriber base;
int fd; /**< client provided fd */ int fd; /**< client provided fd */
struct wl_resource *resource; /**< weston_debug_stream_v1 object */ struct wl_resource *resource; /**< weston_debug_stream_v1 object */
}; };
static struct weston_debug_stream * static struct weston_log_debug_wayland *
to_weston_debug_stream(struct weston_log_subscriber *sub) to_weston_log_debug_wayland(struct weston_log_subscriber *sub)
{ {
return container_of(sub, struct weston_debug_stream, base); return container_of(sub, struct weston_log_debug_wayland, base);
} }
static void static void
stream_close_unlink(struct weston_debug_stream *stream) stream_close_unlink(struct weston_log_debug_wayland *stream)
{ {
if (stream->fd != -1) if (stream->fd != -1)
close(stream->fd); close(stream->fd);
@ -68,7 +71,7 @@ stream_close_unlink(struct weston_debug_stream *stream)
} }
static void WL_PRINTF(2, 3) static void WL_PRINTF(2, 3)
stream_close_on_failure(struct weston_debug_stream *stream, stream_close_on_failure(struct weston_log_debug_wayland *stream,
const char *fmt, ...) const char *fmt, ...)
{ {
char *msg; char *msg;
@ -104,16 +107,16 @@ stream_close_on_failure(struct weston_debug_stream *stream,
* Otherwise on failure, the stream is closed and * Otherwise on failure, the stream is closed and
* \c weston_debug_stream_v1.failure event is sent to the client. * \c weston_debug_stream_v1.failure event is sent to the client.
* *
* \memberof weston_debug_stream * \memberof weston_log_debug_wayland
*/ */
static void static void
weston_debug_stream_write(struct weston_log_subscriber *sub, weston_log_debug_wayland_write(struct weston_log_subscriber *sub,
const char *data, size_t len) const char *data, size_t len)
{ {
ssize_t len_ = len; ssize_t len_ = len;
ssize_t ret; ssize_t ret;
int e; int e;
struct weston_debug_stream *stream = to_weston_debug_stream(sub); struct weston_log_debug_wayland *stream = to_weston_log_debug_wayland(sub);
if (stream->fd == -1) if (stream->fd == -1)
return; return;
@ -144,29 +147,29 @@ weston_debug_stream_write(struct weston_log_subscriber *sub,
* event to the client. This tells the client the debug information dump * event to the client. This tells the client the debug information dump
* is complete. * is complete.
* *
* \memberof weston_debug_stream * \memberof weston_log_debug_wayland
*/ */
static void static void
weston_debug_stream_complete(struct weston_log_subscriber *sub) weston_log_debug_wayland_complete(struct weston_log_subscriber *sub)
{ {
struct weston_debug_stream *stream = to_weston_debug_stream(sub); struct weston_log_debug_wayland *stream = to_weston_log_debug_wayland(sub);
stream_close_unlink(stream); stream_close_unlink(stream);
weston_debug_stream_v1_send_complete(stream->resource); weston_debug_stream_v1_send_complete(stream->resource);
} }
static void static void
weston_debug_stream_to_destroy(struct weston_log_subscriber *sub) weston_log_debug_wayland_to_destroy(struct weston_log_subscriber *sub)
{ {
struct weston_debug_stream *stream = to_weston_debug_stream(sub); struct weston_log_debug_wayland *stream = to_weston_log_debug_wayland(sub);
stream_close_on_failure(stream, "debug name removed"); stream_close_on_failure(stream, "debug name removed");
} }
static struct weston_debug_stream * static struct weston_log_debug_wayland *
stream_create(struct weston_log_context *log_ctx, const char *name, stream_create(struct weston_log_context *log_ctx, const char *name,
int32_t streamfd, struct wl_resource *stream_resource) int32_t streamfd, struct wl_resource *stream_resource)
{ {
struct weston_debug_stream *stream; struct weston_log_debug_wayland *stream;
struct weston_log_scope *scope; struct weston_log_scope *scope;
struct weston_log_subscription *sub; struct weston_log_subscription *sub;
@ -177,9 +180,9 @@ stream_create(struct weston_log_context *log_ctx, const char *name,
stream->fd = streamfd; stream->fd = streamfd;
stream->resource = stream_resource; stream->resource = stream_resource;
stream->base.write = weston_debug_stream_write; stream->base.write = weston_log_debug_wayland_write;
stream->base.destroy = weston_debug_stream_to_destroy; stream->base.destroy = weston_log_debug_wayland_to_destroy;
stream->base.complete = weston_debug_stream_complete; stream->base.complete = weston_log_debug_wayland_complete;
wl_list_init(&stream->base.subscription_list); wl_list_init(&stream->base.subscription_list);
@ -200,7 +203,7 @@ stream_create(struct weston_log_context *log_ctx, const char *name,
static void static void
stream_destroy(struct wl_resource *stream_resource) stream_destroy(struct wl_resource *stream_resource)
{ {
struct weston_debug_stream *stream; struct weston_log_debug_wayland *stream;
struct weston_log_subscription *sub = NULL; struct weston_log_subscription *sub = NULL;
stream = wl_resource_get_user_data(stream_resource); stream = wl_resource_get_user_data(stream_resource);
@ -244,7 +247,7 @@ weston_debug_subscribe(struct wl_client *client,
struct weston_log_context *log_ctx; struct weston_log_context *log_ctx;
struct wl_resource *stream_resource; struct wl_resource *stream_resource;
uint32_t version; uint32_t version;
struct weston_debug_stream *stream; struct weston_log_debug_wayland *stream;
log_ctx = wl_resource_get_user_data(global_resource); log_ctx = wl_resource_get_user_data(global_resource);
version = wl_resource_get_version(global_resource); version = wl_resource_get_version(global_resource);

Loading…
Cancel
Save