From patchwork Fri Mar 22 14:47:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orit Wasserman X-Patchwork-Id: 230077 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 B5C3B2C00CB for ; Sat, 23 Mar 2013 01:49:27 +1100 (EST) Received: from localhost ([::1]:56263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ3Ha-0000k8-0O for incoming@patchwork.ozlabs.org; Fri, 22 Mar 2013 10:49:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ3FL-00064D-9Z for qemu-devel@nongnu.org; Fri, 22 Mar 2013 10:47:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJ3FK-0007fg-1c for qemu-devel@nongnu.org; Fri, 22 Mar 2013 10:47:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55537) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ3FJ-0007fX-RC for qemu-devel@nongnu.org; Fri, 22 Mar 2013 10:47:05 -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 r2MEl43X007993 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 22 Mar 2013 10:47:04 -0400 Received: from dhcp-1-120.tlv.redhat.com (vpn-200-53.tlv.redhat.com [10.35.200.53]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2MEkukl010401; Fri, 22 Mar 2013 10:47:02 -0400 From: Orit Wasserman To: qemu-devel@nongnu.org Date: Fri, 22 Mar 2013 16:47:58 +0200 Message-Id: <1363963683-26157-3-git-send-email-owasserm@redhat.com> In-Reply-To: <1363963683-26157-1-git-send-email-owasserm@redhat.com> References: <1363963683-26157-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: mst@redhat.com, quintela@redhat.com, Orit Wasserman , pbonzini@redhat.com, chegu_vinod@hp.com Subject: [Qemu-devel] [PATCH v5 2/7] Add socket_writev_buffer function 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 Signed-off-by: Orit Wasserman --- savevm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/savevm.c b/savevm.c index 35c8d1e..21140c4 100644 --- a/savevm.c +++ b/savevm.c @@ -39,6 +39,7 @@ #include "qmp-commands.h" #include "trace.h" #include "qemu/bitops.h" +#include "qemu/iov.h" #define SELF_ANNOUNCE_ROUNDS 5 @@ -171,6 +172,19 @@ static void coroutine_fn yield_until_fd_readable(int fd) qemu_coroutine_yield(); } +static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt) +{ + QEMUFileSocket *s = opaque; + ssize_t len; + ssize_t size = iov_size(iov, iovcnt); + + len = iov_send(s->fd, iov, iovcnt, 0, size); + if (len < size) { + len = -socket_error(); + } + return len; +} + static int socket_get_fd(void *opaque) { QEMUFileSocket *s = opaque; @@ -387,6 +401,7 @@ static const QEMUFileOps socket_read_ops = { static const QEMUFileOps socket_write_ops = { .get_fd = socket_get_fd, .put_buffer = socket_put_buffer, + .writev_buffer = socket_writev_buffer, .close = socket_close };