提交 b9739b47 编写于 作者: D Daniel P. Berrange

Add missing locking calls in remote driver

上级 3aed6728
Tue Mar 3 19:31:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
* src/libvirt.c: Fix return status s/-2/-1/ for virNodeGetSecurityModel
and virDomainGetSecurityLabel()
* src/remote_driver.c:Add missing mutex lock/unlock calls for
virNodeGetSecurityModel and virDomainGetSecurityLabel drivers
Tue Mar 3 16:55:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
Mingw32 portability fixes
......
......@@ -4206,7 +4206,7 @@ virDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel)
return conn->driver->domainGetSecurityLabel(domain, seclabel);
virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -2;
return -1;
}
/**
......@@ -4236,7 +4236,7 @@ virNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel)
return conn->driver->nodeGetSecurityModel(conn, secmodel);
virLibConnWarning(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -2;
return -1;
}
/**
......
......@@ -2302,26 +2302,33 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel)
remote_domain_get_security_label_args args;
remote_domain_get_security_label_ret ret;
struct private_data *priv = domain->conn->privateData;
int rv = -1;
remoteDriverLock(priv);
make_nonnull_domain (&args.dom, domain);
memset (&ret, 0, sizeof ret);
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL,
(xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args,
(xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1) {
return -1;
goto done;
}
if (ret.label.label_val != NULL) {
if (strlen (ret.label.label_val) >= sizeof seclabel->label) {
errorf (domain->conn, VIR_ERR_RPC, _("security label exceeds maximum: %zd"),
sizeof seclabel->label - 1);
return -1;
goto done;
}
strcpy (seclabel->label, ret.label.label_val);
seclabel->enforcing = ret.enforcing;
}
return 0;
rv = 0;
done:
remoteDriverUnlock(priv);
return rv;
}
static int
......@@ -2329,19 +2336,22 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
{
remote_node_get_security_model_ret ret;
struct private_data *priv = conn->privateData;
int rv = -1;
remoteDriverLock(priv);
memset (&ret, 0, sizeof ret);
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL,
(xdrproc_t) xdr_void, NULL,
(xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1) {
return -1;
goto done;
}
if (ret.model.model_val != NULL) {
if (strlen (ret.model.model_val) >= sizeof secmodel->model) {
errorf (conn, VIR_ERR_RPC, _("security model exceeds maximum: %zd"),
sizeof secmodel->model - 1);
return -1;
goto done;
}
strcpy (secmodel->model, ret.model.model_val);
}
......@@ -2350,11 +2360,16 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel)
if (strlen (ret.doi.doi_val) >= sizeof secmodel->doi) {
errorf (conn, VIR_ERR_RPC, _("security doi exceeds maximum: %zd"),
sizeof secmodel->doi - 1);
return -1;
goto done;
}
strcpy (secmodel->doi, ret.doi.doi_val);
}
return 0;
rv = 0;
done:
remoteDriverUnlock(priv);
return rv;
}
static char *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册