Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jx2Sc-00006t-OJ for qemu-devel@nongnu.org; Fri, 16 May 2008 12:07:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jx2SY-0008To-65 for qemu-devel@nongnu.org; Fri, 16 May 2008 12:07:10 -0400 Received: from [199.232.76.173] (port=45561 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jx2SX-0008TU-So for qemu-devel@nongnu.org; Fri, 16 May 2008 12:07:05 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:48567) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jx2SX-0007RC-Dv for qemu-devel@nongnu.org; Fri, 16 May 2008 12:07:05 -0400 Received: from mariner.uk.xensource.com ([10.80.2.22]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id m4GG6xKf025384 for ; Fri, 16 May 2008 09:07:00 -0700 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1Jx2SQ-00046Q-U1 for qemu-devel@nongnu.org; Fri, 16 May 2008 17:06:58 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18477.45346.661890.287463@mariner.uk.xensource.com> Date: Fri, 16 May 2008 17:06:58 +0100 From: Ian Jackson Subject: [Qemu-devel] [PATCH] register_savevm etc.: make save function optional Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org register_savevm etc.: make save function optional This allows a device to provide only a loading function, not a saving function. This is useful if a later version of an emulation restores its state in some other way (eg by having a different device name, or by exploiting invariants in the state); when this happens it is still necessary to load or skip the information when it is found in old savefiles. Signed-off-by: Ian Jackson diff --git a/vl.c b/vl.c index 67712f0..3a9135c 100644 --- a/vl.c +++ b/vl.c @@ -5988,6 +5988,10 @@ static int qemu_savevm_state(QEMUFile *f) qemu_put_be64(f, 0); /* total size */ for(se = first_se; se != NULL; se = se->next) { + if (se->save_state == NULL) + /* this one has a loader only, for backwards compatibility */ + continue; + /* ID string */ len = strlen(se->idstr); qemu_put_byte(f, len);