qemu/include/block
Kevin Wolf c2ad1b0c46 block: Allow omitting the file name when using driver-specific options
After this patch, using -drive with an empty file name continues to open
the file if driver-specific options are used. If no driver-specific
options are specified, the semantics stay as it was: It defines a drive
without an inserted medium.

In order to achieve this, bdrv_open() must be made safe to work with a
NULL filename parameter. The assumption that is made is that only block
drivers which implement bdrv_parse_filename() support using driver
specific options and could therefore work without a filename. These
drivers must make sure to cope with NULL in their implementation of
.bdrv_open() (this is only NBD for now). For all other drivers, the
block layer code will make sure to error out before calling into their
code - they can't possibly work without a filename.

Now an NBD connection can be opened like this:

  qemu-system-x86_64 -drive file.driver=nbd,file.port=1234,file.host=::1

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2013-03-22 17:51:32 +01:00
..
aes.h block: move include files to include/block/ 2012-12-19 08:31:31 +01:00
aio.h aio: add a ThreadPool instance to AioContext 2013-03-15 16:07:50 +01:00
block_int.h block: Allow omitting the file name when using driver-specific options 2013-03-22 17:51:32 +01:00
block.h block: Add options QDict to bdrv_file_open() prototypes 2013-03-22 17:51:31 +01:00
blockjob.h block: move include files to include/block/ 2012-12-19 08:31:31 +01:00
coroutine_int.h misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
coroutine.h coroutine: use AioContext for CoQueue BH 2013-03-15 16:07:51 +01:00
nbd.h nbd: Remove unused functions 2013-03-22 17:51:32 +01:00
thread-pool.h threadpool: drop global thread pool 2013-03-15 16:07:51 +01:00