xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror
  2012-03-30  8:25 [PATCH 00 of 18] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
@ 2012-03-30  8:25 ` Olaf Hering
  2012-04-02 14:39   ` Ian Jackson
  0 siblings, 1 reply; 26+ messages in thread
From: Olaf Hering @ 2012-03-30  8:25 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333046764 -7200
# Node ID 95ab84b43c99e4c9a82cd42aca0e021a091741b4
# Parent  46ec38b96a225eadcadd70927eb2b136f1172265
tools/memshr: fix build errors caused by Werror

-O2 -Wall -Werror triggers these warnings:

cc1: warnings being treated as errors
interface.c: In function 'memshr_daemon_initialize':
interface.c:55: error: unused variable 'h'
interface.c:54: error: unused variable 'shm_base_addr'
cc1: warnings being treated as errors
bidir-hash.h:47: error: 'fgprtshr_fgprt_hash' defined but not used
bidir-hash.h:52: error: 'fgprtshr_mfn_hash' defined but not used
bidir-hash.h:57: error: 'fgprtshr_fgprt_cmp' defined but not used
bidir-hash.h:62: error: 'fgprtshr_mfn_cmp' defined but not used
make[3]: *** [interface.o] Error 1
make[3]: *** [bidir-daemon.o] Error 1
cc1: warnings being treated as errors
bidir-hash.h:47: error: 'fgprtshr_fgprt_hash' defined but not used
bidir-hash.h:52: error: 'fgprtshr_mfn_hash' defined but not used
bidir-hash.h:57: error: 'fgprtshr_fgprt_cmp' defined but not used
bidir-hash.h:62: error: 'fgprtshr_mfn_cmp' defined but not used

Mark fingerprint functions as inline, remove unused variables.

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

diff -r 46ec38b96a22 -r 95ab84b43c99 tools/memshr/bidir-hash.h
--- a/tools/memshr/bidir-hash.h
+++ b/tools/memshr/bidir-hash.h
@@ -43,22 +43,22 @@ typedef struct vbdblk {
 #undef BIDIR_VALUE
 #undef BIDIR_KEY_T
 #undef BIDIR_VALUE_T
-static uint32_t fgprtshr_fgprt_hash(uint32_t h)
+static inline uint32_t fgprtshr_fgprt_hash(uint32_t h)
 {
     return h;
 }
 
-static uint32_t fgprtshr_mfn_hash(uint64_t m)
+static inline uint32_t fgprtshr_mfn_hash(uint64_t m)
 {
     return (uint32_t)m;
 }
 
-static int fgprtshr_fgprt_cmp(uint32_t h1, uint32_t h2)
+static inline int fgprtshr_fgprt_cmp(uint32_t h1, uint32_t h2)
 {
     return (h1 == h2);
 }
 
-static int fgprtshr_mfn_cmp(uint32_t m1, uint32_t m2)
+static inline int fgprtshr_mfn_cmp(uint32_t m1, uint32_t m2)
 {
     return (m1 == m2);
 }
diff -r 46ec38b96a22 -r 95ab84b43c99 tools/memshr/interface.c
--- a/tools/memshr/interface.c
+++ b/tools/memshr/interface.c
@@ -51,9 +51,6 @@ void memshr_set_domid(int domid)
 
 void memshr_daemon_initialize(void)
 {
-    void *shm_base_addr;
-    struct fgprtshr_hash *h;
-
     memset(&memshr, 0, sizeof(private_memshr_info_t));
 
     if((SHARED_INFO = shm_shared_info_open(1)) == NULL)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror
  2012-03-30  8:25 ` [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror Olaf Hering
@ 2012-04-02 14:39   ` Ian Jackson
  0 siblings, 0 replies; 26+ messages in thread
From: Ian Jackson @ 2012-04-02 14:39 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel

Olaf Hering writes ("[Xen-devel] [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror"):
> tools/memshr: fix build errors caused by Werror
...
> Mark fingerprint functions as inline, remove unused variables.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror
@ 2012-04-02 20:15 Olaf Hering
  2012-04-02 20:15 ` [PATCH 01 of 18] tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num Olaf Hering
                   ` (17 more replies)
  0 siblings, 18 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson


Changes:
tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num
tools/blktap: constify string arrays in convert_dev_name_to_num
tools/blktap: fix params and physical-device parsing
tools/blktap: remove unneeded pointer dereferencing from img2qcow.c
tools/blktap: remove unneeded pointer dereferencing from qcow2raw.c
tools/blktap2: fix build errors caused by Werror in vhd_journal_write_entry
tools/blktap2: fix out of bounds access in block-log.c
tools/blktap2: fix build errors caused by Werror in tdqcow_get_parent_id
tools/blktap2: remove unneeded pointer dereferencing from img2qcow.c
tools/blktap2: remove unneeded pointer dereferencing from qcow2raw.c
tools/libvchan: fix function prototypes in node-select.c
tools/memshr: fix build errors caused by Werror
tools/xenpaging: fix build errors caused by -Werror
tools/libvchan: fix build errors caused by Werror in io.c
tools/blktap2: remove static string table from header file
tools/blktap2: fix build errors caused by Werror, remove blkif_op_name
tools/blktap2: remove unused labels
tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables

 tools/blktap/drivers/blktapctrl.c          |   19 ++++++-----------
 tools/blktap/drivers/block-aio.c           |    5 ----
 tools/blktap/drivers/block-qcow.c          |    8 +++----
 tools/blktap/drivers/block-qcow2.c         |    9 ++++----
 tools/blktap/drivers/block-ram.c           |    7 ------
 tools/blktap/drivers/block-sync.c          |    5 ----
 tools/blktap/drivers/img2qcow.c            |    7 +-----
 tools/blktap/drivers/qcow2raw.c            |    6 ++---
 tools/blktap/drivers/tapaio.c              |    1 
 tools/blktap/drivers/tapdisk.c             |   18 ++++++++--------
 tools/blktap/lib/xenbus.c                  |   11 ++++-----
 tools/blktap/lib/xs_api.c                  |   32 ++++++++++++++---------------
 tools/blktap2/control/tap-ctl-check.c      |    1 
 tools/blktap2/control/tap-ctl-list.c       |    3 --
 tools/blktap2/control/tap-ctl-spawn.c      |    2 -
 tools/blktap2/drivers/block-aio.c          |    3 --
 tools/blktap2/drivers/block-log.c          |   10 +++------
 tools/blktap2/drivers/block-qcow.c         |   21 ++++++++-----------
 tools/blktap2/drivers/block-ram.c          |    7 ------
 tools/blktap2/drivers/block-remus.c        |   16 +-------------
 tools/blktap2/drivers/block-vhd.c          |   24 ---------------------
 tools/blktap2/drivers/img2qcow.c           |   11 ++-------
 tools/blktap2/drivers/io-optimize.c        |    1 
 tools/blktap2/drivers/lock.c               |    1 
 tools/blktap2/drivers/qcow2raw.c           |    8 ++-----
 tools/blktap2/drivers/tapdisk-client.c     |    1 
 tools/blktap2/drivers/tapdisk-control.c    |    9 +-------
 tools/blktap2/drivers/tapdisk-diff.c       |    2 -
 tools/blktap2/drivers/tapdisk-filter.c     |    2 -
 tools/blktap2/drivers/tapdisk-interface.c  |    1 
 tools/blktap2/drivers/tapdisk-queue.c      |    4 ---
 tools/blktap2/drivers/tapdisk-server.c     |    1 
 tools/blktap2/drivers/tapdisk-stream.c     |    1 
 tools/blktap2/drivers/tapdisk-utils.c      |    1 
 tools/blktap2/drivers/tapdisk-vbd.c        |    5 ----
 tools/blktap2/drivers/td.c                 |    4 +--
 tools/blktap2/include/blktaplib.h          |   11 ---------
 tools/blktap2/include/vhd.h                |   11 ---------
 tools/blktap2/lvm/lvm-util.c               |    2 -
 tools/blktap2/vhd/lib/libvhd-journal.c     |   10 +--------
 tools/blktap2/vhd/lib/libvhd.c             |    6 +----
 tools/blktap2/vhd/lib/vhd-util-check.c     |    2 -
 tools/blktap2/vhd/lib/vhd-util-read.c      |   16 +++++++++++---
 tools/blktap2/vhd/lib/vhd-util-resize.c    |    2 -
 tools/blktap2/vhd/lib/vhd-util-scan.c      |    5 ----
 tools/blktap2/vhd/lib/vhd-util-set-field.c |    2 -
 tools/libvchan/io.c                        |    6 +++--
 tools/libvchan/node-select.c               |    4 +--
 tools/memshr/bidir-hash.h                  |    8 +++----
 tools/memshr/interface.c                   |    3 --
 tools/xenpaging/xenpaging.c                |    5 ----
 51 files changed, 113 insertions(+), 247 deletions(-)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 01 of 18] tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 02 of 18] tools/blktap: constify string arrays " Olaf Hering
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397497 -7200
# Node ID 21640ef72ce861892d71f3916ba6ed0f9a411cca
# Parent  14609be41f369c26e759c5d63cc0d2be2fc5b9b6
tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num

xs_api.c: In function 'convert_dev_name_to_num':
xs_api.c:227:4: warning: value computed is not used [-Wunused-value]
xs_api.c:229:3: warning: value computed is not used [-Wunused-value]
xs_api.c:235:4: warning: value computed is not used [-Wunused-value]
xs_api.c:237:3: warning: value computed is not used [-Wunused-value]
xs_api.c:244:4: warning: value computed is not used [-Wunused-value]
xs_api.c:246:3: warning: value computed is not used [-Wunused-value]

Do not dereference pointer before increment.

v2:
 - update description, fix only the actual compiler warning
   other unrelated changes will go into a separate patch

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

diff -r 14609be41f36 -r 21640ef72ce8 tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c
+++ b/tools/blktap/lib/xs_api.c
@@ -224,26 +224,26 @@ int convert_dev_name_to_num(char *name) 
 		for(i = 0, ptr = alpha; i < strlen(alpha); i++) {
 			if(*ptr == *p)
 				break;
-			*ptr++;
+			ptr++;
 		}
