[4838] Allow QEMU to connect directly to an NBD server, by Laurent Vivier.
Revision: 4838
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4838 Author: ths Date: 2008-07-03 13:41:03 +0000 (Thu, 03 Jul 2008)
Log Message:
-----------
Allow QEMU to connect directly to an NBD server, by Laurent Vivier.
Modified Paths:
--------------
trunk/Makefile
trunk/block.c
trunk/block.h
trunk/nbd.c
trunk/nbd.h
trunk/qemu-doc.texi
trunk/qemu-nbd.c
trunk/qemu-nbd.texi
Added Paths:
-----------
trunk/block-nbd.c
Modified: trunk/Makefile
===================================================================
Makefile +4 -4
@@ -42,7 +42,7 @@ BLOCK_OBJS=cutils.o qemu-malloc.o BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o -BLOCK_OBJS+=block-qcow2.o block-parallels.o +BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o ###################################################################### # libqemu_common.a: Target independent part of system emulation. The
@@ -50,7 +50,7 @@ # system emulation, i.e. a single QEMU executable should support all # CPUs and machines. -OBJS=$(BLOCK_OBJS) +OBJS=nbd.o $(BLOCK_OBJS) OBJS+=readline.o console.o OBJS+=block.o
@@ -159,7 +159,7 @@ rm -f $@ $(AR) rcs $@ $(USER_OBJS) -QEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS) +QEMU_IMG_BLOCK_OBJS = nbd.o $(BLOCK_OBJS) ifdef CONFIG_WIN32 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o else
@@ -180,7 +180,7 @@ qemu-nbd-%.o: %.c $(CC) $(CFLAGS) $(CPPFLAGS) -DQEMU_NBD -c -o $@ $< -qemu-nbd$(EXESUF): qemu-nbd.o nbd.o qemu-img-block.o \ +qemu-nbd$(EXESUF): qemu-nbd.o qemu-nbd-nbd.o qemu-img-block.o \ osdep.o qemu-nbd-block-raw-posix.o $(BLOCK_OBJS) $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS)
Added: trunk/block-nbd.c
===================================================================
block-nbd.c +194 -0
194 lines not on this page · raw message
Modified: trunk/block.c
===================================================================
block.c +1 -0
@@ -1332,6 +1332,7 @@bdrv_register (&bdrv_vvfat);bdrv_register (&bdrv_qcow2);bdrv_register (&bdrv_parallels); +bdrv_register (&bdrv_nbd); } void *qemu_aio_get(BlockDriverState *bs, BlockDriverCompletionFunc *cb,
Modified: trunk/block.h
===================================================================
block.h +1 -0
@@ -16,6 +16,7 @@extern BlockDriver bdrv_vvfat;extern BlockDriver bdrv_qcow2;extern BlockDriver bdrv_parallels; +extern BlockDriver bdrv_nbd; typedef struct BlockDriverInfo { /* in bytes, 0 if irrelevant */
Modified: trunk/nbd.c
===================================================================
nbd.c +143 -68
343 lines not on this page · raw message
Modified: trunk/nbd.h
===================================================================
nbd.h +24 -2
@@ -1,4 +1,4 @@ -/*\ +/* * Copyright (C) 2005 Anthony Liguori <[email protected]> * * Network Block Device
@@ -15,7 +15,7 @@* You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -\*/ +*/ #ifndef NBD_H #define NBD_H
@@ -26,6 +26,26 @@#include <qemu-common.h> #include "block_int.h" +struct nbd_request { +uint32_t type; +uint64_t handle; +uint64_t from; +uint32_t len; +}; + +struct nbd_reply { +uint32_t error; +uint64_t handle; +}; + +enum { +NBD_CMD_READ =0 , +NBD_CMD_WRITE =1 , +NBD_CMD_DISC =2 +}; + +size_t nbd_wr_sync (int fd,void *buffer,size_t size,bool do_read); +int tcp_socket_outgoing (const char *address,uint16_t port);int tcp_socket_incoming (const char *address,uint16_t port);int unix_socket_outgoing (const char *path);int unix_socket_incoming (const char *path);
@@ -33,6 +53,8 @@int nbd_negotiate (BlockDriverState *bs,int csock,off_t size);int nbd_receive_negotiate (int csock,off_t *size,size_t *blocksize);int nbd_init (int fd,int csock,off_t size,size_t blocksize); +int nbd_send_request (int csock,struct nbd_request *request); +int nbd_receive_reply (int csock,struct nbd_reply *reply);int nbd_trip (BlockDriverState *bs,int csock,off_t size,uint64_t dev_offset,off_t *offset,bool readonly,uint8_t *data,int data_size);int nbd_client (int fd,int csock);
Modified: trunk/qemu-doc.texi
===================================================================
qemu-doc.texi +35 -0
@@ -1321,6 +1321,7 @@ * qemu_nbd_invocation:: qemu-nbd Invocation * host_drives:: Using host drives * disk_images_fat_images:: Virtual FAT disk images +* disk_images_nbd:: NBD access @end menu @node disk_images_quickstart
@@ -1503,6 +1504,40 @@ @item write to the FAT directory on the host system while accessing it with the guest system. @end itemize +@node disk_images_nbd +@subsection NBD access + +QEMU can access directly to block device exported using the Network Block Device +protocol. + +@example +qemu linux.img -hdb nbd:my_nbd_server.mydomain.org:1024 +@end example + +If the NBD server is located on the same host, you can use an unix socket instead +of an inet socket: + +@example +qemu linux.img -hdb nbd:unix:/tmp/my_socket +@end example + +In this case, the block device must be exported using qemu-nbd: + +@example +qemu-nbd --socket=/tmp/my_socket my_disk.qcow2 +@end example + +The use of qemu-nbd allows to share a disk between several guests: +@example +qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2 +@end example + +and then you can use it with two guests: +@example +qemu linux1.img -hdb nbd:unix:/tmp/my_socket +qemu linux2.img -hdb nbd:unix:/tmp/my_socket +@end example + @node pcsys_network @section Network emulation
Modified: trunk/qemu-nbd.c
===================================================================
qemu-nbd.c +8 -2
@@ -56,6 +56,7 @@" -c, --connect=DEV connect FILE to the local NBD device DEV\n" " -d, --disconnect disconnect the specified device\n" " -e, --shared=NUM device can be shared by NUM clients (default '1')\n" +" -t, --persistent don't exit on the last connection\n" " -v, --verbose display extra debugging information\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n"
@@ -189,7 +190,7 @@char *device =NULL ;char *socket =NULL ;char sockpath[128 ]; -const char *sopt ="hVbo:p:rsnP:c:dvk:e:" ; +const char *sopt ="hVbo:p:rsnP:c:dvk:e:t" ;struct option lopt[] = { {"help" ,0 ,0 ,'h' }, {"version" ,0 ,0 ,'V' },
@@ -204,6 +205,7 @@ { "snapshot", 0, 0, 's' }, { "nocache", 0, 0, 'n' }, { "shared", 1, 0, 'e' }, + { "persistent", 0, 0, 't' }, { "verbose", 0, 0, 'v' }, { NULL, 0, 0, 0 } };
@@ -222,6 +224,7 @@int i;int nb_fds =0 ;int max_fd; +int persistent =0 ;while ((ch =getopt_long (argc, argv, sopt, lopt, &opt_ind)) !=-1 ) {switch (ch) {
@@ -283,6 +286,9 @@errx (EINVAL ,"Shared device number must be greater than 0\n" ); }break ; +case 't' : + persistent =1 ; +break ;case 'v' : verbose =1 ;break ;
@@ -459,7 +465,7 @@ } } } - }while (nb_fds >1 ); + }while (persistent || nb_fds >1 );qemu_free (data);close (sharing_fds[0 ]);
Modified: trunk/qemu-nbd.texi
===================================================================
qemu-nbd.texi +2 -0
@@ -36,6 +36,8 @@ disconnect the specified device @item -e, --shared=NUM device can be shared by NUM clients (default '1') +@item -t, --persistent + don't exit on the last connection @item -v, --verbose display extra debugging information @item -h, --help
block-nbd.c line 38
Quoted 7 lines
block-nbd.c +7
-0+#include <sys/types.h> +#include <unistd.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <pthread.h>
Maybe you should wrap these with "#ifndef _WIN32", I get an error on windows:
nbd.c:24:23: warning: sys/ioctl.h: No such file or directory nbd.c:27:24: warning: sys/socket.h: No such file or directory nbd.c:28:20: warning: sys/un.h: No such file or directory nbd.c:29:24: warning: netinet/in.h: No such file or directory nbd.c:30:25: warning: netinet/tcp.h: No such file or directory nbd.c:31:23: warning: arpa/inet.h: No such file or directory nbd.c:32:19: warning: netdb.h: No such file or directory
Quoted 10 lines · chenqing
block-nbd.c line 38
Quoted 7 lines
block-nbd.c +7
-0+#include <sys/types.h> +#include <unistd.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <pthread.h> Maybe you should wrap these with "#ifndef
_WIN32", I get an error on windows:
Quoted 7 lines
nbd.c:24:23: warning:
sys/ioctl.h: No such file or directory nbd.c:27:24: warning:sys/socket.h: No such file or directory nbd.c:28:20: warning:sys/un.h: No such file or directory nbd.c:29:24: warning:netinet/in.h: No such file or directory nbd.c:30:25: warning:netinet/tcp.h: No such file or directory nbd.c:31:23: warning:arpa/inet.h: No such file or directory nbd.c:32:19: warning:netdb.h: No such file or directory
Hm, how much of nbd.c works on windows?
Thiemo
Quoted 2 lines
Hm, how much of
nbd.cworks on windows?
We don't care nbd.c works on windows, we just want to compile qemu on windows smoothly. In fact, I can did it successfully yestoday, but failed today because these error.
Quoted 19 lines · Thiemo Seufer
Quoted 10 lines · chenqing
block-nbd.c line 38
Quoted 7 lines
block-nbd.c +7
-0+#include <sys/types.h> +#include <unistd.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <pthread.h> Maybe you should wrap these with "#ifndef
_WIN32", I get an error on windows:Quoted 7 lines
nbd.c:24:23: warning:
sys/ioctl.h: No such file or directory nbd.c:27:24: warning:sys/socket.h: No such file or directory nbd.c:28:20: warning:sys/un.h: No such file or directory nbd.c:29:24: warning:netinet/in.h: No such file or directory nbd.c:30:25: warning:netinet/tcp.h: No such file or directory nbd.c:31:23: warning:arpa/inet.h: No such file or directory nbd.c:32:19: warning:netdb.h: No such file or directory
Quoted 1 line
Hm, how much of
nbd.cworks on windows?
Except the part of NBD client using kernel module, NBD should works (it's only networking).
Regards,
Laurent
Signature · 3 lines
------------- [email protected] --------------- "The best way to predict the future is to invent it." - Alan Kay
Quoted 6 lines · chenqing
Quoted 2 lines
Hm, how much of
nbd.cworks on windows?We don't care
nbd.cworks on windows, we just want to compile qemu on windows smoothly. In fact, I can did it successfully yestoday, but failed today because these error.
The attached patch should disable NBD on win32.
Regards,
Laurent
Signature · 3 lines
------------- [email protected] --------------- "The best way to predict the future is to invent it." - Alan Kay
--- Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
Makefile +10 -4
@@ -42,7 +42,10 @@ recurse-all: $(SUBDIR_RULES) BLOCK_OBJS=cutils.o qemu-malloc.o BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o -BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o +BLOCK_OBJS+=block-qcow2.o block-parallels.o +ifndef CONFIG_WIN32 +BLOCK_OBJS+=block-nbd.o +endif ###################################################################### # libqemu_common.a: Target independent part of system emulation. The
@@ -50,7 +53,10 @@ BLOCK_OBJS+=block-qcow2.o block-parallel # system emulation, i.e. a single QEMU executable should support all # CPUs and machines. -OBJS=nbd.o $(BLOCK_OBJS) +OBJS=$(BLOCK_OBJS) +ifndef CONFIG_WIN32 +OBJS+=nbd.o +endif OBJS+=readline.o console.o OBJS+=block.o
@@ -159,11 +165,11 @@ libqemu_user.a: $(USER_OBJS) rm -f $@ $(AR) rcs $@ $(USER_OBJS) -QEMU_IMG_BLOCK_OBJS = nbd.o $(BLOCK_OBJS) +QEMU_IMG_BLOCK_OBJS = $(BLOCK_OBJS) ifdef CONFIG_WIN32 QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-win32.o else -QEMU_IMG_BLOCK_OBJS += qemu-img-block-raw-posix.o +QEMU_IMG_BLOCK_OBJS += nbd.o qemu-img-block-raw-posix.o endif ######################################################################
Quoted 9 lines · Laurent Vivier
Quoted 6 lines · chenqing
Quoted 2 lines
Hm, how much of
nbd.cworks on windows?We don't care
nbd.cworks on windows, we just want to compile qemu on windows smoothly. In fact, I can did it successfully yestoday, but failed today because these error.The attached patch should disable NBD on win32.
Anybody out there who thinks NBD could be useful on Win32, and is inclined to write a patch?
Thiemo
Hi,
Quoted 5 lines · Thiemo Seufer
Quoted 4 lines · Laurent Vivier
Quoted 3 lines · chenqing
Quoted 2 lines
Hm, how much of
nbd.cworks on windows?
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
We don't care
nbd.cworks on windows, we just want to compile qemu on windows smoothly. In fact, I can did it successfully yestoday, but failed today because these error.The attached patch should disable NBD on win32.
Anybody out there who thinks NBD could be useful on Win32, and is inclined to write a patch?
I think it would be useful, especially given the file system limitations Windows has.
Even if I am somewhat allergic to requests of Windows users, I will give a try at a patch.
Ciao,
Dscho
PATCH 1/1 Fix compilation of nbd on Windows
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
---
This is only compile-tested, since I can only work in an emulated environment.
Oh, and feel free to reorder nbd.h so that it has only one #ifndef..#endif.
If I find some time next week, I might try to actually compile qemu-nbd and get it to run on Windows.
Makefile | 1 + block-nbd.c | 11 ++++++++++- nbd.c | 36 +++++++++++++++++++++++++++++++++++- nbd.h | 6 ++++++ 4 files changed, 52 insertions(+), 2 deletions(-)
Makefile +1 -0
@@ -70,6 +70,7 @@ endif ifdef CONFIG_WIN32 OBJS+=tap-win32.o +LIBS+= -lws2_32 endif AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
block-nbd.c +10 -1
@@ -31,11 +31,17 @@#include <sys/types.h> #include <unistd.h> +#ifdef _WIN32 +#include <windows.h> +#include <winsock2.h> +#include <ws2tcpip.h> +#else #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> +#endif typedef struct BDRVNBDState { int sock;
@@ -61,11 +67,14 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)if (strstart (host,"unix:" , &unixpath)) { +#ifdef _WIN32 +return -EINVAL ; +#else if (unixpath[0 ] !='/' )return -EINVAL ; sock =unix_socket_outgoing (unixpath); - +#endif }else {uint16_t port;char *p, *r;
nbd.c +35 -1
@@ -21,15 +21,45 @@#include <errno.h> #include <string.h> -#include <sys/ioctl.h> #include <ctype.h> #include <inttypes.h> +#ifdef _WIN32 +#include <windows.h> +#include <winsock2.h> +#include <ws2tcpip.h> + +#define socket_error () WSAGetLastError() +#undef EAGAIN +#undef EINTR +#undef EINVAL +#define EAGAIN WSAEWOULDBLOCK +#define EINTR WSAEINTR +#define EINVAL WSAEINVAL + +static inline int inet_aton (const char *cp,struct in_addr *inp) +{ +unsigned long result =inet_addr (cp); +if (result ==INADDR_NONE ) +return 0 ; + inp->s_addr = result; +return 1 ; +} + +static inline int mingw_setsockopt (int s,int level,int optname, +const void *optval,socklen_t optlen) +{ +return setsockopt (s, level, optname, (const char *)optval, optlen); +} +#define setsockopt mingw_setsockopt +#else +#include <sys/ioctl.h> #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> +#endif #if defined(QEMU_NBD )extern int verbose;
@@ -188,6 +218,7 @@ error:return -1 ; } +#ifndef _WIN32int unix_socket_incoming (const char *path) {int s;
@@ -245,6 +276,7 @@ error: errno = serrno; return -1; } +#endif /* Basic flow
@@ -334,6 +366,7 @@ int nbd_receive_negotiate(int csock, off_t *size, size_t *blocksize)return 0 ; } +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize) {TRACE ("Setting block size to %lu" , (unsigned long )blocksize);
@@ -407,6 +440,7 @@ int nbd_client(int fd, int csock) errno = serrno; return ret; } +#endif int nbd_send_request (int csock,struct nbd_request *request) {
nbd.h +6 -0
@@ -47,17 +47,23 @@ enum {size_t nbd_wr_sync (int fd,void *buffer,size_t size,bool do_read);int tcp_socket_outgoing (const char *address,uint16_t port);int tcp_socket_incoming (const char *address,uint16_t port); +#ifndef _WIN32int unix_socket_outgoing (const char *path);int unix_socket_incoming (const char *path); +#endif int nbd_negotiate (BlockDriverState *bs,int csock,off_t size);int nbd_receive_negotiate (int csock,off_t *size,size_t *blocksize); +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize); +#endif int nbd_send_request (int csock,struct nbd_request *request);int nbd_receive_reply (int csock,struct nbd_reply *reply);int nbd_trip (BlockDriverState *bs,int csock,off_t size,uint64_t dev_offset,off_t *offset,bool readonly,uint8_t *data,int data_size); +#ifndef _WIN32int nbd_client (int fd,int csock);int nbd_disconnect (int fd); +#endif #endif
Signature · 1 line
1.5.6.1.376.g6b0fd
Re: [Qemu-devel] [PATCH] Fix compilation of nbd on Windows
Closing sockets with "close" doesn't work on WinSock. Add "#define close closesocket" to the top of file to fix it. Otherwise, good job!
Best regards,
Filip Navara
Quoted 190 lines · Johannes Schindelin
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
Signed-off-by Johannes Schindelin <[email protected]>---
This is only compile-tested, since I can only work in an emulated environment.
Oh, and feel free to reorder
nbd.hso that it has only one #ifndef..#endif.If I find some time next week, I might try to actually compile qemu-nbd and get it to run on Windows.
Makefile | 1 + block-nbd.c | 11 ++++++++++- nbd.c | 36 +++++++++++++++++++++++++++++++++++- nbd.h | 6 ++++++ 4 files changed, 52 insertions(+), 2 deletions(-)Makefile +1
-0@@ -70,6 +70,7 @@ endif ifdef CONFIG_WIN32 OBJS+=tap-win32.o +LIBS+= -lws2_32 endif AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.oblock-nbd.c +10
-1@@ -31,11 +31,17 @@#include <sys/types.h> #include <unistd.h> +#ifdef _WIN32 +#include <windows.h> +#include <winsock2.h> +#include <ws2tcpip.h> +#else #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> +#endif typedef struct BDRVNBDState { int sock;@@ -61,11 +67,14 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)if (strstart (host,"unix:" , &unixpath)) { +#ifdef _WIN32 +return -EINVAL ; +#else if (unixpath[0 ] !='/' )return -EINVAL ; sock =unix_socket_outgoing (unixpath); - +#endif }else {uint16_t port;char *p, *r;nbd.c +35
-1@@ -21,15 +21,45 @@#include <errno.h> #include <string.h> -#include <sys/ioctl.h> #include <ctype.h> #include <inttypes.h> +#ifdef _WIN32 +#include <windows.h> +#include <winsock2.h> +#include <ws2tcpip.h> + +#define socket_error () WSAGetLastError() +#undef EAGAIN +#undef EINTR +#undef EINVAL +#define EAGAIN WSAEWOULDBLOCK +#define EINTR WSAEINTR +#define EINVAL WSAEINVAL + +static inline int inet_aton (const char *cp,struct in_addr *inp) +{ +unsigned long result =inet_addr (cp); +if (result ==INADDR_NONE ) +return 0 ; + inp->s_addr = result; +return 1 ; +} + +static inline int mingw_setsockopt (int s,int level,int optname, +const void *optval,socklen_t optlen) +{ +return setsockopt (s, level, optname, (const char *)optval, optlen); +} +#define setsockopt mingw_setsockopt +#else +#include <sys/ioctl.h> #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> +#endif #if defined(QEMU_NBD )extern int verbose;@@ -188,6 +218,7 @@ error:return -1 ; } +#ifndef _WIN32int unix_socket_incoming (const char *path) {int s;@@ -245,6 +276,7 @@ error: errno = serrno; return -1; } +#endif /* Basic flow @@ -334,6 +366,7 @@ int nbd_receive_negotiate(int csock, off_t *size, size_t *blocksize)return 0 ; } +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize) {TRACE ("Setting block size to %lu" , (unsigned long )blocksize);@@ -407,6 +440,7 @@ int nbd_client(int fd, int csock) errno = serrno; return ret; } +#endif int nbd_send_request (int csock,struct nbd_request *request) {nbd.h +6
-1@@ -47,17 +47,23 @@ enum {size_t nbd_wr_sync (int fd,void *buffer,size_t size,bool do_read);int tcp_socket_outgoing (const char *address,uint16_t port);int tcp_socket_incoming (const char *address,uint16_t port); +#ifndef _WIN32int unix_socket_outgoing (const char *path);int unix_socket_incoming (const char *path); +#endif int nbd_negotiate (BlockDriverState *bs,int csock,off_t size);int nbd_receive_negotiate (int csock,off_t *size,size_t *blocksize); +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize); +#endif int nbd_send_request (int csock,struct nbd_request *request);int nbd_receive_reply (int csock,struct nbd_reply *reply);int nbd_trip (BlockDriverState *bs,int csock,off_t size,uint64_t dev_offset,off_t *offset,bool readonly,uint8_t *data,int data_size); +#ifndef _WIN32int nbd_client (int fd,int csock);int nbd_disconnect (int fd); +#endif #endif --1.5.6.1.376.g6b0fd
Re: [Qemu-devel] [PATCH] Fix compilation of nbd on Windows
Quoted 2 lines · Filip Navara
Closing sockets with "close" doesn't work on WinSock. Add "#define close closesocket" to the top of file to fix it. Otherwise, good job!
Socket error handling is different too, you might want to check any places errno is used in the socket code. Also ioctl -> ioctlsocket (but you probably don't use it).
Or look at the rest of QEMU, which surely does some Windows networking.
-- Jamie
Re: [Qemu-devel] [PATCH] Fix compilation of nbd on Windows
Hi,
Quoted 3 lines · Jamie Lokier
Quoted 2 lines · Filip Navara
Closing sockets with "close" doesn't work on WinSock. Add "#define close closesocket" to the top of file to fix it.
Yep, seems like I missed that, in spite of having looked at some sample code of mine.
Quoted 2 lines
Socket error handling is different too, you might want to check any places errno is used in the socket code.
Now, that is funny, as ...
Quoted 1 line
Or look at the rest of QEMU, which surely does some Windows networking.
... I did exactly that, and copied the GetLastError() part from there.
Puzzled,
Dscho
Re: [Qemu-devel] [PATCH] Fix compilation of nbd on Windows
Quoted 8 lines · Johannes Schindelin
Quoted 2 lines
Socket error handling is different too, you might want to check any places errno is used in the socket code.
Now, that is funny, as ...
Quoted 1 line
Or look at the rest of QEMU, which surely does some Windows networking.
... I did exactly that, and copied the
GetLastError()part from there.
NP, I didn't look at your code, just following on from the parent comment, the few key differences with Winsock. :-)
-- Jamie
Re: [Qemu-devel] [PATCH] Fix compilation of nbd on Windows
Hi,
Quoted 6 lines · Jamie Lokier
Quoted 5 lines · Johannes Schindelin
Quoted 2 lines
Socket error handling is different too, you might want to check any places errno is used in the socket code.
Now, that is funny, as ...
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Or look at the rest of QEMU, which surely does some Windows networking.
... I did exactly that, and copied the
GetLastError()part from there.NP, I didn't look at your code, just following on from the parent comment, the few key differences with Winsock. :-)
NP, I just thought you had something to say to me.
Ciao,
Dscho
Re: [Qemu-devel] [PATCH] Fix compilation of nbd on Windows
In reply to Johannes SchindelinQuoted 43 lines · Johannes Schindelin
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
Signed-off-by Johannes Schindelin <[email protected]>---
This is only compile-tested, since I can only work in an emulated environment.
Oh, and feel free to reorder
nbd.hso that it has only one #ifndef..#endif.If I find some time next week, I might try to actually compile qemu-nbd and get it to run on Windows.
Makefile | 1 + block-nbd.c | 11 ++++++++++- nbd.c | 36 +++++++++++++++++++++++++++++++++++- nbd.h | 6 ++++++ 4 files changed, 52 insertions(+), 2 deletions(-)Makefile +1
-0@@ -70,6 +70,7 @@ endif ifdef CONFIG_WIN32 OBJS+=tap-win32.o +LIBS+= -lws2_32 endif AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.oblock-nbd.c +2
-0@@ -31,11 +31,17 @@#include <sys/types.h> #include <unistd.h> +#ifdef _WIN32 +#include <windows.h>
block-nbd.c line 45
Quoted 10 lines
block-nbd.c +4
-0+#include <winsock2.h> +#include <ws2tcpip.h> +#else #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> +#endif
qemu_socket.h already does this for you.
Quoted 49 lines
block-nbd.c +4
-1typedef struct BDRVNBDState { int sock;@@ -61,11 +67,14 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)if (strstart (host,"unix:" , &unixpath)) { +#ifdef _WIN32 +return -EINVAL ; +#else if (unixpath[0 ] !='/' )return -EINVAL ; sock =unix_socket_outgoing (unixpath); - +#endif }else {uint16_t port;char *p, *r;nbd.c +20
-1@@ -21,15 +21,45 @@#include <errno.h> #include <string.h> -#include <sys/ioctl.h> #include <ctype.h> #include <inttypes.h> +#ifdef _WIN32 +#include <windows.h> +#include <winsock2.h> +#include <ws2tcpip.h> + +#define socket_error () WSAGetLastError() +#undef EAGAIN +#undef EINTR +#undef EINVAL +#define EAGAIN WSAEWOULDBLOCK +#define EINTR WSAEINTR +#define EINVAL WSAEINVAL + +static inline int inet_aton (const char *cp,struct in_addr *inp) +{ +unsigned long result =inet_addr (cp); +if (result ==INADDR_NONE ) +return 0 ; + inp->s_addr = result; +return 1 ;
nbd.c line 55
Quoted 10 lines
nbd.c +9
-0+} + +static inline int mingw_setsockopt (int s,int level,int optname, +const void *optval,socklen_t optlen) +{ +return setsockopt (s, level, optname, (const char *)optval, optlen); +} +#define setsockopt mingw_setsockopt +#else
Any more compat stuff should go in qemu_socket.h
Regards,
Anthony Liguori
Quoted 72 lines
nbd.c +2
-0+#include <sys/ioctl.h> #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> +#endif #if defined(QEMU_NBD )extern int verbose;
nbd.c +4
-0@@ -188,6 +218,7 @@ error:return -1 ; } +#ifndef _WIN32int unix_socket_incoming (const char *path) {int s;@@ -245,6 +276,7 @@ error: errno = serrno; return -1; } +#endif /* Basic flow @@ -334,6 +366,7 @@ int nbd_receive_negotiate(int csock, off_t *size, size_t *blocksize)return 0 ; } +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize) {TRACE ("Setting block size to %lu" , (unsigned long )blocksize);@@ -407,6 +440,7 @@ int nbd_client(int fd, int csock) errno = serrno; return ret; } +#endif int nbd_send_request (int csock,struct nbd_request *request) {nbd.h +6
-0@@ -47,17 +47,23 @@ enum {size_t nbd_wr_sync (int fd,void *buffer,size_t size,bool do_read);int tcp_socket_outgoing (const char *address,uint16_t port);int tcp_socket_incoming (const char *address,uint16_t port); +#ifndef _WIN32int unix_socket_outgoing (const char *path);int unix_socket_incoming (const char *path); +#endif int nbd_negotiate (BlockDriverState *bs,int csock,off_t size);int nbd_receive_negotiate (int csock,off_t *size,size_t *blocksize); +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize); +#endif int nbd_send_request (int csock,struct nbd_request *request);int nbd_receive_reply (int csock,struct nbd_reply *reply);int nbd_trip (BlockDriverState *bs,int csock,off_t size,uint64_t dev_offset,off_t *offset,bool readonly,uint8_t *data,int data_size); +#ifndef _WIN32int nbd_client (int fd,int csock);int nbd_disconnect (int fd); +#endif #endif
Re: [Qemu-devel] [PATCH] Fix compilation of nbd on Windows
Hi,
Quoted 39 lines · Anthony Liguori
Quoted 38 lines · Johannes Schindelin
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
Signed-off-by Johannes Schindelin <[email protected]>---
This is only compile-tested, since I can only work in an emulated environment.
Oh, and feel free to reorder
nbd.hso that it has only one #ifndef..#endif.If I find some time next week, I might try to actually compile qemu-nbd and get it to run on Windows.
Makefile | 1 + block-nbd.c | 11 ++++++++++- nbd.c | 36 +++++++++++++++++++++++++++++++++++- nbd.h | 6 ++++++ 4 files changed, 52 insertions(+), 2 deletions(-)Makefile +1
-0@@ -70,6 +70,7 @@ endif ifdef CONFIG_WIN32 OBJS+=tap-win32.o +LIBS+= -lws2_32 endif AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.oblock-nbd.c +0
-0@@ -31,11 +31,17 @@
Quoted 16 lines
Quoted 4 lines
block-nbd.c +2
-0#include <sys/types.h> #include <unistd.h> +#ifdef _WIN32 +#include <windows.h> block-nbd.c line 45
Quoted 10 lines
block-nbd.c +4
-0+#include <winsock2.h> +#include <ws2tcpip.h> +#else #include <sys/socket.h> #include <sys/un.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> +#endif
qemu_socket.halready does this for you.
Thanks! That was actually very useful advice!
Note that I will likely have to do different things until later this week, but then I will definitely take this advice into account, and try to get qemu-nbd going (tcp-only) on Windows.
Ciao,
Dscho
[Qemu-devel] Re: [PATCH] Fix compilation of nbd on Windows
Quoted 1 line · Johannes Schindelin
Note that I will likely have to do different things until later this week, but then I will definitely take this advice into account, and try to get qemu-nbd going (tcp-only) on Windows.
Did you find some time to take a look at it again?
- Sebastian
Re: [Qemu-devel] Re: [PATCH] Fix compilation of nbd on Windows
Hi,
Quoted 7 lines · Sebastian Herbszt
Quoted 3 lines · Johannes Schindelin
Note that I will likely have to do different things until later this week, but then I will definitely take this advice into account, and try to get qemu-nbd going (tcp-only) on Windows.
Did you find some time to take a look at it again?
Unfortunately, not yet. Otherwise I would have posted a new version of the patch already.
Ciao,
Dscho
PATCH v2 1/1 Fix compilation of nbd on Windows
In reply to Johannes SchindelinThis still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
---
This is still untested; that is the job of Windows users. At least it compiles.
Makefile | 1 + block-nbd.c | 10 +++++++--- nbd.c | 31 +++++++++++++++++++------------ nbd.h | 6 ++++++ qemu_socket.h | 18 ++++++++++++++++++ 5 files changed, 51 insertions(+), 15 deletions(-)
Makefile +1 -0
@@ -75,6 +75,7 @@ endif ifdef CONFIG_WIN32 OBJS+=tap-win32.o +LIBS+= -lws2_32 endif AUDIO_OBJS = audio.o noaudio.o wavaudio.o mixeng.o
block-nbd.c +7 -3
@@ -31,11 +31,12 @@#include <sys/types.h> #include <unistd.h> -#include <sys/socket.h> +#include "qemu_socket.h" +#ifndef WIN32 #include <sys/un.h> -#include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> +#endif typedef struct BDRVNBDState { int sock;
@@ -61,11 +62,14 @@ static int nbd_open(BlockDriverState *bs, const char* filename, int flags)if (strstart (host,"unix:" , &unixpath)) { +#ifdef _WIN32 +return -EINVAL ; +#else if (unixpath[0 ] !='/' )return -EINVAL ; sock =unix_socket_outgoing (unixpath); - +#endif }else {uint16_t port;char *p, *r;
nbd.c +19 -12
@@ -21,18 +21,18 @@#include <errno.h> #include <string.h> +#include <ctype.h> +#include <inttypes.h> +#include "qemu_socket.h" +#ifndef _WIN32#include <sys/ioctl.h> #ifdef __sun__#include <sys/ioccom.h> #endif -#include <ctype.h> -#include <inttypes.h> -#include <sys/socket.h> -#include <sys/un.h> -#include <netinet/in.h> #include <netinet/tcp.h> #include <arpa/inet.h> #include <netdb.h> +#endif #if defined(QEMU_NBD )extern int verbose;
@@ -83,7 +83,8 @@ size_t nbd_wr_sync(int fd, void *buffer, size_t size, bool do_read) }/* recoverable error */ -if (len ==-1 && (errno ==EAGAIN || errno ==EINTR )) { +if (len ==-1 && (socket_error () ==EAGAIN || +socket_error () ==EINTR )) {continue ; }
@@ -112,6 +113,7 @@ int tcp_socket_outgoing(const char *address, uint16_t port) s =socket (PF_INET ,SOCK_STREAM ,0 );if (s ==-1 ) { + errno =socket_error ();return -1 ; }
@@ -136,8 +138,8 @@ int tcp_socket_outgoing(const char *address, uint16_t port)return s; error: - serrno = errno; -close (s); + serrno =socket_error (); +closesocket (s); errno = serrno;return -1 ; }
@@ -152,6 +154,7 @@ int tcp_socket_incoming(const char *address, uint16_t port) s =socket (PF_INET ,SOCK_STREAM ,0 );if (s ==-1 ) { + errno =socket_error ();return -1 ; }
@@ -185,12 +188,13 @@ int tcp_socket_incoming(const char *address, uint16_t port)return s; error: - serrno = errno; -close (s); + serrno =socket_error (); +closesocket (s); errno = serrno;return -1 ; } +#ifndef _WIN32int unix_socket_incoming (const char *path) {int s;
@@ -217,7 +221,7 @@ int unix_socket_incoming(const char *path)return s; error: serrno = errno; -close (s); +closesocket (s); errno = serrno;return -1 ; }
@@ -244,10 +248,11 @@ int unix_socket_outgoing(const char *path)return s; error: serrno = errno; -close (s); +closesocket (s); errno = serrno; return -1; } +#endif /* Basic flow
@@ -337,6 +342,7 @@ int nbd_receive_negotiate(int csock, off_t *size, size_t *blocksize)return 0 ; } +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize) {TRACE ("Setting block size to %lu" , (unsigned long )blocksize);
@@ -410,6 +416,7 @@ int nbd_client(int fd, int csock) errno = serrno; return ret; } +#endif int nbd_send_request (int csock,struct nbd_request *request) {
nbd.h +6 -0
@@ -47,17 +47,23 @@ enum {size_t nbd_wr_sync (int fd,void *buffer,size_t size,bool do_read);int tcp_socket_outgoing (const char *address,uint16_t port);int tcp_socket_incoming (const char *address,uint16_t port); +#ifndef _WIN32int unix_socket_outgoing (const char *path);int unix_socket_incoming (const char *path); +#endif int nbd_negotiate (BlockDriverState *bs,int csock,off_t size);int nbd_receive_negotiate (int csock,off_t *size,size_t *blocksize); +#ifndef _WIN32int nbd_init (int fd,int csock,off_t size,size_t blocksize); +#endif int nbd_send_request (int csock,struct nbd_request *request);int nbd_receive_reply (int csock,struct nbd_reply *reply);int nbd_trip (BlockDriverState *bs,int csock,off_t size,uint64_t dev_offset,off_t *offset,bool readonly,uint8_t *data,int data_size); +#ifndef _WIN32int nbd_client (int fd,int csock);int nbd_disconnect (int fd); +#endif #endif
qemu_socket.h +18 -0
@@ -10,9 +10,27 @@#define socket_error () WSAGetLastError()#undef EINTR +#undef EINVAL#define EWOULDBLOCK WSAEWOULDBLOCK#define EINTR WSAEINTR#define EINPROGRESS WSAEINPROGRESS +#define EINVAL WSAEINVAL + +static inline int inet_aton (const char *cp,struct in_addr *inp) +{ +unsigned long result =inet_addr (cp); +if (result ==INADDR_NONE ) +return 0 ; + inp->s_addr = result; +return 1 ; +} + +static inline int mingw_setsockopt (int s,int level,int optname, +const void *optval,socklen_t optlen) +{ +return setsockopt (s, level, optname, (const char *)optval, optlen); +} +#define setsockopt mingw_setsockopt#else
Signature · 1 line
1.6.0.rc1.70.g91e1d
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
Quoted 3 lines · Johannes Schindelin
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
This patch fixes the build of qemu-nbd but breaks the build of qemu for win32.
Quoted 16 lines
Signed-off-by Johannes Schindelin <[email protected]>---
qemu_socket.h +2
-0@@ -10,9 +10,27 @@#define socket_error () WSAGetLastError()#undef EINTR +#undef EINVAL#define EWOULDBLOCK WSAEWOULDBLOCK#define EINTR WSAEINTR#define EINPROGRESS WSAEINPROGRESS +#define EINVAL WSAEINVAL
qemu_socket.h line 27
Quoted 10 lines
qemu_socket.h +9
-0+ +static inline int inet_aton (const char *cp,struct in_addr *inp) +{ +unsigned long result =inet_addr (cp); +if (result ==INADDR_NONE ) +return 0 ; + inp->s_addr = result; +return 1 ; +}
This bit conflicts with:
Quoted 3 lines
qemu_socket.h +0
-0#include <winsock2.h> int inet_aton (const char *cp,struct in_addr *ia);#endif
This definition in vl.c
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
Hi,
[was it intentional that you culled me, and me alone, from the Cc: list?
I know that you like to be rude against me, but I'd like to know if it was really meant this way this time.]
Quoted 7 lines · Anthony Liguori
Quoted 3 lines · Johannes Schindelin
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
This patch fixes the build of qemu-nbd but breaks the build of qemu for win32.
The build did not break here.
But then, I do not have a Windows computer myself, so I could not really test QEmu itself.
Quoted 12 lines
qemu_socket.h line 26
Quoted 9 lines
qemu_socket.h +8
-0+static inline int inet_aton (const char *cp,struct in_addr *inp) +{ +unsigned long result =inet_addr (cp); +if (result ==INADDR_NONE ) +return 0 ; + inp->s_addr = result; +return 1 ; +}This bit conflicts with:
Quoted 5 lines
Quoted 3 lines
#include <
winsock2.h>
intinet_aton(const char *cp, struct in_addr *ia); #endifThis definition in
vl.c
It is not the definition, but just the declaration. And by your own reasoning, it should not be in vl.c but in qemu_socket.h, where I would have picked up on it and spared myself writing my own implementation of inet_aton().
Indeed, it seems that inet_aton() is defined in slirp/misc.c. So qemu_socket.h is not even the right place for the definition, but better than nothing.
Ciao,
Dscho
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
Quoted 6 lines · Johannes Schindelin
Hi,
[was it intentional that you culled me, and me alone, from the Cc: list?
I know that you like to be rude against me, but I'd like to know if it was really meant this way this time.]
No, it's the annoying way that the mailing list is configured. The mailing list sets a Reply-To header and reply to all in thunderbird ignores the original From line (because Reply-To has been set).
Quoted 1 line
It is not the definition, but just the declaration.
The problem is mixing a static and non-static declaration of a function.
Quoted 2 lines
And by your own
reasoning, it should not be invl.cbut inqemu_socket.h,
Yup.
Quoted 5 lines
where I would
have picked up on it and spared myself writing my own implementation ofinet_aton().Indeed, it seems that
inet_aton()is defined inslirp/misc.c. Soqemu_socket.his not even the right place for the definition, but better than nothing.
Ugh, I wonder what happens when you do --disable-slirp :-( Do you want to work up a patch to sanitize all of this or should I?
Regards,
Anthony Liguori
Quoted 4 lines
Ciao,
Dscho
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
Hi,
Quoted 8 lines · Anthony Liguori
Quoted 3 lines · Johannes Schindelin
Indeed, it seems that
inet_aton()is defined inslirp/misc.c. Soqemu_socket.his not even the right place for the definition, but better than nothing.Ugh, I wonder what happens when you do --disable-slirp :-( Do you want to work up a patch to sanitize all of this or should I?
You mean to keep my static implementation, but put it in an #ifndef CONFIG_SLIRP, with the #else branch declaring the function?
Sure, I can do it, just tell me if that is what you meant.
Ciao,
Dscho
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
Quoted 8 lines · Johannes Schindelin
Hi,
Quoted 3 lines · Anthony Liguori
Johannes Schindelin wrote:
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Indeed, it seems that
inet_aton()is defined inslirp/misc.c. Soqemu_socket.his not even the right place for the definition, but better than nothing.Ugh, I wonder what happens when you do --disable-slirp :-( Do you want to work up a patch to sanitize all of this or should I?
You mean to keep my static implementation, but put it in an #ifndef
CONFIG_SLIRP, with the #else branch declaring the function?Sure, I can do it, just tell me if that is what you meant.
It's all pretty messy right now. I tried to wrap your static implementation in a #ifdef QEMU_IMG but then nbd.o gets linked into both qemu and qemu-nbd which makes things a pain. I actually ended up just removing the declaration in vl.c and that seemed to work.
Whatever you can do that will make it so we're only using a single implementation of inet_aton() will make me happy.
Regards,
Anthony Liguori
Quoted 4 lines
Ciao,
Dscho
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
In reply to Johannes SchindelinQuoted 15 lines · Johannes Schindelin
Hi,
[was it intentional that you culled me, and me alone, from the Cc: list?
I know that you like to be rude against me, but I'd like to know if it was really meant this way this time.]Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Johannes Schindelin
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
Quoted 7 lines
Quoted 2 lines
This patch fixes the build of qemu-nbd but breaks the build of qemu for win32.
The build did not break here.
But then, I do not have a Windows computer myself, so I could not really test QEmu itself.
BTW, QEMU seems to run just fine under wine. Right now I'm building with mingw and testing with wine. That seems to be working pretty well.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
In reply to Anthony LiguoriHi Anthony,
Quoted 16 lines · Anthony Liguori
Quoted 14 lines · Johannes Schindelin
Quoted 8 lines · Anthony Liguori
Quoted 3 lines · Johannes Schindelin
Indeed, it seems that
inet_aton()is defined inslirp/misc.c. Soqemu_socket.his not even the right place for the definition, but better than nothing.Ugh, I wonder what happens when you do --disable-slirp :-( Do you want to work up a patch to sanitize all of this or should I?
You mean to keep my static implementation, but put it in an #ifndef
CONFIG_SLIRP, with the #else branch declaring the function?
Quoted 6 lines
Quoted 1 line
Sure, I can do it, just tell me if that is what you meant.
It's all pretty messy right now. I tried to wrap your static implementation in a #ifdef
QEMU_IMGbut then nbd.o gets linked into both qemu and qemu-nbd which makes things a pain. I actually ended up just removing the declaration invl.cand that seemed to work.
Yes, I just realized that it gets messy.
Quoted 2 lines
Whatever you can do that will make it so we're only using a single implementation of
inet_aton()will make me happy.
Well, we cannot cleanly include qemu_socket.h from slirp, can we? And we cannot link qemu_common.a to qemu-img because of the missing implementations for *_input().
So I think that unfortunately, we have no clean way to have a single implementation, short of having a separate "inet_aton.h" in slirp/ with a static implementation...
The whole issue only arises because Win32 misses inet_aton(), sigh.
Ciao,
Dscho
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
In reply to Anthony LiguoriHi,
Quoted 12 lines · Anthony Liguori
Quoted 10 lines · Johannes Schindelin
Quoted 7 lines · Anthony Liguori
Quoted 2 lines · Johannes Schindelin
This still only supports the client side, and only the TCP version of it, since Windows does not have Unix sockets.
This patch fixes the build of qemu-nbd but breaks the build of qemu for win32.
Quoted 7 lines
Quoted 4 lines
The build did not break here.
But then, I do not have a Windows computer myself, so I could not really test QEmu itself.
BTW, QEMU seems to run just fine under wine. Right now I'm building with mingw and testing with wine. That seems to be working pretty well.
In my experience, Wine only shows you so far what works on Windows and what does not. For example, MingW itself does not run properly in Wine. At least last time I needed it.
Ciao,
Dscho
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
In reply to Johannes SchindelinHi Dscho,
Am 03.08.2008 um 19:32 schrieb Johannes Schindelin:
Quoted 1 line
[was it intentional that you culled me, and me alone, from the Cc: list?
I have seen it happening myself multiple times on this list that a CC was somehow dropped. That is, it's still there in my sent message but doesn't show up in the received list message.
My recent nbd patch for instance was cc'ed to Laurent Vivier but the list message shows no CC at all.
Anyway, don't take it personal.
Andreas
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
In reply to Anthony LiguoriQuoted 11 lines · Anthony Liguori
Quoted 6 lines · Johannes Schindelin
Hi,
[was it intentional that you culled me, and me alone, from the Cc: list? I know that you like to be rude against me, but I'd like to know if it was really meant this way this time.]
No, it's the annoying way that the mailing list is configured. The
mailing list sets a Reply-To header and reply to all in thunderbird ignores the original From line (because Reply-To has been set).
Mutt's group-reply function is the same. It sends to everyone in the To and Cc, but not the person in From! Very annoying on a list like this. It has an option to ignore list's Reply-To entirely, but not an option to make group-reply send to everyone.
-- Jamie
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
In reply to Johannes SchindelinQuoted 9 lines · Johannes Schindelin
Quoted 5 lines
Quoted 2 lines
But then, I do not have a Windows computer myself, so I could not really test QEmu itself.
BTW, QEMU seems to run just fine under wine. Right now I'm building with mingw and testing with wine. That seems to be working pretty well.
In my experience, Wine only shows you so far what works on Windows and what does not. For example, MingW itself does not run properly in Wine. At least last time I needed it.
Unfortunately, for testing, Wine is also _able_ to run some programs that _don't_ run under Windows.
I cross-compiled my unix application using Mingw (GCC for native Windows), and after a few fixes, it was working in Wine.
Unfortunately when I came to deliver the program to a real user, it totally failed under Windows XP.
In that instance, it was because Wine allocates file descriptors with small numbers (like unix) and Windows allocates large HANDLE values, so my unix-friendly code ran ok under Wine but not under real Windows.
The only real test is running it under Windows - I use a virtual machine (KVM) for that.
-- Jamie
Re: [Qemu-devel] [PATCH v2] Fix compilation of nbd on Windows
In reply to Jamie LokierQuoted 9 lines · Jamie Lokier
Quoted 8 lines · Anthony Liguori
Quoted 6 lines · Johannes Schindelin
Hi,
[was it intentional that you culled me, and me alone, from the Cc: list? I know that you like to be rude against me, but I'd like to know if it was really meant this way this time.]
Quoted 8 lines
Quoted 3 lines
No, it's the annoying way that the mailing list is configured. The
mailing list sets a Reply-To header and reply to all in thunderbird ignores the original From line (because Reply-To has been set).Mutt's group-reply function is the same. It sends to everyone in the To and Cc, but not the person in From! Very annoying on a list like this. It has an option to ignore list's Reply-To entirely, but not an option to make group-reply send to everyone.
Maybe
unset reply_to
helps in this case.
Thiemo