From patchwork Thu Jun 23 16:53:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 12892992 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 3E9B7C433EF for ; Thu, 23 Jun 2022 17:13:29 +0000 (UTC) Received: from localhost ([::1]:37184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o4QOW-0005io-8X for qemu-devel@archiver.kernel.org; Thu, 23 Jun 2022 13:13:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4Q69-0006JY-T2 for qemu-devel@nongnu.org; Thu, 23 Jun 2022 12:54:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o4Q68-00060C-7p for qemu-devel@nongnu.org; Thu, 23 Jun 2022 12:54:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656003267; 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=4axUKHaIIzvzWlrJsA5rLvfS1C75sXnDRQj3DDCmvRE=; b=POItB1AqoWe8GjAVxgUNX0+eMF6PwKv6ME1QodeXOAy5ZD3YgGlb26Yl3r5AQiabeq0vYT 9WM8z0IZzF6Ist1cMQjIEjOu9dTOeEKiMHxo6KsCPx4NxVGXPvpOJ5aJov4Pa14f0O4CUn y/v8h4ZKZEfZVJZ1FXL99FtCvKgOqQk= 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-508-KI3AGW-CM5iKnc1rzMmE3A-1; Thu, 23 Jun 2022 12:54:24 -0400 X-MC-Unique: KI3AGW-CM5iKnc1rzMmE3A-1 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 5520B8117B0; Thu, 23 Jun 2022 16:54:24 +0000 (UTC) Received: from dgilbert-t580.localhost (unknown [10.33.36.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56B1C2026D64; Thu, 23 Jun 2022 16:54:23 +0000 (UTC) From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, berrange@redhat.com, huangy81@chinatelecom.cn, quintela@redhat.com, leobras@redhat.com, peterx@redhat.com Cc: jdenemar@redhat.com Subject: [PULL 20/25] migration: remove the QEMUFileOps 'set_blocking' callback Date: Thu, 23 Jun 2022 17:53:49 +0100 Message-Id: <20220623165354.197792-21-dgilbert@redhat.com> In-Reply-To: <20220623165354.197792-1-dgilbert@redhat.com> References: <20220623165354.197792-1-dgilbert@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Received-SPF: pass client-ip=170.10.133.124; envelope-from=dgilbert@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=ham 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" From: Daniel P. Berrangé This directly implements the set_blocking logic using QIOChannel APIs. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Signed-off-by: Dr. David Alan Gilbert --- migration/qemu-file-channel.c | 14 -------------- migration/qemu-file.c | 4 +--- migration/qemu-file.h | 5 ----- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c index 80f05dc371..0350d367ec 100644 --- a/migration/qemu-file-channel.c +++ b/migration/qemu-file-channel.c @@ -112,18 +112,6 @@ static int channel_close(void *opaque, Error **errp) } -static int channel_set_blocking(void *opaque, - bool enabled, - Error **errp) -{ - QIOChannel *ioc = QIO_CHANNEL(opaque); - - if (qio_channel_set_blocking(ioc, enabled, errp) < 0) { - return -1; - } - return 0; -} - static QEMUFile *channel_get_input_return_path(void *opaque) { QIOChannel *ioc = QIO_CHANNEL(opaque); @@ -141,7 +129,6 @@ static QEMUFile *channel_get_output_return_path(void *opaque) static const QEMUFileOps channel_input_ops = { .get_buffer = channel_get_buffer, .close = channel_close, - .set_blocking = channel_set_blocking, .get_return_path = channel_get_input_return_path, }; @@ -149,7 +136,6 @@ static const QEMUFileOps channel_input_ops = { static const QEMUFileOps channel_output_ops = { .writev_buffer = channel_writev_buffer, .close = channel_close, - .set_blocking = channel_set_blocking, .get_return_path = channel_get_output_return_path, }; diff --git a/migration/qemu-file.c b/migration/qemu-file.c index d71bcb6c9c..95d5db9dd6 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -879,9 +879,7 @@ void qemu_put_counted_string(QEMUFile *f, const char *str) */ void qemu_file_set_blocking(QEMUFile *f, bool block) { - if (f->ops->set_blocking) { - f->ops->set_blocking(f->ioc, block, NULL); - } + qio_channel_set_blocking(f->ioc, block, NULL); } /* diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 9fa92c1998..7793e765f2 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -46,10 +46,6 @@ typedef ssize_t (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, */ typedef int (QEMUFileCloseFunc)(void *opaque, Error **errp); -/* Called to change the blocking mode of the file - */ -typedef int (QEMUFileSetBlocking)(void *opaque, bool enabled, Error **errp); - /* * This function writes an iovec to file. The handler must write all * of the data or return a negative errno value. @@ -92,7 +88,6 @@ typedef QEMUFile *(QEMURetPathFunc)(void *opaque); typedef struct QEMUFileOps { QEMUFileGetBufferFunc *get_buffer; QEMUFileCloseFunc *close; - QEMUFileSetBlocking *set_blocking; QEMUFileWritevBufferFunc *writev_buffer; QEMURetPathFunc *get_return_path; } QEMUFileOps;