Since the secondary drivers are only active when the primary
driver is also the remote driver, there is no need to use the
different type specific privateData fields.
---
src/remote/remote_driver.c | 84 +++++++++++++---------------------------------
src/rpc/gendispatch.pl | 28 +---------------
2 files changed, 24 insertions(+), 88 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 19a70a1..fa4556b 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -3527,60 +3527,30 @@ remoteConnectListAllSecrets(virConnectPtr conn,
/*----------------------------------------------------------------------*/
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
-remoteGenericOpen(virConnectPtr conn, void **genericPrivateData)
+remoteGenericOpen(virConnectPtr conn)
{
if (inside_daemon)
return VIR_DRV_OPEN_DECLINED;
if (conn->driver &&
STREQ(conn->driver->name, "remote")) {
- struct private_data *priv;
-
- /* If we're here, the remote driver is already
- * in use due to a) a QEMU uri, or b) a remote
- * URI. So we can re-use existing connection */
- priv = conn->privateData;
- remoteDriverLock(priv);
- priv->localUses++;
- *genericPrivateData = priv;
- remoteDriverUnlock(priv);
return VIR_DRV_OPEN_SUCCESS;
}
return VIR_DRV_OPEN_DECLINED;
}
-static int
-remoteGenericClose(virConnectPtr conn, void **genericPrivateData)
-{
- int rv = 0;
- struct private_data *priv = *genericPrivateData;
-
- remoteDriverLock(priv);
- priv->localUses--;
- if (!priv->localUses) {
- rv = doRemoteClose(conn, priv);
- *genericPrivateData = NULL;
- remoteDriverUnlock(priv);
- virMutexDestroy(&priv->lock);
- VIR_FREE(priv);
- }
- if (priv)
- remoteDriverUnlock(priv);
- return rv;
-}
-
static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
remoteNetworkOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, &conn->networkPrivateData);
+ return remoteGenericOpen(conn);
}
static int
-remoteNetworkClose(virConnectPtr conn)
+remoteNetworkClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
- return remoteGenericClose(conn, &conn->networkPrivateData);
+ return 0;
}
/*----------------------------------------------------------------------*/
@@ -3589,13 +3559,13 @@ static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
remoteInterfaceOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, &conn->interfacePrivateData);
+ return remoteGenericOpen(conn);
}
static int
-remoteInterfaceClose(virConnectPtr conn)
+remoteInterfaceClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
- return remoteGenericClose(conn, &conn->interfacePrivateData);
+ return 0;
}
/*----------------------------------------------------------------------*/
@@ -3604,13 +3574,13 @@ static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
remoteStorageOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, &conn->storagePrivateData);
+ return remoteGenericOpen(conn);
}
static int
-remoteStorageClose(virConnectPtr conn)
+remoteStorageClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
- return remoteGenericClose(conn, &conn->storagePrivateData);
+ return 0;
}
static char *
@@ -3622,7 +3592,7 @@ remoteConnectFindStoragePoolSources(virConnectPtr conn,
char *rv = NULL;
remote_connect_find_storage_pool_sources_args args;
remote_connect_find_storage_pool_sources_ret ret;
- struct private_data *priv = conn->storagePrivateData;
+ struct private_data *priv = conn->privateData;
remoteDriverLock(priv);
@@ -3786,13 +3756,13 @@ static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
remoteNodeDeviceOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, &conn->nodeDevicePrivateData);
+ return remoteGenericOpen(conn);
}
static int
-remoteNodeDeviceClose(virConnectPtr conn)
+remoteNodeDeviceClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
- return remoteGenericClose(conn, &conn->nodeDevicePrivateData);
+ return 0;
}
static int
@@ -3800,8 +3770,6 @@ remoteNodeDeviceDettach(virNodeDevicePtr dev)
{
int rv = -1;
remote_node_device_dettach_args args;
- /* This method is unusual in that it uses the HV driver, not the devMon driver
- * hence its use of privateData, instead of nodeDevicePrivateData */
struct private_data *priv = dev->conn->privateData;
remoteDriverLock(priv);
@@ -3827,10 +3795,6 @@ remoteNodeDeviceDetachFlags(virNodeDevicePtr dev,
{
int rv = -1;
remote_node_device_detach_flags_args args;
- /* This method is unusual in that it uses the HV driver, not the
- * devMon driver hence its use of privateData, instead of
- * nodeDevicePrivateData
- */
struct private_data *priv = dev->conn->privateData;
remoteDriverLock(priv);
@@ -3856,8 +3820,6 @@ remoteNodeDeviceReAttach(virNodeDevicePtr dev)
{
int rv = -1;
remote_node_device_re_attach_args args;
- /* This method is unusual in that it uses the HV driver, not the devMon driver
- * hence its use of privateData, instead of nodeDevicePrivateData */
struct private_data *priv = dev->conn->privateData;
remoteDriverLock(priv);
@@ -3907,13 +3869,13 @@ static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
remoteNWFilterOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, &conn->nwfilterPrivateData);
+ return remoteGenericOpen(conn);
}
static int
-remoteNWFilterClose(virConnectPtr conn)
+remoteNWFilterClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
- return remoteGenericClose(conn, &conn->nwfilterPrivateData);
+ return 0;
}
/*----------------------------------------------------------------------*/
@@ -5563,13 +5525,13 @@ static virDrvOpenStatus ATTRIBUTE_NONNULL(1)
remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
unsigned int flags ATTRIBUTE_UNUSED)
{
- return remoteGenericOpen(conn, &conn->secretPrivateData);
+ return remoteGenericOpen(conn);
}
static int
-remoteSecretClose(virConnectPtr conn)
+remoteSecretClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{
- return remoteGenericClose(conn, &conn->secretPrivateData);
+ return 0;
}
static unsigned char *
@@ -5579,7 +5541,7 @@ remoteSecretGetValue(virSecretPtr secret, size_t *value_size,
unsigned char *rv = NULL;
remote_secret_get_value_args args;
remote_secret_get_value_ret ret;
- struct private_data *priv = secret->conn->secretPrivateData;
+ struct private_data *priv = secret->conn->privateData;
remoteDriverLock(priv);
@@ -7660,7 +7622,7 @@ remoteNetworkGetDHCPLeases(virNetworkPtr net,
{
int rv = -1;
size_t i;
- struct private_data *priv = net->conn->networkPrivateData;
+ struct private_data *priv = net->conn->privateData;
remote_network_get_dhcp_leases_args args;
remote_network_get_dhcp_leases_ret ret;
@@ -7728,7 +7690,7 @@ remoteConnectGetAllDomainStats(virConnectPtr conn,
virDomainStatsRecordPtr **retStats,
unsigned int flags)
{
- struct private_data *priv = conn->networkPrivateData;
+ struct private_data *priv = conn->privateData;
int rv = -1;
size_t i;
remote_connect_get_all_domain_stats_args args;
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 27093d2..b38d5bb 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -1090,7 +1090,6 @@ elsif ($mode eq "client") {
my @setters_list2 = ();
my @free_list = ();
my $priv_src = "conn";
- my $priv_name = "privateData";
my $call_args = "&args";
if ($argtype eq "void") {
@@ -1106,7 +1105,6 @@ elsif ($mode eq "client") {
!($argtype =~ m/^remote_node_device_lookup_by_name_/) and
!($argtype =~ m/^remote_node_device_create_xml_/)) {
$has_node_device = 1;
- $priv_name = "nodeDevicePrivateData";
}
foreach my $args_member (@{$call->{args_members}}) {
@@ -1125,12 +1123,6 @@ elsif ($mode eq "client") {
} else {
$priv_src = "$arg_name->conn";
}
-
- if ($name =~ m/^storage_/) {
- $priv_name = "storagePrivateData";
- } elsif (!($name =~ m/^domain/)) {
- $priv_name = "${name}PrivateData";
- }
}
push(@args_list, "vir${type_name}Ptr $arg_name");
@@ -1258,16 +1250,6 @@ elsif ($mode eq "client") {
push(@args_list, "virConnectPtr conn");
}
- # fix priv_name for the NumOf* functions
- if ($priv_name eq "privateData" and
- !($call->{ProcName} =~ m/(Domains|DomainSnapshot)/) and
- ($call->{ProcName} =~ m/NumOf(Defined|Domain)*(\S+)s/ or
- $call->{ProcName} =~ m/List(Defined|Domain)*(\S+)s/)) {
- my $prefix = lc $2;
- $prefix =~ s/(pool|vol)$//;
- $priv_name = "${prefix}PrivateData";
- }
-
# handle return values of the function
my @ret_list = ();
my @ret_list2 = ();
@@ -1342,14 +1324,6 @@ elsif ($mode eq "client") {
my $arg_name = $2;
my $type_name = name_to_TypeName($name);
- if ($name eq "node_device") {
- $priv_name = "nodeDevicePrivateData";
- } elsif ($name =~ m/^storage_/) {
- $priv_name = "storagePrivateData";
- } elsif (!($name =~ m/^domain/)) {
- $priv_name = "${name}PrivateData";
- }
-
if ($call->{ProcName} eq "DomainCreateWithFlags") {
# SPECIAL: virDomainCreateWithFlags updates the given
# domain object instead of returning a new one
@@ -1475,7 +1449,7 @@ elsif ($mode eq "client") {
print ")\n";
print "{\n";
print " $single_ret_var;\n";
- print " struct private_data *priv = $priv_src->$priv_name;\n";
+ print " struct private_data *priv = $priv_src->privateData;\n";
foreach my $var (@vars_list) {
print " $var;\n";
--
2.1.0