From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036180762173.80986697108108; Wed, 17 May 2017 08:49:40 -0700 (PDT) Received: from localhost ([::1]:49614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1Ck-0000wn-WE for importer@patchew.org; Wed, 17 May 2017 11:49:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BI-0008VW-H0 for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BF-0000iq-Np for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BF-0000ic-Ex for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61DDA19CBE9 for ; Wed, 17 May 2017 15:48:04 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E31B77D68; Wed, 17 May 2017 15:48:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 61DDA19CBE9 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 61DDA19CBE9 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:48 +0200 Message-Id: <20170517154756.22079-2-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 17 May 2017 15:48:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/9] migration: Create migration/xbzrle.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- include/migration/migration.h | 4 ---- migration/ram.c | 1 + migration/xbzrle.c | 2 +- migration/xbzrle.h | 21 +++++++++++++++++++++ tests/test-xbzrle.c | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 migration/xbzrle.h diff --git a/include/migration/migration.h b/include/migration/migration.h index b80a6ed..7d1eef7 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -251,10 +251,6 @@ bool migrate_zero_blocks(void); =20 bool migrate_auto_converge(void); =20 -int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen, - uint8_t *dst, int dlen); -int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen); - int migrate_use_xbzrle(void); int64_t migrate_xbzrle_cache_size(void); bool migrate_colo_enabled(void); diff --git a/migration/ram.c b/migration/ram.c index 76c118c..2564c00 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -35,6 +35,7 @@ #include "qemu/bitmap.h" #include "qemu/timer.h" #include "qemu/main-loop.h" +#include "xbzrle.h" #include "migration/migration.h" #include "postcopy-ram.h" #include "exec/address-spaces.h" diff --git a/migration/xbzrle.c b/migration/xbzrle.c index c858339..1ba482d 100644 --- a/migration/xbzrle.c +++ b/migration/xbzrle.c @@ -12,7 +12,7 @@ */ #include "qemu/osdep.h" #include "qemu/cutils.h" -#include "include/migration/migration.h" +#include "xbzrle.h" =20 /* page =3D zrun nzrun diff --git a/migration/xbzrle.h b/migration/xbzrle.h new file mode 100644 index 0000000..a0db507 --- /dev/null +++ b/migration/xbzrle.h @@ -0,0 +1,21 @@ +/* + * QEMU live migration + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef QEMU_MIGRATION_XBZRLE_H +#define QEMU_MIGRATION_XBZRLE_H + +int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen, + uint8_t *dst, int dlen); + +int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen); +#endif diff --git a/tests/test-xbzrle.c b/tests/test-xbzrle.c index 49f6419..f5e08de 100644 --- a/tests/test-xbzrle.c +++ b/tests/test-xbzrle.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/cutils.h" -#include "include/migration/migration.h" +#include "../migration/xbzrle.h" =20 #define PAGE_SIZE 4096 =20 --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036316712268.358979512082; Wed, 17 May 2017 08:51:56 -0700 (PDT) Received: from localhost ([::1]:49630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1Ew-0002ac-A9 for importer@patchew.org; Wed, 17 May 2017 11:51:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42698) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BJ-0008Vg-P2 for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BI-0000k2-Ba for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32986) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BI-0000jO-35 for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 106C13F1E5 for ; Wed, 17 May 2017 15:48:07 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2B0317A7B; Wed, 17 May 2017 15:48:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 106C13F1E5 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 106C13F1E5 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:49 +0200 Message-Id: <20170517154756.22079-3-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 17 May 2017 15:48:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/9] migration: Split migration/channel.c for channel operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Create an include for its exported functions. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- include/migration/migration.h | 7 ----- migration/Makefile.objs | 2 +- migration/channel.c | 69 +++++++++++++++++++++++++++++++++++++++= ++++ migration/channel.h | 25 ++++++++++++++++ migration/exec.c | 1 + migration/fd.c | 1 + migration/migration.c | 50 ------------------------------- migration/socket.c | 1 + migration/tls.c | 1 + 9 files changed, 99 insertions(+), 58 deletions(-) create mode 100644 migration/channel.c create mode 100644 migration/channel.h diff --git a/include/migration/migration.h b/include/migration/migration.h index 7d1eef7..e831259 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -157,17 +157,10 @@ void migration_fd_process_incoming(QEMUFile *f); =20 void qemu_start_incoming_migration(const char *uri, Error **errp); =20 -void migration_channel_process_incoming(MigrationState *s, - QIOChannel *ioc); - void migration_tls_channel_process_incoming(MigrationState *s, QIOChannel *ioc, Error **errp); =20 -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - const char *hostname); - void migration_tls_channel_connect(MigrationState *s, QIOChannel *ioc, const char *hostname, diff --git a/migration/Makefile.objs b/migration/Makefile.objs index 00a3f4a..4e8ab0a 100644 --- a/migration/Makefile.objs +++ b/migration/Makefile.objs @@ -1,5 +1,5 @@ common-obj-y +=3D migration.o socket.o fd.o exec.o -common-obj-y +=3D tls.o +common-obj-y +=3D tls.o channel.o common-obj-y +=3D colo-comm.o colo.o colo-failover.o common-obj-y +=3D vmstate.o page_cache.o common-obj-y +=3D qemu-file.o diff --git a/migration/channel.c b/migration/channel.c new file mode 100644 index 0000000..6104de5 --- /dev/null +++ b/migration/channel.c @@ -0,0 +1,69 @@ +/* + * QEMU live migration + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" +#include "channel.h" +#include "migration/migration.h" +#include "trace.h" +#include "qapi/error.h" +#include "io/channel-tls.h" + +void migration_channel_process_incoming(MigrationState *s, + QIOChannel *ioc) +{ + trace_migration_set_incoming_channel( + ioc, object_get_typename(OBJECT(ioc))); + + if (s->parameters.tls_creds && + *s->parameters.tls_creds && + !object_dynamic_cast(OBJECT(ioc), + TYPE_QIO_CHANNEL_TLS)) { + Error *local_err =3D NULL; + migration_tls_channel_process_incoming(s, ioc, &local_err); + if (local_err) { + error_report_err(local_err); + } + } else { + QEMUFile *f =3D qemu_fopen_channel_input(ioc); + migration_fd_process_incoming(f); + } +} + + +void migration_channel_connect(MigrationState *s, + QIOChannel *ioc, + const char *hostname) +{ + trace_migration_set_outgoing_channel( + ioc, object_get_typename(OBJECT(ioc)), hostname); + + if (s->parameters.tls_creds && + *s->parameters.tls_creds && + !object_dynamic_cast(OBJECT(ioc), + TYPE_QIO_CHANNEL_TLS)) { + Error *local_err =3D NULL; + migration_tls_channel_connect(s, ioc, hostname, &local_err); + if (local_err) { + migrate_fd_error(s, local_err); + error_free(local_err); + } + } else { + QEMUFile *f =3D qemu_fopen_channel_output(ioc); + + s->to_dst_file =3D f; + + migrate_fd_connect(s); + } +} diff --git a/migration/channel.h b/migration/channel.h new file mode 100644 index 0000000..618acb7 --- /dev/null +++ b/migration/channel.h @@ -0,0 +1,25 @@ +/* + * QEMU live migration channel functions + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef QEMU_MIGRATION_CHANNEL_H +#define QEMU_MIGRATION_CHANNEL_H + +#include "io/channel.h" + +void migration_channel_process_incoming(MigrationState *s, + QIOChannel *ioc); + +void migration_channel_connect(MigrationState *s, + QIOChannel *ioc, + const char *hostname); +#endif diff --git a/migration/exec.c b/migration/exec.c index aba9089..57a9335 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "channel.h" #include "migration/migration.h" #include "io/channel-command.h" #include "trace.h" diff --git a/migration/fd.c b/migration/fd.c index 58cb51a..05e0a5c 100644 --- a/migration/fd.c +++ b/migration/fd.c @@ -17,6 +17,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu-common.h" +#include "channel.h" #include "migration/migration.h" #include "monitor/monitor.h" #include "io/channel-util.h" diff --git a/migration/migration.c b/migration/migration.c index d5ebcd2..3ba32eb 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -444,56 +444,6 @@ void migration_fd_process_incoming(QEMUFile *f) qemu_coroutine_enter(co); } =20 - -void migration_channel_process_incoming(MigrationState *s, - QIOChannel *ioc) -{ - trace_migration_set_incoming_channel( - ioc, object_get_typename(OBJECT(ioc))); - - if (s->parameters.tls_creds && - *s->parameters.tls_creds && - !object_dynamic_cast(OBJECT(ioc), - TYPE_QIO_CHANNEL_TLS)) { - Error *local_err =3D NULL; - migration_tls_channel_process_incoming(s, ioc, &local_err); - if (local_err) { - error_report_err(local_err); - } - } else { - QEMUFile *f =3D qemu_fopen_channel_input(ioc); - migration_fd_process_incoming(f); - } -} - - -void migration_channel_connect(MigrationState *s, - QIOChannel *ioc, - const char *hostname) -{ - trace_migration_set_outgoing_channel( - ioc, object_get_typename(OBJECT(ioc)), hostname); - - if (s->parameters.tls_creds && - *s->parameters.tls_creds && - !object_dynamic_cast(OBJECT(ioc), - TYPE_QIO_CHANNEL_TLS)) { - Error *local_err =3D NULL; - migration_tls_channel_connect(s, ioc, hostname, &local_err); - if (local_err) { - migrate_fd_error(s, local_err); - error_free(local_err); - } - } else { - QEMUFile *f =3D qemu_fopen_channel_output(ioc); - - s->to_dst_file =3D f; - - migrate_fd_connect(s); - } -} - - /* * Send a message on the return channel back to the source * of the migration. diff --git a/migration/socket.c b/migration/socket.c index 1cfbe81..53f9d61 100644 --- a/migration/socket.c +++ b/migration/socket.c @@ -19,6 +19,7 @@ #include "qemu-common.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "channel.h" #include "migration/migration.h" #include "migration/qemu-file.h" #include "io/channel-socket.h" diff --git a/migration/tls.c b/migration/tls.c index a33ecb7..34ad121 100644 --- a/migration/tls.c +++ b/migration/tls.c @@ -19,6 +19,7 @@ */ =20 #include "qemu/osdep.h" +#include "channel.h" #include "migration/migration.h" #include "io/channel-tls.h" #include "crypto/tlscreds.h" --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036188999143.77522410509732; Wed, 17 May 2017 08:49:48 -0700 (PDT) Received: from localhost ([::1]:49616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1Cr-00011h-JI for importer@patchew.org; Wed, 17 May 2017 11:49:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BN-00005x-1I for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BL-0000la-RD for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48842) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BL-0000lM-Ie for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 847B9C05FFC8 for ; Wed, 17 May 2017 15:48:10 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61D2D17A7B; Wed, 17 May 2017 15:48:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 847B9C05FFC8 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 847B9C05FFC8 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:50 +0200 Message-Id: <20170517154756.22079-4-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 17 May 2017 15:48:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- include/migration/migration.h | 1 + include/migration/qemu-file.h | 4 ---- migration/channel.c | 1 + migration/colo.c | 1 + migration/migration.c | 1 + migration/qemu-file-channel.c | 1 + migration/qemu-file-channel.h | 21 +++++++++++++++++++++ migration/rdma.c | 1 + migration/savevm.c | 1 + tests/test-vmstate.c | 1 + 10 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 migration/qemu-file-channel.h diff --git a/include/migration/migration.h b/include/migration/migration.h index e831259..8280df1 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -19,6 +19,7 @@ #include "qemu/thread.h" #include "qemu/notify.h" #include "migration/vmstate.h" +#include "io/channel.h" #include "qapi-types.h" #include "exec/cpu-common.h" #include "qemu/coroutine_int.h" diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index 0cd648a..b5ac800 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -27,8 +27,6 @@ =20 #include "qemu-common.h" #include "exec/cpu-common.h" -#include "io/channel.h" - =20 /* Read a chunk of data from a file at the given position. The pos argume= nt * can be ignored if the file is only be used for streaming. The number of @@ -119,8 +117,6 @@ typedef struct QEMUFileHooks { } QEMUFileHooks; =20 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops); -QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc); -QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc); void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks); int qemu_get_fd(QEMUFile *f); int qemu_fclose(QEMUFile *f); diff --git a/migration/channel.c b/migration/channel.c index 6104de5..fed8563 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -16,6 +16,7 @@ #include "qemu/osdep.h" #include "channel.h" #include "migration/migration.h" +#include "qemu-file-channel.h" #include "trace.h" #include "qapi/error.h" #include "io/channel-tls.h" diff --git a/migration/colo.c b/migration/colo.c index dd38fed..9cd0250 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -13,6 +13,7 @@ #include "qemu/osdep.h" #include "qemu/timer.h" #include "sysemu/sysemu.h" +#include "qemu-file-channel.h" #include "migration/colo.h" #include "migration/block.h" #include "io/channel-buffer.h" diff --git a/migration/migration.c b/migration/migration.c index 3ba32eb..ff3f7aa 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -19,6 +19,7 @@ #include "qemu/main-loop.h" #include "migration/blocker.h" #include "migration/migration.h" +#include "qemu-file-channel.h" #include "migration/qemu-file.h" #include "sysemu/sysemu.h" #include "block/block.h" diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c index 45c13f1..dc991c9 100644 --- a/migration/qemu-file-channel.c +++ b/migration/qemu-file-channel.c @@ -23,6 +23,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu-file-channel.h" #include "migration/qemu-file.h" #include "io/channel-socket.h" #include "qemu/iov.h" diff --git a/migration/qemu-file-channel.h b/migration/qemu-file-channel.h new file mode 100644 index 0000000..d1bd5ff --- /dev/null +++ b/migration/qemu-file-channel.h @@ -0,0 +1,21 @@ +/* + * QEMU migration file channel operations + * + * Copyright IBM, Corp. 2008 + * + * Authors: + * Anthony Liguori + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + */ + +#ifndef QEMU_FILE_CHANNEL_H +#define QEMU_FILE_CHANNEL_H + +#include "io/channel.h" + +QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc); +QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc); +#endif diff --git a/migration/rdma.c b/migration/rdma.c index 7eaaf96..166cd60 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -20,6 +20,7 @@ #include "migration/migration.h" #include "migration/qemu-file.h" #include "exec/cpu-common.h" +#include "qemu-file-channel.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" #include "qemu/sockets.h" diff --git a/migration/savevm.c b/migration/savevm.c index a728414..8565103 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -36,6 +36,7 @@ #include "sysemu/sysemu.h" #include "qemu/timer.h" #include "migration/migration.h" +#include "qemu-file-channel.h" #include "postcopy-ram.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index f694a89..1c13570 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -27,6 +27,7 @@ #include "qemu-common.h" #include "migration/migration.h" #include "migration/vmstate.h" +#include "../migration/qemu-file-channel.h" #include "qemu/coroutine.h" #include "io/channel-file.h" =20 --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036428178180.4217172073869; Wed, 17 May 2017 08:53:48 -0700 (PDT) Received: from localhost ([::1]:49645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1Gj-00048H-Qb for importer@patchew.org; Wed, 17 May 2017 11:53:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BO-00006s-La for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BN-0000mA-Rf for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41516) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BN-0000ls-Ky for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92331804F7 for ; Wed, 17 May 2017 15:48:12 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D587817A7B; Wed, 17 May 2017 15:48:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 92331804F7 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 92331804F7 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:51 +0200 Message-Id: <20170517154756.22079-5-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 17 May 2017 15:48:12 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 4/9] migration: Remove migration.h from colo.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" migration.h is not included in any includes now. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- include/migration/colo.h | 1 - migration/colo-comm.c | 3 ++- migration/colo.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/migration/colo.h b/include/migration/colo.h index 2bbff9e..ba0bb6e 100644 --- a/include/migration/colo.h +++ b/include/migration/colo.h @@ -14,7 +14,6 @@ #define QEMU_COLO_H =20 #include "qemu-common.h" -#include "migration/migration.h" #include "qemu/coroutine_int.h" #include "qemu/thread.h" #include "qemu/main-loop.h" diff --git a/migration/colo-comm.c b/migration/colo-comm.c index 20b60ec..3d91798 100644 --- a/migration/colo-comm.c +++ b/migration/colo-comm.c @@ -12,7 +12,8 @@ */ =20 #include "qemu/osdep.h" -#include +#include "migration/migration.h" +#include "migration/colo.h" #include "trace.h" =20 typedef struct { diff --git a/migration/colo.c b/migration/colo.c index 9cd0250..73ebd64 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -14,6 +14,7 @@ #include "qemu/timer.h" #include "sysemu/sysemu.h" #include "qemu-file-channel.h" +#include "migration/migration.h" #include "migration/colo.h" #include "migration/block.h" #include "io/channel-buffer.h" --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036525253841.2178068679821; Wed, 17 May 2017 08:55:25 -0700 (PDT) Received: from localhost ([::1]:49656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1II-0005Fo-Ss for importer@patchew.org; Wed, 17 May 2017 11:55:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BT-0000B4-Oa for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BP-0000n7-NI for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46628) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BP-0000ms-Hi for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D7B17F6B3 for ; Wed, 17 May 2017 15:48:14 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5EB877D68; Wed, 17 May 2017 15:48:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7D7B17F6B3 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7D7B17F6B3 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:52 +0200 Message-Id: <20170517154756.22079-6-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 17 May 2017 15:48:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 5/9] migration: Move qjson.h to migration/ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is only used for migration code. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- migration/qjson.c | 2 +- {include/migration =3D> migration}/qjson.h | 0 migration/vmstate.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {include/migration =3D> migration}/qjson.h (100%) diff --git a/migration/qjson.c b/migration/qjson.c index f345904..9d7f6eb 100644 --- a/migration/qjson.c +++ b/migration/qjson.c @@ -25,7 +25,7 @@ =20 #include "qemu/osdep.h" #include "qapi/qmp/qstring.h" -#include "migration/qjson.h" +#include "qjson.h" =20 struct QJSON { QString *str; diff --git a/include/migration/qjson.h b/migration/qjson.h similarity index 100% rename from include/migration/qjson.h rename to migration/qjson.h diff --git a/migration/vmstate.c b/migration/vmstate.c index 7b4a607..66c50ee 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -7,7 +7,7 @@ #include "qemu/error-report.h" #include "qemu/queue.h" #include "trace.h" -#include "migration/qjson.h" +#include "qjson.h" =20 static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription = *vmsd, void *opaque, QJSON *vmdesc); --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036622305464.71934744738405; Wed, 17 May 2017 08:57:02 -0700 (PDT) Received: from localhost ([::1]:49663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1Jr-0006Rs-QA for importer@patchew.org; Wed, 17 May 2017 11:56:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BV-0000DL-SI for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BS-0000od-0G for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48994) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BR-0000nR-JN for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84385C05FFC2 for ; Wed, 17 May 2017 15:48:16 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0BF57E2FC; Wed, 17 May 2017 15:48:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 84385C05FFC2 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 84385C05FFC2 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:53 +0200 Message-Id: <20170517154756.22079-7-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 17 May 2017 15:48:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 6/9] migration: Split vmstate-types.c from vmstate.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now one just has the interperter, and the other has the basic types. Once there, add copyright boilerplate. Signed-off-by: Juan Quintela -- Use GPL v2 or later. Detected by David. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/Makefile.objs | 2 +- migration/vmstate-types.c | 661 ++++++++++++++++++++++++++++++++++++++++++= ++++ migration/vmstate.c | 654 +-----------------------------------------= --- tests/Makefile.include | 2 +- 4 files changed, 675 insertions(+), 644 deletions(-) create mode 100644 migration/vmstate-types.c diff --git a/migration/Makefile.objs b/migration/Makefile.objs index 4e8ab0a..3272415 100644 --- a/migration/Makefile.objs +++ b/migration/Makefile.objs @@ -1,7 +1,7 @@ common-obj-y +=3D migration.o socket.o fd.o exec.o common-obj-y +=3D tls.o channel.o common-obj-y +=3D colo-comm.o colo.o colo-failover.o -common-obj-y +=3D vmstate.o page_cache.o +common-obj-y +=3D vmstate.o vmstate-types.o page_cache.o common-obj-y +=3D qemu-file.o common-obj-y +=3D qemu-file-channel.o common-obj-y +=3D xbzrle.o postcopy-ram.o diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c new file mode 100644 index 0000000..cc95e47 --- /dev/null +++ b/migration/vmstate-types.c @@ -0,0 +1,661 @@ +/* + * VMStateInfo's for basic typse + * + * Copyright (c) 2009-2017 Red Hat Inc + * + * Authors: + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "migration/migration.h" +#include "migration/qemu-file.h" +#include "migration/vmstate.h" +#include "qemu/error-report.h" +#include "qemu/queue.h" +#include "trace.h" + +/* bool */ + +static int get_bool(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d) +{ + bool *v =3D pv; + *v =3D qemu_get_byte(f); + return 0; +} + +static int put_bool(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d, + QJSON *vmdesc) +{ + bool *v =3D pv; + qemu_put_byte(f, *v); + return 0; +} + +const VMStateInfo vmstate_info_bool =3D { + .name =3D "bool", + .get =3D get_bool, + .put =3D put_bool, +}; + +/* 8 bit int */ + +static int get_int8(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d) +{ + int8_t *v =3D pv; + qemu_get_s8s(f, v); + return 0; +} + +static int put_int8(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d, + QJSON *vmdesc) +{ + int8_t *v =3D pv; + qemu_put_s8s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_int8 =3D { + .name =3D "int8", + .get =3D get_int8, + .put =3D put_int8, +}; + +/* 16 bit int */ + +static int get_int16(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) +{ + int16_t *v =3D pv; + qemu_get_sbe16s(f, v); + return 0; +} + +static int put_int16(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, + QJSON *vmdesc) +{ + int16_t *v =3D pv; + qemu_put_sbe16s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_int16 =3D { + .name =3D "int16", + .get =3D get_int16, + .put =3D put_int16, +}; + +/* 32 bit int */ + +static int get_int32(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) +{ + int32_t *v =3D pv; + qemu_get_sbe32s(f, v); + return 0; +} + +static int put_int32(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, + QJSON *vmdesc) +{ + int32_t *v =3D pv; + qemu_put_sbe32s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_int32 =3D { + .name =3D "int32", + .get =3D get_int32, + .put =3D put_int32, +}; + +/* 32 bit int. See that the received value is the same than the one + in the field */ + +static int get_int32_equal(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + int32_t *v =3D pv; + int32_t v2; + qemu_get_sbe32s(f, &v2); + + if (*v =3D=3D v2) { + return 0; + } + error_report("%" PRIx32 " !=3D %" PRIx32, *v, v2); + return -EINVAL; +} + +const VMStateInfo vmstate_info_int32_equal =3D { + .name =3D "int32 equal", + .get =3D get_int32_equal, + .put =3D put_int32, +}; + +/* 32 bit int. Check that the received value is non-negative + * and less than or equal to the one in the field. + */ + +static int get_int32_le(QEMUFile *f, void *pv, size_t size, VMStateField *= field) +{ + int32_t *cur =3D pv; + int32_t loaded; + qemu_get_sbe32s(f, &loaded); + + if (loaded >=3D 0 && loaded <=3D *cur) { + *cur =3D loaded; + return 0; + } + error_report("Invalid value %" PRId32 + " expecting positive value <=3D %" PRId32, + loaded, *cur); + return -EINVAL; +} + +const VMStateInfo vmstate_info_int32_le =3D { + .name =3D "int32 le", + .get =3D get_int32_le, + .put =3D put_int32, +}; + +/* 64 bit int */ + +static int get_int64(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) +{ + int64_t *v =3D pv; + qemu_get_sbe64s(f, v); + return 0; +} + +static int put_int64(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, + QJSON *vmdesc) +{ + int64_t *v =3D pv; + qemu_put_sbe64s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_int64 =3D { + .name =3D "int64", + .get =3D get_int64, + .put =3D put_int64, +}; + +/* 8 bit unsigned int */ + +static int get_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) +{ + uint8_t *v =3D pv; + qemu_get_8s(f, v); + return 0; +} + +static int put_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, + QJSON *vmdesc) +{ + uint8_t *v =3D pv; + qemu_put_8s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_uint8 =3D { + .name =3D "uint8", + .get =3D get_uint8, + .put =3D put_uint8, +}; + +/* 16 bit unsigned int */ + +static int get_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) +{ + uint16_t *v =3D pv; + qemu_get_be16s(f, v); + return 0; +} + +static int put_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, + QJSON *vmdesc) +{ + uint16_t *v =3D pv; + qemu_put_be16s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_uint16 =3D { + .name =3D "uint16", + .get =3D get_uint16, + .put =3D put_uint16, +}; + +/* 32 bit unsigned int */ + +static int get_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) +{ + uint32_t *v =3D pv; + qemu_get_be32s(f, v); + return 0; +} + +static int put_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, + QJSON *vmdesc) +{ + uint32_t *v =3D pv; + qemu_put_be32s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_uint32 =3D { + .name =3D "uint32", + .get =3D get_uint32, + .put =3D put_uint32, +}; + +/* 32 bit uint. See that the received value is the same than the one + in the field */ + +static int get_uint32_equal(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + uint32_t *v =3D pv; + uint32_t v2; + qemu_get_be32s(f, &v2); + + if (*v =3D=3D v2) { + return 0; + } + error_report("%" PRIx32 " !=3D %" PRIx32, *v, v2); + return -EINVAL; +} + +const VMStateInfo vmstate_info_uint32_equal =3D { + .name =3D "uint32 equal", + .get =3D get_uint32_equal, + .put =3D put_uint32, +}; + +/* 64 bit unsigned int */ + +static int get_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) +{ + uint64_t *v =3D pv; + qemu_get_be64s(f, v); + return 0; +} + +static int put_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, + QJSON *vmdesc) +{ + uint64_t *v =3D pv; + qemu_put_be64s(f, v); + return 0; +} + +const VMStateInfo vmstate_info_uint64 =3D { + .name =3D "uint64", + .get =3D get_uint64, + .put =3D put_uint64, +}; + +static int get_nullptr(QEMUFile *f, void *pv, size_t size, VMStateField *f= ield) + +{ + if (qemu_get_byte(f) =3D=3D VMS_NULLPTR_MARKER) { + return 0; + } + error_report("vmstate: get_nullptr expected VMS_NULLPTR_MARKER"); + return -EINVAL; +} + +static int put_nullptr(QEMUFile *f, void *pv, size_t size, + VMStateField *field, QJSON *vmdesc) + +{ + if (pv =3D=3D NULL) { + qemu_put_byte(f, VMS_NULLPTR_MARKER); + return 0; + } + error_report("vmstate: put_nullptr must be called with pv =3D=3D NULL"= ); + return -EINVAL; +} + +const VMStateInfo vmstate_info_nullptr =3D { + .name =3D "uint64", + .get =3D get_nullptr, + .put =3D put_nullptr, +}; + +/* 64 bit unsigned int. See that the received value is the same than the o= ne + in the field */ + +static int get_uint64_equal(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + uint64_t *v =3D pv; + uint64_t v2; + qemu_get_be64s(f, &v2); + + if (*v =3D=3D v2) { + return 0; + } + error_report("%" PRIx64 " !=3D %" PRIx64, *v, v2); + return -EINVAL; +} + +const VMStateInfo vmstate_info_uint64_equal =3D { + .name =3D "int64 equal", + .get =3D get_uint64_equal, + .put =3D put_uint64, +}; + +/* 8 bit int. See that the received value is the same than the one + in the field */ + +static int get_uint8_equal(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + uint8_t *v =3D pv; + uint8_t v2; + qemu_get_8s(f, &v2); + + if (*v =3D=3D v2) { + return 0; + } + error_report("%x !=3D %x", *v, v2); + return -EINVAL; +} + +const VMStateInfo vmstate_info_uint8_equal =3D { + .name =3D "uint8 equal", + .get =3D get_uint8_equal, + .put =3D put_uint8, +}; + +/* 16 bit unsigned int int. See that the received value is the same than t= he one + in the field */ + +static int get_uint16_equal(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + uint16_t *v =3D pv; + uint16_t v2; + qemu_get_be16s(f, &v2); + + if (*v =3D=3D v2) { + return 0; + } + error_report("%x !=3D %x", *v, v2); + return -EINVAL; +} + +const VMStateInfo vmstate_info_uint16_equal =3D { + .name =3D "uint16 equal", + .get =3D get_uint16_equal, + .put =3D put_uint16, +}; + +/* floating point */ + +static int get_float64(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + float64 *v =3D pv; + + *v =3D make_float64(qemu_get_be64(f)); + return 0; +} + +static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField *f= ield, + QJSON *vmdesc) +{ + uint64_t *v =3D pv; + + qemu_put_be64(f, float64_val(*v)); + return 0; +} + +const VMStateInfo vmstate_info_float64 =3D { + .name =3D "float64", + .get =3D get_float64, + .put =3D put_float64, +}; + +/* CPU_DoubleU type */ + +static int get_cpudouble(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + CPU_DoubleU *v =3D pv; + qemu_get_be32s(f, &v->l.upper); + qemu_get_be32s(f, &v->l.lower); + return 0; +} + +static int put_cpudouble(QEMUFile *f, void *pv, size_t size, + VMStateField *field, QJSON *vmdesc) +{ + CPU_DoubleU *v =3D pv; + qemu_put_be32s(f, &v->l.upper); + qemu_put_be32s(f, &v->l.lower); + return 0; +} + +const VMStateInfo vmstate_info_cpudouble =3D { + .name =3D "CPU_Double_U", + .get =3D get_cpudouble, + .put =3D put_cpudouble, +}; + +/* uint8_t buffers */ + +static int get_buffer(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + uint8_t *v =3D pv; + qemu_get_buffer(f, v, size); + return 0; +} + +static int put_buffer(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, + QJSON *vmdesc) +{ + uint8_t *v =3D pv; + qemu_put_buffer(f, v, size); + return 0; +} + +const VMStateInfo vmstate_info_buffer =3D { + .name =3D "buffer", + .get =3D get_buffer, + .put =3D put_buffer, +}; + +/* unused buffers: space that was used for some fields that are + not useful anymore */ + +static int get_unused_buffer(QEMUFile *f, void *pv, size_t size, + VMStateField *field) +{ + uint8_t buf[1024]; + int block_len; + + while (size > 0) { + block_len =3D MIN(sizeof(buf), size); + size -=3D block_len; + qemu_get_buffer(f, buf, block_len); + } + return 0; +} + +static int put_unused_buffer(QEMUFile *f, void *pv, size_t size, + VMStateField *field, QJSON *vmdesc) +{ + static const uint8_t buf[1024]; + int block_len; + + while (size > 0) { + block_len =3D MIN(sizeof(buf), size); + size -=3D block_len; + qemu_put_buffer(f, buf, block_len); + } + + return 0; +} + +const VMStateInfo vmstate_info_unused_buffer =3D { + .name =3D "unused_buffer", + .get =3D get_unused_buffer, + .put =3D put_unused_buffer, +}; + +/* vmstate_info_tmp, see VMSTATE_WITH_TMP, the idea is that we allocate + * a temporary buffer and the pre_load/pre_save methods in the child vmsd + * copy stuff from the parent into the child and do calculations to fill + * in fields that don't really exist in the parent but need to be in the + * stream. + */ +static int get_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field) +{ + int ret; + const VMStateDescription *vmsd =3D field->vmsd; + int version_id =3D field->version_id; + void *tmp =3D g_malloc(size); + + /* Writes the parent field which is at the start of the tmp */ + *(void **)tmp =3D pv; + ret =3D vmstate_load_state(f, vmsd, tmp, version_id); + g_free(tmp); + return ret; +} + +static int put_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field, + QJSON *vmdesc) +{ + const VMStateDescription *vmsd =3D field->vmsd; + void *tmp =3D g_malloc(size); + + /* Writes the parent field which is at the start of the tmp */ + *(void **)tmp =3D pv; + vmstate_save_state(f, vmsd, tmp, vmdesc); + g_free(tmp); + + return 0; +} + +const VMStateInfo vmstate_info_tmp =3D { + .name =3D "tmp", + .get =3D get_tmp, + .put =3D put_tmp, +}; + +/* bitmaps (as defined by bitmap.h). Note that size here is the size + * of the bitmap in bits. The on-the-wire format of a bitmap is 64 + * bit words with the bits in big endian order. The in-memory format + * is an array of 'unsigned long', which may be either 32 or 64 bits. + */ +/* This is the number of 64 bit words sent over the wire */ +#define BITS_TO_U64S(nr) DIV_ROUND_UP(nr, 64) +static int get_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) +{ + unsigned long *bmp =3D pv; + int i, idx =3D 0; + for (i =3D 0; i < BITS_TO_U64S(size); i++) { + uint64_t w =3D qemu_get_be64(f); + bmp[idx++] =3D w; + if (sizeof(unsigned long) =3D=3D 4 && idx < BITS_TO_LONGS(size)) { + bmp[idx++] =3D w >> 32; + } + } + return 0; +} + +static int put_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, + QJSON *vmdesc) +{ + unsigned long *bmp =3D pv; + int i, idx =3D 0; + for (i =3D 0; i < BITS_TO_U64S(size); i++) { + uint64_t w =3D bmp[idx++]; + if (sizeof(unsigned long) =3D=3D 4 && idx < BITS_TO_LONGS(size)) { + w |=3D ((uint64_t)bmp[idx++]) << 32; + } + qemu_put_be64(f, w); + } + + return 0; +} + +const VMStateInfo vmstate_info_bitmap =3D { + .name =3D "bitmap", + .get =3D get_bitmap, + .put =3D put_bitmap, +}; + +/* get for QTAILQ + * meta data about the QTAILQ is encoded in a VMStateField structure + */ +static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size, + VMStateField *field) +{ + int ret =3D 0; + const VMStateDescription *vmsd =3D field->vmsd; + /* size of a QTAILQ element */ + size_t size =3D field->size; + /* offset of the QTAILQ entry in a QTAILQ element */ + size_t entry_offset =3D field->start; + int version_id =3D field->version_id; + void *elm; + + trace_get_qtailq(vmsd->name, version_id); + if (version_id > vmsd->version_id) { + error_report("%s %s", vmsd->name, "too new"); + trace_get_qtailq_end(vmsd->name, "too new", -EINVAL); + + return -EINVAL; + } + if (version_id < vmsd->minimum_version_id) { + error_report("%s %s", vmsd->name, "too old"); + trace_get_qtailq_end(vmsd->name, "too old", -EINVAL); + return -EINVAL; + } + + while (qemu_get_byte(f)) { + elm =3D g_malloc(size); + ret =3D vmstate_load_state(f, vmsd, elm, version_id); + if (ret) { + return ret; + } + QTAILQ_RAW_INSERT_TAIL(pv, elm, entry_offset); + } + + trace_get_qtailq_end(vmsd->name, "end", ret); + return ret; +} + +/* put for QTAILQ */ +static int put_qtailq(QEMUFile *f, void *pv, size_t unused_size, + VMStateField *field, QJSON *vmdesc) +{ + const VMStateDescription *vmsd =3D field->vmsd; + /* offset of the QTAILQ entry in a QTAILQ element*/ + size_t entry_offset =3D field->start; + void *elm; + + trace_put_qtailq(vmsd->name, vmsd->version_id); + + QTAILQ_RAW_FOREACH(elm, pv, entry_offset) { + qemu_put_byte(f, true); + vmstate_save_state(f, vmsd, elm, vmdesc); + } + qemu_put_byte(f, false); + + trace_put_qtailq_end(vmsd->name, "end"); + + return 0; +} +const VMStateInfo vmstate_info_qtailq =3D { + .name =3D "qtailq", + .get =3D get_qtailq, + .put =3D put_qtailq, +}; diff --git a/migration/vmstate.c b/migration/vmstate.c index 66c50ee..ff54531 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -1,3 +1,15 @@ +/* + * VMState interpreter + * + * Copyright (c) 2009-2017 Red Hat Inc + * + * Authors: + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + #include "qemu/osdep.h" #include "qemu-common.h" #include "migration/migration.h" @@ -5,7 +17,6 @@ #include "migration/vmstate.h" #include "qemu/bitops.h" #include "qemu/error-report.h" -#include "qemu/queue.h" #include "trace.h" #include "qjson.h" =20 @@ -475,644 +486,3 @@ static void vmstate_subsection_save(QEMUFile *f, cons= t VMStateDescription *vmsd, json_end_array(vmdesc); } } - -/* bool */ - -static int get_bool(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d) -{ - bool *v =3D pv; - *v =3D qemu_get_byte(f); - return 0; -} - -static int put_bool(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d, - QJSON *vmdesc) -{ - bool *v =3D pv; - qemu_put_byte(f, *v); - return 0; -} - -const VMStateInfo vmstate_info_bool =3D { - .name =3D "bool", - .get =3D get_bool, - .put =3D put_bool, -}; - -/* 8 bit int */ - -static int get_int8(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d) -{ - int8_t *v =3D pv; - qemu_get_s8s(f, v); - return 0; -} - -static int put_int8(QEMUFile *f, void *pv, size_t size, VMStateField *fiel= d, - QJSON *vmdesc) -{ - int8_t *v =3D pv; - qemu_put_s8s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_int8 =3D { - .name =3D "int8", - .get =3D get_int8, - .put =3D put_int8, -}; - -/* 16 bit int */ - -static int get_int16(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) -{ - int16_t *v =3D pv; - qemu_get_sbe16s(f, v); - return 0; -} - -static int put_int16(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, - QJSON *vmdesc) -{ - int16_t *v =3D pv; - qemu_put_sbe16s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_int16 =3D { - .name =3D "int16", - .get =3D get_int16, - .put =3D put_int16, -}; - -/* 32 bit int */ - -static int get_int32(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) -{ - int32_t *v =3D pv; - qemu_get_sbe32s(f, v); - return 0; -} - -static int put_int32(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, - QJSON *vmdesc) -{ - int32_t *v =3D pv; - qemu_put_sbe32s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_int32 =3D { - .name =3D "int32", - .get =3D get_int32, - .put =3D put_int32, -}; - -/* 32 bit int. See that the received value is the same than the one - in the field */ - -static int get_int32_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - int32_t *v =3D pv; - int32_t v2; - qemu_get_sbe32s(f, &v2); - - if (*v =3D=3D v2) { - return 0; - } - error_report("%" PRIx32 " !=3D %" PRIx32, *v, v2); - return -EINVAL; -} - -const VMStateInfo vmstate_info_int32_equal =3D { - .name =3D "int32 equal", - .get =3D get_int32_equal, - .put =3D put_int32, -}; - -/* 32 bit int. Check that the received value is non-negative - * and less than or equal to the one in the field. - */ - -static int get_int32_le(QEMUFile *f, void *pv, size_t size, VMStateField *= field) -{ - int32_t *cur =3D pv; - int32_t loaded; - qemu_get_sbe32s(f, &loaded); - - if (loaded >=3D 0 && loaded <=3D *cur) { - *cur =3D loaded; - return 0; - } - error_report("Invalid value %" PRId32 - " expecting positive value <=3D %" PRId32, - loaded, *cur); - return -EINVAL; -} - -const VMStateInfo vmstate_info_int32_le =3D { - .name =3D "int32 le", - .get =3D get_int32_le, - .put =3D put_int32, -}; - -/* 64 bit int */ - -static int get_int64(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) -{ - int64_t *v =3D pv; - qemu_get_sbe64s(f, v); - return 0; -} - -static int put_int64(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, - QJSON *vmdesc) -{ - int64_t *v =3D pv; - qemu_put_sbe64s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_int64 =3D { - .name =3D "int64", - .get =3D get_int64, - .put =3D put_int64, -}; - -/* 8 bit unsigned int */ - -static int get_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld) -{ - uint8_t *v =3D pv; - qemu_get_8s(f, v); - return 0; -} - -static int put_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *fie= ld, - QJSON *vmdesc) -{ - uint8_t *v =3D pv; - qemu_put_8s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_uint8 =3D { - .name =3D "uint8", - .get =3D get_uint8, - .put =3D put_uint8, -}; - -/* 16 bit unsigned int */ - -static int get_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) -{ - uint16_t *v =3D pv; - qemu_get_be16s(f, v); - return 0; -} - -static int put_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, - QJSON *vmdesc) -{ - uint16_t *v =3D pv; - qemu_put_be16s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_uint16 =3D { - .name =3D "uint16", - .get =3D get_uint16, - .put =3D put_uint16, -}; - -/* 32 bit unsigned int */ - -static int get_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) -{ - uint32_t *v =3D pv; - qemu_get_be32s(f, v); - return 0; -} - -static int put_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, - QJSON *vmdesc) -{ - uint32_t *v =3D pv; - qemu_put_be32s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_uint32 =3D { - .name =3D "uint32", - .get =3D get_uint32, - .put =3D put_uint32, -}; - -/* 32 bit uint. See that the received value is the same than the one - in the field */ - -static int get_uint32_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - uint32_t *v =3D pv; - uint32_t v2; - qemu_get_be32s(f, &v2); - - if (*v =3D=3D v2) { - return 0; - } - error_report("%" PRIx32 " !=3D %" PRIx32, *v, v2); - return -EINVAL; -} - -const VMStateInfo vmstate_info_uint32_equal =3D { - .name =3D "uint32 equal", - .get =3D get_uint32_equal, - .put =3D put_uint32, -}; - -/* 64 bit unsigned int */ - -static int get_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) -{ - uint64_t *v =3D pv; - qemu_get_be64s(f, v); - return 0; -} - -static int put_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, - QJSON *vmdesc) -{ - uint64_t *v =3D pv; - qemu_put_be64s(f, v); - return 0; -} - -const VMStateInfo vmstate_info_uint64 =3D { - .name =3D "uint64", - .get =3D get_uint64, - .put =3D put_uint64, -}; - -static int get_nullptr(QEMUFile *f, void *pv, size_t size, VMStateField *f= ield) - -{ - if (qemu_get_byte(f) =3D=3D VMS_NULLPTR_MARKER) { - return 0; - } - error_report("vmstate: get_nullptr expected VMS_NULLPTR_MARKER"); - return -EINVAL; -} - -static int put_nullptr(QEMUFile *f, void *pv, size_t size, - VMStateField *field, QJSON *vmdesc) - -{ - if (pv =3D=3D NULL) { - qemu_put_byte(f, VMS_NULLPTR_MARKER); - return 0; - } - error_report("vmstate: put_nullptr must be called with pv =3D=3D NULL"= ); - return -EINVAL; -} - -const VMStateInfo vmstate_info_nullptr =3D { - .name =3D "uint64", - .get =3D get_nullptr, - .put =3D put_nullptr, -}; - -/* 64 bit unsigned int. See that the received value is the same than the o= ne - in the field */ - -static int get_uint64_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - uint64_t *v =3D pv; - uint64_t v2; - qemu_get_be64s(f, &v2); - - if (*v =3D=3D v2) { - return 0; - } - error_report("%" PRIx64 " !=3D %" PRIx64, *v, v2); - return -EINVAL; -} - -const VMStateInfo vmstate_info_uint64_equal =3D { - .name =3D "int64 equal", - .get =3D get_uint64_equal, - .put =3D put_uint64, -}; - -/* 8 bit int. See that the received value is the same than the one - in the field */ - -static int get_uint8_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - uint8_t *v =3D pv; - uint8_t v2; - qemu_get_8s(f, &v2); - - if (*v =3D=3D v2) { - return 0; - } - error_report("%x !=3D %x", *v, v2); - return -EINVAL; -} - -const VMStateInfo vmstate_info_uint8_equal =3D { - .name =3D "uint8 equal", - .get =3D get_uint8_equal, - .put =3D put_uint8, -}; - -/* 16 bit unsigned int int. See that the received value is the same than t= he one - in the field */ - -static int get_uint16_equal(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - uint16_t *v =3D pv; - uint16_t v2; - qemu_get_be16s(f, &v2); - - if (*v =3D=3D v2) { - return 0; - } - error_report("%x !=3D %x", *v, v2); - return -EINVAL; -} - -const VMStateInfo vmstate_info_uint16_equal =3D { - .name =3D "uint16 equal", - .get =3D get_uint16_equal, - .put =3D put_uint16, -}; - -/* floating point */ - -static int get_float64(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - float64 *v =3D pv; - - *v =3D make_float64(qemu_get_be64(f)); - return 0; -} - -static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField *f= ield, - QJSON *vmdesc) -{ - uint64_t *v =3D pv; - - qemu_put_be64(f, float64_val(*v)); - return 0; -} - -const VMStateInfo vmstate_info_float64 =3D { - .name =3D "float64", - .get =3D get_float64, - .put =3D put_float64, -}; - -/* CPU_DoubleU type */ - -static int get_cpudouble(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - CPU_DoubleU *v =3D pv; - qemu_get_be32s(f, &v->l.upper); - qemu_get_be32s(f, &v->l.lower); - return 0; -} - -static int put_cpudouble(QEMUFile *f, void *pv, size_t size, - VMStateField *field, QJSON *vmdesc) -{ - CPU_DoubleU *v =3D pv; - qemu_put_be32s(f, &v->l.upper); - qemu_put_be32s(f, &v->l.lower); - return 0; -} - -const VMStateInfo vmstate_info_cpudouble =3D { - .name =3D "CPU_Double_U", - .get =3D get_cpudouble, - .put =3D put_cpudouble, -}; - -/* uint8_t buffers */ - -static int get_buffer(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - uint8_t *v =3D pv; - qemu_get_buffer(f, v, size); - return 0; -} - -static int put_buffer(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, - QJSON *vmdesc) -{ - uint8_t *v =3D pv; - qemu_put_buffer(f, v, size); - return 0; -} - -const VMStateInfo vmstate_info_buffer =3D { - .name =3D "buffer", - .get =3D get_buffer, - .put =3D put_buffer, -}; - -/* unused buffers: space that was used for some fields that are - not useful anymore */ - -static int get_unused_buffer(QEMUFile *f, void *pv, size_t size, - VMStateField *field) -{ - uint8_t buf[1024]; - int block_len; - - while (size > 0) { - block_len =3D MIN(sizeof(buf), size); - size -=3D block_len; - qemu_get_buffer(f, buf, block_len); - } - return 0; -} - -static int put_unused_buffer(QEMUFile *f, void *pv, size_t size, - VMStateField *field, QJSON *vmdesc) -{ - static const uint8_t buf[1024]; - int block_len; - - while (size > 0) { - block_len =3D MIN(sizeof(buf), size); - size -=3D block_len; - qemu_put_buffer(f, buf, block_len); - } - - return 0; -} - -const VMStateInfo vmstate_info_unused_buffer =3D { - .name =3D "unused_buffer", - .get =3D get_unused_buffer, - .put =3D put_unused_buffer, -}; - -/* vmstate_info_tmp, see VMSTATE_WITH_TMP, the idea is that we allocate - * a temporary buffer and the pre_load/pre_save methods in the child vmsd - * copy stuff from the parent into the child and do calculations to fill - * in fields that don't really exist in the parent but need to be in the - * stream. - */ -static int get_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field) -{ - int ret; - const VMStateDescription *vmsd =3D field->vmsd; - int version_id =3D field->version_id; - void *tmp =3D g_malloc(size); - - /* Writes the parent field which is at the start of the tmp */ - *(void **)tmp =3D pv; - ret =3D vmstate_load_state(f, vmsd, tmp, version_id); - g_free(tmp); - return ret; -} - -static int put_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field, - QJSON *vmdesc) -{ - const VMStateDescription *vmsd =3D field->vmsd; - void *tmp =3D g_malloc(size); - - /* Writes the parent field which is at the start of the tmp */ - *(void **)tmp =3D pv; - vmstate_save_state(f, vmsd, tmp, vmdesc); - g_free(tmp); - - return 0; -} - -const VMStateInfo vmstate_info_tmp =3D { - .name =3D "tmp", - .get =3D get_tmp, - .put =3D put_tmp, -}; - -/* bitmaps (as defined by bitmap.h). Note that size here is the size - * of the bitmap in bits. The on-the-wire format of a bitmap is 64 - * bit words with the bits in big endian order. The in-memory format - * is an array of 'unsigned long', which may be either 32 or 64 bits. - */ -/* This is the number of 64 bit words sent over the wire */ -#define BITS_TO_U64S(nr) DIV_ROUND_UP(nr, 64) -static int get_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld) -{ - unsigned long *bmp =3D pv; - int i, idx =3D 0; - for (i =3D 0; i < BITS_TO_U64S(size); i++) { - uint64_t w =3D qemu_get_be64(f); - bmp[idx++] =3D w; - if (sizeof(unsigned long) =3D=3D 4 && idx < BITS_TO_LONGS(size)) { - bmp[idx++] =3D w >> 32; - } - } - return 0; -} - -static int put_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *fi= eld, - QJSON *vmdesc) -{ - unsigned long *bmp =3D pv; - int i, idx =3D 0; - for (i =3D 0; i < BITS_TO_U64S(size); i++) { - uint64_t w =3D bmp[idx++]; - if (sizeof(unsigned long) =3D=3D 4 && idx < BITS_TO_LONGS(size)) { - w |=3D ((uint64_t)bmp[idx++]) << 32; - } - qemu_put_be64(f, w); - } - - return 0; -} - -const VMStateInfo vmstate_info_bitmap =3D { - .name =3D "bitmap", - .get =3D get_bitmap, - .put =3D put_bitmap, -}; - -/* get for QTAILQ - * meta data about the QTAILQ is encoded in a VMStateField structure - */ -static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size, - VMStateField *field) -{ - int ret =3D 0; - const VMStateDescription *vmsd =3D field->vmsd; - /* size of a QTAILQ element */ - size_t size =3D field->size; - /* offset of the QTAILQ entry in a QTAILQ element */ - size_t entry_offset =3D field->start; - int version_id =3D field->version_id; - void *elm; - - trace_get_qtailq(vmsd->name, version_id); - if (version_id > vmsd->version_id) { - error_report("%s %s", vmsd->name, "too new"); - trace_get_qtailq_end(vmsd->name, "too new", -EINVAL); - - return -EINVAL; - } - if (version_id < vmsd->minimum_version_id) { - error_report("%s %s", vmsd->name, "too old"); - trace_get_qtailq_end(vmsd->name, "too old", -EINVAL); - return -EINVAL; - } - - while (qemu_get_byte(f)) { - elm =3D g_malloc(size); - ret =3D vmstate_load_state(f, vmsd, elm, version_id); - if (ret) { - return ret; - } - QTAILQ_RAW_INSERT_TAIL(pv, elm, entry_offset); - } - - trace_get_qtailq_end(vmsd->name, "end", ret); - return ret; -} - -/* put for QTAILQ */ -static int put_qtailq(QEMUFile *f, void *pv, size_t unused_size, - VMStateField *field, QJSON *vmdesc) -{ - const VMStateDescription *vmsd =3D field->vmsd; - /* offset of the QTAILQ entry in a QTAILQ element*/ - size_t entry_offset =3D field->start; - void *elm; - - trace_put_qtailq(vmsd->name, vmsd->version_id); - - QTAILQ_RAW_FOREACH(elm, pv, entry_offset) { - qemu_put_byte(f, true); - vmstate_save_state(f, vmsd, elm, vmdesc); - } - qemu_put_byte(f, false); - - trace_put_qtailq_end(vmsd->name, "end"); - - return 0; -} -const VMStateInfo vmstate_info_qtailq =3D { - .name =3D "qtailq", - .get =3D get_qtailq, - .put =3D put_qtailq, -}; diff --git a/tests/Makefile.include b/tests/Makefile.include index 4277597..7589383 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -574,7 +574,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-= global-props.o \ hw/core/reset.o \ $(test-qapi-obj-y) tests/test-vmstate$(EXESUF): tests/test-vmstate.o \ - migration/vmstate.o migration/qemu-file.o \ + migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \ migration/qemu-file-channel.o migration/qjson.o \ $(test-io-obj-y) tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-= obj-y) --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036319537997.4034609145717; Wed, 17 May 2017 08:51:59 -0700 (PDT) Received: from localhost ([::1]:49631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1Ez-0002e3-40 for importer@patchew.org; Wed, 17 May 2017 11:51:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BX-0000Ej-7r for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BW-0000r5-6L for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40816) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BV-0000qY-TO for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAFF3659B3 for ; Wed, 17 May 2017 15:48:20 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id D84FE77D68; Wed, 17 May 2017 15:48:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CAFF3659B3 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CAFF3659B3 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:54 +0200 Message-Id: <20170517154756.22079-8-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 17 May 2017 15:48:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 7/9] migration: Remove qemu-file.h from vmstate.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert -- minor rearangements due to the rebase Signed-off-by: Juan Quintela --- include/hw/hw.h | 1 + include/migration/vmstate.h | 3 --- migration/block.c | 1 + migration/colo.c | 1 + migration/postcopy-ram.c | 1 + migration/ram.c | 1 + tests/test-vmstate.c | 1 + 7 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/hw/hw.h b/include/hw/hw.h index e22d4ce..af9eae1 100644 --- a/include/hw/hw.h +++ b/include/hw/hw.h @@ -11,6 +11,7 @@ #include "exec/memory.h" #include "hw/irq.h" #include "migration/vmstate.h" +#include "migration/qemu-file.h" #include "qemu/module.h" #include "sysemu/reset.h" =20 diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index dacb052..f97411d 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -27,9 +27,6 @@ #ifndef QEMU_VMSTATE_H #define QEMU_VMSTATE_H =20 -#ifndef CONFIG_USER_ONLY -#include "migration/qemu-file.h" -#endif #include "migration/qjson.h" =20 typedef void SaveStateHandler(QEMUFile *f, void *opaque); diff --git a/migration/block.c b/migration/block.c index 5d22926..5baf46d 100644 --- a/migration/block.c +++ b/migration/block.c @@ -26,6 +26,7 @@ #include "migration/block.h" #include "migration/migration.h" #include "sysemu/blockdev.h" +#include "migration/qemu-file.h" #include "sysemu/block-backend.h" =20 #define BLOCK_SIZE (1 << 20) diff --git a/migration/colo.c b/migration/colo.c index 73ebd64..929b31c 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -15,6 +15,7 @@ #include "sysemu/sysemu.h" #include "qemu-file-channel.h" #include "migration/migration.h" +#include "migration/qemu-file.h" #include "migration/colo.h" #include "migration/block.h" #include "io/channel-buffer.h" diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index a0489f6..64f09e1 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -20,6 +20,7 @@ =20 #include "qemu-common.h" #include "migration/migration.h" +#include "migration/qemu-file.h" #include "postcopy-ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h" diff --git a/migration/ram.c b/migration/ram.c index 2564c00..04667de 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -37,6 +37,7 @@ #include "qemu/main-loop.h" #include "xbzrle.h" #include "migration/migration.h" +#include "migration/qemu-file.h" #include "postcopy-ram.h" #include "exec/address-spaces.h" #include "migration/page_cache.h" diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 1c13570..25389bc 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -27,6 +27,7 @@ #include "qemu-common.h" #include "migration/migration.h" #include "migration/vmstate.h" +#include "migration/qemu-file.h" #include "../migration/qemu-file-channel.h" #include "qemu/coroutine.h" #include "io/channel-file.h" --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036451404371.3447542562167; Wed, 17 May 2017 08:54:11 -0700 (PDT) Received: from localhost ([::1]:49646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1H5-0004OI-1A for importer@patchew.org; Wed, 17 May 2017 11:54:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1BY-0000GO-V0 for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1BX-0000rj-Vj for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BX-0000rH-Q6 for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:23 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B8925C059750 for ; Wed, 17 May 2017 15:48:22 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2940677D68; Wed, 17 May 2017 15:48:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B8925C059750 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B8925C059750 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:55 +0200 Message-Id: <20170517154756.22079-9-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 17 May 2017 15:48:22 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 8/9] migration: Remove vmstate.h from migration.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- Minor rearrangements due to rebase Signed-off-by: Juan Quintela --- include/migration/migration.h | 1 - migration/block.c | 1 + migration/colo-comm.c | 1 + migration/migration.c | 1 + migration/ram.c | 1 + 5 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/migration/migration.h b/include/migration/migration.h index 8280df1..0e807b6 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -18,7 +18,6 @@ #include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" -#include "migration/vmstate.h" #include "io/channel.h" #include "qapi-types.h" #include "exec/cpu-common.h" diff --git a/migration/block.c b/migration/block.c index 5baf46d..13f90d3 100644 --- a/migration/block.c +++ b/migration/block.c @@ -27,6 +27,7 @@ #include "migration/migration.h" #include "sysemu/blockdev.h" #include "migration/qemu-file.h" +#include "migration/vmstate.h" #include "sysemu/block-backend.h" =20 #define BLOCK_SIZE (1 << 20) diff --git a/migration/colo-comm.c b/migration/colo-comm.c index 3d91798..8bfdf68 100644 --- a/migration/colo-comm.c +++ b/migration/colo-comm.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "migration/migration.h" #include "migration/colo.h" +#include "migration/vmstate.h" #include "trace.h" =20 typedef struct { diff --git a/migration/migration.c b/migration/migration.c index ff3f7aa..75a728a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -21,6 +21,7 @@ #include "migration/migration.h" #include "qemu-file-channel.h" #include "migration/qemu-file.h" +#include "migration/vmstate.h" #include "sysemu/sysemu.h" #include "block/block.h" #include "qapi/qmp/qerror.h" diff --git a/migration/ram.c b/migration/ram.c index 04667de..a68a9db 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -38,6 +38,7 @@ #include "xbzrle.h" #include "migration/migration.h" #include "migration/qemu-file.h" +#include "migration/vmstate.h" #include "postcopy-ram.h" #include "exec/address-spaces.h" #include "migration/page_cache.h" --=20 2.9.3 From nobody Sun Apr 28 23:28:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1495036322203868.0947882911187; Wed, 17 May 2017 08:52:02 -0700 (PDT) Received: from localhost ([::1]:49633 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1F1-0002fw-SJ for importer@patchew.org; Wed, 17 May 2017 11:51:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dB1Be-0000Kw-1o for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dB1Ba-0000wU-0k for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57234) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dB1BZ-0000uX-RF for qemu-devel@nongnu.org; Wed, 17 May 2017 11:48:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8EE0C04B926 for ; Wed, 17 May 2017 15:48:24 +0000 (UTC) Received: from secure.mitica (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16D7677D68; Wed, 17 May 2017 15:48:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C8EE0C04B926 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=quintela@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C8EE0C04B926 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 17 May 2017 17:47:56 +0200 Message-Id: <20170517154756.22079-10-quintela@redhat.com> In-Reply-To: <20170517154756.22079-1-quintela@redhat.com> References: <20170517154756.22079-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 17 May 2017 15:48:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 9/9] migration: migration.h was not needed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This files don't use any function from migration.h, so drop it. Signed-off-by: Juan Quintela Acked-by: Dr. David Alan Gilbert Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- block/qed.c | 1 - hw/i386/pc_q35.c | 1 - hw/virtio/vhost-user.c | 1 - hw/virtio/vhost-vsock.c | 1 - hw/virtio/virtio.c | 1 - monitor.c | 1 - 6 files changed, 6 deletions(-) diff --git a/block/qed.c b/block/qed.c index fd76817..8d899fd 100644 --- a/block/qed.c +++ b/block/qed.c @@ -19,7 +19,6 @@ #include "trace.h" #include "qed.h" #include "qapi/qmp/qerror.h" -#include "migration/migration.h" #include "sysemu/block-backend.h" =20 static const AIOCBInfo qed_aiocb_info =3D { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 66303a7..a58785b 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -46,7 +46,6 @@ #include "hw/ide/ahci.h" #include "hw/usb.h" #include "qemu/error-report.h" -#include "migration/migration.h" #include "sysemu/numa.h" =20 /* ICH9 AHCI has 6 ports */ diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 9334a8a..ebc8ccf 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -17,7 +17,6 @@ #include "sysemu/kvm.h" #include "qemu/error-report.h" #include "qemu/sockets.h" -#include "migration/migration.h" =20 #include #include diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index b481562..49e0022 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -17,7 +17,6 @@ #include "qapi/error.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" -#include "migration/migration.h" #include "qemu/error-report.h" #include "hw/virtio/vhost-vsock.h" #include "qemu/iov.h" diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 03592c5..2d2b6bf 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -21,7 +21,6 @@ #include "hw/virtio/virtio.h" #include "qemu/atomic.h" #include "hw/virtio/virtio-bus.h" -#include "migration/migration.h" #include "hw/virtio/virtio-access.h" #include "sysemu/dma.h" =20 diff --git a/monitor.c b/monitor.c index 078cba5..fa295c4 100644 --- a/monitor.c +++ b/monitor.c @@ -49,7 +49,6 @@ #include "disas/disas.h" #include "sysemu/balloon.h" #include "qemu/timer.h" -#include "migration/migration.h" #include "sysemu/hw_accel.h" #include "qemu/acl.h" #include "sysemu/tpm.h" --=20 2.9.3