summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@linux.vnet.ibm.com>2018-03-12 19:07:53 -0300
committerKevin Wolf <kwolf@redhat.com>2018-03-26 12:16:00 +0200
commit1e486cf30a3817b9136b333d31e7e77379fd6a90 (patch)
tree1c240055b50824ea1ce1577381b6deddb119f1a9
parent8140e786f045a074928070640e20914873aeb396 (diff)
downloadfocaccia-qemu-1e486cf30a3817b9136b333d31e7e77379fd6a90.tar.gz
focaccia-qemu-1e486cf30a3817b9136b333d31e7e77379fd6a90.zip
include/block/block_int: Document protocol related functions
Clarify that:

- for protocols the brdv_file_open function is used instead
of bdrv_open;

- when protocol_name is set, a driver should expect
to be given only a filename and no other options.

Signed-off-by: Fabiano Rosas <farosas@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--include/block/block_int.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 27e17addba..c4dd1d4bb8 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -126,6 +126,8 @@ struct BlockDriver {
 
     int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags,
                      Error **errp);
+
+    /* Protocol drivers should implement this instead of bdrv_open */
     int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags,
                           Error **errp);
     void (*bdrv_close)(BlockDriverState *bs);
@@ -251,6 +253,12 @@ struct BlockDriver {
      */
     int coroutine_fn (*bdrv_co_flush_to_os)(BlockDriverState *bs);
 
+    /*
+     * Drivers setting this field must be able to work with just a plain
+     * filename with '<protocol_name>:' as a prefix, and no other options.
+     * Options may be extracted from the filename by implementing
+     * bdrv_parse_filename.
+     */
     const char *protocol_name;
     int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset,
                          PreallocMode prealloc, Error **errp);