History | View | Annotate | Download (24.4 kB)
sockets: change inet_connect() to support nonblock socket
Add a bool argument to inet_connect() to assign if set socketto block/nonblock, and delete original argument 'socktype'that is unused.Add a new argument to inet_connect()/inet_connect_opts(),to pass back connect error by error class....
sockets: use error class to pass listen error
Add a new argument in inet_listen()/inet_listen_opts()to pass back listen error.
Change nbd, qemu-char, vnc to use new interface.
Signed-off-by: Amos Kong <akong@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>...
nbd: do not include block_int.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
nbd: obey FUA on reads
nbd: consistently use ssize_t
GCC (pedantically, but correctly) considers that a negative ssize_t maybecome positive when casted to int. This may cause uninitialized variablewarnings when a function returns such a negative ssize_t and is inlined.Propagate ssize_t return types to avoid this....
nbd: consistently check for <0 or >=0
This prepares for the following patch, which changes -1 return valuesto negative errno.
nbd: consistently return negative errno values
In the next patch we need to look at the return code of nbd_wr_sync.To avoid percolating the socket_error() ugliness all around, let'shandle errors by returning negative errno values.
nbd: do not block in nbd_wr_sync if no data at all is available
Right now, nbd_wr_sync will hang if no data at all is available on thesocket and the other side is not going to provide any. Relax this bymaking it loop only for writes or partial reads. This fixes a race...
nbd: Fix compiler warning (w64)
Portable printing of dev_offset (data type off_t) needs a type cast.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
qemu-nbd: move client handling to nbd.c
This patch sets up the fd handler in nbd.c instead of qemu-nbd.c. Itintroduces NBDClient, which wraps the arguments to nbd_trip in a singlestructure, so that we can add a notifier to it. This way, qemu-nbd canknow about disconnections....
qemu-nbd: add client pointer to NBDRequest
By attaching a client to an NBDRequest, we can avoid passing around thesocket descriptor and data buffer.
Also, we can now manage the reference count for the client innbd_request_get/put request instead of having to do it ourselved in...
qemu-nbd: asynchronous operation
Using coroutines enable asynchronous operation on both the network andthe block side. Network can be owned by two coroutines at the same time,one writing and one reading. On the send side, mutual exclusion isguaranteed by a CoMutex. On the receive side, mutual exclusion is...
qemu-nbd: throttle requests
Limiting the number of in-flight requests is implemented very simplywith a can_read callback. It does not require a semaphore, unlike theclient side in block/nbd.c, because we can throttle directly the creationof coroutines. The client side can have a coroutine created at any time...
Update ioctl order in nbd_init() to detect EBUSY
Update ioctl(s) in nbd_init() to detect device busy early.
Current nbd_init() issues NBD_CLEAR_SOCKET before NBD_SET_SOCKET, if issuing"qemu-nbd -c /dev/nbd0 disk.img" twice, the second time won't detect EBUSY in...
qemu-nbd: remove offset argument to nbd_trip
The argument is write-only.
qemu-nbd: remove data_size argument to nbd_trip
The size of the buffer is in practice part of the protocol.
qemu-nbd: simplify nbd_trip
Use TCP_CORK to remove a violation of encapsulation, that would laterrequire nbd_trip to know too much about an NBD reply.
We could also switch to sendmsg (qemu_co_sendv) later, it is eveneasier once coroutines are in.
qemu-nbd: introduce nbd_do_send_reply
Group the sending of a reply and the associated data into a new function.Without corking, the caller would be forced to leave 12 free bytes at thebeginning of the data pointer. Not too ugly, but still ugly. :)
Using nbd_do_send_reply everywhere will help when the routine will set up...
qemu-nbd: more robust handling of invalid requests
Fail invalid requests with EINVAL instead of dropping them intothe void.
qemu-nbd: introduce nbd_do_receive_request
Group the receiving of a response and the associated data into a new function.
qemu-nbd: introduce NBDExport
Wrap the common parameters of nbd_trip and nbd_negotiate in asingle opaque struct.
qemu-nbd: introduce NBDRequest
Move the buffer from NBDExport to a new structure, so that it will bepossible to have multiple in-flight requests for the same export(and for the same client too---we get that for free).
nbd: switch to asynchronous operation
nbd: fix error handling in the server
bdrv_read and bdrv_write return negative errno values, not -1.
nbd: add support for NBD_CMD_FLAG_FUA
nbd: add support for NBD_CMD_FLUSH
nbd: add support for NBD_CMD_TRIM
fix spelling in main directory
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
nbd: treat EPIPE from NBD_DO_IT as success
This can be seen with "qemu-nbd -v -c", which returns 1 instead of 0when you disconnect with "qemu-nbd -d".
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
nbd: fix non-Linux build failure
nbd: support feature negotiation
nbd supports writing flags in bytes 24...27 of the header,and uses that for the read-only flag. Add support for itin qemu-nbd.
nbd: sync API definitions with upstream
nbd: support NBD_SET_FLAGS ioctl
The nbd kernel module cannot enable DISCARD requests unless it isinformed 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>...
nbd: Clean up use of block_int.h
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Wrap recv to avoid warnings
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]...
NBD library: whitespace changes
Signed-off-by: Nick Thomas <nick@bytemark.co.uk>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
NBD: Use qemu_socket functions to open TCP and UNIX sockets
This commit has the side-effect of making the qemu-nbd binarycapable of binding to IPv6 addresses. ("-b ::1", for instance).block/nbd.c fails to parse IPv6 IP addresses correctly at thispoint, but will work over IPv6 when given a hostname. It still...
nbd: Haiku has _IO() in its BSD compatibility layer
Signed-off-by: Andreas Färber <andreas.faerber@web.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Improve qemu-nbd performance by 4400 %
This patch allows to reduce the boot time from an NBD server from 225 seconds to5 seconds (time between the "boot cd:0" and the kernel init) for thefollowing command lines:
./qemu-nbd -t ../ISO/debian-500-powerpc-netinst.iso...
Merge remote branch 'kwolf/for-anthony' into staging
Remove unused argument for nbd_client()
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
nbd: Introduce NBD named exports.
This patch allows to connect Qemu using NBD protocol to an nbd-serverusing 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...
Fix %lld or %llx printf format use
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Update to a hopefully more future proof FSF address
Cast pointer arguments of get/setsockopt, send to void * to keep GCCfrom producing a warning about pointer type mismatches with Winsock
Signed-off-by: malc <av1474@comtv.ru>
Fix some win32 compile warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6984 c046a42c-6fe2-441c-8c8c-71466251a162
Update FSF address in GPL/LGPL boilerplate
The attached patch updates the FSF address in the GPL/LGPL boilerplatein 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>...
Use qemu_isfoobar and qemu_towombat versions, based on patch by Christoph Egger
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5774 c046a42c-6fe2-441c-8c8c-71466251a162
Use common objects for qemu-img and qemu-nbd
Right now, we sprinkle #if defined(QEMU_IMG) && defined(QEMU_NBD) all over thecode. It's ugly and causes us to have to build multiple object files forlinking against qemu and the tools.
This patch introduces a new file, qemu-tool.c which contains enough for...
qemu-nbd: remove useless parameter from nbd_negotiate() (Laurent Vivier)
This patch removes "BlockDriverState *bs" from nbd_negotiate() becauseit is not used.
Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.fr>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
Fix compilation of nbd on Solaris (Andreas Faerber)
Compilation of QEMU is currently broken on Solaris due to nbd's use of _IO anddue to network libraries not being linked into qemu-img.
The attached patch adds the appropriate libraries (copied from Makefile.target)...
Add missing return
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.
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.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4836 c046a42c-6fe2-441c-8c8c-71466251a162
Merge NBD client/server, by Laurent Vivier.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4834 c046a42c-6fe2-441c-8c8c-71466251a162
Cleanup qemu-nbd related code, by Laurent Vivier.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4829 c046a42c-6fe2-441c-8c8c-71466251a162
Fix compiler warning.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4676 c046a42c-6fe2-441c-8c8c-71466251a162
qemu-nbd tool (Anthony Liguori)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4596 c046a42c-6fe2-441c-8c8c-71466251a162