From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:906:cf90:b0:9bd:85f7:2662 with SMTP id um16csp734756ejb; Thu, 19 Oct 2023 12:10:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHd43iKG6KsEI9u2vFe/CgguVwibpdqQpPZ5QwEa87Gr7zSyZWZKAirVSbMUb9MpmUlgh3+ X-Received: by 2002:a0c:e091:0:b0:66d:589:5841 with SMTP id l17-20020a0ce091000000b0066d05895841mr2958140qvk.28.1697742640338; Thu, 19 Oct 2023 12:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697742640; cv=none; d=google.com; s=arc-20160816; b=OPC+IkqLjotqLokF2mqZGoXs/zd0LvHILlQ0RhbgO3hkpVMHbTEEfJ+ozQ/upnQQyY NEVEiH4Jjgv34P0aUOxNgEYHQD/7kVoLzV0L8yqoc59aOOkFFHF/xsUk5aXmhN6iSHQq ayg4t5o67YU5kkSes3UOItuRMAuh6F4KR3C+M6sjQXXYEA7e/Pzeam8PiJY3yaJ5DmOp Gr5MtSlp8RL8VZp7GnCn41yJakvPmW9OrgOLN5YS82g96+SLecUH54swUgLH9FtpkNe1 VmM/y+IJou/s2Xd+q/fCMJVajCFCuLzOrHZdLkjOYHn03LlAw2033aSbNhXFJEGU1c3Q lYQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kfv2FceEPDXhMANhc6Hti7LB22oV2l3CO2/Zmp0mGao=; fh=Xlf3et2nYyn6Dffgqd/l95XMDkc357MJlcbLmxiOqZU=; b=pyhJML9jAY4Tn9wcvIMPmymfgyU+B/KfvIJsdpNT3GSmP1c+IDNHGLNAPwNvF4QOOE uLFCMZeG6AxAK/V8a2DKwCzpUUOuflhhEVNAOdsnAHVYFcU3sK9NLJGaz2p07W/MKoLV Lan7qPkBF2vzM3Y3u9wh7ByV00399RRdF7ob19E1SKq+PQLGUj5sVuC6zwAlTg39KP8M K6cB0U8NM5MA7w+riVk/K9VjmhQzeFd7YDwCRata0JP8UcVpyBxRxignFTwbVk/3Piid eKffIQEHbdJHx+zRQbNzM+J/KlZogDtYTs4wC7Y2V7wBCl4PGoR6htUmWTipHfK3YXru bwOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B8EqutLd; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ev2-20020a0562140a8200b006589ed189c5si184871qvb.5.2023.10.19.12.10.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2023 12:10:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B8EqutLd; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtYP8-00015v-07; Thu, 19 Oct 2023 15:09:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtYP1-0000gL-K7 for qemu-arm@nongnu.org; Thu, 19 Oct 2023 15:09:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtYOw-00053N-Ph for qemu-arm@nongnu.org; Thu, 19 Oct 2023 15:09:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697742584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kfv2FceEPDXhMANhc6Hti7LB22oV2l3CO2/Zmp0mGao=; b=B8EqutLd3ZRAZmQcVcLdnjfGU9NEqRO24Uvt6EIMRZkn1qlwFcZzK6XHVDWHp638JPUCys OU948ymTR0dDeLgvYHI3gLSXQ60bRg+wb7nVAIAHqjYFJf9it9g54/f8jxWG1RK1s6z+tA pP+l6k1VFJsH5X+/2A20RUcy9PoDPKo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-361-fA7xCgiQM2O9lDsC0yI8Fg-1; Thu, 19 Oct 2023 15:09:35 -0400 X-MC-Unique: fA7xCgiQM2O9lDsC0yI8Fg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B59D89B846; Thu, 19 Oct 2023 19:09:33 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E34C1121314; Thu, 19 Oct 2023 19:09:28 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Stefan Berger , Marcel Apfelbaum , qemu-ppc@nongnu.org, Nicholas Piggin , qemu-s390x@nongnu.org, Gerd Hoffmann , Corey Minyard , Samuel Thibault , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , Fabiano Rosas , Eric Farman , Peter Xu , Harsh Prateek Bora , John Snow , qemu-block@nongnu.org, Mark Cave-Ayland , Christian Borntraeger , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Weil , qemu-arm@nongnu.org, Juan Quintela , Jason Wang , Corey Minyard , Leonardo Bras , Thomas Huth , Peter Maydell , "Michael S. Tsirkin" , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , David Gibson , Halil Pasic , Daniel Henrique Barboza Subject: [PATCH 10/13] migration: Improve example and documentation of vmstate_register() Date: Thu, 19 Oct 2023 21:08:28 +0200 Message-ID: <20231019190831.20363-11-quintela@redhat.com> In-Reply-To: <20231019190831.20363-1-quintela@redhat.com> References: <20231019190831.20363-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: 3flAabIqCJtz Signed-off-by: Juan Quintela --- docs/devel/migration.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index c3e1400c0c..a9fde75862 100644 --- a/docs/devel/migration.rst +++ b/docs/devel/migration.rst @@ -165,13 +165,17 @@ An example (from hw/input/pckbd.c) } }; -We are declaring the state with name "pckbd". -The ``version_id`` is 3, and the fields are 4 uint8_t in a KBDState structure. -We registered this with: +We are declaring the state with name "pckbd". The ``version_id`` is +3, and the fields are 4 uint8_t in a KBDState structure. We +registered this with one of those. The first one will generate a +device ``instance_id`` different for each registration. Use the +second one if you already have an id different for each instance of +the device: .. code:: c - vmstate_register(NULL, 0, &vmstate_kbd, s); + vmstate_register_any(NULL, &vmstate_kbd, s); + vmstate_register(NULL, instance_id, &vmstate_kbd, s); For devices that are ``qdev`` based, we can register the device in the class init function: -- 2.41.0