From f5b05390f057b0c7c1a5f99be354692445678e55 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 8 Jun 2023 20:15:45 -0700 Subject: til_stream: name pipe-oriented stream api as such When all the stream encapsulated were pipes/taps, naming was less precise. With module contexts in the process of being registered in the stream, there's a need to distinguish things more. This is a largely mechanical naming change... --- src/main.c | 2 +- src/til_stream.c | 6 +++--- src/til_stream.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 240dab1..de26001 100644 --- a/src/main.c +++ b/src/main.c @@ -340,7 +340,7 @@ static void * rototiller_thread(void *_rt) if (rt->args.print_pipes) { /* render threads are idle at this point */ printf("\x1b[2J\x1b[;H"); /* ANSI codes for clear screen and move cursor to top left */ - til_stream_fprint(rt->stream, stdout); + til_stream_fprint_pipes(rt->stream, stdout); } } diff --git a/src/til_stream.c b/src/til_stream.c index 1eb749b..afc635b 100644 --- a/src/til_stream.c +++ b/src/til_stream.c @@ -304,7 +304,7 @@ static int til_stream_fprint_pipe_cb(void *arg, til_stream_pipe_t *pipe, const v { FILE *out = arg; - fprintf(out, "%s/%s: ", pipe->parent_path, pipe->driving_tap->name); + fprintf(out, " %s/%s: ", pipe->parent_path, pipe->driving_tap->name); for (size_t j = 0; j < pipe->driving_tap->n_elems; j++) { const char *sep = j ? ", " : ""; @@ -420,7 +420,7 @@ static int til_stream_fprint_pipe_cb(void *arg, til_stream_pipe_t *pipe, const v * to acquire the mutex - but it's also an uncontended lock if that's the case so just take the * mutex anyways since we're accessing the underlying structure it protects. */ -void til_stream_fprint(til_stream_t *stream, FILE *out) +void til_stream_fprint_pipes(til_stream_t *stream, FILE *out) { fprintf(out, "Pipes on stream %p:\n", stream); (void) til_stream_for_each_pipe(stream, til_stream_fprint_pipe_cb, out); @@ -429,7 +429,7 @@ void til_stream_fprint(til_stream_t *stream, FILE *out) /* returns -errno on error (from pipe_cb), 0 otherwise */ -int til_stream_for_each_pipe(til_stream_t *stream, til_stream_iter_func_t pipe_cb, void *cb_context) +int til_stream_for_each_pipe(til_stream_t *stream, til_stream_pipe_iter_func_t pipe_cb, void *cb_context) { assert(stream); assert(pipe_cb); diff --git a/src/til_stream.h b/src/til_stream.h index da1abdf..1fb709f 100644 --- a/src/til_stream.h +++ b/src/til_stream.h @@ -31,7 +31,7 @@ typedef struct til_tap_t til_tap_t; * things can be done to it (like changing the ownership?) * return 0 to stop iterating, 1 to continue, -errno on error */ -typedef int (til_stream_iter_func_t)(void *context, til_stream_pipe_t *pipe, const void *owner, const void *owner_foo, const til_tap_t *driving_tap); +typedef int (til_stream_pipe_iter_func_t)(void *context, til_stream_pipe_t *pipe, const void *owner, const void *owner_foo, const til_tap_t *driving_tap); /* this provides a way to intercept pipe creations/deletions when they occur, * allowing another module to snipe ownership when they appear and cleanup @@ -57,9 +57,9 @@ static inline int til_stream_tap_context(til_stream_t *stream, const til_module_ } void til_stream_untap_owner(til_stream_t *stream, const void *owner); -void til_stream_fprint(til_stream_t *stream, FILE *out); +void til_stream_fprint_pipes(til_stream_t *stream, FILE *out); -int til_stream_for_each_pipe(til_stream_t *stream, til_stream_iter_func_t pipe_cb, void *cb_arg); +int til_stream_for_each_pipe(til_stream_t *stream, til_stream_pipe_iter_func_t pipe_cb, void *cb_arg); void til_stream_pipe_set_owner(til_stream_pipe_t *pipe, const void *owner, const void *owner_foo); void til_stream_pipe_set_driving_tap(til_stream_pipe_t *pipe, const til_tap_t *driving_tap); -- cgit v1.2.3