mirror of
https://github.com/libvirt/libvirt.git
synced 2025-01-24 07:16:47 -06:00
Add a opaque parameter to the RPC client init callback
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@redhat.com>
This commit is contained in:
parent
ccb9478500
commit
c6b2d5d082
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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__ */
|
||||
|
@ -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 &&
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user