From nobody Tue Feb 10 16:22:14 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=1674252318; cv=none; d=zohomail.com; s=zohoarc; b=C46W8/2k9F8Iwm/ojwv1r43QZjtKjdAvmW1OB8ArYLnlDzhZZ+yKcz7V8s6QN0C+pJZ3cWTGpNT98718lb3RAQSzQ6EzSlR+1CGgF0NS5e7F9P7329uBHaAYTOvGMXYdGPLSCOzHXAfov71BNKyKxd9108jvg6p67TQm+wWffeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674252318; 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=OboLTqXKZoat/aWlqwDRbPt2HJVRMYTvlUTN0JLR/w4=; b=R6WgcYAm77PqumzCoqrNA0QIgw6fdgkQZr9SF7SCugCTlqP2tGhJE/+Dl3f9t8jezoin/1GOXoxTmzhRy7f0f8vNXJ5hCOqqel69hcqSX3/FdhMfqGlKmYDetop/txb6vzOTlxFy7AcVJ9NryfKzyTlpXAr9ULWp/lptYAbYUP0= 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 1674252318603343.2094724805212; Fri, 20 Jan 2023 14:05:18 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-619-HmCU1_4SPzOEGJtFxlnHDQ-1; Fri, 20 Jan 2023 17:03:56 -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 7F7C0299E753; Fri, 20 Jan 2023 22:03:40 +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 68F202026D68; Fri, 20 Jan 2023 22:03:40 +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 58D6F1947040; Fri, 20 Jan 2023 22:03:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BFC9A1946588 for ; Fri, 20 Jan 2023 22:03:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B4357140EBF6; Fri, 20 Jan 2023 22:03:30 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.18.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A15914171C1; Fri, 20 Jan 2023 22:03:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674252314; 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=OboLTqXKZoat/aWlqwDRbPt2HJVRMYTvlUTN0JLR/w4=; b=El+q8x3roWHFScxGi1Hxcw/Nnx3rdN1UVJwRgSfCKH/w1QY+xkvw2Ln8O2NNUs0tjNaMaw DZdFjvfAj/8Dd29RqcUIfZARqSV7Eqkb5NWrmizrDT+VktFHZUwEE5curHQPJFCMF8LRxP F22uW0CLA3G2/xyZv/YMpHmd4c9n6s8= X-MC-Unique: HmCU1_4SPzOEGJtFxlnHDQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v4 21/31] util: make virCommandSetSendBuffer testable Date: Fri, 20 Jan 2023 16:03:15 -0600 Message-Id: <20230120220325.1015090-22-jjongsma@redhat.com> In-Reply-To: <20230120220325.1015090-1-jjongsma@redhat.com> References: <20230120220325.1015090-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1674252320159100001 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 576ec8f95f..94a1fb6f33 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2086,6 +2086,7 @@ virCommandNewArgs; virCommandNewVAList; virCommandNonblockingFDs; virCommandPassFD; +virCommandPeekSendBuffers; virCommandRawStatus; virCommandRequireHandshake; virCommandRun; diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 0917bc9cfb..e81b29669a 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -77,14 +77,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 @@ -3452,3 +3444,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.0