From patchwork Thu Mar 21 09:09:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orit Wasserman X-Patchwork-Id: 229613 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 59CC62C00B6 for ; Thu, 21 Mar 2013 20:57:12 +1100 (EST) Received: from localhost ([::1]:34816 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIbXY-0001WS-4i for incoming@patchwork.ozlabs.org; Thu, 21 Mar 2013 05:12:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIbUq-0007Ks-3m for qemu-devel@nongnu.org; Thu, 21 Mar 2013 05:09:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIbUn-0005ez-Ni for qemu-devel@nongnu.org; Thu, 21 Mar 2013 05:09:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIbUn-0005eu-FX for qemu-devel@nongnu.org; Thu, 21 Mar 2013 05:09:13 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2L99CO2025397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 21 Mar 2013 05:09:12 -0400 Received: from dhcp-1-120.tlv.redhat.com (vpn-200-38.tlv.redhat.com [10.35.200.38]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2L98Z4K016557; Thu, 21 Mar 2013 05:09:10 -0400 From: Orit Wasserman To: qemu-devel@nongnu.org Date: Thu, 21 Mar 2013 11:09:27 +0200 Message-Id: <1363856971-4601-9-git-send-email-owasserm@redhat.com> In-Reply-To: <1363856971-4601-1-git-send-email-owasserm@redhat.com> References: <1363856971-4601-1-git-send-email-owasserm@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Orit Wasserman , pbonzini@redhat.com, mst@redhat.com, chegu_vinod@hp.com, quintela@redhat.com Subject: [Qemu-devel] [RFC 08/12] Use writev ops instead of put_buffer ops 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 Update qemu_fflush and stdio_close to use writev ops Signed-off-by: Orit Wasserman --- savevm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/savevm.c b/savevm.c index d5834ca..9506a20 100644 --- a/savevm.c +++ b/savevm.c @@ -297,7 +297,7 @@ static int stdio_fclose(void *opaque) QEMUFileStdio *s = opaque; int ret = 0; - if (s->file->ops->put_buffer) { + if (s->file->ops->writev_buffer) { int fd = fileno(s->stdio_file); struct stat st; @@ -534,18 +534,19 @@ static void qemu_file_set_error(QEMUFile *f, int ret) } } -/** Flushes QEMUFile buffer +/** + * Flushes QEMUFile iovec * */ static void qemu_fflush(QEMUFile *f) { int ret = 0; - if (!f->ops->put_buffer) { + if (!f->ops->writev_buffer) { return; } - if (f->is_write && f->buf_index > 0) { - ret = f->ops->put_buffer(f->opaque, f->buf, f->pos, f->buf_index); + if (f->is_write && f->iovcnt > 0) { + ret = f->ops->writev_buffer(f->opaque, f->iov, f->iovcnt); if (ret >= 0) { f->pos += f->buf_index; }