From patchwork Tue May 24 11:02:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 12860116 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A1EE2C433EF for ; Tue, 24 May 2022 11:51:57 +0000 (UTC) Received: from localhost ([::1]:51794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntT4u-00078h-Nb for qemu-devel@archiver.kernel.org; Tue, 24 May 2022 07:51:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntSKy-0006Ap-Or for qemu-devel@nongnu.org; Tue, 24 May 2022 07:04:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntSJt-0003aZ-NU for qemu-devel@nongnu.org; Tue, 24 May 2022 07:04:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653390192; h=from:from: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; bh=NAVSYPk4vrJH8E6jm6Z5xwmYGQH1/cDJ/WTrPGvpn9I=; b=cpVy0cAHDgVDoU9PVQc9mLVy0pwsBFlyDWa0KZSwJNNgNoqU010q4Pq4QYoRhedhqy9tnN Rzwvj5psCUqg6LjnBE357vzDzIFhtb6pBAZyHriCoq36WEyGTwv1LKB9N0wB4PXmDSkpcb aZ2tyLk3WAaZhDRFcW72MH+yX/fJsIM= 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-184-z4t7eKnCNwan_mKqarHstQ-1; Tue, 24 May 2022 07:03:11 -0400 X-MC-Unique: z4t7eKnCNwan_mKqarHstQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AC8823C1E321; Tue, 24 May 2022 11:03:10 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B2971121315; Tue, 24 May 2022 11:03:09 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , "Dr. David Alan Gilbert" , qemu-block@nongnu.org, Stefan Hajnoczi , Hailiang Zhang , Juan Quintela , Fam Zheng Subject: [PATCH 19/20] migration: remove the QEMUFileOps 'get_return_path' callback Date: Tue, 24 May 2022 12:02:34 +0100 Message-Id: <20220524110235.145079-20-berrange@redhat.com> In-Reply-To: <20220524110235.145079-1-berrange@redhat.com> References: <20220524110235.145079-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This directly implements the get_return_path logic using QIOChannel APIs. Signed-off-by: Daniel P. Berrangé Reviewed-by: Dr. David Alan Gilbert --- migration/qemu-file-channel.c | 16 ---------------- migration/qemu-file.c | 22 ++++++++++------------ migration/qemu-file.h | 6 ------ 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c index 2e139f7bcd..51717c1137 100644 --- a/migration/qemu-file-channel.c +++ b/migration/qemu-file-channel.c @@ -32,27 +32,11 @@ #include "yank_functions.h" -static QEMUFile *channel_get_input_return_path(void *opaque) -{ - QIOChannel *ioc = QIO_CHANNEL(opaque); - - return qemu_fopen_channel_output(ioc); -} - -static QEMUFile *channel_get_output_return_path(void *opaque) -{ - QIOChannel *ioc = QIO_CHANNEL(opaque); - - return qemu_fopen_channel_input(ioc); -} - static const QEMUFileOps channel_input_ops = { - .get_return_path = channel_get_input_return_path, }; static const QEMUFileOps channel_output_ops = { - .get_return_path = channel_get_output_return_path, }; diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 72a6f58af5..dfee808924 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -92,18 +92,6 @@ int qemu_file_shutdown(QEMUFile *f) return ret; } -/* - * Result: QEMUFile* for a 'return path' for comms in the opposite direction - * NULL if not available - */ -QEMUFile *qemu_file_get_return_path(QEMUFile *f) -{ - if (!f->ops->get_return_path) { - return NULL; - } - return f->ops->get_return_path(f->ioc); -} - bool qemu_file_mode_is_not_valid(const char *mode) { if (mode == NULL || @@ -131,6 +119,16 @@ static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, return f; } +/* + * Result: QEMUFile* for a 'return path' for comms in the opposite direction + * NULL if not available + */ +QEMUFile *qemu_file_get_return_path(QEMUFile *f) +{ + object_ref(f->ioc); + return qemu_file_new_impl(f->ioc, f->ops, !f->is_writable); +} + QEMUFile *qemu_file_new_output(QIOChannel *ioc, const QEMUFileOps *ops) { return qemu_file_new_impl(ioc, ops, true); diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 542c637934..5370e4e5ec 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -55,13 +55,7 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, size_t size, uint64_t *bytes_sent); -/* - * Return a QEMUFile for comms in the opposite direction - */ -typedef QEMUFile *(QEMURetPathFunc)(void *opaque); - typedef struct QEMUFileOps { - QEMURetPathFunc *get_return_path; } QEMUFileOps; typedef struct QEMUFileHooks {