From nobody Wed Feb 11 06:14:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1676394616; cv=none; d=zohomail.com; s=zohoarc; b=CeyFFhaVXJPwR85Hs74z8H5X5vScf4F0aGMlBEsqFUtmsUOIYk1gGGcj7aCKdhzttnaURIxJQXMMHYrF73cCzsDBx3XWxmp04WaLMliJVPvvFjXTN44TTwwd7+YLgGRRJ43CHb0jLkYbVj0pYoKR8C7E8fJjNbsSqyYRIa00LHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676394616; h=Content-Type:Content-Transfer-Encoding:Cc: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=NWH/qsqhH5SAfIO+S3S4weXVABsgcfecSZqW3EEAVTY=; b=bX7/OmZy41m/U8MEAr/DLvAISbyOt0VhDAS4ijMI7mfka25PzoOEzQO966UCdu1Ebsg00l47KzKQt2iAuwf+7OMLmjog5pYTG5LEsUvzrDfZ4qFUN7ZVu8FzKamct9VsbsJlCwJMYPUXlms88WtKPDs0M4kxI04IIG9apsRjK7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1676394616449314.7979238303982; Tue, 14 Feb 2023 09:10:16 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-645-4LaCKaO1MZyDw7WhNgxgqw-1; Tue, 14 Feb 2023 12:09:21 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 65C461871DBB; Tue, 14 Feb 2023 17:09:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52AB92026D4B; Tue, 14 Feb 2023 17:09:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 74398194E00A; Tue, 14 Feb 2023 17:08:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 49D7919465B8 for ; Tue, 14 Feb 2023 17:08:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0D2D844101; Tue, 14 Feb 2023 17:08:26 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.8.15]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5841440D7; Tue, 14 Feb 2023 17:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676394615; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=NWH/qsqhH5SAfIO+S3S4weXVABsgcfecSZqW3EEAVTY=; b=Gc/L2mVm6eVOrYLwQtRi4/17feKi7WxIpU6F2Pq1EcRx0GMzbM2LYdWVgYXB15M2+hEkY6 N2r6cQhRlBmldw7+s4jJfo1Syn1O4mExx9TKOAa6rI5EZ0QBk5MQmKJgXoFWoiS0BUlou/ CRYA3cKpuDQQWNyyPeSKotNXigmHago= X-MC-Unique: 4LaCKaO1MZyDw7WhNgxgqw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v5 22/32] util: make virCommandSetSendBuffer testable Date: Tue, 14 Feb 2023 11:08:09 -0600 Message-Id: <20230214170819.3143132-23-jjongsma@redhat.com> In-Reply-To: <20230214170819.3143132-1-jjongsma@redhat.com> References: <20230214170819.3143132-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Krempa Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676394616974100013 Content-Type: text/plain; charset="utf-8"; x-default="true" Add a private function to peek at the list of send buffers in virCommand so that it is testable Signed-off-by: Jonathon Jongsma Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 1 + src/util/vircommand.c | 17 +++++++++-------- src/util/vircommand.h | 8 ++++++++ src/util/vircommandpriv.h | 4 ++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 97c3d86217..b73449fcad 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2097,6 +2097,7 @@ virCommandNewArgs; virCommandNewVAList; virCommandNonblockingFDs; virCommandPassFD; +virCommandPeekSendBuffers; virCommandRawStatus; virCommandRequireHandshake; virCommandRun; diff --git a/src/util/vircommand.c b/src/util/vircommand.c index aef63efb26..1ef1411436 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -78,14 +78,6 @@ struct _virCommandFD { unsigned int flags; }; =20 -typedef struct _virCommandSendBuffer virCommandSendBuffer; -struct _virCommandSendBuffer { - int fd; - unsigned char *buffer; - size_t buflen; - off_t offset; -}; - struct _virCommand { int has_error; /* 0 on success, -1 on error */ =20 @@ -3454,3 +3446,12 @@ virCommandSetRunAmong(virCommand *cmd, =20 cmd->schedCore =3D pid; } + +void +virCommandPeekSendBuffers(virCommand *cmd, + virCommandSendBuffer **buffers, + int *nbuffers) +{ + *buffers =3D cmd->sendBuffers; + *nbuffers =3D cmd->numSendBuffers; +} diff --git a/src/util/vircommand.h b/src/util/vircommand.h index e0002103b6..0f14d14e49 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -24,6 +24,14 @@ #include "internal.h" #include "virbuffer.h" =20 +typedef struct _virCommandSendBuffer virCommandSendBuffer; +struct _virCommandSendBuffer { + int fd; + unsigned char *buffer; + size_t buflen; + off_t offset; +}; + typedef struct _virCommand virCommand; =20 /* This will execute in the context of the first child diff --git a/src/util/vircommandpriv.h b/src/util/vircommandpriv.h index ff17fa5ded..d579810bb5 100644 --- a/src/util/vircommandpriv.h +++ b/src/util/vircommandpriv.h @@ -47,3 +47,7 @@ void virCommandSetDryRun(virCommandDryRunToken *tok, bool bufCommandStripPath, virCommandDryRunCallback cb, void *opaque); + +void virCommandPeekSendBuffers(virCommand *cmd, + virCommandSendBuffer **buffers, + int *nbuffers); --=20 2.39.1