diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-01-16 11:50:39 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-01-22 23:35:27 +0100 |
commit | 7f37bf4cd51fc73441aeee1acf0129f4802e0cba (patch) | |
tree | fb20a59815290ce548e2900865afedd0df08ac8f | |
parent | 02e092b4feb8abf9f9beb77a9155ad75b0e4e3d5 (diff) | |
download | passt-7f37bf4cd51fc73441aeee1acf0129f4802e0cba.tar passt-7f37bf4cd51fc73441aeee1acf0129f4802e0cba.tar.gz passt-7f37bf4cd51fc73441aeee1acf0129f4802e0cba.tar.bz2 passt-7f37bf4cd51fc73441aeee1acf0129f4802e0cba.tar.lz passt-7f37bf4cd51fc73441aeee1acf0129f4802e0cba.tar.xz passt-7f37bf4cd51fc73441aeee1acf0129f4802e0cba.tar.zst passt-7f37bf4cd51fc73441aeee1acf0129f4802e0cba.zip |
flow: Move flow_log_() to near top of flow.c
flow_log_() is a very basic widely used function that many other functions
in flow.c will end up needing. At present it's below flow_table_compact()
which happens not to need it, but that's likely to change. Move it to
near the top of flow.c to avoid forward declarations.
Code motion only, no changes.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | flow.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -31,6 +31,24 @@ union flow flowtab[FLOW_MAX]; /* Last time the flow timers ran */ static struct timespec flow_timer_run; +/** flow_log_ - Log flow-related message + * @f: flow the message is related to + * @pri: Log priority + * @fmt: Format string + * @...: printf-arguments + */ +void flow_log_(const struct flow_common *f, int pri, const char *fmt, ...) +{ + char msg[BUFSIZ]; + va_list args; + + va_start(args, fmt); + (void)vsnprintf(msg, sizeof(msg), fmt, args); + va_end(args); + + logmsg(pri, "Flow %u (%s): %s", flow_idx(f), FLOW_TYPE(f), msg); +} + /** * flow_table_compact() - Perform compaction on flow table * @c: Execution context @@ -70,24 +88,6 @@ void flow_table_compact(struct ctx *c, union flow *hole) memset(from, 0, sizeof(*from)); } -/** flow_log_ - Log flow-related message - * @f: flow the message is related to - * @pri: Log priority - * @fmt: Format string - * @...: printf-arguments - */ -void flow_log_(const struct flow_common *f, int pri, const char *fmt, ...) -{ - char msg[BUFSIZ]; - va_list args; - - va_start(args, fmt); - (void)vsnprintf(msg, sizeof(msg), fmt, args); - va_end(args); - - logmsg(pri, "Flow %u (%s): %s", flow_idx(f), FLOW_TYPE(f), msg); -} - /** * flow_defer_handler() - Handler for per-flow deferred and timed tasks * @c: Execution context |