-		*p++;
+		p++;
 		ret = BASE_DEV_VAL + (16*i) + atoi(p);
 	} else if (strstr(name, p_hd) != NULL) {
 		p = name + strlen(p_hd);
 		for (i = 0, ptr = alpha; i < strlen(alpha); i++) {
 			if(*ptr == *p) break;
-			*ptr++;
+			ptr++;
 		}
-		*p++;
+		p++;
 		ret = (majors[i/2]*256) + atoi(p);
 
 	} else if (strstr(name, p_xvd) != NULL) {
 		p = name + strlen(p_xvd);
 		for(i = 0, ptr = alpha; i < strlen(alpha); i++) {
 			if(*ptr == *p) break;
-			*ptr++;
+			ptr++;
 		}
-		*p++;
+		p++;
 		ret = (202*256) + (16*i) + atoi(p);
 
 	} else if (strstr(name, p_plx) != NULL) {

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 02 of 18] tools/blktap: constify string arrays in convert_dev_name_to_num
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
  2012-04-02 20:15 ` [PATCH 01 of 18] tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 03 of 18] tools/blktap: fix params and physical-device parsing Olaf Hering
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397505 -7200
# Node ID 569fc8260490b64ae837c6ed67f1a5b2e582744c
# Parent  21640ef72ce861892d71f3916ba6ed0f9a411cca
tools/blktap: constify string arrays in convert_dev_name_to_num

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

diff -r 21640ef72ce8 -r 569fc8260490 tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c
+++ b/tools/blktap/lib/xs_api.c
@@ -210,14 +210,15 @@ done:
 }
 
 int convert_dev_name_to_num(char *name) {
-	char *p, *ptr;
+	char *p;
+	const char *ptr;
 	int majors[10] = {3,22,33,34,56,57,88,89,90,91};
 	int maj,i,ret = 0;
-	char *p_sd = "/dev/sd";
-	char *p_hd = "/dev/hd";
-	char *p_xvd = "/dev/xvd";
-	char *p_plx = "plx";
-	char *alpha = "abcdefghijklmnop";
+	const char p_sd[] = "/dev/sd";
+	const char p_hd[] = "/dev/hd";
+	const char p_xvd[] = "/dev/xvd";
+	const char p_plx[] = "plx";
+	const char alpha[] = "abcdefghijklmnop";
 
 	if (strstr(name, p_sd) != NULL) {
 		p = name + strlen(p_sd);

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 03 of 18] tools/blktap: fix params and physical-device parsing
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
  2012-04-02 20:15 ` [PATCH 01 of 18] tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num Olaf Hering
  2012-04-02 20:15 ` [PATCH 02 of 18] tools/blktap: constify string arrays " Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 04 of 18] tools/blktap: remove unneeded pointer dereferencing from img2qcow.c Olaf Hering
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397506 -7200
# Node ID 90e2257cace2c3b7b8e7c4611614ad4da07ec895
# Parent  569fc8260490b64ae837c6ed67f1a5b2e582744c
tools/blktap: fix params and physical-device parsing

If parsing the "physical-device" property fails the physical device node
should come from the "params" property. But since the deverr value was
overwritten during read of the "mode" property, the "params" property
was never parsed.

Fix this by using different local variable for reading "mode" so that
deverr can be reused to check the "params" property.

v2:
 - use different local variable as suggested by IanJ

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

diff -r 569fc8260490 -r 90e2257cace2 tools/blktap/lib/xenbus.c
--- a/tools/blktap/lib/xenbus.c
+++ b/tools/blktap/lib/xenbus.c
@@ -346,8 +346,8 @@ static void ueblktap_setup(struct xs_han
 	}
 
 	/* Check to see if device is to be opened read-only. */
-	deverr = xs_gather(h, bepath, "mode", NULL, &path, NULL);
-	if (deverr) {
+	er = xs_gather(h, bepath, "mode", NULL, &path, NULL);
+	if (er) {
 		DPRINTF("ERROR: could not find read/write mode\n");
 		goto fail;
 	} else if (path[0] == 'r')

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 04 of 18] tools/blktap: remove unneeded pointer dereferencing from img2qcow.c
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (2 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 03 of 18] tools/blktap: fix params and physical-device parsing Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 05 of 18] tools/blktap: remove unneeded pointer dereferencing from qcow2raw.c Olaf Hering
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397521 -7200
# Node ID ae6bf2207a4e36ca6a60b42e82f79b8de09acec3
# Parent  90e2257cace2c3b7b8e7c4611614ad4da07ec895
tools/blktap: remove unneeded pointer dereferencing from img2qcow.c

img2qcow.c: In function 'print_bytes':
img2qcow.c:72:9: warning: value computed is not used [-Wunused-value]

Do not dereference pointer before increment.

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

diff -r 90e2257cace2 -r ae6bf2207a4e tools/blktap/drivers/img2qcow.c
--- a/tools/blktap/drivers/img2qcow.c
+++ b/tools/blktap/drivers/img2qcow.c
@@ -69,7 +69,7 @@ static void print_bytes(void *ptr, int l
     DFPRINTF("Buf dump, length %d:\n",length);
     for (k = 0; k < length; k++) {
         DFPRINTF("%x",*p);
-        *p++;
+        p++;
 	if(k % 16 == 0) DFPRINTF("\n");
         else if(k % 2 == 0) DFPRINTF(" ");	
     }

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 05 of 18] tools/blktap: remove unneeded pointer dereferencing from qcow2raw.c
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (3 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 04 of 18] tools/blktap: remove unneeded pointer dereferencing from img2qcow.c Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 06 of 18] tools/blktap2: fix build errors caused by Werror in vhd_journal_write_entry Olaf Hering
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397528 -7200
# Node ID cbdba2284f36dba539b7f5a0cded571c96f2bc4c
# Parent  ae6bf2207a4e36ca6a60b42e82f79b8de09acec3
tools/blktap: remove unneeded pointer dereferencing from qcow2raw.c

qcow2raw.c: In function 'print_bytes':
qcow2raw.c:76:9: warning: value computed is not used [-Wunused-value]

Do not dereference pointer before increment.

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

diff -r ae6bf2207a4e -r cbdba2284f36 tools/blktap/drivers/qcow2raw.c
--- a/tools/blktap/drivers/qcow2raw.c
+++ b/tools/blktap/drivers/qcow2raw.c
@@ -73,7 +73,7 @@ static void print_bytes(void *ptr, int l
     DFPRINTF("Buf dump, length %d:\n",length);
     for (k = 0; k < length; k++) {
         DFPRINTF("%x",*p);
-        *p++;
+        p++;
 	if (k % 16 == 0) DFPRINTF("\n");
         else if (k % 2 == 0) DFPRINTF(" ");	
     }

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 06 of 18] tools/blktap2: fix build errors caused by Werror in vhd_journal_write_entry
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (4 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 05 of 18] tools/blktap: remove unneeded pointer dereferencing from qcow2raw.c Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 07 of 18] tools/blktap2: fix out of bounds access in block-log.c Olaf Hering
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397533 -7200
# Node ID 8d134408ddf233c6fe3a452b9b9f0780f91170e6
# Parent  cbdba2284f36dba539b7f5a0cded571c96f2bc4c
tools/blktap2: fix build errors caused by Werror in vhd_journal_write_entry

-O2 -Wall -Werror triggers these warnings:

libvhd-journal.c: In function 'vhd_journal_write_entry':
libvhd-journal.c:335: warning: statement with no effect

Really return the error from vhd_journal_write() to caller.

v2:
 - simplify the patch by just adding the missing return statement

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

diff -r cbdba2284f36 -r 8d134408ddf2 tools/blktap2/vhd/lib/libvhd-journal.c
--- a/tools/blktap2/vhd/lib/libvhd-journal.c
+++ b/tools/blktap2/vhd/lib/libvhd-journal.c
@@ -332,7 +332,7 @@ vhd_journal_write_entry(vhd_journal_t *j
 
 	err = vhd_journal_write(j, &e, sizeof(vhd_journal_entry_t));
 	if (err)
-		err;
+		return err;
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 07 of 18] tools/blktap2: fix out of bounds access in block-log.c
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (5 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 06 of 18] tools/blktap2: fix build errors caused by Werror in vhd_journal_write_entry Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 08 of 18] tools/blktap2: fix build errors caused by Werror in tdqcow_get_parent_id Olaf Hering
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397537 -7200
# Node ID acb561c6d4d8ebee95ad0e7007f99a2d22dbaa34
# Parent  8d134408ddf233c6fe3a452b9b9f0780f91170e6
tools/blktap2: fix out of bounds access in block-log.c

block-log.c: In function 'ctl_close_sock':
block-log.c:363:23: warning: array subscript is above array bounds [-Warray-bounds]

Adjust loop condition in ctl_close_sock() to fix warning.
Adjust array acccess in ctl_close() to actually access the array member.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r 8d134408ddf2 -r acb561c6d4d8 tools/blktap2/drivers/block-log.c
--- a/tools/blktap2/drivers/block-log.c
+++ b/tools/blktap2/drivers/block-log.c
@@ -324,11 +324,11 @@ static int ctl_open(struct tdlog_state* 
 static int ctl_close(struct tdlog_state* s)
 {
   while (s->connected) {
+    s->connected--;
     tapdisk_server_unregister_event(s->connections[s->connected].id);
     close(s->connections[s->connected].fd);
     s->connections[s->connected].fd = -1;
     s->connections[s->connected].id = 0;
-    s->connected--;
   }
 
   if (s->ctl.fd >= 0) {
@@ -359,7 +359,7 @@ static int ctl_close_sock(struct tdlog_s
 {
   int i;
 
-  for (i = 0; i <= s->connected; i++) {
+  for (i = 0; i < s->connected; i++) {
     if (s->connections[i].fd == fd) {
       tapdisk_server_unregister_event(s->connections[i].id);
       close(s->connections[i].fd);

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 08 of 18] tools/blktap2: fix build errors caused by Werror in tdqcow_get_parent_id
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (6 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 07 of 18] tools/blktap2: fix out of bounds access in block-log.c Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 09 of 18] tools/blktap2: remove unneeded pointer dereferencing from img2qcow.c Olaf Hering
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397540 -7200
# Node ID e9b9e8254311fb61930ab5a954e777928466c607
# Parent  acb561c6d4d8ebee95ad0e7007f99a2d22dbaa34
tools/blktap2: fix build errors caused by Werror in tdqcow_get_parent_id

-O2 -Wall -Werror triggers these warnings:

block-qcow.c: In function 'tdqcow_get_parent_id':
block-qcow.c:1457:17: warning: 'type' may be used uninitialized in this function [-Wuninitialized]

The compiler can not know that open() writes to errno so it has to
assume that errno can be zero. Use assert as hint for gcc.

v2:
 - add assert() as suggested by IanJ

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

diff -r acb561c6d4d8 -r e9b9e8254311 tools/blktap2/drivers/block-qcow.c
--- a/tools/blktap2/drivers/block-qcow.c
+++ b/tools/blktap2/drivers/block-qcow.c
@@ -34,6 +34,7 @@
 #include <inttypes.h>
 #include <libaio.h>
 #include <limits.h>
+#include <assert.h>
 #include "bswap.h"
 #include "aes.h"
 #include "md5.h"
@@ -1407,8 +1408,10 @@ tdqcow_get_image_type(const char *file, 
 	QCowHeader header;
 
 	fd = open(file, O_RDONLY);
-	if (fd == -1)
+	if (fd == -1) {
+		assert(errno);
 		return -errno;
+	}
 
 	size = read(fd, &header, sizeof(header));
 	close(fd);

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 09 of 18] tools/blktap2: remove unneeded pointer dereferencing from img2qcow.c
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (7 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 08 of 18] tools/blktap2: fix build errors caused by Werror in tdqcow_get_parent_id Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 10 of 18] tools/blktap2: remove unneeded pointer dereferencing from qcow2raw.c Olaf Hering
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397548 -7200
# Node ID 9b7de2b8d7d6c8312e10dabb68ebebeb5bfd1787
# Parent  e9b9e8254311fb61930ab5a954e777928466c607
tools/blktap2: remove unneeded pointer dereferencing from img2qcow.c

img2qcow.c: In function 'print_bytes':
img2qcow.c:90:9: warning: value computed is not used [-Wunused-value]

Do not dereference pointer before increment.

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

diff -r e9b9e8254311 -r 9b7de2b8d7d6 tools/blktap2/drivers/img2qcow.c
--- a/tools/blktap2/drivers/img2qcow.c
+++ b/tools/blktap2/drivers/img2qcow.c
@@ -87,7 +87,7 @@ static void print_bytes(void *ptr, int l
     DFPRINTF("Buf dump, length %d:\n",length);
     for (k = 0; k < length; k++) {
         DFPRINTF("%x",*p);
-        *p++;
+        p++;
 	if(k % 16 == 0) DFPRINTF("\n");
         else if(k % 2 == 0) DFPRINTF(" ");	
     }

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 10 of 18] tools/blktap2: remove unneeded pointer dereferencing from qcow2raw.c
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (8 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 09 of 18] tools/blktap2: remove unneeded pointer dereferencing from img2qcow.c Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 11 of 18] tools/libvchan: fix function prototypes in node-select.c Olaf Hering
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397554 -7200
# Node ID b0863d6ce260ffdfb9dd6c76d84c083fcf372a7f
# Parent  9b7de2b8d7d6c8312e10dabb68ebebeb5bfd1787
tools/blktap2: remove unneeded pointer dereferencing from qcow2raw.c

qcow2raw.c: In function 'print_bytes':
qcow2raw.c:96:9: warning: value computed is not used [-Wunused-value]

Do not dereference pointer before increment.

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

diff -r 9b7de2b8d7d6 -r b0863d6ce260 tools/blktap2/drivers/qcow2raw.c
--- a/tools/blktap2/drivers/qcow2raw.c
+++ b/tools/blktap2/drivers/qcow2raw.c
@@ -93,7 +93,7 @@ static void print_bytes(void *ptr, int l
     DFPRINTF("Buf dump, length %d:\n",length);
     for (k = 0; k < length; k++) {
         DFPRINTF("%x",*p);
-        *p++;
+        p++;
 	if (k % 16 == 0) DFPRINTF("\n");
         else if (k % 2 == 0) DFPRINTF(" ");	
     }

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 11 of 18] tools/libvchan: fix function prototypes in node-select.c
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (9 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 10 of 18] tools/blktap2: remove unneeded pointer dereferencing from qcow2raw.c Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror Olaf Hering
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397559 -7200
# Node ID c582ef14a24cb2186c1748047a62a85fae0dbeb3
# Parent  b0863d6ce260ffdfb9dd6c76d84c083fcf372a7f
tools/libvchan: fix function prototypes in node-select.c

-O2 -Wall -Werror triggers these warnings:

node-select.c:57:6: warning: function declaration isn't a prototype [-Wstrict-prototypes]
node-select.c:71:6: warning: function declaration isn't a prototype [-Wstrict-prototypes]

v2:
 - fix just the -Wstrict-prototypes warning

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

diff -r b0863d6ce260 -r c582ef14a24c tools/libvchan/node-select.c
--- a/tools/libvchan/node-select.c
+++ b/tools/libvchan/node-select.c
@@ -54,7 +54,7 @@ int insiz = 0;
 int outsiz = 0;
 struct libxenvchan *ctrl = 0;
 
-void vchan_wr() {
+void vchan_wr(void) {
 	if (!insiz)
 		return;
 	int ret = libxenvchan_write(ctrl, inbuf, insiz);
@@ -68,7 +68,7 @@ void vchan_wr() {
 	}
 }
 
-void stdout_wr() {
+void stdout_wr(void) {
 	if (!outsiz)
 		return;
 	int ret = write(1, outbuf, outsiz);

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (10 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 11 of 18] tools/libvchan: fix function prototypes in node-select.c Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 13 of 18] tools/xenpaging: fix build errors caused by -Werror Olaf Hering
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397566 -7200
# Node ID 5d89ebdf878b8b0647a688d0ef938bb933772d86
# Parent  c582ef14a24cb2186c1748047a62a85fae0dbeb3
tools/memshr: fix build errors caused by Werror

-O2 -Wall -Werror triggers these warnings:

cc1: warnings being treated as errors
interface.c: In function 'memshr_daemon_initialize':
interface.c:55: error: unused variable 'h'
interface.c:54: error: unused variable 'shm_base_addr'
cc1: warnings being treated as errors
bidir-hash.h:47: error: 'fgprtshr_fgprt_hash' defined but not used
bidir-hash.h:52: error: 'fgprtshr_mfn_hash' defined but not used
bidir-hash.h:57: error: 'fgprtshr_fgprt_cmp' defined but not used
bidir-hash.h:62: error: 'fgprtshr_mfn_cmp' defined but not used
make[3]: *** [interface.o] Error 1
make[3]: *** [bidir-daemon.o] Error 1
cc1: warnings being treated as errors
bidir-hash.h:47: error: 'fgprtshr_fgprt_hash' defined but not used
bidir-hash.h:52: error: 'fgprtshr_mfn_hash' defined but not used
bidir-hash.h:57: error: 'fgprtshr_fgprt_cmp' defined but not used
bidir-hash.h:62: error: 'fgprtshr_mfn_cmp' defined but not used

Mark fingerprint functions as inline, remove unused variables.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r c582ef14a24c -r 5d89ebdf878b tools/memshr/bidir-hash.h
--- a/tools/memshr/bidir-hash.h
+++ b/tools/memshr/bidir-hash.h
@@ -43,22 +43,22 @@ typedef struct vbdblk {
 #undef BIDIR_VALUE
 #undef BIDIR_KEY_T
 #undef BIDIR_VALUE_T
-static uint32_t fgprtshr_fgprt_hash(uint32_t h)
+static inline uint32_t fgprtshr_fgprt_hash(uint32_t h)
 {
     return h;
 }
 
-static uint32_t fgprtshr_mfn_hash(uint64_t m)
+static inline uint32_t fgprtshr_mfn_hash(uint64_t m)
 {
     return (uint32_t)m;
 }
 
-static int fgprtshr_fgprt_cmp(uint32_t h1, uint32_t h2)
+static inline int fgprtshr_fgprt_cmp(uint32_t h1, uint32_t h2)
 {
     return (h1 == h2);
 }
 
-static int fgprtshr_mfn_cmp(uint32_t m1, uint32_t m2)
+static inline int fgprtshr_mfn_cmp(uint32_t m1, uint32_t m2)
 {
     return (m1 == m2);
 }
diff -r c582ef14a24c -r 5d89ebdf878b tools/memshr/interface.c
--- a/tools/memshr/interface.c
+++ b/tools/memshr/interface.c
@@ -51,9 +51,6 @@ void memshr_set_domid(int domid)
 
 void memshr_daemon_initialize(void)
 {
-    void *shm_base_addr;
-    struct fgprtshr_hash *h;
-
     memset(&memshr, 0, sizeof(private_memshr_info_t));
 
     if((SHARED_INFO = shm_shared_info_open(1)) == NULL)

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 13 of 18] tools/xenpaging: fix build errors caused by -Werror
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (11 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c Olaf Hering
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397571 -7200
# Node ID 1a0b5c53a3da2a47a98ec093b296616c4b22d810
# Parent  5d89ebdf878b8b0647a688d0ef938bb933772d86
tools/xenpaging: fix build errors caused by -Werror

-O2 -Wall -Werror triggers these warnings:

xenpaging.c: In function 'xenpaging_init':
xenpaging.c:284: warning: unused variable 'p'
xenpaging.c: In function 'xenpaging_evict_page':
xenpaging.c:606: warning: unused variable 'domctl'
xenpaging.c: In function 'resume_pages':
xenpaging.c:742: warning: unused variable 'xch'
xenpaging.c: In function 'evict_pages':
xenpaging.c:820: warning: unused variable 'xch'

Remove the offending local variables.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r 5d89ebdf878b -r 1a0b5c53a3da tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -279,7 +279,6 @@ static struct xenpaging *xenpaging_init(
     xc_domaininfo_t domain_info;
     xc_interface *xch = NULL;
     xentoollog_logger *dbg = NULL;
-    char *p;
     int rc;
     unsigned long ring_pfn, mmap_pfn;
 
@@ -601,8 +600,6 @@ static int xenpaging_evict_page(struct x
     xen_pfn_t victim = gfn;
     int ret;
 
-    DECLARE_DOMCTL;
-
     /* Nominate page */
     ret = xc_mem_paging_nominate(xch, paging->mem_event.domain_id, gfn);
     if ( ret < 0 )
@@ -737,7 +734,6 @@ static int xenpaging_populate_page(struc
 /* Trigger a page-in for a batch of pages */
 static void resume_pages(struct xenpaging *paging, int num_pages)
 {
-    xc_interface *xch = paging->xc_handle;
     int i, num = 0;
 
     for ( i = 0; i < paging->max_pages && num < num_pages; i++ )
@@ -815,7 +811,6 @@ static int evict_victim(struct xenpaging
  */
 static int evict_pages(struct xenpaging *paging, int num_pages)
 {
-    xc_interface *xch = paging->xc_handle;
     int rc, slot, num = 0;
 
     /* Reuse known free slots */

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (12 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 13 of 18] tools/xenpaging: fix build errors caused by -Werror Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-03 10:25   ` Ian Jackson
  2012-04-02 20:15 ` [PATCH 15 of 18] tools/blktap2: remove static string table from header file Olaf Hering
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397572 -7200
# Node ID 3d15aa971865cf18dac45cb70b53b5380604cc8d
# 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.

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 3d15aa971865 tools/libvchan/io.c
--- a/tools/libvchan/io.c
+++ b/tools/libvchan/io.c
@@ -193,7 +193,8 @@ static int do_send(struct libxenvchan *c
 		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);
+		/* Silence gcc warning, will always fail */
+		if (writev(-1, iov, 2));
 	}
 	if (avail_contig > size)
 		avail_contig = size;
@@ -284,7 +285,8 @@ static int do_recv(struct libxenvchan *c
 		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);
+		/* Silence gcc warning, will always fail */
+		if (writev(-1, iov, 2));
 	}
 	if (send_notify(ctrl, VCHAN_NOTIFY_READ))
 		return -1;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 15 of 18] tools/blktap2: remove static string table from header file
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (13 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 16 of 18] tools/blktap2: fix build errors caused by Werror, remove blkif_op_name Olaf Hering
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397578 -7200
# Node ID 55f205a0d2d6831f0e0280bd19d0ade22ebd9fe3
# Parent  3d15aa971865cf18dac45cb70b53b5380604cc8d
tools/blktap2: remove static string table from header file

-O2 -Wall -Werror triggers these warnings:

../../include/vhd.h:109: warning: 'HD_TYPE_STR' defined but not used

Since its used only in one place, move it to the .c file.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r 3d15aa971865 -r 55f205a0d2d6 tools/blktap2/include/vhd.h
--- a/tools/blktap2/include/vhd.h
+++ b/tools/blktap2/include/vhd.h
@@ -105,17 +105,6 @@ static const char HD_COOKIE[9]  =  "cone
 #define HD_TYPE_DYNAMIC    3  /* dynamic disk */
 #define HD_TYPE_DIFF       4  /* differencing disk */
 
-/* String table for hd.type */
-static const char *HD_TYPE_STR[7] = {
-        "None",                    /* 0 */
-        "Reserved (deprecated)",   /* 1 */
-        "Fixed hard disk",         /* 2 */
-        "Dynamic hard disk",       /* 3 */
-        "Differencing hard disk",  /* 4 */
-        "Reserved (deprecated)",   /* 5 */
-        "Reserved (deprecated)"    /* 6 */
-};
-
 #define HD_TYPE_MAX 6
 
 struct prt_loc {
diff -r 3d15aa971865 -r 55f205a0d2d6 tools/blktap2/vhd/lib/vhd-util-read.c
--- a/tools/blktap2/vhd/lib/vhd-util-read.c
+++ b/tools/blktap2/vhd/lib/vhd-util-read.c
@@ -34,6 +34,17 @@
 #include "libvhd.h"
 #include "vhd-util.h"
 
+/* String table for hd.type */
+static const char *HD_TYPE_STR[7] = {
+        "None",                    /* 0 */
+        "Reserved (deprecated)",   /* 1 */
+        "Fixed hard disk",         /* 2 */
+        "Dynamic hard disk",       /* 3 */
+        "Differencing hard disk",  /* 4 */
+        "Reserved (deprecated)",   /* 5 */
+        "Reserved (deprecated)"    /* 6 */
+};
+
 #define nsize     15
 static char nbuf[nsize];

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 16 of 18] tools/blktap2: fix build errors caused by Werror, remove blkif_op_name
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (14 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 15 of 18] tools/blktap2: remove static string table from header file Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 17 of 18] tools/blktap2: remove unused labels Olaf Hering
  2012-04-02 20:15 ` [PATCH 18 of 18] tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables Olaf Hering
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397580 -7200
# Node ID 71055bfdb14c72072d9b3fdf6b3c4973ae5b8a20
# Parent  55f205a0d2d6831f0e0280bd19d0ade22ebd9fe3
tools/blktap2: fix build errors caused by Werror, remove blkif_op_name

