This series adds a passthrough JSON protocol block driver. Its filenames are JSON objects prefixed by "json:". The objects are used as options for opening another block device which will be the child of the JSON device. Regarding this child device, the JSON driver behaves nearly the same as raw_bsd in that it is just a passthrough driver. The only difference is probably that the JSON driver identifies itself as a block filter, in contrast to raw_bsd.
The purpose of this driver is that it may sometimes be desirable to specify options for a block device where only a filename can be given, e.g., for backing files. Using this should obviously be the exception, but it is nice to have if actually needed. v2: - rebased on top of Kevin's block branch and on Benoît's patch "block: Rewrite the snapshot authorization mechanism for block filters." (this series now depends on this patch) - Added patch 2: Adds test cases for the qdict_join() function introduced by patch 1 - Added patch 3: Since Benoît changed the snapshot authorization mechanism, there is now no easy way of detecting whether a block filter only has a single child (which is however required for patch 11). This patch introduces such a way. - Patch 4: - Simplified return in json_open() [Benoît] - Adjusted to fit the new authorization mechanism [Benoît], including patch 3 of this series - Patch 6: Recursive calls should go to bs->file, not bs itself [Benoît] - Patch 7: Added missing "*pnum = nb_sectors;" [Benoît] - Patch 11: Adjusted to fit the new authorization mechanism [Benoît] and especially patch 3 - Patch 12: - Skip test if TEST_IMG contains a quotation mark [Eric] - Omit the test number from which two of the test cases are originally taken from the test output [Eric] git-backport-diff against v1: Key: [----] : patches are identical [####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively 001/12:[----] [--] 'qdict: Add qdict_join()' 002/12:[down] 'check-qdict: Add test for qdict_join()' 003/12:[down] 'block: Add "has_single_child" field for drivers' 004/12:[0008] [FC] 'block/json: Add JSON protocol driver' 005/12:[----] [--] 'block/json: Add functions for cache control' 006/12:[0004] [FC] 'block/json: Add functions for writing zeroes etc.' 007/12:[0001] [FC] 'block/json: Add bdrv_co_get_block_status()' 008/12:[----] [-C] 'block/json: Add ioctl etc.' 009/12:[----] [-C] 'block/json: Add bdrv_get_specific_info()' 010/12:[----] [--] 'block/raw_bsd: Add bdrv_get_specific_info()' 011/12:[0012] [FC] 'block/qapi: Ignore filters on top for format name' 012/12:[0017] [FC] 'iotests: Add test for the JSON protocol' Max Reitz (12): qdict: Add qdict_join() check-qdict: Add test for qdict_join() block: Add "has_single_child" field for drivers block/json: Add JSON protocol driver block/json: Add functions for cache control block/json: Add functions for writing zeroes etc. block/json: Add bdrv_co_get_block_status() block/json: Add ioctl etc. block/json: Add bdrv_get_specific_info() block/raw_bsd: Add bdrv_get_specific_info() block/qapi: Ignore filters on top for format name iotests: Add test for the JSON protocol block.c | 4 + block/Makefile.objs | 2 +- block/json.c | 235 +++++++++++++++++++++++++++++++++++++++++++++ block/qapi.c | 18 +++- block/raw_bsd.c | 6 ++ include/block/block_int.h | 7 ++ include/qapi/qmp/qdict.h | 3 + qobject/qdict.c | 32 ++++++ tests/check-qdict.c | 87 +++++++++++++++++ tests/qemu-iotests/084 | 123 ++++++++++++++++++++++++ tests/qemu-iotests/084.out | 39 ++++++++ tests/qemu-iotests/group | 1 + 12 files changed, 554 insertions(+), 3 deletions(-) create mode 100644 block/json.c create mode 100755 tests/qemu-iotests/084 create mode 100644 tests/qemu-iotests/084.out -- 1.9.0