Skip to content

block/json: Add JSON protocol driver

Max Reitz qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest12 patches 7 repliesIn review
  2. v212 patches 12 repliesSuperseded
  3. v110 patches 28 repliesSuperseded

Changes in v3 from the cover letter

- rebased on top of Kevin's block branch
- Patch 5: bdrv_invalidate_cache() now takes an Error parameter, add it
- Patch 7: Don't use BDRV_BLOCK_RAW, but rather simply pass bdrv_get_block_status() to the underlying block device [Benoît/Peter]
- Patch 12: Test number 084 is already taken, raise it to 089

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12qdict: Add qdict_join()include/qapi/qmp/qdict.h qobject/qdict.c+35 -00 replies
2/12check-qdict: Add test for qdict_join()tests/check-qdict.c+87 -00 replies
3/12block: Add "has_single_child" field for driversblock.c include/block/block_int.h+11 -00 replies
4/12block/json: Add JSON protocol driverblock/Makefile.objs block/json.c+135 -10 replies
5/12block/json: Add functions for cache controlblock/json.c+15 -01 reply
6/12block/json: Add functions for writing zeroes etc.block/json.c+30 -00 replies
7/12block/json: Add bdrv_co_get_block_status()block/json.c+8 -02 replies
8/12block/json: Add ioctl etc.block/json.c+40 -00 replies
9/12block/json: Add bdrv_get_specific_info()block/json.c+6 -00 replies
10/12block/raw_bsd: Add bdrv_get_specific_info()block/raw_bsd.c+6 -00 replies
11/12block/qapi: Ignore filters on top for format nameblock/qapi.c+16 -20 replies
12/12iotests: Add test for the JSON protocoltests/qemu-iotests/089 tests/qemu-iotests/089.out tests/qemu-iotests/group+163 -00 replies

Reviews trailers per patch

All 12 patches have a Reviewed-by or Acked-by.

PatchBenoit CanetEric Blake
1/12R-b R-b
2/12R-b R-b
3/12R-b
4/12R-b
5/12R-b
6/12R-b
7/12R-b
8/12R-b
9/12R-b
10/12R-b
11/12R-b
12/12R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 00/12] block/json: Add JSON protocol driver

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.

v3:
- rebased on top of Kevin's block branch
- Patch 5: bdrv_invalidate_cache() now takes an Error parameter, add it
- Patch 7: Don't use BDRV_BLOCK_RAW, but rather simply pass bdrv_get_block_status() to the underlying block device [Benoît/Peter]
- Patch 12: Test number 084 is already taken, raise it to 089

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 v2:

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:[----] [--] 'check-qdict: Add test for qdict_join()' 003/12:[----] [--] 'block: Add "has_single_child" field for drivers' 004/12:[----] [--] 'block/json: Add JSON protocol driver' 005/12:[0004] [FC] 'block/json: Add functions for cache control' 006/12:[----] [-C] 'block/json: Add functions for writing zeroes etc.' 007/12:[0004] [FC] 'block/json: Add bdrv_co_get_block_status()' 008/12:[----] [-C] 'block/json: Add ioctl etc.' 009/12:[----] [--] 'block/json: Add bdrv_get_specific_info()' 010/12:[----] [--] 'block/raw_bsd: Add bdrv_get_specific_info()' 011/12:[----] [--] 'block/qapi: Ignore filters on top for format name' 012/12:[0004] [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               | 233 +++++++++++++++++++++++++++++++++++++++++++++
 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/089     | 123 ++++++++++++++++++++++++
 tests/qemu-iotests/089.out |  39 ++++++++
 tests/qemu-iotests/group   |   1 +
 12 files changed, 552 insertions(+), 3 deletions(-)
 create mode 100644 block/json.c
 create mode 100755 tests/qemu-iotests/089
 create mode 100644 tests/qemu-iotests/089.out
Signature · 1 line
1.9.1