[4596] qemu-nbd tool (Anthony Liguori)
Revision: 4596
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4596 Author: bellard Date: 2008-05-27 21:13:40 +0000 (Tue, 27 May 2008)
Log Message:
-----------
qemu-nbd tool (Anthony Liguori)
Modified Paths:
--------------
trunk/Makefile
trunk/configure
trunk/exec-all.h
Added Paths:
-----------
trunk/nbd.c
trunk/nbd.h
trunk/qemu-nbd.c
trunk/qemu-nbd.texi
Modified: trunk/Makefile
===================================================================
Makefile +13 -1
@@ -17,7 +17,7 @@ LDFLAGS += -static endif ifdef BUILD_DOCS -DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 +DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 else DOCS= endif
@@ -159,6 +159,10 @@ %.o: %.c $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +qemu-nbd$(EXESUF): qemu-nbd.o nbd.o qemu-img-block.o \ + $(QEMU_IMG_BLOCK_OBJS) + $(CC) $(LDFLAGS) -o $@ $^ -lz $(LIBS) + # dyngen host tool dyngen$(EXESUF): dyngen.c $(HOST_CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^
@@ -191,6 +195,8 @@ ifndef CONFIG_WIN32 mkdir -p "$(DESTDIR)$(mandir)/man1" $(INSTALL) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1" + mkdir -p "$(DESTDIR)$(mandir)/man8" + $(INSTALL) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8" endif install: all $(if $(BUILD_DOCS),install-doc)
@@ -244,6 +250,10 @@ $(SRC_PATH)/texi2pod.pl $< qemu-img.pod pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@ +qemu-nbd.8: qemu-nbd.texi + $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod + pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@ + info: qemu-doc.info qemu-tech.info dvi: qemu-doc.dvi qemu-tech.dvi
@@ -296,6 +306,7 @@ $(bindir)/qemu-sh4eb \ $(bindir)/qemu-cris \ $(bindir)/qemu-img \ + $(bindir)/qemu-nbd \ $(datadir)/bios.bin \ $(datadir)/vgabios.bin \ $(datadir)/vgabios-cirrus.bin \
@@ -309,6 +320,7 @@ $(docdir)/qemu-doc.html \ $(docdir)/qemu-tech.html \ $(mandir)/man1/qemu.1 $(mandir)/man1/qemu-img.1 + $(mandir)/man8/qemu-nbd.8 # Include automatically generated dependency files -include $(wildcard *.d audio/*.d slirp/*.d)
Modified: trunk/configure
===================================================================
configure +3 -0
@@ -1105,6 +1105,9 @@ tools= if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then tools="qemu-img\$(EXESUF) $tools" + if [ "$linux" = "yes" ] ; then + tools="qemu-nbd\$(EXESUF) $tools" + fi fi echo "TOOLS=$tools" >> $config_mak
Modified: trunk/exec-all.h
===================================================================
exec-all.h +1 -1
@@ -126,7 +126,7 @@#define CODE_GEN_BUFFER_SIZE (6 * 1024 * 1024)#else /* XXX: make it dynamic on x86 */ -#define CODE_GEN_BUFFER_SIZE (16 * 1024 * 1024) +#define CODE_GEN_BUFFER_SIZE (64 * 1024 * 1024)#endif //#define CODE_GEN_BUFFER_SIZE (128 * 1024)
Added: trunk/nbd.c
===================================================================
nbd.c +500 -0
500 lines not on this page · raw message
Added: trunk/nbd.h
===================================================================
nbd.h +37 -0
@@ -0,0 +1,37 @@ +/*\ +* Copyright (C) 2005 Anthony Liguori <[email protected]> +* +* Network Block Device +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; under version 2 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* 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 + +#include <sys/types.h> +#include <stdbool.h> + +#include <qemu-common.h> +#include "block_int.h" + +int tcp_socket_incoming (const char *address,uint16_t port); + +int nbd_negotiate (BlockDriverState *bs,int csock,off_t size); +int nbd_receive_negotiate (int fd,int csock); +int nbd_trip (BlockDriverState *bs,int csock,off_t size,uint64_t dev_offset,off_t *offset,bool readonly); +int nbd_client (int fd,int csock); +int nbd_disconnect (int fd); + +#endif
Added: trunk/qemu-nbd.c
===================================================================
qemu-nbd.c +275 -0
275 lines not on this page · raw message
Added: trunk/qemu-nbd.texi
===================================================================
qemu-nbd.texi +52 -0
52 lines not on this page · raw message
Merci
Laurent
Signature · 3 lines
------------- [email protected] --------------- "The best way to predict the future is to invent it." - Alan Kay