From patchwork Thu Nov 23 08:47:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhoujian (jay)" X-Patchwork-Id: 10072521 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3B686056E for ; Thu, 23 Nov 2017 08:49:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2FE829ED7 for ; Thu, 23 Nov 2017 08:49:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9655929EF4; Thu, 23 Nov 2017 08:49:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 63D4629ED7 for ; Thu, 23 Nov 2017 08:49:16 +0000 (UTC) Received: from localhost ([::1]:43045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHnC6-0002QV-3n for patchwork-qemu-devel@patchwork.kernel.org; Thu, 23 Nov 2017 03:49:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHnBN-0002QN-QZ for qemu-devel@nongnu.org; Thu, 23 Nov 2017 03:48:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHnBH-0005uf-O3 for qemu-devel@nongnu.org; Thu, 23 Nov 2017 03:48:29 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:2734) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHnBH-0005rs-0o for qemu-devel@nongnu.org; Thu, 23 Nov 2017 03:48:23 -0500 Received: from 172.30.72.60 (EHLO DGGEMS403-HUB.china.huawei.com) ([172.30.72.60]) by dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DLL91959; Thu, 23 Nov 2017 16:48:09 +0800 (CST) Received: from localhost (10.177.19.14) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Thu, 23 Nov 2017 16:48:01 +0800 From: Jay Zhou To: Date: Thu, 23 Nov 2017 16:47:52 +0800 Message-ID: <1511426872-13980-1-git-send-email-jianjay.zhou@huawei.com> X-Mailer: git-send-email 2.6.1.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.177.19.14] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.5A168B4A.01F0, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 40be3a47f81a545fb89e1e6acbf2be39 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 45.249.212.191 Subject: [Qemu-devel] [PATCH] docs/devel/migration.txt: keep functions consistent with the code 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: wangxinxin.wang@huawei.com, Jay Zhou , weidong.huang@huawei.com, dgilbert@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since the commit 11808bb0c422134bf09119f4aa22c59b0ce84bf3 removed the put_buffer callback and using an iovec based write handler instead, the docs should be sync with the code too. Signed-off-by: Jay Zhou --- docs/devel/migration.txt | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/docs/devel/migration.txt b/docs/devel/migration.txt index 4030703..e7b08c9 100644 --- a/docs/devel/migration.txt +++ b/docs/devel/migration.txt @@ -52,26 +52,31 @@ QEMU uses a QEMUFile abstraction to be able to do migration. Any type of migration that wants to use QEMU infrastructure has to create a QEMUFile with: -QEMUFile *qemu_fopen_ops(void *opaque, - QEMUFilePutBufferFunc *put_buffer, - QEMUFileGetBufferFunc *get_buffer, - QEMUFileCloseFunc *close); +typedef struct QEMUFileOps { + QEMUFileGetBufferFunc *get_buffer; + QEMUFileCloseFunc *close; + QEMUFileSetBlocking *set_blocking; + QEMUFileWritevBufferFunc *writev_buffer; + QEMURetPathFunc *get_return_path; + QEMUFileShutdownFunc *shut_down; +} QEMUFileOps; -The functions have the following functionality: +QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops); -This function writes a chunk of data to a file at the given position. -The pos argument can be ignored if the file is only used for -streaming. The handler should try to write all of the data it can. +The main functions of QEMUFileOps have the following functionality: -typedef int (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf, - int64_t pos, int size); +This function writes an iovec to file. The handler must write all +of the data or return a negative errno value. + +typedef ssize_t (QEMUFileWritevBufferFunc)(void *opaque, struct iovec *iov, + int iovcnt, int64_t pos); Read a chunk of data from a file at the given position. The pos argument can be ignored if the file is only be used for streaming. The number of bytes actually read should be returned. -typedef int (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, - int64_t pos, int size); +typedef ssize_t (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, + int64_t pos, int size); Close a file and return an error code. @@ -80,7 +85,7 @@ typedef int (QEMUFileCloseFunc)(void *opaque); You can use any internal state that you need using the opaque void * pointer that is passed to all functions. -The important functions for us are put_buffer()/get_buffer() that +The important functions for us are writev_buffer()/get_buffer() that allow to write/read a buffer into the QEMUFile. === How to save the state of one device ===