xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: xen-devel@lists.xensource.com
Subject: [PATCH] tools/libvchan: fix build errors caused by Werror in io.c
Date: Tue, 03 Apr 2012 19:36:06 +0200	[thread overview]
Message-ID: <7c0fd18a2ba52da307ba.1333474566@probook.site> (raw)

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333472656 -7200
# Node ID 7c0fd18a2ba52da307ba04859086c85ac83223ce
# Parent  1a0b5c53a3da2a47a98ec093b296616c4b22d810
tools/libvchan: fix build errors caused by Werror in io.c

-O2 -Wall -Werror triggers these warnings:

io.c: In function 'do_send':
io.c:196: warning: ignoring return value of 'writev', declared with attribute warn_unused_result
io.c: In function 'do_recv':
io.c:287: warning: ignoring return value of 'writev', declared with attribute warn_unused_result

writev to -1 will always fail, silence the warning by removing the offending
(disabled) debug code.

v3:
 - remove debug code
v2:
 - add comment about writev use case (see comment about strace in the code)

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 1a0b5c53a3da -r 7c0fd18a2ba5 tools/libvchan/io.c
--- a/tools/libvchan/io.c
+++ b/tools/libvchan/io.c
@@ -49,11 +49,6 @@
 #define PAGE_SIZE 4096
 #endif
 
-// allow vchan data to be easily observed in strace by doing a
-// writev() to FD -1 with the data being read/written.
-#ifndef VCHAN_DEBUG
-#define VCHAN_DEBUG 0
-#endif
 
 static inline uint32_t rd_prod(struct libxenvchan *ctrl)
 {
@@ -186,15 +181,6 @@ static int do_send(struct libxenvchan *c
 {
 	int real_idx = wr_prod(ctrl) & (wr_ring_size(ctrl) - 1);
 	int avail_contig = wr_ring_size(ctrl) - real_idx;
-	if (VCHAN_DEBUG) {
-		char metainfo[32];
-		struct iovec iov[2];
-		iov[0].iov_base = metainfo;
-		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p wr", ctrl);
-		iov[1].iov_base = (void *)data;
-		iov[1].iov_len = size;
-		writev(-1, iov, 2);
-	}
 	if (avail_contig > size)
 		avail_contig = size;
 	xen_mb(); /* read indexes /then/ write data */
@@ -277,15 +263,6 @@ static int do_recv(struct libxenvchan *c
 	}
 	xen_mb(); /* consume /then/ notify */
 	rd_cons(ctrl) += size;
-	if (VCHAN_DEBUG) {
-		char metainfo[32];
-		struct iovec iov[2];
-		iov[0].iov_base = metainfo;
-		iov[0].iov_len = snprintf(metainfo, 32, "vchan@%p rd", ctrl);
-		iov[1].iov_base = data;
-		iov[1].iov_len = size;
-		writev(-1, iov, 2);
-	}
 	if (send_notify(ctrl, VCHAN_NOTIFY_READ))
 		return -1;
 	return size;

             reply	other threads:[~2012-04-03 17:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 17:36 Olaf Hering [this message]
2012-04-17 17:19 ` [PATCH] tools/libvchan: fix build errors caused by Werror in io.c Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c0fd18a2ba52da307ba.1333474566@probook.site \
    --to=olaf@aepfle.de \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).