From nobody Sun Feb 8 12:37:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1583412731; cv=none; d=zohomail.com; s=zohoarc; b=Ho6RdBKEoMDIK2JntCvXrqbrNNigzRND7BsBu3DVV4vPY60oZaLJiGAPpGHd1YuL1F3PSHf1UkdoM+/sQ5OY/DmVS92ypK21OgQ2RsV5W/f37auxVLI1/HyXOi9JcMzfyp/kza5ayykHYl9VOgATYvZxQCa65XIFVXTIToJPQ1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583412731; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H6Ju3ySYqvDG3qWxY2NSSGOLk0g/v0j2+3Gy1DvLHJ8=; b=MrW8st8NOtxECQeTV33yPSa4Di27WBjnD3RodmD/oiDdoBcrFCsB0KvI0jQYiZt+3vjrYn1YoKxDXg2dZBk+HyjLfG/attDxlRDbvFzRWgk0haGJ0X3oipEXUznCtC7F00zGLfxUgvqQsmKsOY4BhdGhols7p7UXT1gPWvtukfc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 15834127314682.2873561119001806; Thu, 5 Mar 2020 04:52:11 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-FkzUCedIM4GDov3FT2S7UA-1; Thu, 05 Mar 2020 07:52:07 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BFC213F5; Thu, 5 Mar 2020 12:52:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0AB855DA2C; Thu, 5 Mar 2020 12:52:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7E4BF18089CF; Thu, 5 Mar 2020 12:52:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 025CpwGO000910 for ; Thu, 5 Mar 2020 07:51:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1400A1001DF0; Thu, 5 Mar 2020 12:51:58 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F6791001DC2; Thu, 5 Mar 2020 12:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583412730; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=H6Ju3ySYqvDG3qWxY2NSSGOLk0g/v0j2+3Gy1DvLHJ8=; b=LQHbvJQhTwm1aSfr809/OmfFx+hFacP+Oj7sQCx9G/NkMzfQLWFCiXDGXT3dRGwuQp2rjZ iL7rl/Mi4ruVMjl266Yiz/J4iD0ixCVTGbC8cJn+jMJq5ZAx6bIxW5obyN6WId8BsKJltr ZNA5eZifJzFVfM76YSZ0iJB837dxi+4= X-MC-Unique: FkzUCedIM4GDov3FT2S7UA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH v2 6/7] qemu: fix variable naming in agent code Date: Thu, 5 Mar 2020 12:51:46 +0000 Message-Id: <20200305125147.2003011-7-berrange@redhat.com> In-Reply-To: <20200305125147.2003011-1-berrange@redhat.com> References: <20200305125147.2003011-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We are dealing with the QEMU agent, not the monitor. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_agent.c | 498 +++++++++++++++++++++--------------------- 1 file changed, 249 insertions(+), 249 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 9f3fb9732f..72ea159a9c 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -65,7 +65,7 @@ VIR_LOG_INIT("qemu.qemu_agent"); * static struct { const char *type; - void (*handler)(qemuAgentPtr mon, virJSONValuePtr data); + void (*handler)(qemuAgentPtr agent, virJSONValuePtr data); } eventHandlers[] =3D { }; */ @@ -78,13 +78,13 @@ struct _qemuAgentMessage { int txOffset; int txLength; =20 - /* Used by the JSON monitor to hold reply / error */ + /* Used by the JSON agent to hold reply / error */ char *rxBuffer; int rxLength; void *rxObject; =20 /* True if rxBuffer / rxObject are ready, or a - * fatal error occurred on the monitor channel + * fatal error occurred on the agent channel */ bool finished; /* true for sync command */ @@ -113,18 +113,18 @@ struct _qemuAgent { * non-NULL */ qemuAgentMessagePtr msg; =20 - /* Buffer incoming data ready for Agent monitor + /* Buffer incoming data ready for agent * code to process & find message boundaries */ size_t bufferOffset; size_t bufferLength; char *buffer; =20 /* If anything went wrong, this will be fed back - * the next monitor msg */ + * the next agent msg */ virError lastError; =20 /* Some guest agent commands don't return anything - * but fire up an event on qemu monitor instead. + * but fire up an event on qemu agent instead. * Take that as indication of successful completion */ qemuAgentEvent await_event; int timeout; @@ -166,71 +166,71 @@ qemuAgentEscapeNonPrintable(const char *text) =20 static void qemuAgentDispose(void *obj) { - qemuAgentPtr mon =3D obj; - VIR_DEBUG("mon=3D%p", mon); - if (mon->cb && mon->cb->destroy) - (mon->cb->destroy)(mon, mon->vm); - virCondDestroy(&mon->notify); - VIR_FREE(mon->buffer); - virResetError(&mon->lastError); + qemuAgentPtr agent =3D obj; + VIR_DEBUG("agent=3D%p", agent); + if (agent->cb && agent->cb->destroy) + (agent->cb->destroy)(agent, agent->vm); + virCondDestroy(&agent->notify); + VIR_FREE(agent->buffer); + virResetError(&agent->lastError); } =20 static int -qemuAgentOpenUnix(const char *monitor) +qemuAgentOpenUnix(const char *socketpath) { struct sockaddr_un addr; - int monfd; + int agentfd; int ret =3D -1; =20 - if ((monfd =3D socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { + if ((agentfd =3D socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { virReportSystemError(errno, "%s", _("failed to create socket")); return -1; } =20 - if (virSetNonBlock(monfd) < 0) { + if (virSetNonBlock(agentfd) < 0) { virReportSystemError(errno, "%s", _("Unable to put monitor " "into non-blocking mode")); goto error; } =20 - if (virSetCloseExec(monfd) < 0) { + if (virSetCloseExec(agentfd) < 0) { virReportSystemError(errno, "%s", - _("Unable to set monitor " + _("Unable to set agent " "close-on-exec flag")); goto error; } =20 memset(&addr, 0, sizeof(addr)); addr.sun_family =3D AF_UNIX; - if (virStrcpyStatic(addr.sun_path, monitor) < 0) { + if (virStrcpyStatic(addr.sun_path, socketpath) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Agent path %s too big for destination"), monitor= ); + _("Socket path %s too big for destination"), socket= path); goto error; } =20 - ret =3D connect(monfd, (struct sockaddr *)&addr, sizeof(addr)); + ret =3D connect(agentfd, (struct sockaddr *)&addr, sizeof(addr)); if (ret < 0) { virReportSystemError(errno, "%s", - _("failed to connect to monitor socket")); + _("failed to connect to agent socket")); goto error; } =20 - return monfd; + return agentfd; =20 error: - VIR_FORCE_CLOSE(monfd); + VIR_FORCE_CLOSE(agentfd); return -1; } =20 =20 static int -qemuAgentIOProcessEvent(qemuAgentPtr mon, +qemuAgentIOProcessEvent(qemuAgentPtr agent, virJSONValuePtr obj) { const char *type; - VIR_DEBUG("mon=3D%p obj=3D%p", mon, obj); + VIR_DEBUG("agent=3D%p obj=3D%p", agent, obj); =20 type =3D virJSONValueObjectGetString(obj, "event"); if (!type) { @@ -245,7 +245,7 @@ qemuAgentIOProcessEvent(qemuAgentPtr mon, virJSONValuePtr data =3D virJSONValueObjectGet(obj, "data"); VIR_DEBUG("handle %s handler=3D%p data=3D%p", type, eventHandlers[i].handler, data); - (eventHandlers[i].handler)(mon, data); + (eventHandlers[i].handler)(agent, data); break; } } @@ -254,7 +254,7 @@ qemuAgentIOProcessEvent(qemuAgentPtr mon, } =20 static int -qemuAgentIOProcessLine(qemuAgentPtr mon, +qemuAgentIOProcessLine(qemuAgentPtr agent, const char *line, qemuAgentMessagePtr msg) { @@ -283,7 +283,7 @@ qemuAgentIOProcessLine(qemuAgentPtr mon, if (virJSONValueObjectHasKey(obj, "QMP") =3D=3D 1) { ret =3D 0; } else if (virJSONValueObjectHasKey(obj, "event") =3D=3D 1) { - ret =3D qemuAgentIOProcessEvent(mon, obj); + ret =3D qemuAgentIOProcessEvent(agent, obj); } else if (virJSONValueObjectHasKey(obj, "error") =3D=3D 1 || virJSONValueObjectHasKey(obj, "return") =3D=3D 1) { if (msg) { @@ -323,7 +323,7 @@ qemuAgentIOProcessLine(qemuAgentPtr mon, return ret; } =20 -static int qemuAgentIOProcessData(qemuAgentPtr mon, +static int qemuAgentIOProcessData(qemuAgentPtr agent, char *data, size_t len, qemuAgentMessagePtr msg) @@ -347,7 +347,7 @@ static int qemuAgentIOProcessData(qemuAgentPtr mon, int got =3D nl - (data + used); for (i =3D 0; i < strlen(LINE_ENDING); i++) data[used + got + i] =3D '\0'; - if (qemuAgentIOProcessLine(mon, data + used, msg) < 0) + if (qemuAgentIOProcessLine(agent, data + used, msg) < 0) return -1; used +=3D got + strlen(LINE_ENDING); } else { @@ -360,11 +360,11 @@ static int qemuAgentIOProcessData(qemuAgentPtr mon, } =20 /* This method processes data that has been received - * from the monitor. Looking for async events and + * from the agent. Looking for async events and * replies/errors. */ static int -qemuAgentIOProcess(qemuAgentPtr mon) +qemuAgentIOProcess(qemuAgentPtr agent) { int len; qemuAgentMessagePtr msg =3D NULL; @@ -372,97 +372,97 @@ qemuAgentIOProcess(qemuAgentPtr mon) /* See if there's a message ready for reply; that is, * one that has completed writing all its data. */ - if (mon->msg && mon->msg->txOffset =3D=3D mon->msg->txLength) - msg =3D mon->msg; + if (agent->msg && agent->msg->txOffset =3D=3D agent->msg->txLength) + msg =3D agent->msg; =20 #if DEBUG_IO # if DEBUG_RAW_IO char *str1 =3D qemuAgentEscapeNonPrintable(msg ? msg->txBuffer : ""); - char *str2 =3D qemuAgentEscapeNonPrintable(mon->buffer); + char *str2 =3D qemuAgentEscapeNonPrintable(agent->buffer); VIR_ERROR(_("Process %zu %p %p [[[%s]]][[[%s]]]"), - mon->bufferOffset, mon->msg, msg, str1, str2); + agent->bufferOffset, agent->msg, msg, str1, str2); VIR_FREE(str1); VIR_FREE(str2); # else - VIR_DEBUG("Process %zu", mon->bufferOffset); + VIR_DEBUG("Process %zu", agent->bufferOffset); # endif #endif =20 - len =3D qemuAgentIOProcessData(mon, - mon->buffer, mon->bufferOffset, + len =3D qemuAgentIOProcessData(agent, + agent->buffer, agent->bufferOffset, msg); =20 if (len < 0) return -1; =20 - if (len < mon->bufferOffset) { - memmove(mon->buffer, mon->buffer + len, mon->bufferOffset - len); - mon->bufferOffset -=3D len; + if (len < agent->bufferOffset) { + memmove(agent->buffer, agent->buffer + len, agent->bufferOffset - = len); + agent->bufferOffset -=3D len; } else { - VIR_FREE(mon->buffer); - mon->bufferOffset =3D mon->bufferLength =3D 0; + VIR_FREE(agent->buffer); + agent->bufferOffset =3D agent->bufferLength =3D 0; } #if DEBUG_IO - VIR_DEBUG("Process done %zu used %d", mon->bufferOffset, len); + VIR_DEBUG("Process done %zu used %d", agent->bufferOffset, len); #endif if (msg && msg->finished) - virCondBroadcast(&mon->notify); + virCondBroadcast(&agent->notify); return len; } =20 =20 /* - * Called when the monitor is able to write data - * Call this function while holding the monitor lock. + * Called when the agent is able to write data + * Call this function while holding the agent lock. */ static int -qemuAgentIOWrite(qemuAgentPtr mon) +qemuAgentIOWrite(qemuAgentPtr agent) { int done; =20 /* If no active message, or fully transmitted, then no-op */ - if (!mon->msg || mon->msg->txOffset =3D=3D mon->msg->txLength) + if (!agent->msg || agent->msg->txOffset =3D=3D agent->msg->txLength) return 0; =20 - done =3D safewrite(mon->fd, - mon->msg->txBuffer + mon->msg->txOffset, - mon->msg->txLength - mon->msg->txOffset); + done =3D safewrite(agent->fd, + agent->msg->txBuffer + agent->msg->txOffset, + agent->msg->txLength - agent->msg->txOffset); =20 if (done < 0) { if (errno =3D=3D EAGAIN) return 0; =20 virReportSystemError(errno, "%s", - _("Unable to write to monitor")); + _("Unable to write to agent")); return -1; } - mon->msg->txOffset +=3D done; + agent->msg->txOffset +=3D done; return done; } =20 /* - * Called when the monitor has incoming data to read - * Call this function while holding the monitor lock. + * Called when the agent has incoming data to read + * Call this function while holding the agent lock. * * Returns -1 on error, or number of bytes read */ static int -qemuAgentIORead(qemuAgentPtr mon) +qemuAgentIORead(qemuAgentPtr agent) { - size_t avail =3D mon->bufferLength - mon->bufferOffset; + size_t avail =3D agent->bufferLength - agent->bufferOffset; int ret =3D 0; =20 if (avail < 1024) { - if (mon->bufferLength >=3D QEMU_AGENT_MAX_RESPONSE) { + if (agent->bufferLength >=3D QEMU_AGENT_MAX_RESPONSE) { virReportSystemError(ERANGE, _("No complete agent response found in %d= bytes"), QEMU_AGENT_MAX_RESPONSE); return -1; } - if (VIR_REALLOC_N(mon->buffer, - mon->bufferLength + 1024) < 0) + if (VIR_REALLOC_N(agent->buffer, + agent->bufferLength + 1024) < 0) return -1; - mon->bufferLength +=3D 1024; + agent->bufferLength +=3D 1024; avail +=3D 1024; } =20 @@ -470,14 +470,14 @@ qemuAgentIORead(qemuAgentPtr mon) until we block on EAGAIN, or hit EOF */ while (avail > 1) { int got; - got =3D read(mon->fd, - mon->buffer + mon->bufferOffset, + got =3D read(agent->fd, + agent->buffer + agent->bufferOffset, avail - 1); if (got < 0) { if (errno =3D=3D EAGAIN) break; virReportSystemError(errno, "%s", - _("Unable to read from monitor")); + _("Unable to read from agent")); ret =3D -1; break; } @@ -486,79 +486,79 @@ qemuAgentIORead(qemuAgentPtr mon) =20 ret +=3D got; avail -=3D got; - mon->bufferOffset +=3D got; - mon->buffer[mon->bufferOffset] =3D '\0'; + agent->bufferOffset +=3D got; + agent->buffer[agent->bufferOffset] =3D '\0'; } =20 #if DEBUG_IO - VIR_DEBUG("Now read %zu bytes of data", mon->bufferOffset); + VIR_DEBUG("Now read %zu bytes of data", agent->bufferOffset); #endif =20 return ret; } =20 =20 -static void qemuAgentUpdateWatch(qemuAgentPtr mon) +static void qemuAgentUpdateWatch(qemuAgentPtr agent) { int events =3D VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR; =20 - if (!mon->watch) + if (!agent->watch) return; =20 - if (mon->lastError.code =3D=3D VIR_ERR_OK) { + if (agent->lastError.code =3D=3D VIR_ERR_OK) { events |=3D VIR_EVENT_HANDLE_READABLE; =20 - if (mon->msg && mon->msg->txOffset < mon->msg->txLength) + if (agent->msg && agent->msg->txOffset < agent->msg->txLength) events |=3D VIR_EVENT_HANDLE_WRITABLE; } =20 - virEventUpdateHandle(mon->watch, events); + virEventUpdateHandle(agent->watch, events); } =20 =20 static void qemuAgentIO(int watch, int fd, int events, void *opaque) { - qemuAgentPtr mon =3D opaque; + qemuAgentPtr agent =3D opaque; bool error =3D false; bool eof =3D false; =20 - virObjectRef(mon); - /* lock access to the monitor and protect fd */ - virObjectLock(mon); + virObjectRef(agent); + /* lock access to the agent and protect fd */ + virObjectLock(agent); #if DEBUG_IO - VIR_DEBUG("Agent %p I/O on watch %d fd %d events %d", mon, watch, fd, = events); + VIR_DEBUG("Agent %p I/O on watch %d fd %d events %d", agent, watch, fd= , events); #endif =20 - if (mon->fd =3D=3D -1 || mon->watch =3D=3D 0) { - virObjectUnlock(mon); - virObjectUnref(mon); + if (agent->fd =3D=3D -1 || agent->watch =3D=3D 0) { + virObjectUnlock(agent); + virObjectUnref(agent); return; } =20 - if (mon->fd !=3D fd || mon->watch !=3D watch) { + if (agent->fd !=3D fd || agent->watch !=3D watch) { if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) eof =3D true; virReportError(VIR_ERR_INTERNAL_ERROR, _("event from unexpected fd %d!=3D%d / watch %d!=3D= %d"), - mon->fd, fd, mon->watch, watch); + agent->fd, fd, agent->watch, watch); error =3D true; - } else if (mon->lastError.code !=3D VIR_ERR_OK) { + } else if (agent->lastError.code !=3D VIR_ERR_OK) { if (events & (VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR)) eof =3D true; error =3D true; } else { if (events & VIR_EVENT_HANDLE_WRITABLE) { - if (qemuAgentIOWrite(mon) < 0) + if (qemuAgentIOWrite(agent) < 0) error =3D true; events &=3D ~VIR_EVENT_HANDLE_WRITABLE; } =20 if (!error && events & VIR_EVENT_HANDLE_READABLE) { - int got =3D qemuAgentIORead(mon); + int got =3D qemuAgentIORead(agent); events &=3D ~VIR_EVENT_HANDLE_READABLE; if (got < 0) { error =3D true; @@ -569,7 +569,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) * give time for that data to be consumed */ events =3D 0; =20 - if (qemuAgentIOProcess(mon) < 0) + if (qemuAgentIOProcess(agent) < 0) error =3D true; } } @@ -577,7 +577,7 @@ qemuAgentIO(int watch, int fd, int events, void *opaque) if (!error && events & VIR_EVENT_HANDLE_HANGUP) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("End of file from agent monitor")); + _("End of file from agent socket")); eof =3D true; events &=3D ~VIR_EVENT_HANDLE_HANGUP; } @@ -585,69 +585,69 @@ qemuAgentIO(int watch, int fd, int events, void *opaq= ue) if (!error && !eof && events & VIR_EVENT_HANDLE_ERROR) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid file descriptor while waiting for mo= nitor")); + _("Invalid file descriptor while waiting for ag= ent")); eof =3D true; events &=3D ~VIR_EVENT_HANDLE_ERROR; } if (!error && events) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unhandled event %d for monitor fd %d"), - events, mon->fd); + _("Unhandled event %d for agent fd %d"), + events, agent->fd); error =3D true; } } =20 if (error || eof) { - if (mon->lastError.code !=3D VIR_ERR_OK) { + if (agent->lastError.code !=3D VIR_ERR_OK) { /* Already have an error, so clear any new error */ virResetLastError(); } else { if (virGetLastErrorCode() =3D=3D VIR_ERR_OK) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Error while processing monitor IO")); - virCopyLastError(&mon->lastError); + _("Error while processing agent IO")); + virCopyLastError(&agent->lastError); virResetLastError(); } =20 - VIR_DEBUG("Error on monitor %s", NULLSTR(mon->lastError.message)); + VIR_DEBUG("Error on agent %s", NULLSTR(agent->lastError.message)); /* If IO process resulted in an error & we have a message, * then wakeup that waiter */ - if (mon->msg && !mon->msg->finished) { - mon->msg->finished =3D 1; - virCondSignal(&mon->notify); + if (agent->msg && !agent->msg->finished) { + agent->msg->finished =3D 1; + virCondSignal(&agent->notify); } } =20 - qemuAgentUpdateWatch(mon); + qemuAgentUpdateWatch(agent); =20 /* We have to unlock to avoid deadlock against command thread, * but is this safe ? I think it is, because the callback * will try to acquire the virDomainObjPtr mutex next */ if (eof) { void (*eofNotify)(qemuAgentPtr, virDomainObjPtr) - =3D mon->cb->eofNotify; - virDomainObjPtr vm =3D mon->vm; + =3D agent->cb->eofNotify; + virDomainObjPtr vm =3D agent->vm; =20 /* Make sure anyone waiting wakes up now */ - virCondSignal(&mon->notify); - virObjectUnlock(mon); - virObjectUnref(mon); + virCondSignal(&agent->notify); + virObjectUnlock(agent); + virObjectUnref(agent); VIR_DEBUG("Triggering EOF callback"); - (eofNotify)(mon, vm); + (eofNotify)(agent, vm); } else if (error) { void (*errorNotify)(qemuAgentPtr, virDomainObjPtr) - =3D mon->cb->errorNotify; - virDomainObjPtr vm =3D mon->vm; + =3D agent->cb->errorNotify; + virDomainObjPtr vm =3D agent->vm; =20 /* Make sure anyone waiting wakes up now */ - virCondSignal(&mon->notify); - virObjectUnlock(mon); - virObjectUnref(mon); + virCondSignal(&agent->notify); + virObjectUnlock(agent); + virObjectUnref(agent); VIR_DEBUG("Triggering error callback"); - (errorNotify)(mon, vm); + (errorNotify)(agent, vm); } else { - virObjectUnlock(mon); - virObjectUnref(mon); + virObjectUnlock(agent); + virObjectUnref(agent); } } =20 @@ -657,7 +657,7 @@ qemuAgentOpen(virDomainObjPtr vm, const virDomainChrSourceDef *config, qemuAgentCallbacksPtr cb) { - qemuAgentPtr mon; + qemuAgentPtr agent; =20 if (!cb || !cb->eofNotify) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -668,49 +668,49 @@ qemuAgentOpen(virDomainObjPtr vm, if (qemuAgentInitialize() < 0) return NULL; =20 - if (!(mon =3D virObjectLockableNew(qemuAgentClass))) + if (!(agent =3D virObjectLockableNew(qemuAgentClass))) return NULL; =20 - mon->timeout =3D QEMU_DOMAIN_PRIVATE(vm)->agentTimeout; - mon->fd =3D -1; - if (virCondInit(&mon->notify) < 0) { + agent->timeout =3D QEMU_DOMAIN_PRIVATE(vm)->agentTimeout; + agent->fd =3D -1; + if (virCondInit(&agent->notify) < 0) { virReportSystemError(errno, "%s", - _("cannot initialize monitor condition")); - virObjectUnref(mon); + _("cannot initialize agent condition")); + virObjectUnref(agent); return NULL; } - mon->vm =3D vm; - mon->cb =3D cb; + agent->vm =3D vm; + agent->cb =3D cb; =20 if (config->type !=3D VIR_DOMAIN_CHR_TYPE_UNIX) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to handle monitor type: %s"), + _("unable to handle agent type: %s"), virDomainChrTypeToString(config->type)); goto cleanup; } =20 - mon->fd =3D qemuAgentOpenUnix(config->data.nix.path); - if (mon->fd =3D=3D -1) + agent->fd =3D qemuAgentOpenUnix(config->data.nix.path); + if (agent->fd =3D=3D -1) goto cleanup; =20 - virObjectRef(mon); - if ((mon->watch =3D virEventAddHandle(mon->fd, + virObjectRef(agent); + if ((agent->watch =3D virEventAddHandle(agent->fd, VIR_EVENT_HANDLE_HANGUP | VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_READABLE, qemuAgentIO, - mon, + agent, virObjectFreeCallback)) < 0) { - virObjectUnref(mon); + virObjectUnref(agent); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unable to register monitor events")); + _("unable to register agent events")); goto cleanup; } =20 - mon->running =3D true; - VIR_DEBUG("New mon %p fd =3D%d watch=3D%d", mon, mon->fd, mon->watch); + agent->running =3D true; + VIR_DEBUG("New agent %p fd =3D%d watch=3D%d", agent, agent->fd, agent-= >watch); =20 - return mon; + return agent; =20 cleanup: /* We don't want the 'destroy' callback invoked during @@ -718,75 +718,75 @@ qemuAgentOpen(virDomainObjPtr vm, * give a double-unref on virDomainObjPtr in the caller, * so kill the callbacks now. */ - mon->cb =3D NULL; - qemuAgentClose(mon); + agent->cb =3D NULL; + qemuAgentClose(agent); return NULL; } =20 =20 static void -qemuAgentNotifyCloseLocked(qemuAgentPtr mon) +qemuAgentNotifyCloseLocked(qemuAgentPtr agent) { - if (mon) { - mon->running =3D false; + if (agent) { + agent->running =3D false; =20 /* If there is somebody waiting for a message * wake him up. No message will arrive anyway. */ - if (mon->msg && !mon->msg->finished) { - mon->msg->finished =3D 1; - virCondSignal(&mon->notify); + if (agent->msg && !agent->msg->finished) { + agent->msg->finished =3D 1; + virCondSignal(&agent->notify); } } } =20 =20 void -qemuAgentNotifyClose(qemuAgentPtr mon) +qemuAgentNotifyClose(qemuAgentPtr agent) { - if (!mon) + if (!agent) return; =20 - VIR_DEBUG("mon=3D%p", mon); + VIR_DEBUG("agent=3D%p", agent); =20 - virObjectLock(mon); - qemuAgentNotifyCloseLocked(mon); - virObjectUnlock(mon); + virObjectLock(agent); + qemuAgentNotifyCloseLocked(agent); + virObjectUnlock(agent); } =20 =20 -void qemuAgentClose(qemuAgentPtr mon) +void qemuAgentClose(qemuAgentPtr agent) { - if (!mon) + if (!agent) return; =20 - VIR_DEBUG("mon=3D%p", mon); + VIR_DEBUG("agent=3D%p", agent); =20 - virObjectLock(mon); + virObjectLock(agent); =20 - if (mon->fd >=3D 0) { - if (mon->watch) { - virEventRemoveHandle(mon->watch); - mon->watch =3D 0; + if (agent->fd >=3D 0) { + if (agent->watch) { + virEventRemoveHandle(agent->watch); + agent->watch =3D 0; } - VIR_FORCE_CLOSE(mon->fd); + VIR_FORCE_CLOSE(agent->fd); } =20 - qemuAgentNotifyCloseLocked(mon); - virObjectUnlock(mon); + qemuAgentNotifyCloseLocked(agent); + virObjectUnlock(agent); =20 - virObjectUnref(mon); + virObjectUnref(agent); } =20 #define QEMU_AGENT_WAIT_TIME 5 =20 /** * qemuAgentSend: - * @mon: Monitor + * @agent: agent object * @msg: Message * @seconds: number of seconds to wait for the result, it can be either * -2, -1, 0 or positive. * - * Send @msg to agent @mon. If @seconds is equal to + * Send @msg to agent @agent. If @seconds is equal to * VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK(-2), this function will block forev= er * waiting for the result. The value of * VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT(-1) means use default timeout val= ue @@ -798,7 +798,7 @@ void qemuAgentClose(qemuAgentPtr mon) * -2 on timeout, * -1 otherwise */ -static int qemuAgentSend(qemuAgentPtr mon, +static int qemuAgentSend(qemuAgentPtr agent, qemuAgentMessagePtr msg, int seconds) { @@ -806,10 +806,10 @@ static int qemuAgentSend(qemuAgentPtr mon, unsigned long long then =3D 0; =20 /* Check whether qemu quit unexpectedly */ - if (mon->lastError.code !=3D VIR_ERR_OK) { + if (agent->lastError.code !=3D VIR_ERR_OK) { VIR_DEBUG("Attempt to send command while error is set %s", - NULLSTR(mon->lastError.message)); - virSetError(&mon->lastError); + NULLSTR(agent->lastError.message)); + virSetError(&agent->lastError); return -1; } =20 @@ -822,37 +822,37 @@ static int qemuAgentSend(qemuAgentPtr mon, then =3D now + seconds * 1000ull; } =20 - mon->msg =3D msg; - qemuAgentUpdateWatch(mon); + agent->msg =3D msg; + qemuAgentUpdateWatch(agent); =20 - while (!mon->msg->finished) { - if ((then && virCondWaitUntil(&mon->notify, &mon->parent.lock, the= n) < 0) || - (!then && virCondWait(&mon->notify, &mon->parent.lock) < 0)) { + while (!agent->msg->finished) { + if ((then && virCondWaitUntil(&agent->notify, &agent->parent.lock,= then) < 0) || + (!then && virCondWait(&agent->notify, &agent->parent.lock) < 0= )) { if (errno =3D=3D ETIMEDOUT) { virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", _("Guest agent not available for now")); ret =3D -2; } else { virReportSystemError(errno, "%s", - _("Unable to wait on agent monitor " + _("Unable to wait on agent socket " "condition")); } goto cleanup; } } =20 - if (mon->lastError.code !=3D VIR_ERR_OK) { + if (agent->lastError.code !=3D VIR_ERR_OK) { VIR_DEBUG("Send command resulted in error %s", - NULLSTR(mon->lastError.message)); - virSetError(&mon->lastError); + NULLSTR(agent->lastError.message)); + virSetError(&agent->lastError); goto cleanup; } =20 ret =3D 0; =20 cleanup: - mon->msg =3D NULL; - qemuAgentUpdateWatch(mon); + agent->msg =3D NULL; + qemuAgentUpdateWatch(agent); =20 return ret; } @@ -860,7 +860,7 @@ static int qemuAgentSend(qemuAgentPtr mon, =20 /** * qemuAgentGuestSync: - * @mon: Monitor + * @agent: agent object * * Send guest-sync with unique ID * and wait for reply. If we get one, check if @@ -870,7 +870,7 @@ static int qemuAgentSend(qemuAgentPtr mon, * -1 otherwise */ static int -qemuAgentGuestSync(qemuAgentPtr mon) +qemuAgentGuestSync(qemuAgentPtr agent) { int ret =3D -1; int send_ret; @@ -880,8 +880,8 @@ qemuAgentGuestSync(qemuAgentPtr mon) =20 /* if user specified a custom agent timeout that is lower than the * default timeout, use the shorter timeout instead */ - if ((mon->timeout >=3D 0) && (mon->timeout < timeout)) - timeout =3D mon->timeout; + if ((agent->timeout >=3D 0) && (agent->timeout < timeout)) + timeout =3D agent->timeout; =20 memset(&sync_msg, 0, sizeof(sync_msg)); /* set only on first sync */ @@ -900,7 +900,7 @@ qemuAgentGuestSync(qemuAgentPtr mon) =20 VIR_DEBUG("Sending guest-sync command with ID: %llu", id); =20 - send_ret =3D qemuAgentSend(mon, &sync_msg, timeout); + send_ret =3D qemuAgentSend(agent, &sync_msg, timeout); =20 VIR_DEBUG("qemuAgentSend returned: %d", send_ret); =20 @@ -913,9 +913,9 @@ qemuAgentGuestSync(qemuAgentPtr mon) memset(&sync_msg, 0, sizeof(sync_msg)); goto retry; } else { - if (mon->running) + if (agent->running) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing monitor reply object")); + _("Missing agent reply object")); else virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", _("Guest agent disappeared while executing = command")); @@ -1066,7 +1066,7 @@ qemuAgentCheckError(virJSONValuePtr cmd, } =20 static int -qemuAgentCommand(qemuAgentPtr mon, +qemuAgentCommand(qemuAgentPtr agent, virJSONValuePtr cmd, virJSONValuePtr *reply, bool needReply, @@ -1075,17 +1075,17 @@ qemuAgentCommand(qemuAgentPtr mon, int ret =3D -1; qemuAgentMessage msg; char *cmdstr =3D NULL; - int await_event =3D mon->await_event; + int await_event =3D agent->await_event; =20 *reply =3D NULL; =20 - if (!mon->running) { + if (!agent->running) { virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", _("Guest agent disappeared while executing command"= )); return -1; } =20 - if (qemuAgentGuestSync(mon) < 0) + if (qemuAgentGuestSync(agent) < 0) return -1; =20 memset(&msg, 0, sizeof(msg)); @@ -1097,7 +1097,7 @@ qemuAgentCommand(qemuAgentPtr mon, =20 VIR_DEBUG("Send command '%s' for write, seconds =3D %d", cmdstr, secon= ds); =20 - ret =3D qemuAgentSend(mon, &msg, seconds); + ret =3D qemuAgentSend(agent, &msg, seconds); =20 VIR_DEBUG("Receive command reply ret=3D%d rxObject=3D%p", ret, msg.rxObject); @@ -1109,9 +1109,9 @@ qemuAgentCommand(qemuAgentPtr mon, if (await_event && !needReply) { VIR_DEBUG("Woken up by event %d", await_event); } else { - if (mon->running) + if (agent->running) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing monitor reply object")); + _("Missing agent reply object")); else virReportError(VIR_ERR_AGENT_UNRESPONSIVE, "%s", _("Guest agent disappeared while execut= ing command")); @@ -1184,22 +1184,22 @@ qemuAgentMakeStringsArray(const char **strings, uns= igned int len) return NULL; } =20 -void qemuAgentNotifyEvent(qemuAgentPtr mon, +void qemuAgentNotifyEvent(qemuAgentPtr agent, qemuAgentEvent event) { - virObjectLock(mon); + virObjectLock(agent); =20 - VIR_DEBUG("mon=3D%p event=3D%d await_event=3D%d", mon, event, mon->awa= it_event); - if (mon->await_event =3D=3D event) { - mon->await_event =3D QEMU_AGENT_EVENT_NONE; + VIR_DEBUG("agent=3D%p event=3D%d await_event=3D%d", agent, event, agen= t->await_event); + if (agent->await_event =3D=3D event) { + agent->await_event =3D QEMU_AGENT_EVENT_NONE; /* somebody waiting for this event, wake him up. */ - if (mon->msg && !mon->msg->finished) { - mon->msg->finished =3D 1; - virCondSignal(&mon->notify); + if (agent->msg && !agent->msg->finished) { + agent->msg->finished =3D 1; + virCondSignal(&agent->notify); } } =20 - virObjectUnlock(mon); + virObjectUnlock(agent); } =20 VIR_ENUM_DECL(qemuAgentShutdownMode); @@ -1209,7 +1209,7 @@ VIR_ENUM_IMPL(qemuAgentShutdownMode, "powerdown", "reboot", "halt", ); =20 -int qemuAgentShutdown(qemuAgentPtr mon, +int qemuAgentShutdown(qemuAgentPtr agent, qemuAgentShutdownMode mode) { int ret =3D -1; @@ -1223,10 +1223,10 @@ int qemuAgentShutdown(qemuAgentPtr mon, return -1; =20 if (mode =3D=3D QEMU_AGENT_SHUTDOWN_REBOOT) - mon->await_event =3D QEMU_AGENT_EVENT_RESET; + agent->await_event =3D QEMU_AGENT_EVENT_RESET; else - mon->await_event =3D QEMU_AGENT_EVENT_SHUTDOWN; - ret =3D qemuAgentCommand(mon, cmd, &reply, false, + agent->await_event =3D QEMU_AGENT_EVENT_SHUTDOWN; + ret =3D qemuAgentCommand(agent, cmd, &reply, false, VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN); =20 virJSONValueFree(cmd); @@ -1236,7 +1236,7 @@ int qemuAgentShutdown(qemuAgentPtr mon, =20 /* * qemuAgentFSFreeze: - * @mon: Agent + * @agent: agent object * @mountpoints: Array of mountpoint paths to be frozen, or NULL for all * @nmountpoints: Number of mountpoints to be frozen, or 0 for all * @@ -1248,7 +1248,7 @@ int qemuAgentShutdown(qemuAgentPtr mon, * Returns: number of file system frozen on success, * -1 on error. */ -int qemuAgentFSFreeze(qemuAgentPtr mon, const char **mountpoints, +int qemuAgentFSFreeze(qemuAgentPtr agent, const char **mountpoints, unsigned int nmountpoints) { int ret =3D -1; @@ -1269,7 +1269,7 @@ int qemuAgentFSFreeze(qemuAgentPtr mon, const char **= mountpoints, if (!cmd) goto cleanup; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 if (virJSONValueObjectGetNumberInt(reply, "return", &ret) < 0) { @@ -1286,7 +1286,7 @@ int qemuAgentFSFreeze(qemuAgentPtr mon, const char **= mountpoints, =20 /* * qemuAgentFSThaw: - * @mon: Agent + * @agent: agent object * * Issue guest-fsfreeze-thaw command to guest agent, * which unfreezes all mounted file systems and returns @@ -1295,7 +1295,7 @@ int qemuAgentFSFreeze(qemuAgentPtr mon, const char **= mountpoints, * Returns: number of file system thawed on success, * -1 on error. */ -int qemuAgentFSThaw(qemuAgentPtr mon) +int qemuAgentFSThaw(qemuAgentPtr agent) { int ret =3D -1; virJSONValuePtr cmd; @@ -1306,7 +1306,7 @@ int qemuAgentFSThaw(qemuAgentPtr mon) if (!cmd) return -1; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 if (virJSONValueObjectGetNumberInt(reply, "return", &ret) < 0) { @@ -1330,7 +1330,7 @@ VIR_ENUM_IMPL(qemuAgentSuspendMode, ); =20 int -qemuAgentSuspend(qemuAgentPtr mon, +qemuAgentSuspend(qemuAgentPtr agent, unsigned int target) { int ret =3D -1; @@ -1342,8 +1342,8 @@ qemuAgentSuspend(qemuAgentPtr mon, if (!cmd) return -1; =20 - mon->await_event =3D QEMU_AGENT_EVENT_SUSPEND; - ret =3D qemuAgentCommand(mon, cmd, &reply, false, mon->timeout); + agent->await_event =3D QEMU_AGENT_EVENT_SUSPEND; + ret =3D qemuAgentCommand(agent, cmd, &reply, false, agent->timeout); =20 virJSONValueFree(cmd); virJSONValueFree(reply); @@ -1351,7 +1351,7 @@ qemuAgentSuspend(qemuAgentPtr mon, } =20 int -qemuAgentArbitraryCommand(qemuAgentPtr mon, +qemuAgentArbitraryCommand(qemuAgentPtr agent, const char *cmd_str, char **result, int timeout) @@ -1372,7 +1372,7 @@ qemuAgentArbitraryCommand(qemuAgentPtr mon, if (!(cmd =3D virJSONValueFromString(cmd_str))) goto cleanup; =20 - if ((ret =3D qemuAgentCommand(mon, cmd, &reply, true, timeout)) < 0) + if ((ret =3D qemuAgentCommand(agent, cmd, &reply, true, timeout)) < 0) goto cleanup; =20 if (!(*result =3D virJSONValueToString(reply, false))) @@ -1386,7 +1386,7 @@ qemuAgentArbitraryCommand(qemuAgentPtr mon, } =20 int -qemuAgentFSTrim(qemuAgentPtr mon, +qemuAgentFSTrim(qemuAgentPtr agent, unsigned long long minimum) { int ret =3D -1; @@ -1399,7 +1399,7 @@ qemuAgentFSTrim(qemuAgentPtr mon, if (!cmd) return ret; =20 - ret =3D qemuAgentCommand(mon, cmd, &reply, false, mon->timeout); + ret =3D qemuAgentCommand(agent, cmd, &reply, false, agent->timeout); =20 virJSONValueFree(cmd); virJSONValueFree(reply); @@ -1407,7 +1407,7 @@ qemuAgentFSTrim(qemuAgentPtr mon, } =20 int -qemuAgentGetVCPUs(qemuAgentPtr mon, +qemuAgentGetVCPUs(qemuAgentPtr agent, qemuAgentCPUInfoPtr *info) { int ret =3D -1; @@ -1420,7 +1420,7 @@ qemuAgentGetVCPUs(qemuAgentPtr mon, if (!(cmd =3D qemuAgentMakeCommand("guest-get-vcpus", NULL))) return -1; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 if (!(data =3D virJSONValueObjectGetArray(reply, "return"))) { @@ -1482,7 +1482,7 @@ qemuAgentGetVCPUs(qemuAgentPtr mon, =20 /* returns the value provided by the guest agent or -1 on internal error */ static int -qemuAgentSetVCPUsCommand(qemuAgentPtr mon, +qemuAgentSetVCPUsCommand(qemuAgentPtr agent, qemuAgentCPUInfoPtr info, size_t ninfo, int *nmodified) @@ -1533,7 +1533,7 @@ qemuAgentSetVCPUsCommand(qemuAgentPtr mon, NULL))) goto cleanup; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 /* All negative values are invalid. Return of 0 is bogus since we woul= dn't @@ -1564,7 +1564,7 @@ qemuAgentSetVCPUsCommand(qemuAgentPtr mon, * Returns -1 on error, 0 on success. */ int -qemuAgentSetVCPUs(qemuAgentPtr mon, +qemuAgentSetVCPUs(qemuAgentPtr agent, qemuAgentCPUInfoPtr info, size_t ninfo) { @@ -1573,7 +1573,7 @@ qemuAgentSetVCPUs(qemuAgentPtr mon, size_t i; =20 do { - if ((rv =3D qemuAgentSetVCPUsCommand(mon, info, ninfo, &nmodified)= ) < 0) + if ((rv =3D qemuAgentSetVCPUsCommand(agent, info, ninfo, &nmodifie= d)) < 0) return -1; =20 /* all vcpus were set successfully */ @@ -1673,7 +1673,7 @@ qemuAgentUpdateCPUInfo(unsigned int nvcpus, =20 =20 int -qemuAgentGetHostname(qemuAgentPtr mon, +qemuAgentGetHostname(qemuAgentPtr agent, char **hostname) { int ret =3D -1; @@ -1688,7 +1688,7 @@ qemuAgentGetHostname(qemuAgentPtr mon, if (!cmd) return ret; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) { + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) { if (qemuAgentErrorCommandUnsupported(reply)) ret =3D -2; goto cleanup; @@ -1718,7 +1718,7 @@ qemuAgentGetHostname(qemuAgentPtr mon, =20 =20 int -qemuAgentGetTime(qemuAgentPtr mon, +qemuAgentGetTime(qemuAgentPtr agent, long long *seconds, unsigned int *nseconds) { @@ -1732,7 +1732,7 @@ qemuAgentGetTime(qemuAgentPtr mon, if (!cmd) return ret; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 if (virJSONValueObjectGetNumberUlong(reply, "return", &json_time) < 0)= { @@ -1760,7 +1760,7 @@ qemuAgentGetTime(qemuAgentPtr mon, * @sync: let guest agent to read domain's RTC (@setTime is ignored) */ int -qemuAgentSetTime(qemuAgentPtr mon, +qemuAgentSetTime(qemuAgentPtr agent, long long seconds, unsigned int nseconds, bool rtcSync) @@ -1777,7 +1777,7 @@ qemuAgentSetTime(qemuAgentPtr mon, long long json_time; =20 /* Check if we overflow. For some reason qemu doesn't handle unsig= ned - * long long on the monitor well as it silently truncates numbers = to + * long long on the agent well as it silently truncates numbers to * signed long long. Therefore we must check overflow against LLON= G_MAX * not ULLONG_MAX. */ if (seconds > LLONG_MAX / 1000000000LL) { @@ -1797,7 +1797,7 @@ qemuAgentSetTime(qemuAgentPtr mon, if (!cmd) return ret; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 ret =3D 0; @@ -1919,7 +1919,7 @@ qemuAgentGetFSInfoFillDisks(virJSONValuePtr jsondisks, * -1 otherwise */ int -qemuAgentGetFSInfo(qemuAgentPtr mon, +qemuAgentGetFSInfo(qemuAgentPtr agent, qemuAgentFSInfoPtr **info) { size_t i; @@ -1934,7 +1934,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, if (!cmd) return ret; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) { + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) { if (qemuAgentErrorCommandUnsupported(reply)) ret =3D -2; goto cleanup; @@ -2052,7 +2052,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, =20 /* * qemuAgentGetInterfaces: - * @mon: Agent monitor + * @agent: agent object * @ifaces: pointer to an array of pointers pointing to interface objects * * Issue guest-network-get-interfaces to guest agent, which returns a @@ -2062,7 +2062,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, * Returns: number of interfaces on success, -1 on error. */ int -qemuAgentGetInterfaces(qemuAgentPtr mon, +qemuAgentGetInterfaces(qemuAgentPtr agent, virDomainInterfacePtr **ifaces) { int ret =3D -1; @@ -2085,7 +2085,7 @@ qemuAgentGetInterfaces(qemuAgentPtr mon, if (!(cmd =3D qemuAgentMakeCommand("guest-network-get-interfaces", NUL= L))) goto cleanup; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 if (!(ret_array =3D virJSONValueObjectGet(reply, "return"))) { @@ -2242,7 +2242,7 @@ qemuAgentGetInterfaces(qemuAgentPtr mon, =20 =20 int -qemuAgentSetUserPassword(qemuAgentPtr mon, +qemuAgentSetUserPassword(qemuAgentPtr agent, const char *user, const char *password, bool crypted) @@ -2262,7 +2262,7 @@ qemuAgentSetUserPassword(qemuAgentPtr mon, NULL))) goto cleanup; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) goto cleanup; =20 ret =3D 0; @@ -2279,7 +2279,7 @@ qemuAgentSetUserPassword(qemuAgentPtr mon, * -1 otherwise */ int -qemuAgentGetUsers(qemuAgentPtr mon, +qemuAgentGetUsers(qemuAgentPtr agent, virTypedParameterPtr *params, int *nparams, int *maxparams) @@ -2293,7 +2293,7 @@ qemuAgentGetUsers(qemuAgentPtr mon, if (!(cmd =3D qemuAgentMakeCommand("guest-get-users", NULL))) return -1; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) { + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) { if (qemuAgentErrorCommandUnsupported(reply)) return -2; return -1; @@ -2370,7 +2370,7 @@ qemuAgentGetUsers(qemuAgentPtr mon, * -1 otherwise */ int -qemuAgentGetOSInfo(qemuAgentPtr mon, +qemuAgentGetOSInfo(qemuAgentPtr agent, virTypedParameterPtr *params, int *nparams, int *maxparams) @@ -2382,7 +2382,7 @@ qemuAgentGetOSInfo(qemuAgentPtr mon, if (!(cmd =3D qemuAgentMakeCommand("guest-get-osinfo", NULL))) return -1; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) { + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) { if (qemuAgentErrorCommandUnsupported(reply)) return -2; return -1; @@ -2423,7 +2423,7 @@ qemuAgentGetOSInfo(qemuAgentPtr mon, * -1 otherwise */ int -qemuAgentGetTimezone(qemuAgentPtr mon, +qemuAgentGetTimezone(qemuAgentPtr agent, virTypedParameterPtr *params, int *nparams, int *maxparams) @@ -2437,7 +2437,7 @@ qemuAgentGetTimezone(qemuAgentPtr mon, if (!(cmd =3D qemuAgentMakeCommand("guest-get-timezone", NULL))) return -1; =20 - if (qemuAgentCommand(mon, cmd, &reply, true, mon->timeout) < 0) { + if (qemuAgentCommand(agent, cmd, &reply, true, agent->timeout) < 0) { if (qemuAgentErrorCommandUnsupported(reply)) return -2; return -1; @@ -2468,14 +2468,14 @@ qemuAgentGetTimezone(qemuAgentPtr mon, } =20 /* qemuAgentSetResponseTimeout: - * mon: agent monitor - * timeout: number of seconds to wait for agent response + * @agent: agent object + * @timeout: number of seconds to wait for agent response * * The agent object must be locked prior to calling this function. */ void -qemuAgentSetResponseTimeout(qemuAgentPtr mon, +qemuAgentSetResponseTimeout(qemuAgentPtr agent, int timeout) { - mon->timeout =3D timeout; + agent->timeout =3D timeout; } --=20 2.24.1