[PATCH 01/15] Add a opaque parameter to the RPC client init callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

The callback that is invoked when a new RPC client is
initialized does not have any opaque parameter. Add
one so that custom data can be passed into the callback

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 daemon/libvirtd.c      |    3 ++-
 daemon/remote.c        |    3 ++-
 daemon/remote.h        |    3 ++-
 src/rpc/virnetserver.c |    7 +++++--
 src/rpc/virnetserver.h |    6 ++++--
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 9c06344..8c434a0 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1176,7 +1176,8 @@ int main(int argc, char **argv) {
                                 config->keepalive_count,
                                 !!config->keepalive_required,
                                 config->mdns_adv ? config->mdns_name : NULL,
-                                remoteClientInitHook))) {
+                                remoteClientInitHook,
+                                NULL))) {
         ret = VIR_DAEMON_ERR_INIT;
         goto cleanup;
     }
diff --git a/daemon/remote.c b/daemon/remote.c
index b8c2aab..095d854 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -640,7 +640,8 @@ static void remoteClientCloseFunc(virNetServerClientPtr client)
 
 
 int remoteClientInitHook(virNetServerPtr srv ATTRIBUTE_UNUSED,
-                         virNetServerClientPtr client)
+                         virNetServerClientPtr client,
+                         void *opaque ATTRIBUTE_UNUSED)
 {
     struct daemonClientPrivate *priv;
     int i;
diff --git a/daemon/remote.h b/daemon/remote.h
index 5444e47..d3e1b2d 100644
--- a/daemon/remote.h
+++ b/daemon/remote.h
@@ -36,6 +36,7 @@ extern virNetServerProgramProc qemuProcs[];
 extern size_t qemuNProcs;
 
 int remoteClientInitHook(virNetServerPtr srv,
-                         virNetServerClientPtr client);
+                         virNetServerClientPtr client,
+                         void *opaque);
 
 #endif /* __LIBVIRTD_REMOTE_H__ */
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 247ddd7..358666d 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -112,6 +112,7 @@ struct _virNetServer {
     void *autoShutdownOpaque;
 
     virNetServerClientInitHook clientInitHook;
+    void *clientInitOpaque;
 };
 
 
@@ -248,7 +249,7 @@ static int virNetServerDispatchNewClient(virNetServerServicePtr svc ATTRIBUTE_UN
         goto error;
 
     if (srv->clientInitHook &&
-        srv->clientInitHook(srv, client) < 0)
+        srv->clientInitHook(srv, client, srv->clientInitOpaque) < 0)
         goto error;
 
     if (VIR_EXPAND_N(srv->clients, srv->nclients, 1) < 0) {
@@ -310,7 +311,8 @@ virNetServerPtr virNetServerNew(size_t min_workers,
                                 unsigned int keepaliveCount,
                                 bool keepaliveRequired,
                                 const char *mdnsGroupName,
-                                virNetServerClientInitHook clientInitHook)
+                                virNetServerClientInitHook clientInitHook,
+                                void *opaque)
 {
     virNetServerPtr srv;
     struct sigaction sig_action;
@@ -334,6 +336,7 @@ virNetServerPtr virNetServerNew(size_t min_workers,
     srv->keepaliveRequired = keepaliveRequired;
     srv->sigwrite = srv->sigread = -1;
     srv->clientInitHook = clientInitHook;
+    srv->clientInitOpaque = opaque;
     srv->privileged = geteuid() == 0 ? true : false;
 
     if (mdnsGroupName &&
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 0ebe00e..438f524 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -32,7 +32,8 @@
 # include "virnetserverservice.h"
 
 typedef int (*virNetServerClientInitHook)(virNetServerPtr srv,
-                                          virNetServerClientPtr client);
+                                          virNetServerClientPtr client,
+                                          void *opaque);
 
 virNetServerPtr virNetServerNew(size_t min_workers,
                                 size_t max_workers,
@@ -42,7 +43,8 @@ virNetServerPtr virNetServerNew(size_t min_workers,
                                 unsigned int keepaliveCount,
                                 bool keepaliveRequired,
                                 const char *mdnsGroupName,
-                                virNetServerClientInitHook clientInitHook);
+                                virNetServerClientInitHook clientInitHook,
+                                void *opaque);
 
 typedef int (*virNetServerAutoShutdownFunc)(virNetServerPtr srv, void *opaque);
 
-- 
1.7.10.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]