NBD cleanup
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
@@ -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
@@ -21,7 +21,6 @@#include "block_int.h" #include "nbd.h" -#include <malloc.h> #include <stdarg.h> #include <stdio.h> #include <getopt.h>
Quoted 5 lines · Laurent Vivier
This patch removes include of
malloc.hfromqemu-nbd.cto make it compile on OS X. (as reported by C.W. Betts and commented by Daniel P. Berrange)
It adjusts a printf format innbd.c.
Regards,
Anthony Liguori
Carlo Marcelo Arenas Belon
Reviewed-byQuoted 5 lines · Anthony Liguori
Quoted 4 lines · Laurent Vivier
This patch removes include of
malloc.hfromqemu-nbd.cto make it compile on OS X. (as reported by C.W. Betts and commented by Daniel P. Berrange)
It adjusts a printf format innbd.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
Reviewed-by Anthony Liguori <[email protected]>
Carlo
nbd.c +2 -2
@@ -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
@@ -21,7 +21,6 @@#include "block_int.h" #include "nbd.h" -#include <malloc.h> #include <stdarg.h> #include <stdio.h> #include <getopt.h>