From patchwork Mon Jun 4 09:57:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 162696 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3A09AB6FAB for ; Mon, 4 Jun 2012 19:58:15 +1000 (EST) Received: from localhost ([::1]:36265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbU3A-0008Td-Ut for incoming@patchwork.ozlabs.org; Mon, 04 Jun 2012 05:58:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbU2u-0008RO-1y for qemu-devel@nongnu.org; Mon, 04 Jun 2012 05:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbU2p-0004bP-NN for qemu-devel@nongnu.org; Mon, 04 Jun 2012 05:57:55 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:46498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbU2p-0004ag-EL for qemu-devel@nongnu.org; Mon, 04 Jun 2012 05:57:51 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 35F1048982; Mon, 4 Jun 2012 18:57:45 +0900 (JST) Received: (nullmailer pid 5122 invoked by uid 1000); Mon, 04 Jun 2012 09:57:45 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org, kvm@vger.kernel.org Date: Mon, 4 Jun 2012 18:57:18 +0900 Message-Id: <8b3ed340ec04b7d658d42e068f0a3793c6cd053b.1338802192.git.yamahata@valinux.co.jp> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 210.128.90.3 Cc: benoit.hudzia@gmail.com, aarcange@redhat.com, aliguori@us.ibm.com, quintela@redhat.com, stefanha@gmail.com, t.hirofuchi@aist.go.jp, dlaor@redhat.com, satoshi.itoh@aist.go.jp, mdroth@linux.vnet.ibm.com, yoshikawa.takuya@oss.ntt.co.jp, owasserm@redhat.com, avi@redhat.com, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH v2 16/41] savevm: qemu_pending_size() to return pending buffered size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This will be used later by postcopy migration. Signed-off-by: Isaku Yamahata --- qemu-file.h | 1 + savevm.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/qemu-file.h b/qemu-file.h index a285bef..880ef4b 100644 --- a/qemu-file.h +++ b/qemu-file.h @@ -91,6 +91,7 @@ int qemu_get_byte(QEMUFile *f); int qemu_peek_byte(QEMUFile *f, int offset); int qemu_peek_buffer(QEMUFile *f, uint8_t *buf, int size, size_t offset); void qemu_file_skip(QEMUFile *f, int size); +int qemu_pending_size(const QEMUFile *f); static inline unsigned int qemu_get_ubyte(QEMUFile *f) { diff --git a/savevm.c b/savevm.c index 8ad843f..2992f97 100644 --- a/savevm.c +++ b/savevm.c @@ -595,6 +595,11 @@ void qemu_file_skip(QEMUFile *f, int size) } } +int qemu_pending_size(const QEMUFile *f) +{ + return f->buf_size - f->buf_index; +} + int qemu_peek_buffer(QEMUFile *f, uint8_t *buf, int size, size_t offset) { int pending;