summaryrefslogtreecommitdiffstats
path: root/nbd.c
Commit message (Collapse)AuthorAgeFilesLines
* nbd: fix non-Linux build failurePaolo Bonzini2011-09-211-1/+1
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: support NBD_SET_FLAGS ioctlPaolo Bonzini2011-09-191-0/+8
| | | | | | | | | The nbd kernel module cannot enable DISCARD requests unless it is informed about it. The flags field in the header is used for this, and this patch adds support for it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: sync API definitions with upstreamPaolo Bonzini2011-09-191-0/+2
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: support feature negotiationPaolo Bonzini2011-09-191-7/+25
| | | | | | | | | nbd supports writing flags in bytes 24...27 of the header, and uses that for the read-only flag. Add support for it in qemu-nbd. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: Clean up use of block_int.hMarkus Armbruster2011-09-121-0/+1
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Wrap recv to avoid warningsBlue Swirl2011-07-251-1/+1
| | | | | | | | | | | | | Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o /src/qemu/slirp/ip_icmp.c: In function 'icmp_receive': /src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror] /usr/local/lib/gcc/i686-mingw32msvc/4.6.0/../../../../i686-mingw32msvc/include/winsock2.h:547:32: note: expected 'char *' but argument is of type 'struct icmp *' Remove also casts used to avoid warnings. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* NBD: Use qemu_socket functions to open TCP and UNIX socketsNick Thomas2011-04-071-129/+29
| | | | | | | | | | | | | | | | | | This commit has the side-effect of making the qemu-nbd binary capable of binding to IPv6 addresses. ("-b ::1", for instance). block/nbd.c fails to parse IPv6 IP addresses correctly at this point, but will work over IPv6 when given a hostname. It still works over IPv4 as before. We move the qemu-sockets object from the 'common' to the 'block' list in the Makefile. The common list includes the block list, so this is effectively a no-op for the rest of the code. We also add 32-bit 'magic' attributes to nbd_(request|reply) to facilitate calculating maximum request/response sizes later. Signed-off-by: Nick Thomas <nick@bytemark.co.uk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* NBD library: whitespace changesNick Thomas2011-04-071-417/+418
| | | | | Signed-off-by: Nick Thomas <nick@bytemark.co.uk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: Haiku has _IO() in its BSD compatibility layerAndreas Färber2010-10-031-1/+1
| | | | | Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Improve qemu-nbd performance by 4400 %Laurent Vivier2010-09-211-7/+18
| | | | | | | | | | | | | | | This patch allows to reduce the boot time from an NBD server from 225 seconds to 5 seconds (time between the "boot cd:0" and the kernel init) for the following command lines: ./qemu-nbd -t ../ISO/debian-500-powerpc-netinst.iso and ./ppc-softmmu/qemu-system-ppc -cdrom nbd:localhost:1024 This patch combines the reply header and payload send operation. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori2010-09-081-12/+106
|\
| * nbd: Introduce NBD named exports.Laurent Vivier2010-08-301-12/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows to connect Qemu using NBD protocol to an nbd-server using named exports. For instance, if on the host "isoserver", in /etc/nbd-server/config, you have: [generic] [debian-500-ppc-netinst] exportname = /ISO/debian-500-powerpc-netinst.iso [Fedora-10-ppc-netinst] exportname = /ISO/Fedora-10-ppc-netinst.iso You can connect to it, using: qemu -cdrom nbd:isoserver:exportname=debian-500-ppc-netinst qemu -cdrom nbd:isoserver:exportname=Fedora-10-ppc-netinst NOTE: you need at least nbd-server 2.9.18 Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | Remove unused argument for nbd_client()Jes Sorensen2010-09-041-2/+2
|/ | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix %lld or %llx printf format useBlue Swirl2010-05-221-2/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Update to a hopefully more future proof FSF addressBlue Swirl2009-07-161-2/+1
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Cast pointer arguments of get/setsockopt, send to void * to keep GCCmalc2009-05-211-1/+2
| | | | | | from producing a warning about pointer type mismatches with Winsock Signed-off-by: malc <av1474@comtv.ru>
* Fix some win32 compile warningsblueswir12009-04-051-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
* Update FSF address in GPL/LGPL boilerplateaurel322009-01-041-1/+1
| | | | | | | | | | The attached patch updates the FSF address in the GPL/LGPL boilerplate in most GPL/LGPLed files, and also in COPYING.LIB. Signed-off-by: Stuart Brady <stuart.brady@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6162 c046a42c-6fe2-441c-8c8c-71466251a162
* Use qemu_isfoobar and qemu_towombat versions, based on patch by Christoph Eggerblueswir12008-11-221-8/+8
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5774 c046a42c-6fe2-441c-8c8c-71466251a162
* Use common objects for qemu-img and qemu-nbdaliguori2008-09-151-31/+55
| | | | | | | | | | | | | | | | | | | | | | | Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over the code. It's ugly and causes us to have to build multiple object files for linking against qemu and the tools. This patch introduces a new file, qemu-tool.c which contains enough for qemu-img, qemu-nbd, and QEMU to all share the same objects. This also required getting qemu-nbd to be a bit more Windows friendly. I also changed the Windows block-raw to use normal IO instead of overlapping IO since we don't actually do AIO yet on Windows. I changed the various #if 0's to #if WIN32_AIO to make it easier for someone to eventually fix AIO on Windows. After this patch, there are no longer any #ifdef's related to qemu-img and qemu-nbd. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5226 c046a42c-6fe2-441c-8c8c-71466251a162
* qemu-nbd: remove useless parameter from nbd_negotiate() (Laurent Vivier)aliguori2008-09-101-1/+1
| | | | | | | | | | | | This patch removes "BlockDriverState *bs" from nbd_negotiate() because it is not used. Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.fr> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5186 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix compilation of nbd on Solaris (Andreas Faerber)aliguori2008-08-021-0/+3
| | | | | | | | | | | | | | | | | Compilation of QEMU is currently broken on Solaris due to nbd's use of _IO and due to network libraries not being linked into qemu-img. The attached patch adds the appropriate libraries (copied from Makefile.target) and includes an additional Sun-specific header for _IO. With these fixes it compiles okay, on OpenSolaris snv_93 (amd64). Signed-off-by: Andreas Faerber <andreas.faerber@web.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4982 c046a42c-6fe2-441c-8c8c-71466251a162
* Add missing returnmalc2008-07-041-0/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4846 c046a42c-6fe2-441c-8c8c-71466251a162
* Allow QEMU to connect directly to an NBD server, by Laurent Vivier.ths2008-07-031-68/+143
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4838 c046a42c-6fe2-441c-8c8c-71466251a162
* Add a parameter to disable host cache, by Laurent Vivier.ths2008-07-031-9/+5
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4836 c046a42c-6fe2-441c-8c8c-71466251a162
* Merge NBD client/server, by Laurent Vivier.ths2008-07-031-6/+68
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4834 c046a42c-6fe2-441c-8c8c-71466251a162
* Cleanup qemu-nbd related code, by Laurent Vivier.ths2008-07-021-2/+2
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4829 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix compiler warning.ths2008-06-061-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4676 c046a42c-6fe2-441c-8c8c-71466251a162
* qemu-nbd tool (Anthony Liguori)bellard2008-05-271-0/+500
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4596 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud