qemu/include/block
Max Reitz 7b1d9c4df0 block: Add bdrv_qapi_perm_to_blk_perm()
We need some way to correlate QAPI BlockPermission values with
BLK_PERM_* flags.  We could:

(1) have the same order in the QAPI definition as the the BLK_PERM_*
    flags are in LSb-first order.  However, then there is no guarantee
    that they actually match (e.g. when someone modifies the QAPI schema
    without thinking of the BLK_PERM_* definitions).
    We could add static assertions, but these would break what’s good
    about this solution, namely its simplicity.

(2) define the BLK_PERM_* flags based on the BlockPermission values.
    But this way whenever someone were to modify the QAPI order
    (perfectly sensible in theory), the BLK_PERM_* values would change.
    Because these values are used for file locking, this might break
    file locking between different qemu versions.

Therefore, go the slightly more cumbersome way: Add a function to
translate from the QAPI constants to the BLK_PERM_* flags.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20191108123455.39445-2-mreitz@redhat.com
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
2020-01-06 13:43:06 +01:00
..
accounting.h block: add empty account cookie type 2019-10-10 10:56:18 +02:00
aio_task.h block: introduce aio task pool 2019-10-10 10:56:17 +02:00
aio-wait.h Clean up decorations and whitespace around header guards 2019-05-13 08:58:55 +02:00
aio.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
block_backup.h block/backup: drop unused synchronization interface 2018-12-14 11:52:40 +01:00
block_int.h block: Add bdrv_co_get_self_request() 2019-11-04 09:32:51 +01:00
block-copy.h block/block-copy: increase buffered copy request 2019-10-28 11:22:31 +01:00
block.h block: Add bdrv_qapi_perm_to_blk_perm() 2020-01-06 13:43:06 +01:00
blockjob_int.h job: drop job_drain 2019-09-10 08:58:43 +02:00
blockjob.h blockdev: blockdev_mark_auto_del: drop usage of bs->job 2019-06-18 16:41:10 +02:00
dirty-bitmap.h bitmap: Enforce maximum bitmap name length 2019-11-18 16:01:34 -06:00
nbd.h nbd: Don't send oversize strings 2019-11-18 16:01:34 -06:00
nvme.h nvme: fix NSSRS offset in CAP register 2019-11-04 09:21:45 +01:00
qapi.h block/qapi: Clean up how we print to monitor or stdout 2019-04-18 22:18:59 +02:00
qdict.h block: Factor out qobject_input_visitor_new_flat_confused() 2018-06-15 14:49:44 +02:00
raw-aio.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00
snapshot.h block/snapshot: rename Error ** parameter to more common errp 2019-12-18 08:43:19 +01:00
thread-pool.h Clean up decorations and whitespace around header guards 2016-07-12 16:20:46 +02:00
throttle-groups.h throttle-groups: fix restart coroutine iothread race 2019-01-24 10:02:28 +00:00
write-threshold.h include: Make headers more self-contained 2019-08-16 13:31:51 +02:00