diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-06-08 20:15:45 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-06-08 20:15:45 -0700 |
commit | f5b05390f057b0c7c1a5f99be354692445678e55 (patch) | |
tree | f54842b40e5943d9f87d555093cee0671c7f3a73 /src | |
parent | 7b09ed69ad9f454e702b750d529a8dda95de0aec (diff) |
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...
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/til_stream.c | 6 | ||||
-rw-r--r-- | src/til_stream.h | 6 |
3 files changed, 7 insertions, 7 deletions
@@ -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); |