-O2 -Wall -Werror triggers these warnings:

../include/blktaplib.h:235: warning: 'blkif_op_name' defined but not used

blkif_op_name[] is odd and appearently not used according to google, except in
an 7 years old blkdump.c which would not compile anyway with current blktap.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r 55f205a0d2d6 -r 71055bfdb14c tools/blktap2/include/blktaplib.h
--- a/tools/blktap2/include/blktaplib.h
+++ b/tools/blktap2/include/blktaplib.h
@@ -228,15 +228,4 @@ typedef struct msg_lock {
      ((_req) * BLKIF_MAX_SEGMENTS_PER_REQUEST * getpagesize()) +      \
      ((_seg) * getpagesize()))
 
-/* Defines that are only used by library clients */
-
-#ifndef __COMPILING_BLKTAP_LIB
-
-static char *blkif_op_name[] = {
-	[BLKIF_OP_READ]       = "READ",
-	[BLKIF_OP_WRITE]      = "WRITE",
-};
-
-#endif /* __COMPILING_BLKTAP_LIB */
-
 #endif /* __BLKTAPLIB_H__ */

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 17 of 18] tools/blktap2: remove unused labels
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (15 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 16 of 18] tools/blktap2: fix build errors caused by Werror, remove blkif_op_name Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-02 20:15 ` [PATCH 18 of 18] tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables Olaf Hering
  17 siblings, 0 replies; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397583 -7200
# Node ID a85817bc44e57a805afffc3e91d5bf7051a361e0
# Parent  71055bfdb14c72072d9b3fdf6b3c4973ae5b8a20
tools/blktap2: remove unused labels

vhd-util-read.c:478:2: warning: label 'print' defined but not used [-Wunused-label]
vhd-util-set-field.c:99:2: warning: label 'done' defined but not used [-Wunused-label]

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

diff -r 71055bfdb14c -r a85817bc44e5 tools/blktap2/vhd/lib/vhd-util-read.c
--- a/tools/blktap2/vhd/lib/vhd-util-read.c
+++ b/tools/blktap2/vhd/lib/vhd-util-read.c
@@ -475,7 +475,6 @@ vhd_test_bitmap(vhd_context_t *vhd, uint
 		else
 			bit = vhd_bitmap_test(vhd, buf, blk);
 
-	print:
 		printf("block %s: ", conv(hex, blk));
 		printf("sec: %s: %d\n", conv(hex, sec), bit);
 	}
diff -r 71055bfdb14c -r a85817bc44e5 tools/blktap2/vhd/lib/vhd-util-set-field.c
--- a/tools/blktap2/vhd/lib/vhd-util-set-field.c
+++ b/tools/blktap2/vhd/lib/vhd-util-set-field.c
@@ -96,7 +96,6 @@ vhd_util_set_field(int argc, char **argv
 
 	err = vhd_write_footer(&vhd, &vhd.footer);
 		
- done:
 	vhd_close(&vhd);
 	return err;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 18 of 18] tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables
  2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
                   ` (16 preceding siblings ...)
  2012-04-02 20:15 ` [PATCH 17 of 18] tools/blktap2: remove unused labels Olaf Hering
@ 2012-04-02 20:15 ` Olaf Hering
  2012-04-03 13:21   ` Ian Jackson
  17 siblings, 1 reply; 26+ messages in thread
From: Olaf Hering @ 2012-04-02 20:15 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1333397703 -7200
# Node ID 33af0a492bf7d2d682fe87f6a0a1501efc187508
# Parent  a85817bc44e57a805afffc3e91d5bf7051a361e0
tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables

-O2 -Wall -Werror triggers these warnings below.
The patch removes all listed local variables, a few static arrays in
header files will be changed in another patch.

xenbus.c: In function 'ueblktap_setup':
xenbus.c:325:6: warning: unused variable 'len' [-Wunused-variable]
xenbus.c:324:25: warning: unused variable 'dev' [-Wunused-variable]
xenbus.c: In function 'ueblktap_probe':
xenbus.c:453:11: warning: unused variable 'blkif' [-Wunused-variable]
xenbus.c:451:42: warning: unused variable 'p' [-Wunused-variable]
--
xs_api.c: In function 'xs_gather':
xs_api.c:64:19: warning: unused variable 'i' [-Wunused-variable]
xs_api.c:64:15: warning: unused variable 'num' [-Wunused-variable]
xs_api.c:63:16: warning: unused variable 'e' [-Wunused-variable]
xs_api.c: In function 'convert_dev_name_to_num':
xs_api.c:216:6: warning: unused variable 'maj' [-Wunused-variable]
xs_api.c: In function 'xs_fire_next_watch':
xs_api.c:344:6: warning: unused variable 'er' [-Wunused-variable]
--
blktapctrl.c: In function 'del_disktype':
blktapctrl.c:257:43: warning: unused variable 'close' [-Wunused-variable]
blktapctrl.c:257:32: warning: unused variable 'count' [-Wunused-variable]
blktapctrl.c: In function 'write_msg':
blktapctrl.c:301:11: warning: unused variable 'seed' [-Wunused-variable]
blktapctrl.c:300:19: warning: unused variable 'img' [-Wunused-variable]
blktapctrl.c: In function 'read_msg':
blktapctrl.c:411:25: warning: unused variable 'len' [-Wunused-variable]
blktapctrl.c:410:8: warning: unused variable 'p' [-Wunused-variable]
blktapctrl.c: In function 'blktapctrl_new_blkif':
blktapctrl.c:656:19: warning: unused variable 'wrctldev' [-Wunused-variable]
blktapctrl.c:656:8: warning: unused variable 'rdctldev' [-Wunused-variable]
blktapctrl.c:655:45: warning: unused variable 'new' [-Wunused-variable]
blktapctrl.c:655:29: warning: unused variable 'fd_write' [-Wunused-variable]
blktapctrl.c:655:20: warning: unused variable 'fd_read' [-Wunused-variable]
blktapctrl.c: In function 'open_ctrl_socket':
blktapctrl.c:765:17: warning: unused variable 'timeout' [-Wunused-variable]
blktapctrl.c:764:9: warning: unused variable 'socks' [-Wunused-variable]
blktapctrl.c: In function 'main':
blktapctrl.c:835:26: warning: unused variable 'xs_fd' [-Wunused-variable]
blktapctrl.c:834:17: warning: unused variable 'ctlinfo' [-Wunused-variable]
blktapctrl.c:833:8: warning: unused variable 'devname' [-Wunused-variable]
--
tapdisk.c: In function 'daemonize':
tapdisk.c:65:6: warning: unused variable 'i' [-Wunused-variable]
tapdisk.c: In function 'add_fd_entry':
tapdisk.c:157:6: warning: unused variable 'i' [-Wunused-variable]
tapdisk.c: In function 'read_msg':
tapdisk.c:372:36: warning: unused variable 'io_fd' [-Wunused-variable]
tapdisk.c:372:27: warning: unused variable 'tap_fd' [-Wunused-variable]
tapdisk.c: In function 'do_cow_read':
tapdisk.c:596:11: warning: unused variable 'early' [-Wunused-variable]
tapdisk.c: In function 'get_io_request':
tapdisk.c:647:7: warning: unused variable 'done' [-Wunused-variable]
tapdisk.c:634:6: warning: unused variable 'early' [-Wunused-variable]
tapdisk.c:629:24: warning: unused variable 'rc' [-Wunused-variable]
tapdisk.c: In function 'main':
tapdisk.c:769:18: warning: unused variable 'writefds' [-Wunused-variable]
tapdisk.c:768:8: warning: unused variable 'p' [-Wunused-variable]
tapdisk.c:767:11: warning: unused variable 'msglen' [-Wunused-variable]
tapdisk.c:767:6: warning: unused variable 'len' [-Wunused-variable]
--
block-aio.c: In function 'get_image_info':
block-aio.c:67:17: warning: unused variable 'statBuf' [-Wunused-variable]
block-aio.c:66:16: warning: unused variable 'total_size' [-Wunused-variable]
block-aio.c:65:7: warning: unused variable 'size' [-Wunused-variable]
block-aio.c: In function 'tdaio_open':
block-aio.c:123:6: warning: unused variable 'i' [-Wunused-variable]
--
block-sync.c: In function 'get_image_info':
block-sync.c:59:17: warning: unused variable 'statBuf' [-Wunused-variable]
block-sync.c:58:16: warning: unused variable 'total_size' [-Wunused-variable]
block-sync.c:57:7: warning: unused variable 'size' [-Wunused-variable]
block-sync.c: In function 'tdsync_open':
block-sync.c:114:6: warning: unused variable 'i' [-Wunused-variable]
--
block-ram.c: In function 'get_image_info':
block-ram.c:69:17: warning: unused variable 'statBuf' [-Wunused-variable]
block-ram.c:68:16: warning: unused variable 'total_size' [-Wunused-variable]
block-ram.c:67:7: warning: unused variable 'size' [-Wunused-variable]
block-ram.c: In function 'tdram_queue_read':
block-ram.c:228:22: warning: unused variable 'prv' [-Wunused-variable]
block-ram.c: In function 'tdram_queue_write':
block-ram.c:242:22: warning: unused variable 'prv' [-Wunused-variable]
block-ram.c: In function 'tdram_close':
block-ram.c:260:22: warning: unused variable 'prv' [-Wunused-variable]
--
block-qcow.c: In function 'tdqcow_open':
block-qcow.c:725:10: warning: unused variable 'len' [-Wunused-variable]
block-qcow.c: In function 'tdqcow_queue_write':
block-qcow.c:1012:6: warning: unused variable 'ret' [-Wunused-variable]
block-qcow.c: In function 'tdqcow_do_callbacks':
block-qcow.c:1102:41: warning: unused variable 'ptr' [-Wunused-variable]
block-qcow.c:1102:13: warning: unused variable 'ret' [-Wunused-variable]
block-qcow.c: In function 'qcow_create':
block-qcow.c:1146:21: warning: unused variable 'adjust' [-Wunused-variable]
--
block-qcow2.c: In function 'qcow_read':
block-qcow2.c:955:32: warning: unused variable 'n1' [-Wunused-variable]
block-qcow2.c: In function 'qcow_queue_write':
block-qcow2.c:1148:17: warning: unused variable 'src_buf' [-Wunused-variable]
block-qcow2.c: In function 'qcow_do_callbacks':
block-qcow2.c:1864:34: warning: unused variable 'ptr' [-Wunused-variable]
block-qcow2.c:1864:6: warning: unused variable 'ret' [-Wunused-variable]
--
tapaio.c: In function 'tap_aio_init':
tapaio.c:186:7: warning: unused variable 'ioidx' [-Wunused-variable]
--
img2qcow.c: In function 'print_bytes':
img2qcow.c:66:7: warning: unused variable 'i' [-Wunused-variable]
img2qcow.c: In function 'get_image_info':
img2qcow.c:107:17: warning: unused variable 'statBuf' [-Wunused-variable]
img2qcow.c:106:16: warning: unused variable 'total_size' [-Wunused-variable]
img2qcow.c:105:7: warning: unused variable 'size' [-Wunused-variable]
--
qcow2raw.c: In function 'print_bytes':
qcow2raw.c:70:7: warning: unused variable 'i' [-Wunused-variable]
qcow2raw.c: In function 'main':
qcow2raw.c:151:24: warning: unused variable 'input' [-Wunused-variable]
qcow2raw.c:151:20: warning: unused variable 'len' [-Wunused-variable]
--
lvm-util.c: In function 'lvm_scan_lvs':
lvm-util.c:221:29: warning: unused variable 'dev' [-Wunused-variable]
--
libvhd.c: In function 'vhd_read_header':
libvhd.c:1031:6: warning: unused variable 'err' [-Wunused-variable]
libvhd.c: In function 'vhd_write_header':
libvhd.c:2011:6: warning: unused variable 'err' [-Wunused-variable]
libvhd.c: In function 'vhd_write_bitmap':
libvhd.c:2146:9: warning: unused variable 'secs' [-Wunused-variable]
libvhd.c: In function '__vhd_io_allocate_block':
libvhd.c:3206:6: warning: unused variable 'i' [-Wunused-variable]
--
libvhd-journal.c: In function 'vhd_journal_update':
libvhd-journal.c:356:8: warning: unused variable 'eof' [-Wunused-variable]
libvhd-journal.c: In function 'vhd_journal_add_metadata':
libvhd-journal.c:610:8: warning: unused variable 'eof' [-Wunused-variable]
libvhd-journal.c: In function 'vhd_journal_create':
libvhd-journal.c:1259:14: warning: unused variable 'stats' [-Wunused-variable]
libvhd-journal.c:1258:8: warning: unused variable 'off' [-Wunused-variable]
libvhd-journal.c:1257:9: warning: unused variable 'size' [-Wunused-variable]
libvhd-journal.c:1256:6: warning: unused variable 'i' [-Wunused-variable]
libvhd-journal.c:1255:8: warning: unused variable 'buf' [-Wunused-variable]
--
vhd-util-read.c: In function 'vhd_print_header':
vhd-util-read.c:73:47: warning: unused variable 'out' [-Wunused-variable]
vhd-util-read.c: In function 'vhd_print_footer':
vhd-util-read.c:108:50: warning: unused variable 'cksm_save' [-Wunused-variable]
--
vhd-util-resize.c: In function 'vhd_dynamic_grow':
vhd-util-resize.c:880:6: warning: unused variable 'i' [-Wunused-variable]
--
vhd-util-set-field.c: In function 'vhd_util_set_field':
vhd-util-set-field.c:40:8: warning: unused variable 'eof' [-Wunused-variable]
--
vhd-util-scan.c: In function 'vhd_util_scan_pretty_allocate_list':
vhd-util-scan.c:118:20: warning: unused variable 'list' [-Wunused-variable]
vhd-util-scan.c: In function 'vhd_util_scan_extract_volume_name':
vhd-util-scan.c:446:6: warning: unused variable 'err' [-Wunused-variable]
vhd-util-scan.c: In function 'vhd_util_scan_get_parent':
vhd-util-scan.c:513:6: warning: unused variable 'i' [-Wunused-variable]
vhd-util-scan.c: In function 'vhd_util_scan_open_volume':
vhd-util-scan.c:681:6: warning: unused variable 'err' [-Wunused-variable]
--
vhd-util-check.c: In function 'vhd_util_check_validate_parent':
vhd-util-check.c:312:11: warning: unused variable 'status' [-Wunused-variable]
vhd-util-check.c: In function 'vhd_util_check':
vhd-util-check.c:928:16: warning: unused variable 'vhd' [-Wunused-variable]
--
libvhd.c: In function 'vhd_read_header':
libvhd.c:1031:6: warning: unused variable 'err' [-Wunused-variable]
libvhd.c: In function 'vhd_write_header':
libvhd.c:2011:6: warning: unused variable 'err' [-Wunused-variable]
libvhd.c: In function 'vhd_write_bitmap':
libvhd.c:2146:9: warning: unused variable 'secs' [-Wunused-variable]
libvhd.c: In function '__vhd_io_allocate_block':
libvhd.c:3206:6: warning: unused variable 'i' [-Wunused-variable]
--
libvhd-journal.c: In function 'vhd_journal_update':
libvhd-journal.c:356:8: warning: unused variable 'eof' [-Wunused-variable]
libvhd-journal.c: In function 'vhd_journal_add_metadata':
libvhd-journal.c:610:8: warning: unused variable 'eof' [-Wunused-variable]
libvhd-journal.c: In function 'vhd_journal_create':
libvhd-journal.c:1259:14: warning: unused variable 'stats' [-Wunused-variable]
libvhd-journal.c:1258:8: warning: unused variable 'off' [-Wunused-variable]
libvhd-journal.c:1257:9: warning: unused variable 'size' [-Wunused-variable]
libvhd-journal.c:1256:6: warning: unused variable 'i' [-Wunused-variable]
libvhd-journal.c:1255:8: warning: unused variable 'buf' [-Wunused-variable]
--
vhd-util-read.c: In function 'vhd_print_header':
vhd-util-read.c:73:47: warning: unused variable 'out' [-Wunused-variable]
vhd-util-read.c: In function 'vhd_print_footer':
vhd-util-read.c:108:50: warning: unused variable 'cksm_save' [-Wunused-variable]
--
vhd-util-resize.c: In function 'vhd_dynamic_grow':
vhd-util-resize.c:880:6: warning: unused variable 'i' [-Wunused-variable]
--
vhd-util-set-field.c: In function 'vhd_util_set_field':
vhd-util-set-field.c:40:8: warning: unused variable 'eof' [-Wunused-variable]
--
vhd-util-scan.c: In function 'vhd_util_scan_pretty_allocate_list':
vhd-util-scan.c:118:20: warning: unused variable 'list' [-Wunused-variable]
vhd-util-scan.c: In function 'vhd_util_scan_extract_volume_name':
vhd-util-scan.c:446:6: warning: unused variable 'err' [-Wunused-variable]
vhd-util-scan.c: In function 'vhd_util_scan_get_parent':
vhd-util-scan.c:513:6: warning: unused variable 'i' [-Wunused-variable]
vhd-util-scan.c: In function 'vhd_util_scan_open_volume':
vhd-util-scan.c:681:6: warning: unused variable 'err' [-Wunused-variable]
--
vhd-util-check.c: In function 'vhd_util_check_validate_parent':
vhd-util-check.c:312:11: warning: unused variable 'status' [-Wunused-variable]
vhd-util-check.c: In function 'vhd_util_check':
vhd-util-check.c:928:16: warning: unused variable 'vhd' [-Wunused-variable]
--
../../lvm/lvm-util.c: In function 'lvm_scan_lvs':
../../lvm/lvm-util.c:221:29: warning: unused variable 'dev' [-Wunused-variable]
--
tapdisk-vbd.c: In function 'tapdisk_vbd_add_block_cache':
tapdisk-vbd.c:202:15: warning: unused variable 'driver' [-Wunused-variable]
tapdisk-vbd.c: In function 'tapdisk_vbd_open_level':
tapdisk-vbd.c:316:15: warning: unused variable 'driver' [-Wunused-variable]
tapdisk-vbd.c: In function '__tapdisk_vbd_open_vdi':
tapdisk-vbd.c:389:20: warning: unused variable 'images' [-Wunused-variable]
tapdisk-vbd.c: In function '__tapdisk_vbd_complete_td_request':
tapdisk-vbd.c:1199:17: warning: unused variable 'image' [-Wunused-variable]
--
tapdisk-control.c: In function 'tapdisk_control_allocate_connection':
tapdisk-control.c:92:9: warning: unused variable 'sz' [-Wunused-variable]
tapdisk-control.c: In function 'tapdisk_control_list':
tapdisk-control.c:255:13: warning: unused variable 'i' [-Wunused-variable]
tapdisk-control.c: In function 'tapdisk_control_attach_vbd':
tapdisk-control.c:317:10: warning: unused variable 'image' [-Wunused-variable]
tapdisk-control.c:316:24: warning: unused variable 'params' [-Wunused-variable]
tapdisk-control.c: In function 'tapdisk_control_create_socket':
tapdisk-control.c:761:11: warning: unused variable 'flags' [-Wunused-variable]
tapdisk-control.c: In function 'tapdisk_control_open':
tapdisk-control.c:832:6: warning: unused variable 'err' [-Wunused-variable]
--
tapdisk-interface.c: In function 'td_load':
tapdisk-interface.c:40:6: warning: unused variable 'err' [-Wunused-variable]
--
tapdisk-server.c: In function 'tapdisk_server_kick_responses':
tapdisk-server.c:183:6: warning: unused variable 'n' [-Wunused-variable]
--
tapdisk-queue.c: In function 'tapdisk_rwio_setup':
tapdisk-queue.c:197:6: warning: unused variable 'err' [-Wunused-variable]
tapdisk-queue.c: In function 'tapdisk_lio_setup':
tapdisk-queue.c:477:9: warning: unused variable 'sz' [-Wunused-variable]
tapdisk-queue.c: In function 'tapdisk_init_queue':
tapdisk-queue.c:611:6: warning: unused variable 'i' [-Wunused-variable]
--
tapdisk-filter.c: In function 'check_data':
tapdisk-filter.c:159:14: warning: unused variable 'sec' [-Wunused-variable]
--
tapdisk-utils.c: In function 'tapdisk_get_image_size':
tapdisk-utils.c:114:6: warning: unused variable 'ret' [-Wunused-variable]
--
io-optimize.c: In function 'io_merge':
io-optimize.c:222:15: warning: unused variable 'ophead' [-Wunused-variable]
--
block-aio.c: In function 'tdaio_get_image_info':
block-aio.c:69:17: warning: unused variable 'statBuf' [-Wunused-variable]
block-aio.c:68:16: warning: unused variable 'total_size' [-Wunused-variable]
block-aio.c:67:7: warning: unused variable 'size' [-Wunused-variable]
--
block-ram.c: In function 'get_image_info':
block-ram.c:60:17: warning: unused variable 'statBuf' [-Wunused-variable]
block-ram.c:59:16: warning: unused variable 'total_size' [-Wunused-variable]
block-ram.c:58:7: warning: unused variable 'size' [-Wunused-variable]
block-ram.c: In function 'tdram_queue_read':
block-ram.c:203:22: warning: unused variable 'prv' [-Wunused-variable]
block-ram.c: In function 'tdram_queue_write':
block-ram.c:214:22: warning: unused variable 'prv' [-Wunused-variable]
block-ram.c: In function 'tdram_close':
block-ram.c:227:22: warning: unused variable 'prv' [-Wunused-variable]
--
block-vhd.c: In function '_vhd_close':
block-vhd.c:729:21: warning: unused variable 'bm' [-Wunused-variable]
block-vhd.c: In function 'vhd_validate_parent':
block-vhd.c:776:14: warning: unused variable 'stats' [-Wunused-variable]
block-vhd.c:775:11: warning: unused variable 'status' [-Wunused-variable]
block-vhd.c: In function 'allocate_block':
block-vhd.c:1383:8: warning: unused variable 'zeros' [-Wunused-variable]
block-vhd.c: In function 'start_new_bitmap_transaction':
block-vhd.c:1863:9: warning: unused variable 'error' [-Wunused-variable]
--
block-log.c: In function 'shmem_open':
block-log.c:220:10: warning: unused variable 'l' [-Wunused-variable]
block-log.c:220:7: warning: unused variable 'i' [-Wunused-variable]
block-log.c: In function 'ctl_kick':
block-log.c:489:22: warning: unused variable 'rspend' [-Wunused-variable]
block-log.c:489:12: warning: unused variable 'rspstart' [-Wunused-variable]
block-log.c: In function 'ctl_request':
block-log.c:560:11: warning: unused variable 'i' [-Wunused-variable]
block-log.c: In function 'tdlog_queue_write':
block-log.c:638:7: warning: unused variable 'rc' [-Wunused-variable]
--
block-qcow.c: In function 'gen_cksum':
block-qcow.c:86:7: warning: unused variable 'i' [-Wunused-variable]
block-qcow.c: In function 'init_aio_state':
block-qcow.c:104:18: warning: unused variable 'bs' [-Wunused-variable]
block-qcow.c:103:9: warning: unused variable 'ret' [-Wunused-variable]
block-qcow.c: In function 'tdqcow_open':
block-qcow.c:868:10: warning: unused variable 'len' [-Wunused-variable]
block-qcow.c: In function 'tdqcow_queue_read':
block-qcow.c:987:19: warning: unused variable 'prv' [-Wunused-variable]
block-qcow.c:985:36: warning: unused variable 'i' [-Wunused-variable]
block-qcow.c:985:6: warning: unused variable 'ret' [-Wunused-variable]
block-qcow.c: In function 'tdqcow_queue_write':
block-qcow.c:1057:19: warning: unused variable 'prv' [-Wunused-variable]
block-qcow.c:1056:16: warning: unused variable 'cb' [-Wunused-variable]
block-qcow.c:1054:36: warning: unused variable 'i' [-Wunused-variable]
block-qcow.c:1054:6: warning: unused variable 'ret' [-Wunused-variable]
block-qcow.c: In function 'qcow_create':
block-qcow.c:1181:21: warning: unused variable 'adjust' [-Wunused-variable]
--
block-remus.c: In function 'ramdisk_start_flush':
block-remus.c:581:19: warning: unused variable 'batchlen' [-Wunused-variable]
block-remus.c:581:9: warning: unused variable 'j' [-Wunused-variable]
block-remus.c:580:6: warning: unused variable 'rc' [-Wunused-variable]
block-remus.c:578:12: warning: unused variable 'key' [-Wunused-variable]
block-remus.c: In function 'primary_do_connect':
block-remus.c:749:6: warning: unused variable 'rc' [-Wunused-variable]
block-remus.c: In function 'remus_client_event':
block-remus.c:1031:6: warning: unused variable 'rc' [-Wunused-variable]
block-remus.c: In function 'backup_queue_read':
block-remus.c:1154:6: warning: unused variable 'i' [-Wunused-variable]
block-remus.c: In function 'backup_queue_write':
block-remus.c:1171:24: warning: unused variable 's' [-Wunused-variable]
block-remus.c: In function 'backup_start':
block-remus.c:1186:6: warning: unused variable 'fd' [-Wunused-variable]
block-remus.c: In function 'server_do_wreq':
block-remus.c:1203:11: warning: unused variable 'rc' [-Wunused-variable]
block-remus.c:1201:24: warning: unused variable 'twreq' [-Wunused-variable]
block-remus.c: In function 'get_args':
block-remus.c:1433:9: warning: unused variable 'ipver' [-Wunused-variable]
block-remus.c:1432:9: warning: unused variable 'addr' [-Wunused-variable]
--
td.c: In function 'td_coalesce':
td.c:360:15: warning: unused variable 'pname' [-Wunused-variable]
td.c: In function 'td_set_field':
td.c:548:11: warning: unused variable 'i' [-Wunused-variable]
td.c:548:6: warning: unused variable 'ret' [-Wunused-variable]
--
tapdisk-client.c: In function 'writelog_map':
tapdisk-client.c:244:9: warning: unused variable 'shm' [-Wunused-variable]
--
tapdisk-stream.c: In function 'main':
tapdisk-stream.c:550:21: warning: unused variable 'info' [-Wunused-variable]
--
tapdisk-diff.c: In function 'tapdisk_stream_enqueue2':
tapdisk-diff.c:469:9: warning: unused variable 'blk' [-Wunused-variable]
tapdisk-diff.c:469:6: warning: unused variable 'i' [-Wunused-variable]
tapdisk-diff.c: In function 'main':
tapdisk-diff.c:720:21: warning: unused variable 'info' [-Wunused-variable]
--
lock.c: In function 'main':
lock.c:962:13: warning: unused variable 'dlock' [-Wunused-variable]
--
img2qcow.c: In function 'print_bytes':
img2qcow.c:84:7: warning: unused variable 'i' [-Wunused-variable]
img2qcow.c: In function 'get_image_info':
img2qcow.c:117:17: warning: unused variable 'statBuf' [-Wunused-variable]
img2qcow.c:116:16: warning: unused variable 'total_size' [-Wunused-variable]
img2qcow.c:115:7: warning: unused variable 'size' [-Wunused-variable]
img2qcow.c: In function 'main':
img2qcow.c:167:17: warning: unused variable 'timeout' [-Wunused-variable]
img2qcow.c: At top level:
img2qcow.c:73:17: warning: 'read_idx' defined but not used [-Wunused-variable]
img2qcow.c:76:27: warning: 'written' defined but not used [-Wunused-variable]
--
qcow2raw.c: In function 'print_bytes':
qcow2raw.c:90:7: warning: unused variable 'i' [-Wunused-variable]
qcow2raw.c: In function 'send_read_responses':
qcow2raw.c:147:6: warning: unused variable 'ret' [-Wunused-variable]
qcow2raw.c: In function 'main':
qcow2raw.c:201:24: warning: unused variable 'input' [-Wunused-variable]
qcow2raw.c:201:20: warning: unused variable 'len' [-Wunused-variable]
qcow2raw.c: At top level:
qcow2raw.c:74:17: warning: 'read_idx' defined but not used [-Wunused-variable]
--
tap-ctl-list.c: In function 'tap_ctl_alloc_list':
tap-ctl-list.c:116:22: warning: unused variable 'entry' [-Wunused-variable]
tap-ctl-list.c: In function '_tap_ctl_find_tapdisks':
tap-ctl-list.c:274:7: warning: unused variable 'n' [-Wunused-variable]
--
tap-ctl-spawn.c: In function '__tap_ctl_spawn':
tap-ctl-spawn.c:42:6: warning: unused variable 'err' [-Wunused-variable]
--
tap-ctl-check.c: In function 'tap_ctl_check':
tap-ctl-check.c:68:8: warning: unused variable 'uid' [-Wunused-variable]
--
tap-ctl-list.c: In function 'tap_ctl_alloc_list':
tap-ctl-list.c:116:22: warning: unused variable 'entry' [-Wunused-variable]
tap-ctl-list.c: In function '_tap_ctl_find_tapdisks':
tap-ctl-list.c:274:7: warning: unused variable 'n' [-Wunused-variable]
--
tap-ctl-spawn.c: In function '__tap_ctl_spawn':
tap-ctl-spawn.c:42:6: warning: unused variable 'err' [-Wunused-variable]
--
tap-ctl-check.c: In function 'tap_ctl_check':
tap-ctl-check.c:68:8: warning: unused variable 'uid' [-Wunused-variable]

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

diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c
+++ b/tools/blktap/drivers/blktapctrl.c
@@ -254,7 +254,7 @@ static int qemu_instance_has_disks(pid_t
 static int del_disktype(blkif_t *blkif)
 {
 	driver_list_entry_t *entry, **pprev;
-	int type = blkif->drivertype, count = 0, close = 0;
+	int type = blkif->drivertype;
 
 	if (type > MAX_DISK_TYPES)
 		return 1;
@@ -297,8 +297,7 @@ static int write_msg(int fd, int msgtype
 	int msglen, len, ret;
 	fd_set writefds;
 	struct timeval timeout;
-	image_t *image, *img;
-	uint32_t seed;
+	image_t *image;
 
 	blkif = (blkif_t *)ptr;
 	blk = blkif->info;
@@ -407,8 +406,8 @@ static int read_msg(int fd, int msgtype,
 	blkif_info_t *blk;
 	msg_hdr_t *msg;
 	msg_pid_t *msg_pid;
-	char *p, *buf;
-	int msglen = MSG_SIZE, len, ret;
+	char *buf;
+	int msglen = MSG_SIZE, ret;
 	fd_set readfds;
 	struct timeval timeout;
 	image_t *image, *img;
@@ -652,8 +651,8 @@ fail:
 static int blktapctrl_new_blkif(blkif_t *blkif)
 {
 	blkif_info_t *blk;
-	int major, minor, fd_read, fd_write, type, new;
-	char *rdctldev, *wrctldev, *ptr;
+	int major, minor, type;
+	char *ptr;
 	image_t *image;
 	blkif_t *exist = NULL;
 	static uint16_t next_cookie = 0;
@@ -761,8 +760,6 @@ int open_ctrl_socket(char *devname)
 {
 	int ret;
 	int ipc_fd;
-	fd_set socks;
-	struct timeval timeout;
 
 	if (mkdir(BLKTAP_CTRL_DIR, 0755) == 0)
 		DPRINTF("Created %s directory\n", BLKTAP_CTRL_DIR);
@@ -830,9 +827,7 @@ static void write_pidfile(long pid)
 
 int main(int argc, char *argv[])
 {
-	char *devname;
-	tapdev_info_t *ctlinfo;
-	int tap_pfd, store_pfd, xs_fd, ret, timeout, pfd_count, count=0;
+	int tap_pfd, store_pfd, ret, timeout, pfd_count, count=0;
 	struct xs_handle *h;
 	struct pollfd  pfd[NUM_POLL_FDS];
 	pid_t process;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/block-aio.c
--- a/tools/blktap/drivers/block-aio.c
+++ b/tools/blktap/drivers/block-aio.c
@@ -62,9 +62,6 @@ struct tdaio_state {
 static int get_image_info(struct td_state *s, int fd)
 {
 	int ret;
-	long size;
-	unsigned long total_size;
-	struct statvfs statBuf;
 	struct stat stat;
 
 	ret = fstat(fd, &stat);
@@ -120,7 +117,7 @@ static inline void init_fds(struct disk_
 /* Open the disk file and initialize aio state. */
 static int tdaio_open (struct disk_driver *dd, const char *name, td_flag_t flags)
 {
-	int i, fd, ret = 0, o_flags;
+	int fd, ret = 0, o_flags;
 	struct td_state    *s   = dd->td_state;
 	struct tdaio_state *prv = (struct tdaio_state *)dd->private;
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/block-qcow.c
--- a/tools/blktap/drivers/block-qcow.c
+++ b/tools/blktap/drivers/block-qcow.c
@@ -722,7 +722,7 @@ static inline void init_fds(struct disk_
 /* Open the disk file and initialize qcow state. */
 static int tdqcow_open (struct disk_driver *dd, const char *name, td_flag_t flags)
 {
-	int fd, len, i, shift, ret, size, l1_table_size, o_flags, l1_table_block;
+	int fd, i, shift, ret, size, l1_table_size, o_flags, l1_table_block;
 	int max_aio_reqs;
 	struct td_state     *bs = dd->td_state;
 	struct tdqcow_state *s  = (struct tdqcow_state *)dd->private;
@@ -1009,7 +1009,7 @@ static int tdqcow_queue_write(struct dis
 		       int id, void *private)
 {
 	struct tdqcow_state *s = (struct tdqcow_state *)dd->private;
-	int ret = 0, index_in_cluster, n, i;
+	int index_in_cluster, n, i;
 	uint64_t cluster_offset, sec, nr_secs;
 
 	sec     = sector;
@@ -1099,7 +1099,7 @@ static int tdqcow_close(struct disk_driv
 
 static int tdqcow_do_callbacks(struct disk_driver *dd, int sid)
 {
-        int ret, i, nr_events, rsp = 0,*ptr;
+        int i, nr_events, rsp = 0;
         struct io_event *ep;
         struct tdqcow_state *prv = (struct tdqcow_state *)dd->private;
 
@@ -1143,7 +1143,7 @@ int qcow_create(const char *filename, ui
 		const char *backing_file, int sparse)
 {
 	int fd, header_size, backing_filename_len, l1_size, i;
-	int shift, length, adjust, flags = 0, ret = 0;
+	int shift, length, flags = 0, ret = 0;
 	QCowHeader header;
 	QCowHeader_ext exthdr;
 	char backing_filename[PATH_MAX], *ptr;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/block-qcow2.c
--- a/tools/blktap/drivers/block-qcow2.c
+++ b/tools/blktap/drivers/block-qcow2.c
@@ -952,7 +952,10 @@ static int qcow_read(struct disk_driver 
 		uint8_t *buf, int nb_sectors)
 {
 	BDRVQcowState *s = bs->private;
-	int ret, index_in_cluster, n, n1;
+	int ret, index_in_cluster, n;
+#if 0
+	int n1;
+#endif
 	uint64_t cluster_offset;
 
 	while (nb_sectors > 0) {
@@ -1145,8 +1148,6 @@ static int qcow_queue_write(struct disk_
 	BDRVQcowState *s = bs->private;
 	int i, n, index_in_cluster;
 	uint64_t cluster_offset;
-	const uint8_t *src_buf;
-		
 	
 	/*Check we can get a lock*/
 	for (i = 0; i < nb_sectors; i++) 
@@ -1861,7 +1862,7 @@ static int qcow_do_callbacks(struct disk
 
 static int qcow_do_callbacks(struct disk_driver *dd, int sid)
 {
-	int ret, i, nr_events, rsp = 0,*ptr;
+	int i, nr_events, rsp = 0;
 	struct io_event *ep;
 	struct BDRVQcowState *prv = (struct BDRVQcowState*)dd->private;
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/block-ram.c
--- a/tools/blktap/drivers/block-ram.c
+++ b/tools/blktap/drivers/block-ram.c
@@ -64,9 +64,6 @@ struct tdram_state {
 static int get_image_info(struct td_state *s, int fd)
 {
 	int ret;
-	long size;
-	unsigned long total_size;
-	struct statvfs statBuf;
 	struct stat stat;
 
 	ret = fstat(fd, &stat);
@@ -225,7 +222,6 @@ static int tdram_queue_read(struct disk_
 		      int id, void *private)
 {
 	struct td_state    *s   = dd->td_state;
-	struct tdram_state *prv = (struct tdram_state *)dd->private;
 	int      size    = nb_sectors * s->sector_size;
 	uint64_t offset  = sector * (uint64_t)s->sector_size;
 
@@ -239,7 +235,6 @@ static int tdram_queue_write(struct disk
 		      int id, void *private)
 {
 	struct td_state    *s   = dd->td_state;
-	struct tdram_state *prv = (struct tdram_state *)dd->private;
 	int      size    = nb_sectors * s->sector_size;
 	uint64_t offset  = sector * (uint64_t)s->sector_size;
 	
@@ -257,8 +252,6 @@ static int tdram_submit(struct disk_driv
 
 static int tdram_close(struct disk_driver *dd)
 {
-	struct tdram_state *prv = (struct tdram_state *)dd->private;
-	
 	connections--;
 	
 	return 0;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/block-sync.c
--- a/tools/blktap/drivers/block-sync.c
+++ b/tools/blktap/drivers/block-sync.c
@@ -54,9 +54,6 @@ struct tdsync_state {
 static int get_image_info(struct td_state *s, int fd)
 {
 	int ret;
-	long size;
-	unsigned long total_size;
-	struct statvfs statBuf;
 	struct stat stat;
 
 	ret = fstat(fd, &stat);
@@ -111,7 +108,7 @@ static inline void init_fds(struct disk_
 /* Open the disk file and initialize aio state. */
 static int tdsync_open (struct disk_driver *dd, const char *name, td_flag_t flags)
 {
-	int i, fd, ret = 0, o_flags;
+	int fd, ret = 0, o_flags;
 	struct td_state     *s   = dd->td_state;
 	struct tdsync_state *prv = (struct tdsync_state *)dd->private;
 	
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/img2qcow.c
--- a/tools/blktap/drivers/img2qcow.c
+++ b/tools/blktap/drivers/img2qcow.c
@@ -63,7 +63,7 @@ static char output[25];
 
 static void print_bytes(void *ptr, int length)
 {
-  int i,k;
+  int k;
   unsigned char *p = ptr;
 
     DFPRINTF("Buf dump, length %d:\n",length);
@@ -102,9 +102,6 @@ static inline void LOCAL_FD_SET(fd_set *
 static int get_image_info(struct td_state *s, int fd)
 {
 	int ret;
-	long size;
-	unsigned long total_size;
-	struct statvfs statBuf;
 	struct stat stat;
 
 	ret = fstat(fd, &stat);
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/qcow2raw.c
--- a/tools/blktap/drivers/qcow2raw.c
+++ b/tools/blktap/drivers/qcow2raw.c
@@ -67,7 +67,7 @@ static char output[25];
 
 static void print_bytes(void *ptr, int length)
 {
-  int i,k;
+  int k;
   unsigned char *p = ptr;
 
     DFPRINTF("Buf dump, length %d:\n",length);
@@ -148,7 +148,7 @@ static int send_read_responses(struct di
 
 int main(int argc, char *argv[])
 {
-	int ret = -1, fd, len,input;
+	int ret = -1, fd;
 	uint64_t size;
 	fd_set readfds;
 	struct timeval timeout;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/tapaio.c
--- a/tools/blktap/drivers/tapaio.c
+++ b/tools/blktap/drivers/tapaio.c
@@ -183,7 +183,6 @@ int tap_aio_init(tap_aio_context_t *ctx,
 		int max_aio_reqs)
 {
 	int i, ret;
-	long ioidx;
 
 	ctx->iocb_list = NULL;
 	ctx->pending_aio = NULL;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/drivers/tapdisk.c
--- a/tools/blktap/drivers/tapdisk.c
+++ b/tools/blktap/drivers/tapdisk.c
@@ -62,7 +62,9 @@ static void usage(void)
 
 static void daemonize(void)
 {
+#if 0
 	int i;
+#endif
 
 	if (getppid()==1) return; /* already a daemon */
 	if (fork() != 0) exit(0);
@@ -154,7 +156,6 @@ static inline int LOCAL_FD_SET(fd_set *r
 static inline fd_list_entry_t *add_fd_entry(int tap_fd, struct td_state *s)
 {
 	fd_list_entry_t **pprev, *entry;
-	int i;
 
 	DPRINTF("Adding fd_list_entry\n");
 
@@ -369,7 +370,7 @@ static int open_disk(struct td_state *s,
 
 static int read_msg(char *buf)
 {
-	int length, len, msglen, tap_fd, *io_fd;
+	int length, len, msglen;
 	char *ptr, *path;
 	image_t *img;
 	msg_hdr_t *msg;
@@ -593,7 +594,7 @@ int do_cow_read(struct disk_driver *dd, 
 		int sidx, uint64_t sector, int nr_secs)
 {
 	char *page;
-	int ret, early;
+	int ret;
 	uint64_t seg_start, seg_end;
 	struct td_state  *s = dd->td_state;
 	tapdev_info_t *info = s->ring_info;
@@ -626,12 +627,11 @@ int do_cow_read(struct disk_driver *dd, 
 
 static void get_io_request(struct td_state *s)
 {
-	RING_IDX          rp, rc, j, i;
+	RING_IDX          rp, j, i;
 	blkif_request_t  *req;
 	int idx, nsects, ret;
 	uint64_t sector_nr;
 	char *page;
-	int early = 0; /* count early completions */
 	struct disk_driver *dd = s->disks;
 	struct tap_disk *drv   = dd->drv;
 	blkif_t *blkif = s->blkif;
@@ -644,7 +644,7 @@ static void get_io_request(struct td_sta
 	xen_rmb();
 	for (j = info->fe_ring.req_cons; j != rp; j++)
 	{
-		int done = 0, start_seg = 0; 
+		int start_seg = 0; 
 
 		req = NULL;
 		req = RING_GET_REQUEST(&info->fe_ring, j);
@@ -764,9 +764,9 @@ static void get_io_request(struct td_sta
 
 int main(int argc, char *argv[])
 {
-	int len, msglen, ret;
-	char *p, *buf;
-	fd_set readfds, writefds;	
+	int ret;
+	char *buf;
+	fd_set readfds;	
 	fd_list_entry_t *ptr;
 	struct td_state *s;
 	char openlogbuf[128];
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/lib/xenbus.c
--- a/tools/blktap/lib/xenbus.c
+++ b/tools/blktap/lib/xenbus.c
@@ -321,8 +321,8 @@ static int check_image(struct xs_handle 
 static void ueblktap_setup(struct xs_handle *h, char *bepath)
 {
 	struct backend_info *be;
-	char *path = NULL, *p,*dev;
-	int len, er, deverr;
+	char *path = NULL, *p;
+	int er, deverr;
 	long int pdev = 0, handle;
 	blkif_info_t *blk;
 	const char* errmsg = NULL;
@@ -449,9 +449,8 @@ static void ueblktap_probe(struct xs_han
 			   const char *bepath_im)
 {
 	struct backend_info *be = NULL;
-	char *frontend = NULL, *bepath = NULL, *p;
+	char *frontend = NULL, *bepath = NULL;
 	int er, len;
-	blkif_t *blkif;
 	
 	
 	bepath = strdup(bepath_im);
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c
+++ b/tools/blktap/lib/xs_api.c
@@ -60,8 +60,8 @@ int xs_gather(struct xs_handle *xs, cons
 {
 	va_list ap;
 	const char *name;
-	char *path, **e;
-	int ret = 0, num,i;
+	char *path;
+	int ret = 0;
 	unsigned int len;
 	xs_transaction_t xth;
 
@@ -213,7 +213,7 @@ int convert_dev_name_to_num(char *name) 
 	char *p;
 	const char *ptr;
 	int majors[10] = {3,22,33,34,56,57,88,89,90,91};
-	int maj,i,ret = 0;
+	int i,ret = 0;
 	const char p_sd[] = "/dev/sd";
 	const char p_hd[] = "/dev/hd";
 	const char p_xvd[] = "/dev/xvd";
@@ -341,7 +341,6 @@ int xs_fire_next_watch(struct xs_handle 
 	char *token;
 	char *node = NULL;
 	struct xenbus_watch *w;
-	int er;
 	unsigned int num;
 	
 	res = xs_read_watch(h, &num);
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/control/tap-ctl-check.c
--- a/tools/blktap2/control/tap-ctl-check.c
+++ b/tools/blktap2/control/tap-ctl-check.c
@@ -65,7 +65,6 @@ int
 tap_ctl_check(const char **msg)
 {
 	int err;
-	uid_t uid;
 
 	err = tap_ctl_check_blktap(msg);
 	if (err)
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/control/tap-ctl-list.c
--- a/tools/blktap2/control/tap-ctl-list.c
+++ b/tools/blktap2/control/tap-ctl-list.c
@@ -125,8 +125,6 @@ tap_ctl_alloc_list(int n)
 	memset(list, 0, size);
 
 	for (i = 0; i < n; ++i) {
-		tap_list_t *entry;
-
 		entry = malloc(sizeof(tap_list_t));
 		if (!entry)
 			goto fail;
@@ -271,7 +269,6 @@ _tap_ctl_find_tapdisks(struct tapdisk **
 
 	for (i = 0; i < glbuf.gl_pathc; ++i) {
 		struct tapdisk *tap;
-		int n;
 
 		tap = &tapv[n_taps];
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/control/tap-ctl-spawn.c
--- a/tools/blktap2/control/tap-ctl-spawn.c
+++ b/tools/blktap2/control/tap-ctl-spawn.c
@@ -39,7 +39,7 @@
 static pid_t
 __tap_ctl_spawn(int *readfd)
 {
-	int err, child, channel[2];
+	int child, channel[2];
 	char *tapdisk;
 
 	if (pipe(channel)) {
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/block-aio.c
--- a/tools/blktap2/drivers/block-aio.c
+++ b/tools/blktap2/drivers/block-aio.c
@@ -64,9 +64,6 @@ struct tdaio_state {
 static int tdaio_get_image_info(int fd, td_disk_info_t *info)
 {
 	int ret;
-	long size;
-	unsigned long total_size;
-	struct statvfs statBuf;
 	struct stat stat;
 
 	ret = fstat(fd, &stat);
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/block-log.c
--- a/tools/blktap2/drivers/block-log.c
+++ b/tools/blktap2/drivers/block-log.c
@@ -217,7 +217,7 @@ static char* ctl_makepath(const char* na
 
 static int shmem_open(struct tdlog_state* s, const char* name)
 {
-  int i, l, fd;
+  int fd;
 
   /* device name -> path */
   if (asprintf(&s->shmpath, "/log_%s.wlog", name) < 0) {
@@ -486,7 +486,6 @@ static int ctl_kick(struct tdlog_state* 
   log_request_t req;
 
   /* XXX testing */
-  RING_IDX rspstart, rspend;
   log_response_t rsp;
   struct log_ctlmsg msg;
   int rc;
@@ -557,7 +556,7 @@ static void ctl_request(event_id_t id, c
 {
   struct tdlog_state* s = (struct tdlog_state*)private;
   struct log_ctlmsg msg;
-  int rc, i, fd = -1;
+  int rc, fd = -1;
 
   fd = ctl_find_connection(s, id);
   if (fd == -1)
@@ -635,7 +634,6 @@ static void tdlog_queue_read(td_driver_t
 static void tdlog_queue_write(td_driver_t* driver, td_request_t treq)
 {
   struct tdlog_state* s = (struct tdlog_state*)driver->data;
-  int rc;
 
   writelog_set(s, treq.sec, treq.secs);
   td_forward_request(treq);
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/block-qcow.c
--- a/tools/blktap2/drivers/block-qcow.c
+++ b/tools/blktap2/drivers/block-qcow.c
@@ -84,7 +84,6 @@ static int decompress_cluster(struct tdq
 
 uint32_t gen_cksum(char *ptr, int len)
 {
-  int i;
   uint32_t md[4];
 
   /* Generate checksum */
@@ -101,8 +100,7 @@ static void free_aio_state(struct tdqcow
 
 static int init_aio_state(td_driver_t *driver)
 {
-	int i, ret;
-	td_disk_info_t *bs = &(driver->info);
+	int i;
 	struct tdqcow_state   *s  = (struct tdqcow_state *)driver->data;
 	
         // A segment (i.e. a page) can span multiple clusters
@@ -866,7 +864,7 @@ out:
 /* Open the disk file and initialize qcow state. */
 int tdqcow_open (td_driver_t *driver, const char *name, td_flag_t flags)
 {
-	int fd, len, i, ret, size, o_flags;
+	int fd, i, ret, size, o_flags;
 	td_disk_info_t *bs = &(driver->info);
 	struct tdqcow_state   *s  = (struct tdqcow_state *)driver->data;
 	QCowHeader header;
@@ -983,9 +981,8 @@ fail:
 void tdqcow_queue_read(td_driver_t *driver, td_request_t treq)
 {
 	struct tdqcow_state   *s  = (struct tdqcow_state *)driver->data;
-	int ret = 0, index_in_cluster, n, i;
+	int index_in_cluster, n, i;
 	uint64_t cluster_offset, sector, nb_sectors;
-	struct qcow_prv* prv;
 	td_request_t clone = treq;
 	char* buf = treq.buf;
 
@@ -1007,7 +1004,6 @@ void tdqcow_queue_read(td_driver_t *driv
 		}
 		
 		if(!cluster_offset) {
-            int i;
             /* Forward entire request if possible. */
             for(i=0; i<nb_sectors; i++)
                 if(get_cluster_offset(s, (sector+i) << 9, 0, 0, 0, 0))
@@ -1052,10 +1048,8 @@ done:
 void tdqcow_queue_write(td_driver_t *driver, td_request_t treq)
 {
 	struct tdqcow_state   *s  = (struct tdqcow_state *)driver->data;
-	int ret = 0, index_in_cluster, n, i;
+	int index_in_cluster, n;
 	uint64_t cluster_offset, sector, nb_sectors;
-	td_callback_t cb;
-	struct qcow_prv* prv;
 	char* buf = treq.buf;
 	td_request_t clone=treq;
 
@@ -1179,7 +1173,7 @@ int qcow_create(const char *filename, ui
 		const char *backing_file, int sparse)
 {
 	int fd, header_size, backing_filename_len, l1_size, i;
-	int shift, length, adjust, flags = 0, ret = 0;
+	int shift, length, flags = 0, ret = 0;
 	QCowHeader header;
 	QCowHeader_ext exthdr;
 	char backing_filename[PATH_MAX], *ptr;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/block-ram.c
--- a/tools/blktap2/drivers/block-ram.c
+++ b/tools/blktap2/drivers/block-ram.c
@@ -55,9 +55,6 @@ struct tdram_state {
 static int get_image_info(int fd, td_disk_info_t *info)
 {
 	int ret;
-	long size;
-	unsigned long total_size;
-	struct statvfs statBuf;
 	struct stat stat;
 
 	ret = fstat(fd, &stat);
@@ -200,7 +197,6 @@ done:
 
 void tdram_queue_read(td_driver_t *driver, td_request_t treq)
 {
-	struct tdram_state *prv = (struct tdram_state *)driver->data;
 	int      size    = treq.secs * driver->info.sector_size;
 	uint64_t offset  = treq.sec * (uint64_t)driver->info.sector_size;
 
@@ -211,7 +207,6 @@ void tdram_queue_read(td_driver_t *drive
 
 void tdram_queue_write(td_driver_t *driver, td_request_t treq)
 {
-	struct tdram_state *prv = (struct tdram_state *)driver->data;
 	int      size    = treq.secs * driver->info.sector_size;
 	uint64_t offset  = treq.sec * (uint64_t)driver->info.sector_size;
 	
@@ -224,8 +219,6 @@ void tdram_queue_write(td_driver_t *driv
 
 int tdram_close(td_driver_t *driver)
 {
-	struct tdram_state *prv = (struct tdram_state *)driver->data;
-	
 	connections--;
 	
 	return 0;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/block-remus.c
--- a/tools/blktap2/drivers/block-remus.c
+++ b/tools/blktap2/drivers/block-remus.c
@@ -575,10 +575,8 @@ static int ramdisk_flush(td_driver_t *dr
 static int ramdisk_start_flush(td_driver_t *driver)
 {
 	struct tdremus_state *s = (struct tdremus_state *)driver->data;
-	uint64_t* key;
 	char* buf;
-	int rc = 0;
-	int i, j, count, batchlen;
+	int i, count;
 	uint64_t* sectors;
 
 	if (!hashtable_count(s->ramdisk.h)) {
@@ -746,7 +744,6 @@ static int primary_do_connect(struct tdr
 {
 	event_id_t id;
 	int fd;
-	int rc;
 	int flags;
 
 	RPRINTF("client connecting to %s:%d...\n", inet_ntoa(state->sa.sin_addr), ntohs(state->sa.sin_port));
@@ -1028,7 +1025,6 @@ static void remus_client_event(event_id_
 {
 	struct tdremus_state *s = (struct tdremus_state *)private;
 	char req[5];
-	int rc;
 
 	if (mread(s->stream_fd.fd, req, sizeof(req) - 1) < 0) {
 		/* replication stream closed or otherwise broken (timeout, reset, &c) */
@@ -1151,7 +1147,6 @@ static inline int server_writes_inflight
 void backup_queue_read(td_driver_t *driver, td_request_t treq)
 {
 	struct tdremus_state *s = (struct tdremus_state *)driver->data;
-	int i;
 	if(!remus_image)
 		remus_image = treq.image;
 	
@@ -1168,8 +1163,6 @@ void backup_queue_read(td_driver_t *driv
 /* see above */
 void backup_queue_write(td_driver_t *driver, td_request_t treq)
 {
-	struct tdremus_state *s = (struct tdremus_state *)driver->data;
-
 	/* on a server write, we know the domain has failed over. we must change our
 	 * state to unprotected and then have the unprotected queue_write function
 	 * handle the write
@@ -1183,7 +1176,6 @@ void backup_queue_write(td_driver_t *dri
 static int backup_start(td_driver_t *driver)
 {
 	struct tdremus_state *s = (struct tdremus_state *)driver->data;
-	int fd;
 
 	if (ramdisk_start(driver) < 0)
 		return -1;
@@ -1198,9 +1190,8 @@ static int backup_start(td_driver_t *dri
 static int server_do_wreq(td_driver_t *driver)
 {
 	struct tdremus_state *s = (struct tdremus_state *)driver->data;
-	static tdremus_wire_t twreq;
 	char buf[4096];
-	int len, rc;
+	int len;
 
 	char header[sizeof(uint32_t) + sizeof(uint64_t)];
 	uint32_t *sectors = (uint32_t *) header;
@@ -1429,9 +1420,6 @@ static int get_args(td_driver_t *driver,
 	/* TODO: do something smarter here */
 	valid_addr = 0;
 	for(servinfo_itr = servinfo; servinfo_itr != NULL; servinfo_itr = servinfo_itr->ai_next) {
-		void *addr;
-		char *ipver;
-
 		if (servinfo_itr->ai_family == AF_INET) {
 			valid_addr = 1;
 			memset(&state->sa, 0, sizeof(state->sa));
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/block-vhd.c
--- a/tools/blktap2/drivers/block-vhd.c
+++ b/tools/blktap2/drivers/block-vhd.c
@@ -726,7 +726,6 @@ _vhd_close(td_driver_t *driver)
 {
 	int err;
 	struct vhd_state *s;
-	struct vhd_bitmap *bm;
 	
 	DBG(TLOG_WARN, "vhd_close\n");
 	s = (struct vhd_state *)driver->data;
@@ -772,8 +771,6 @@ int
 vhd_validate_parent(td_driver_t *child_driver,
 		    td_driver_t *parent_driver, td_flag_t flags)
 {
-	uint32_t status;
-	struct stat stats;
 	struct vhd_state *child  = (struct vhd_state *)child_driver->data;
 	struct vhd_state *parent;
 
@@ -789,24 +786,6 @@ vhd_validate_parent(td_driver_t *child_d
 
 	parent = (struct vhd_state *)parent_driver->data;
 
-	/* 
-	 * This check removed because of cases like:
-	 *   - parent VHD marked as 'hidden'
-	 *   - parent VHD modified during coalesce
-	 */
-	/*
-	if (stat(parent->vhd.file, &stats)) {
-		DPRINTF("ERROR stating parent file %s\n", parent->vhd.file);
-		return -errno;
-	}
-
-	if (child->hdr.prt_ts != vhd_time(stats.st_mtime)) {
-		DPRINTF("ERROR: parent file has been modified since "
-			"snapshot.  Child image no longer valid.\n");
-		return -EINVAL;
-	}
-	*/
-
 	if (vhd_uuid_compare(&child->vhd.header.prt_uuid, &parent->vhd.footer.uuid)) {
 		DPRINTF("ERROR: %s: %s, %s: parent uuid has changed since "
 			"snapshot.  Child image no longer valid.\n",
@@ -1380,7 +1359,6 @@ update_bat(struct vhd_state *s, uint32_t
 static int
 allocate_block(struct vhd_state *s, uint32_t blk)
 {
-	char *zeros;
 	int err, gap;
 	uint64_t offset, size;
 	struct vhd_bitmap *bm;
@@ -1860,7 +1838,7 @@ signal_completion(struct vhd_request *li
 static void
 start_new_bitmap_transaction(struct vhd_state *s, struct vhd_bitmap *bm)
 {
-	int i, error = 0;
+	int i;
 	struct vhd_transaction *tx;
 	struct vhd_request *r, *next;
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/img2qcow.c
--- a/tools/blktap2/drivers/img2qcow.c
+++ b/tools/blktap2/drivers/img2qcow.c
@@ -70,10 +70,9 @@
 
 static int running = 1, complete = 0;
 static int returned_events = 0, submit_events = 0;
-static uint32_t read_idx = 0;
 td_driver_t *ddqcow;
 td_vbd_t* qcow_vbd;
-static uint64_t prev = 0, written = 0;
+static uint64_t prev = 0;
 static char output[(100/PROGRESS_QUANT) + 5];
 
 extern tapdisk_server_t server;
@@ -81,7 +80,7 @@ extern tapdisk_server_t server;
 
 static void print_bytes(void *ptr, int length)
 {
-  int i,k;
+  int k;
   unsigned char *p = ptr;
 
     DFPRINTF("Buf dump, length %d:\n",length);
@@ -112,9 +111,6 @@ static void debug_output(uint64_t progre
 static int get_image_info(td_disk_info_t *driver, int fd)
 {
 	int ret;
-	long size;
-	unsigned long total_size;
-	struct statvfs statBuf;
 	struct stat stat;
 	uint64_t sector_size=DEFAULT_SECTOR_SIZE;
 
@@ -164,7 +160,6 @@ void send_responses(td_request_t treq, i
 int main(int argc, const char *argv[])
 {
         int ret = -1, fd, len, err;
-	struct timeval timeout;
 	uint64_t i;
 	char *buf;
 	td_request_t treq;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/io-optimize.c
--- a/tools/blktap2/drivers/io-optimize.c
+++ b/tools/blktap2/drivers/io-optimize.c
@@ -219,7 +219,6 @@ io_merge(struct opioctx *ctx, struct ioc
 {
 	int i, on_queue;
 	struct iocb *io, **q;
-	struct opio *ophead;
 	
 	if (!num)
 		return 0;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/lock.c
--- a/tools/blktap2/drivers/lock.c
+++ b/tools/blktap2/drivers/lock.c
@@ -959,7 +959,6 @@ static void usage(char *prg)
 int main(int argc, char *argv[])
 {
         int status = 0;
-        int dlock;
         char *ptr;
         int force;
         int readonly;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/qcow2raw.c
--- a/tools/blktap2/drivers/qcow2raw.c
+++ b/tools/blktap2/drivers/qcow2raw.c
@@ -71,7 +71,6 @@
 static int running = 1, complete = 0; 
 static int returned_read_events = 0, returned_write_events = 0;
 static int submit_events = 0;
-static uint32_t read_idx = 0;
 td_driver_t *ddqcow, *ddaio;
 td_vbd_t* qcow_vbd, *aio_vbd;
 static uint64_t prev = 0, written = 0;
@@ -87,7 +86,7 @@ struct request_info {
 
 static void print_bytes(void *ptr, int length)
 {
-  int i,k;
+  int k;
   unsigned char *p = ptr;
 
     DFPRINTF("Buf dump, length %d:\n",length);
@@ -144,7 +143,6 @@ static void send_write_responses(td_requ
 
 static void send_read_responses(td_request_t treq, int err)
 {
-	int ret;
         struct request_info* req;
         td_vbd_request_t* vreq;
 
@@ -198,7 +196,7 @@ static void send_read_responses(td_reque
 
 int main(int argc, const char *argv[])
 {
-	int ret = -1, fd, len,input;
+	int ret = -1, fd;
 	uint64_t size;
 	struct timeval timeout;
 	uint64_t i;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-client.c
--- a/tools/blktap2/drivers/tapdisk-client.c
+++ b/tools/blktap2/drivers/tapdisk-client.c
@@ -241,7 +241,6 @@ static int ctl_clear_writes(int fd)
 static int writelog_map(struct writelog* wl)
 {
   int fd;
-  void* shm;
 
   if ((fd = shm_open(wl->shmpath, O_RDWR, 0750)) < 0) {
     BWPRINTF("could not open shared memory at %s: %s", wl->shmpath,
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-control.c
--- a/tools/blktap2/drivers/tapdisk-control.c
+++ b/tools/blktap2/drivers/tapdisk-control.c
@@ -89,7 +89,6 @@ static struct tapdisk_control_connection
 tapdisk_control_allocate_connection(int fd)
 {
 	struct tapdisk_control_connection *connection;
-	size_t sz;
 
 	connection = calloc(1, sizeof(*connection));
 	if (!connection) {
@@ -252,7 +251,7 @@ tapdisk_control_list(struct tapdisk_cont
 	td_vbd_t *vbd;
 	struct list_head *head;
 	tapdisk_message_t response;
-	int count, i;
+	int count;
 
 	memset(&response, 0, sizeof(response));
 	response.type = TAPDISK_MESSAGE_LIST_RSP;
@@ -313,8 +312,6 @@ tapdisk_control_attach_vbd(struct tapdis
 	tapdisk_message_t response;
 	char *devname;
 	td_vbd_t *vbd;
-	struct blktap2_params params;
-	image_t image;
 	int minor, err;
 
 	/*
@@ -758,7 +755,7 @@ tapdisk_control_mkdir(const char *dir)
 static int
 tapdisk_control_create_socket(char **socket_path)
 {
-	int err, flags;
+	int err;
 	struct sockaddr_un saddr;
 
 	err = tapdisk_control_mkdir(BLKTAP2_CONTROL_DIR);
@@ -829,8 +826,6 @@ fail:
 int
 tapdisk_control_open(char **path)
 {
-	int err;
-
 	tapdisk_control_initialize();
 
 	return tapdisk_control_create_socket(path);
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-diff.c
--- a/tools/blktap2/drivers/tapdisk-diff.c
+++ b/tools/blktap2/drivers/tapdisk-diff.c
@@ -466,7 +466,6 @@ static void
 tapdisk_stream_enqueue2(void)
 {
 	td_vbd_t *vbd;
-	int i, blk;
 	struct tapdisk_stream_request *itr;
 	struct tapdisk_stream *s = &stream2;
 
@@ -717,7 +716,6 @@ main(int argc, char *argv[])
 {
 	int c, err, type1;
 	const char *arg1 = NULL, *arg2 = NULL;
-	const disk_info_t *info;
 	const char *path1;
 
 	err    = 0;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-filter.c
--- a/tools/blktap2/drivers/tapdisk-filter.c
+++ b/tools/blktap2/drivers/tapdisk-filter.c
@@ -156,7 +156,7 @@ static void
 check_data(struct tfilter *filter, int type, struct iocb *io)
 {
 	int rw;
-	uint64_t i, sec;
+	uint64_t i;
 
 	rw = (io->aio_lio_opcode == IO_CMD_PWRITE);
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-interface.c
--- a/tools/blktap2/drivers/tapdisk-interface.c
+++ b/tools/blktap2/drivers/tapdisk-interface.c
@@ -37,7 +37,6 @@
 int
 td_load(td_image_t *image)
 {
-	int err;
 	td_image_t *shared;
 	td_driver_t *driver;
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-queue.c
--- a/tools/blktap2/drivers/tapdisk-queue.c
+++ b/tools/blktap2/drivers/tapdisk-queue.c
@@ -194,7 +194,6 @@ static int
 tapdisk_rwio_setup(struct tqueue *queue, int size)
 {
 	struct rwio *rwio = queue->tio_data;
-	int err;
 
 	rwio->aio_events = calloc(size, sizeof(struct io_event));
 	if (!rwio->aio_events)
@@ -474,7 +473,6 @@ static int
 tapdisk_lio_setup(struct tqueue *queue, int qlen)
 {
 	struct lio *lio = queue->tio_data;
-	size_t sz;
 	int err;
 
 	lio->event_id = -1;
@@ -608,7 +606,7 @@ int
 tapdisk_init_queue(struct tqueue *queue, int size,
 		   int drv, struct tfilter *filter)
 {
-	int i, err;
+	int err;
 
 	memset(queue, 0, sizeof(struct tqueue));
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-server.c
--- a/tools/blktap2/drivers/tapdisk-server.c
+++ b/tools/blktap2/drivers/tapdisk-server.c
@@ -180,7 +180,6 @@ tapdisk_server_submit_tiocbs(void)
 static void
 tapdisk_server_kick_responses(void)
 {
-	int n;
 	td_vbd_t *vbd, *tmp;
 
 	tapdisk_server_for_each_vbd(vbd, tmp)
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-stream.c
--- a/tools/blktap2/drivers/tapdisk-stream.c
+++ b/tools/blktap2/drivers/tapdisk-stream.c
@@ -547,7 +547,6 @@ main(int argc, char *argv[])
 {
 	int c, err, type;
 	const char *params;
-	const disk_info_t *info;
 	const char *path;
 	uint64_t count, skip;
 	struct tapdisk_stream stream;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-utils.c
--- a/tools/blktap2/drivers/tapdisk-utils.c
+++ b/tools/blktap2/drivers/tapdisk-utils.c
@@ -111,7 +111,6 @@ tapdisk_namedup(char **dup, const char *
 int
 tapdisk_get_image_size(int fd, uint64_t *_sectors, uint32_t *_sector_size)
 {
-	int ret;
 	struct stat stat;
 	uint64_t sectors;
 	uint64_t sector_size;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/tapdisk-vbd.c
--- a/tools/blktap2/drivers/tapdisk-vbd.c
+++ b/tools/blktap2/drivers/tapdisk-vbd.c
@@ -199,7 +199,6 @@ static int
 tapdisk_vbd_add_block_cache(td_vbd_t *vbd)
 {
 	int err;
-	td_driver_t *driver;
 	td_image_t *cache, *image, *target, *tmp;
 
 	target = NULL;
@@ -313,7 +312,6 @@ tapdisk_vbd_open_level(td_vbd_t *vbd, st
 	int type, err;
 	td_image_t *image;
 	td_disk_id_t id;
-	td_driver_t *driver;
 
 	name    = params;
 	id.name = NULL;
@@ -386,7 +384,6 @@ __tapdisk_vbd_open_vdi(td_vbd_t *vbd, td
 	td_flag_t flags;
 	td_image_t *tmp;
 	td_vbd_driver_info_t *driver_info;
-	struct list_head *images;
 	td_disk_info_t *parent_info = NULL;
 
 	if (list_empty(&vbd->driver_stack))
@@ -1196,7 +1193,6 @@ __tapdisk_vbd_complete_td_request(td_vbd
 				  td_request_t treq, int res)
 {
 	int err;
-    td_image_t *image = treq.image;
 
 	err = (res <= 0 ? res : -res);
 	vbd->secs_pending  -= treq.secs;
@@ -1216,6 +1212,7 @@ __tapdisk_vbd_complete_td_request(td_vbd
 		}
 	} else {
 #ifdef MEMSHR
+		td_image_t *image = treq.image;
 		if (treq.op == TD_OP_READ
 		   && td_flag_test(image->flags, TD_OPEN_RDONLY)) {
 			share_tuple_t hnd = treq.memshr_hnd;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/drivers/td.c
--- a/tools/blktap2/drivers/td.c
+++ b/tools/blktap2/drivers/td.c
@@ -357,7 +357,7 @@ int
 td_coalesce(int type, int argc, char *argv[])
 {
 	int c, ret, cargc;
-	char *name, *pname, *cargv[3];
+	char *name, *cargv[3];
 
 	if (type != TD_TYPE_VHD) {
 		fprintf(stderr, "Cannot create snapshot of %s image type\n",
@@ -545,7 +545,7 @@ td_query(int type, int argc, char *argv[
 int
 td_set_field(int type, int argc, char *argv[])
 {
-	int ret, i, c, cargc;
+	int c, cargc;
 	struct vdi_field *field;
 	char *name, *value, *cargv[7];
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/lvm/lvm-util.c
--- a/tools/blktap2/lvm/lvm-util.c
+++ b/tools/blktap2/lvm/lvm-util.c
@@ -218,7 +218,7 @@ lvm_scan_lvs(struct vg *vg)
 		struct lv *lv;
 		struct lv_segment seg;
 		uint64_t size, seg_start;
-		char type[32], name[256], dev[256], devices[1024];
+		char type[32], name[256], devices[1024];
 
 		if (i >= vg->lv_cnt)
 			break;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/vhd/lib/libvhd-journal.c
--- a/tools/blktap2/vhd/lib/libvhd-journal.c
+++ b/tools/blktap2/vhd/lib/libvhd-journal.c
@@ -357,7 +357,6 @@ vhd_journal_update(vhd_journal_t *j, off
 		   char *buf, size_t size, uint32_t type)
 {
 	int err;
-	off_t eof;
 	uint64_t *off, off_bak;
 	uint32_t *entries;
 	vhd_journal_entry_t entry;
@@ -611,7 +610,6 @@ static int
 vhd_journal_add_metadata(vhd_journal_t *j)
 {
 	int err;
-	off_t eof;
 	vhd_context_t *vhd;
 
 	vhd = &j->vhd;
@@ -1256,11 +1254,7 @@ fail:
 int
 vhd_journal_create(vhd_journal_t *j, const char *file, const char *jfile)
 {
-	char *buf;
-	int i, err;
-	size_t size;
-	off_t off;
-	struct stat stats;
+	int err;
 
 	memset(j, 0, sizeof(vhd_journal_t));
 	j->jfd = -1;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/vhd/lib/libvhd.c
--- a/tools/blktap2/vhd/lib/libvhd.c
+++ b/tools/blktap2/vhd/lib/libvhd.c
@@ -1028,7 +1028,6 @@ out:
 int
 vhd_read_header(vhd_context_t *ctx, vhd_header_t *header)
 {
-	int err;
 	off_t off;
 
 	if (!vhd_type_dynamic(ctx)) {
@@ -2008,7 +2007,6 @@ out:
 int
 vhd_write_header(vhd_context_t *ctx, vhd_header_t *header)
 {
-	int err;
 	off_t off;
 
 	if (!vhd_type_dynamic(ctx))
@@ -2143,7 +2141,7 @@ vhd_write_bitmap(vhd_context_t *ctx, uin
 	int err;
 	off_t off;
 	uint64_t blk;
-	size_t secs, size;
+	size_t size;
 
 	if (!vhd_type_dynamic(ctx))
 		return -EINVAL;
@@ -3203,7 +3201,7 @@ __vhd_io_allocate_block(vhd_context_t *c
 	char *buf;
 	size_t size;
 	off_t off, max;
-	int i, err, gap, spp;
+	int err, gap, spp;
 
 	spp = getpagesize() >> VHD_SECTOR_SHIFT;
 
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/vhd/lib/vhd-util-check.c
--- a/tools/blktap2/vhd/lib/vhd-util-check.c
+++ b/tools/blktap2/vhd/lib/vhd-util-check.c
@@ -309,7 +309,6 @@ vhd_util_check_validate_parent(vhd_conte
 {
 	const char *msg;
 	vhd_context_t parent;
-	uint32_t status;
 
 	msg = NULL;
 
@@ -925,7 +924,6 @@ int
 vhd_util_check(int argc, char **argv)
 {
 	char *name;
-	vhd_context_t vhd;
 	int c, err, ignore, parents;
 
 	if (!argc || !argv) {
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/vhd/lib/vhd-util-read.c
--- a/tools/blktap2/vhd/lib/vhd-util-read.c
+++ b/tools/blktap2/vhd/lib/vhd-util-read.c
@@ -70,7 +70,7 @@ vhd_print_header(vhd_context_t *vhd, vhd
 {
 	int err;
 	uint32_t  cksm;
-	char      uuid[39], time_str[26], cookie[9], out[512], *name;
+	char      uuid[39], time_str[26], cookie[9], *name;
 
 	printf("VHD Header Summary:\n-------------------\n");
 
@@ -105,7 +105,7 @@ static void
 vhd_print_footer(vhd_footer_t *f, int hex)
 {
 	uint64_t  c, h, s;
-	uint32_t  ff_maj, ff_min, cr_maj, cr_min, cksm, cksm_save;
+	uint32_t  ff_maj, ff_min, cr_maj, cr_min, cksm;
 	char      time_str[26], creator[5], uuid[39], cookie[9];
 
 	printf("VHD Footer Summary:\n-------------------\n");
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/vhd/lib/vhd-util-resize.c
--- a/tools/blktap2/vhd/lib/vhd-util-resize.c
+++ b/tools/blktap2/vhd/lib/vhd-util-resize.c
@@ -877,7 +877,7 @@ vhd_add_bat_entries(vhd_journal_t *journ
 static int
 vhd_dynamic_grow(vhd_journal_t *journal, uint64_t secs)
 {
-	int i, err;
+	int err;
 	off_t eob, eom;
 	vhd_context_t *vhd;
 	vhd_block_t first_block;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/vhd/lib/vhd-util-scan.c
--- a/tools/blktap2/vhd/lib/vhd-util-scan.c
+++ b/tools/blktap2/vhd/lib/vhd-util-scan.c
@@ -115,7 +115,6 @@ static int
 vhd_util_scan_pretty_allocate_list(int cnt)
 {
 	int i;
-	struct vhd_image *list;
 
 	memset(&scan, 0, sizeof(scan));
 
@@ -443,7 +442,6 @@ copy_name(char *dst, const char *src)
 static int
 vhd_util_scan_extract_volume_name(char *dst, const char *src)
 {
-	int err;
 	char copy[VHD_MAX_NAME_LEN], *name, *s, *c;
 
 	name = strrchr(src, '/');
@@ -510,7 +508,7 @@ found:
 static int
 vhd_util_scan_get_parent(vhd_context_t *vhd, struct vhd_image *image)
 {
-	int i, err;
+	int err;
 	vhd_parent_locator_t *loc;
 
 	if (!target_vhd(image->target->type)) {
@@ -678,7 +676,6 @@ out:
 static int
 vhd_util_scan_open_volume(vhd_context_t *vhd, struct vhd_image *image)
 {
-	int err;
 	struct target *target;
 
 	target = image->target;
diff -r a85817bc44e5 -r 33af0a492bf7 tools/blktap2/vhd/lib/vhd-util-set-field.c
--- a/tools/blktap2/vhd/lib/vhd-util-set-field.c
+++ b/tools/blktap2/vhd/lib/vhd-util-set-field.c
@@ -37,7 +37,6 @@ vhd_util_set_field(int argc, char **argv
 {
 	long value;
 	int err, c;
-	off_t eof;
 	vhd_context_t vhd;
 	char *name, *field;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c
  2012-04-02 20:15 ` [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c Olaf Hering
@ 2012-04-03 10:25   ` Ian Jackson
  2012-04-03 10:50     ` Ian Campbell
  0 siblings, 1 reply; 26+ messages in thread
From: Ian Jackson @ 2012-04-03 10:25 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xensource.com

Olaf Hering writes ("[PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c"):
> tools/libvchan: fix build errors caused by Werror in io.c
...
> io.c:196: warning: ignoring return value of 'writev', declared with attribute warn_unused_result
...
> -		writev(-1, iov, 2);
> +		/* Silence gcc warning, will always fail */
> +		if (writev(-1, iov, 2));

I still think this is an unpleasant idiom.  Does casting the result to
void not help ?

Ian.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c
  2012-04-03 10:25   ` Ian Jackson
@ 2012-04-03 10:50     ` Ian Campbell
  2012-04-03 15:04       ` Olaf Hering
  0 siblings, 1 reply; 26+ messages in thread
From: Ian Campbell @ 2012-04-03 10:50 UTC (permalink / raw)
  To: Ian Jackson; +Cc: Olaf Hering, xen-devel@lists.xensource.com

On Tue, 2012-04-03 at 11:25 +0100, Ian Jackson wrote:
> Olaf Hering writes ("[PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c"):
> > tools/libvchan: fix build errors caused by Werror in io.c
> ...
> > io.c:196: warning: ignoring return value of 'writev', declared with attribute warn_unused_result
> ...
> > -		writev(-1, iov, 2);
> > +		/* Silence gcc warning, will always fail */
> > +		if (writev(-1, iov, 2));
> 
> I still think this is an unpleasant idiom.  Does casting the result to
> void not help ?

What does writev(-1,...) even mean? Can we not just nuke it?

Ian.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 18 of 18] tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables
  2012-04-02 20:15 ` [PATCH 18 of 18] tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables Olaf Hering
@ 2012-04-03 13:21   ` Ian Jackson
  0 siblings, 0 replies; 26+ messages in thread
From: Ian Jackson @ 2012-04-03 13:21 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xensource.com

Olaf Hering writes ("[PATCH 18 of 18] tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables"):
> tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables

I'm afraid that I don't have time to eyeball the whole of this patch
for unrelated hunks, not described by the commit message.  And sadly
it would appear that I need to do that.  So I'm going to put off
reviewing it until I have more time.

Thanks,
Ian.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c
  2012-04-03 10:50     ` Ian Campbell
@ 2012-04-03 15:04       ` Olaf Hering
  2012-04-03 16:39         ` Ian Campbell
  0 siblings, 1 reply; 26+ messages in thread
From: Olaf Hering @ 2012-04-03 15:04 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel@lists.xensource.com, Ian Jackson

On Tue, Apr 03, Ian Campbell wrote:

> On Tue, 2012-04-03 at 11:25 +0100, Ian Jackson wrote:
> > Olaf Hering writes ("[PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c"):
> > > tools/libvchan: fix build errors caused by Werror in io.c
> > ...
> > > io.c:196: warning: ignoring return value of 'writev', declared with attribute warn_unused_result
> > ...
> > > -		writev(-1, iov, 2);
> > > +		/* Silence gcc warning, will always fail */
> > > +		if (writev(-1, iov, 2));
> > 
> > I still think this is an unpleasant idiom.  Does casting the result to
> > void not help ?

Just '(void)writev(...);' does not prevent the warning.

> What does writev(-1,...) even mean? Can we not just nuke it?

Its just there for debugging with strace. Wether the whole debug ca be
removed, no idea.

Olaf

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c
  2012-04-03 15:04       ` Olaf Hering
@ 2012-04-03 16:39         ` Ian Campbell
  0 siblings, 0 replies; 26+ messages in thread
From: Ian Campbell @ 2012-04-03 16:39 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xensource.com, Ian Jackson

On Tue, 2012-04-03 at 16:04 +0100, Olaf Hering wrote:
> On Tue, Apr 03, Ian Campbell wrote:
> 
> > On Tue, 2012-04-03 at 11:25 +0100, Ian Jackson wrote:
> > > Olaf Hering writes ("[PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c"):
> > > > tools/libvchan: fix build errors caused by Werror in io.c
> > > ...
> > > > io.c:196: warning: ignoring return value of 'writev', declared with attribute warn_unused_result
> > > ...
> > > > -		writev(-1, iov, 2);
> > > > +		/* Silence gcc warning, will always fail */
> > > > +		if (writev(-1, iov, 2));
> > > 
> > > I still think this is an unpleasant idiom.  Does casting the result to
> > > void not help ?
> 
> Just '(void)writev(...);' does not prevent the warning.
> 
> > What does writev(-1,...) even mean? Can we not just nuke it?
> 
> Its just there for debugging with strace. Wether the whole debug ca be
> removed, no idea.

Lets just nuke it then, someone who is debugging libvchan can add things
like this locally if they need to.

Ian.

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2012-04-03 16:39 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 20:15 [PATCH 00 of 18] [v2] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
2012-04-02 20:15 ` [PATCH 01 of 18] tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num Olaf Hering
2012-04-02 20:15 ` [PATCH 02 of 18] tools/blktap: constify string arrays " Olaf Hering
2012-04-02 20:15 ` [PATCH 03 of 18] tools/blktap: fix params and physical-device parsing Olaf Hering
2012-04-02 20:15 ` [PATCH 04 of 18] tools/blktap: remove unneeded pointer dereferencing from img2qcow.c Olaf Hering
2012-04-02 20:15 ` [PATCH 05 of 18] tools/blktap: remove unneeded pointer dereferencing from qcow2raw.c Olaf Hering
2012-04-02 20:15 ` [PATCH 06 of 18] tools/blktap2: fix build errors caused by Werror in vhd_journal_write_entry Olaf Hering
2012-04-02 20:15 ` [PATCH 07 of 18] tools/blktap2: fix out of bounds access in block-log.c Olaf Hering
2012-04-02 20:15 ` [PATCH 08 of 18] tools/blktap2: fix build errors caused by Werror in tdqcow_get_parent_id Olaf Hering
2012-04-02 20:15 ` [PATCH 09 of 18] tools/blktap2: remove unneeded pointer dereferencing from img2qcow.c Olaf Hering
2012-04-02 20:15 ` [PATCH 10 of 18] tools/blktap2: remove unneeded pointer dereferencing from qcow2raw.c Olaf Hering
2012-04-02 20:15 ` [PATCH 11 of 18] tools/libvchan: fix function prototypes in node-select.c Olaf Hering
2012-04-02 20:15 ` [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror Olaf Hering
2012-04-02 20:15 ` [PATCH 13 of 18] tools/xenpaging: fix build errors caused by -Werror Olaf Hering
2012-04-02 20:15 ` [PATCH 14 of 18] tools/libvchan: fix build errors caused by Werror in io.c Olaf Hering
2012-04-03 10:25   ` Ian Jackson
2012-04-03 10:50     ` Ian Campbell
2012-04-03 15:04       ` Olaf Hering
2012-04-03 16:39         ` Ian Campbell
2012-04-02 20:15 ` [PATCH 15 of 18] tools/blktap2: remove static string table from header file Olaf Hering
2012-04-02 20:15 ` [PATCH 16 of 18] tools/blktap2: fix build errors caused by Werror, remove blkif_op_name Olaf Hering
2012-04-02 20:15 ` [PATCH 17 of 18] tools/blktap2: remove unused labels Olaf Hering
2012-04-02 20:15 ` [PATCH 18 of 18] tools/blktap+blktap2: fix build errors caused by Werror, remove unused variables Olaf Hering
2012-04-03 13:21   ` Ian Jackson
  -- strict thread matches above, loose matches on Subject: below --
2012-03-30  8:25 [PATCH 00 of 18] tools: fix bugs and build errors triggered by -O2 -Wall -Werror Olaf Hering
2012-03-30  8:25 ` [PATCH 12 of 18] tools/memshr: fix build errors caused by Werror Olaf Hering
2012-04-02 14:39   ` Ian Jackson

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).