From nobody Tue Nov 18 10:35:59 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1609863477; cv=none; d=zohomail.com; s=zohoarc; b=NPHe7m2+WwVGr16b4xnh+9K/ePj9kFkakuLdNeRZRwcxGy7Lh+0QxgZKjDziFMQ/qEHgejCMX85R5C5aBwbTWb4wnafvzC/yEyLSLxzkDSfrYT1xRJXyd/gQF7U6Uu8WjLw7D1AkWvhtb8B8SBL+THE+rnI/C8DYPQFHy5i7O7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609863477; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Ng2Q+bNSRXq8vcQaGrGjVigIrSDiB3ewBIVgEsNqMgE=; b=gr/7RGwNSkuzH1MmFPFGKeHG0fAnuTIgpLxGZx66a5xs5VMLTHhqt/vRRRy4d+xwSi5Av+SXw6qzecQSF/sKiI/b03mZ4Glunf5rg+bG7vDae6eQTaFKWIwIInbg8gp7NkAvvcfG4DKAOOfmw1wFVu0fmYYUbM31Ymb5UlLP8W4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1609863477614441.9963000649569; Tue, 5 Jan 2021 08:17:57 -0800 (PST) Received: from localhost ([::1]:35608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwp1w-0000OQ-Ao for importer@patchew.org; Tue, 05 Jan 2021 11:17:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwoti-00049U-5A for qemu-devel@nongnu.org; Tue, 05 Jan 2021 11:09:26 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:50894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwotg-00049s-Bi for qemu-devel@nongnu.org; Tue, 05 Jan 2021 11:09:25 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 105FtfdH138063; Tue, 5 Jan 2021 16:09:20 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 35tg8r1h0p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 05 Jan 2021 16:09:20 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 105FuNl9029067; Tue, 5 Jan 2021 16:09:20 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 35uxnsvbav-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Jan 2021 16:09:19 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 105G9IGH018472; Tue, 5 Jan 2021 16:09:18 GMT Received: from ca-dev63.us.oracle.com (/10.211.8.221) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Jan 2021 08:09:18 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2020-01-29; bh=Ng2Q+bNSRXq8vcQaGrGjVigIrSDiB3ewBIVgEsNqMgE=; b=NrLlL/axGYLVfdJ3h1tw/BlKGuehI4aZWsXc4vNX/aanOA7tDX15u6lC5W9kiv+EXiWh FgB9/scnSbbLHVbV84+QHeVgsFnRFmLXhsx3yl65RSzCkG5/SI6KMNdgZkxh3nw8+XQm aaW4gIw1nFcPfiFqcm9xNyG+v9tjLA4m7KEx3BBNaCiF41YHoXuWuS9xsfKy7dLsq3l2 o3xnk2yeRRyp+Vr25QBlg3nQhsd25HJaXWXJXh72j33yZYUKZstSw9q/tHe4FXF5jee1 U8b4PQOycMm9+kJa2losIDjgu4ksUCCf8l4UqkQqkAhw53SUO5/uVRCx7R5pn7dLaKnt qQ== From: Steve Sistare To: qemu-devel@nongnu.org Subject: [PATCH V2 22/22] simplify savevm Date: Tue, 5 Jan 2021 07:42:10 -0800 Message-Id: <1609861330-129855-23-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1609861330-129855-1-git-send-email-steven.sistare@oracle.com> References: <1609861330-129855-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050099 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 phishscore=0 bulkscore=0 spamscore=0 impostorscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050099 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=156.151.31.86; envelope-from=steven.sistare@oracle.com; helo=userp2130.oracle.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.252, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Daniel P. Berrange" , "Michael S. Tsirkin" , Jason Zeng , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Juan Quintela , "Dr. David Alan Gilbert" , Markus Armbruster , Alex Williamson , Steve Sistare , Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use qf_file_open to simplify a few functions in savevm.c. No functional change. Signed-off-by: Steve Sistare --- migration/savevm.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index a843d20..994ad1a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2788,8 +2788,8 @@ int save_snapshot(const char *name, Error **errp) void qmp_xen_save_devices_state(const char *filename, bool has_live, bool = live, Error **errp) { + const char *ioc_name =3D "migration-xen-save-state"; QEMUFile *f; - QIOChannelFile *ioc; int saved_vm_running; int ret; =20 @@ -2803,13 +2803,10 @@ void qmp_xen_save_devices_state(const char *filenam= e, bool has_live, bool live, vm_stop(RUN_STATE_SAVE_VM); global_state_store_running(); =20 - ioc =3D qio_channel_file_new_path(filename, O_WRONLY | O_CREAT, 0660, = errp); - if (!ioc) { + f =3D qf_file_open(filename, O_WRONLY | O_CREAT, 0660, ioc_name, errp); + if (!f) { goto the_end; } - qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-save-state"); - f =3D qemu_fopen_channel_output(QIO_CHANNEL(ioc)); - object_unref(OBJECT(ioc)); ret =3D qemu_save_device_state(f); if (ret < 0 || qemu_fclose(f) < 0) { error_setg(errp, QERR_IO_ERROR); @@ -2837,8 +2834,8 @@ void qmp_xen_save_devices_state(const char *filename,= bool has_live, bool live, =20 void qmp_xen_load_devices_state(const char *filename, Error **errp) { + const char *ioc_name =3D "migration-xen-load-state"; QEMUFile *f; - QIOChannelFile *ioc; int ret; =20 /* Guest must be paused before loading the device state; the RAM state @@ -2850,14 +2847,10 @@ void qmp_xen_load_devices_state(const char *filenam= e, Error **errp) } vm_stop(RUN_STATE_RESTORE_VM); =20 - ioc =3D qio_channel_file_new_path(filename, O_RDONLY | O_BINARY, 0, er= rp); - if (!ioc) { + f =3D qf_file_open(filename, O_RDONLY | O_BINARY, 0, ioc_name, errp); + if (!f) { return; } - qio_channel_set_name(QIO_CHANNEL(ioc), "migration-xen-load-state"); - f =3D qemu_fopen_channel_input(QIO_CHANNEL(ioc)); - object_unref(OBJECT(ioc)); - ret =3D qemu_loadvm_state(f); qemu_fclose(f); if (ret < 0) { --=20 1.8.3.1