nbd: move socket wrappers to qemu-nbd
qemu-nbd is one of the few valid users of qerror_report_err. Movethe error-reporting socket wrappers there.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: Make bdrv_file_open() static
Add the bdrv_open() option BDRV_O_PROTOCOL which results in passing thecall to bdrv_file_open(). Additionally, make bdrv_file_open() static andtherefore bdrv_open() the only way to call it.
Consequently, all existing calls to bdrv_file_open() have to be adjusted...
block: Reuse reference handling from bdrv_open()
Remove the reference parameter and the related handling code frombdrv_file_open(), since it exists in bdrv_open() now as well.
Signed-off-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Benoit Canet <benoit@irqsave.net>...
block: Remove bdrv_new() from bdrv_file_open()
Change bdrv_file_open() to take a simple pointer to an already existingBDS instead of an indirect one. The BDS will be created in bdrv_open()if necessary.
block: Handle bs->options in bdrv_open() only
The fail paths of bdrv_file_open() and bdrv_open() naturally exhibitsimilarities, thus it is possible to reuse the one from bdrv_open() andshorten the one in bdrv_file_open() accordingly.
Also, setting bs->options in bdrv_file_open() is not necessary if it is...
block: Reuse success path from bdrv_open()
The fail and success paths of bdrv_file_open() may be further shortenedby reusing code already existent in bdrv_open(). This includesbdrv_file_open() not taking the reference to options which allows theremoval of QDECREF in that function....
block: Remove bdrv_open_image()'s force_raw option
This option is now unnecessary since specifying BDRV_O_PROTOCOL as flagwill do exactly the same.
Signed-off-by: Max Reitz <mreitz@redhat.com>Reviewed-by: Benoit Canet <benoit@irqsave.net>Reviewed-by: Kevin Wolf <kwolf@redhat.com>...
nbd: produce a better error if neither host nor port is passed
Before: $ qemu-io-old qemu-io-old> open -r -o file.driver=nbd qemu-io-old: can't open device (null): Could not open image: Invalid argument $ ./qemu-io-old qemu-io-old> open -r -o file.driver=nbd,file.host=foo,file.path=bar...
nbd: correctly propagate errors
Before: $ ./qemu-io-old qemu-io-old> open -r -o file.driver=nbd one of path and host must be specified. qemu-io-old: can't open device (null): Could not open image: Invalid argument $ ./qemu-io-old qemu-io-old> open -r -o file.driver=nbd,file.host=foo,file.path=bar...
nbd: inline tcp_socket_incoming_spec into sole caller
View all revisions | View revisions
Also available in: Atom