Skip to contentSkip to conversation

NBD cleanup

PATCH In review Laurent Vivier 3 participants 3 messages Jun 7, 2008 – Jun 18, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NBD cleanup

This patch removes include of malloc.h from qemu-nbd.c to make it compile on OS X. (as reported by C.W. Betts and commented by Daniel P. Berrange)
It adjusts a printf format in nbd.c.

Signature · 3 lines
------------- [email protected] ---------------
"The best way to predict the future is to invent it."
- Alan Kay
nbd.c +1 -1
Index: nbd.c
===================================================================
@@ -388,7 +388,7 @@
 	}
 
 	if (len > sizeof(data)) {
-		LOG("len (%u) is larger than max len (%u)",
+		LOG("len (%u) is larger than max len (%lu)",
 		    len, sizeof(data));
 		errno = EINVAL;
 		return -1;
qemu-nbd.c +0 -1
Index: qemu-nbd.c
===================================================================
@@ -21,7 +21,6 @@
 #include "block_int.h"
 #include "nbd.h"
 
-#include <malloc.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <getopt.h>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Laurent Vivier

This patch removes include of malloc.h from qemu-nbd.c to make it compile on OS X. (as reported by C.W. Betts and commented by Daniel P. Berrange)
It adjusts a printf format in nbd.c.

Regards,

Anthony Liguori

#2 lore raw
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Laurent Vivier

This patch removes include of malloc.h from qemu-nbd.c to make it compile on OS X. (as reported by C.W. Betts and commented by Daniel P. Berrange)
It adjusts a printf format in nbd.c.

this last snippet avoids the following warning on amd64 linux (and other LP64 platforms) :

nbd.c: In function `nbd_trip':
nbd.c:391: warning: unsigned int format, different type arg (arg 7)

but will trigger something similar in x86 linux (and other ILP32 platforms) where sizeof returns unsigned instead.

to prevent this line to keep getting changed back and forth (as shown by r4676 and the two currently proposed patches that touch nbd) to avoid this warning; casting it to unsigned long as suggested in the attached patch (to be applied instead of this one) should be enough, if probably not that elegant.

Quoted 1 line

Carlo

nbd.c +2 -2
Index: nbd.c
===================================================================
@@ -388,8 +388,8 @@
 	}
 
 	if (len > sizeof(data)) {
-		LOG("len (%u) is larger than max len (%u)",
-		    len, sizeof(data));
+		LOG("len (%u) is larger than max len (%lu)",
+		    len, (unsigned long)sizeof(data));
 		errno = EINVAL;
 		return -1;
 	}
qemu-nbd.c +0 -1
Index: qemu-nbd.c
===================================================================
@@ -21,7 +21,6 @@
 #include "block_int.h"
 #include "nbd.h"
 
-#include <malloc.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <getopt.h>