ctdb-daemon: Drop unused prefix, logfn, logfn_private
authorMartin Schwenke <martin@meltin.net>
Mon, 6 Jun 2022 07:57:51 +0000 (17:57 +1000)
committerVolker Lendecke <vl@samba.org>
Thu, 16 Jun 2022 12:42:35 +0000 (12:42 +0000)
These aren't set anywhere in the code.

Drop the log argument because it is also no longer used.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15090

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/server/ctdb_logging.c

index 8af787c189fa47d63cd501bb8ef0fb8cc44931e0..6fcc0535ddd747a0f4ddbac0d0e1e222a1c0c8b1 100644 (file)
 #include "common/logging.h"
 
 struct ctdb_log_state {
-       const char *prefix;
        int fd, pfd;
        char buf[1024];
        uint16_t buf_used;
-       void (*logfn)(const char *, uint16_t, void *);
-       void *logfn_private;
 };
 
 /* Used by ctdb_set_child_logging() */
@@ -68,20 +65,10 @@ bool ctdb_logging_init(TALLOC_CTX *mem_ctx, const char *logging,
        return true;
 }
 
-/* Note that do_debug always uses the global log state. */
-static void write_to_log(struct ctdb_log_state *log,
-                        const char *buf, unsigned int len)
+static void write_to_log(const char *buf, unsigned int len)
 {
        if (script_log_level <= DEBUGLEVEL) {
-               if (log != NULL && log->prefix != NULL) {
-                       dbgtext("%s: %*.*s\n", log->prefix, len, len, buf);
-               } else {
-                       dbgtext("%*.*s\n", len, len, buf);
-               }
-               /* log it in the eventsystem as well */
-               if (log && log->logfn) {
-                       log->logfn(log->buf, len, log->logfn_private);
-               }
+               dbgtext("%*.*s\n", len, len, buf);
        }
 }
 
@@ -119,7 +106,7 @@ static void ctdb_child_log_handler(struct tevent_context *ev,
                if (n2 > 0 && log->buf[n2-1] == '\r') {
                        n2--;
                }
-               write_to_log(log, log->buf, n2);
+               write_to_log(log->buf, n2);
                memmove(log->buf, p+1, sizeof(log->buf) - n1);
                log->buf_used -= n1;
        }
@@ -127,7 +114,7 @@ static void ctdb_child_log_handler(struct tevent_context *ev,
        /* the buffer could have completely filled - unfortunately we have
           no choice but to dump it out straight away */
        if (log->buf_used == sizeof(log->buf)) {
-               write_to_log(log, log->buf, log->buf_used);
+               write_to_log(log->buf, log->buf_used);
                log->buf_used = 0;
        }
 }