From: "Richard W.M. Jones" <rjones(a)redhat.com>
This returns the plugin name, which for plugins is the same as the
ordinary .name method (but for filters will be different).
Message-Id: <20180117205356.8699-5-rjones(a)redhat.com>
---
src/connections.c | 4 ++--
src/internal.h | 1 +
src/plugins.c | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/connections.c b/src/connections.c
index 55bfe9e..7a4c7bb 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -221,7 +221,7 @@ _handle_single_connection (int sockin, int sockout)
if (backend->open (backend, conn, readonly) == -1)
goto done;
- threadlocal_set_name (backend->name (backend));
+ threadlocal_set_name (backend->plugin_name (backend));
/* Handshake. */
if (negotiate_handshake (conn) == -1)
@@ -253,7 +253,7 @@ _handle_single_connection (int sockin, int sockout)
goto wait;
}
if (asprintf (&worker->name,
- "%s.%d", backend->name (backend), nworkers) < 0) {
+ "%s.%d", backend->plugin_name (backend), nworkers) <
0) {
perror ("asprintf");
set_status (conn, -1);
free (worker);
diff --git a/src/internal.h b/src/internal.h
index c69ec25..9d01c2b 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -157,6 +157,7 @@ struct backend {
void (*free) (struct backend *);
int (*thread_model) (struct backend *);
const char *(*name) (struct backend *);
+ const char *(*plugin_name) (struct backend *);
void (*usage) (struct backend *);
const char *(*version) (struct backend *);
void (*dump_fields) (struct backend *);
diff --git a/src/plugins.c b/src/plugins.c
index eff25d3..4442a50 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -494,6 +494,7 @@ static struct backend plugin_functions = {
.free = plugin_free,
.thread_model = plugin_thread_model,
.name = plugin_name,
+ .plugin_name = plugin_name,
.usage = plugin_usage,
.version = plugin_version,
.dump_fields = plugin_dump_fields,
--
2.14.3