提交 d5762cc0 编写于 作者: M Michal Privoznik

qemu: change qemuFindAgentConfig return type

While this is no functional change, whole channel definition is
going to be needed very soon. Moreover, while touching this obey
const correctness rule in qemuAgentOpen() - so far it was passed
regular pointer to channel config even though the function is
expected to not change pointee at all. Pass const pointer
instead.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 2f504455
......@@ -710,7 +710,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque)
qemuAgentPtr
qemuAgentOpen(virDomainObjPtr vm,
virDomainChrSourceDefPtr config,
const virDomainChrSourceDef *config,
qemuAgentCallbacksPtr cb)
{
qemuAgentPtr mon;
......
......@@ -44,7 +44,7 @@ struct _qemuAgentCallbacks {
qemuAgentPtr qemuAgentOpen(virDomainObjPtr vm,
virDomainChrSourceDefPtr config,
const virDomainChrSourceDef *config,
qemuAgentCallbacksPtr cb);
void qemuAgentClose(qemuAgentPtr mon);
......
......@@ -3704,10 +3704,9 @@ qemuDomainSupportsBlockJobs(virDomainObjPtr vm,
* Returns the pointer to the channel definition that is used to access the
* guest agent if the agent is configured or NULL otherwise.
*/
virDomainChrSourceDefPtr
virDomainChrDefPtr
qemuFindAgentConfig(virDomainDefPtr def)
{
virDomainChrSourceDefPtr config = NULL;
size_t i;
for (i = 0; i < def->nchannels; i++) {
......@@ -3716,13 +3715,11 @@ qemuFindAgentConfig(virDomainDefPtr def)
if (channel->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO)
continue;
if (STREQ_NULLABLE(channel->target.name, "org.qemu.guest_agent.0")) {
config = &channel->source;
break;
}
if (STREQ_NULLABLE(channel->target.name, "org.qemu.guest_agent.0"))
return channel;
}
return config;
return NULL;
}
......
......@@ -487,7 +487,7 @@ int qemuDomainAlignMemorySizes(virDomainDefPtr def);
void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
virDomainMemoryDefPtr mem);
virDomainChrSourceDefPtr qemuFindAgentConfig(virDomainDefPtr def);
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
bool qemuDomainMachineIsQ35(const virDomainDef *def);
bool qemuDomainMachineIsI440FX(const virDomainDef *def);
......
......@@ -203,7 +203,7 @@ qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm)
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
qemuAgentPtr agent = NULL;
virDomainChrSourceDefPtr config = qemuFindAgentConfig(vm->def);
virDomainChrDefPtr config = qemuFindAgentConfig(vm->def);
if (!config)
return 0;
......@@ -223,7 +223,7 @@ qemuConnectAgent(virQEMUDriverPtr driver, virDomainObjPtr vm)
virObjectUnlock(vm);
agent = qemuAgentOpen(vm,
config,
&config->source,
&agentCallbacks);
virObjectLock(vm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册