qemu/scripts
Vladimir Sementsov-Ogievskiy aaaa20b69b scripts: add block-coroutine-wrapper.py
We have a very frequent pattern of creating a coroutine from a function
with several arguments:

  - create a structure to pack parameters
  - create _entry function to call original function taking parameters
    from struct
  - do different magic to handle completion: set ret to NOT_DONE or
    EINPROGRESS or use separate bool field
  - fill the struct and create coroutine from _entry function with this
    struct as a parameter
  - do coroutine enter and BDRV_POLL_WHILE loop

Let's reduce code duplication by generating coroutine wrappers.

This patch adds scripts/block-coroutine-wrapper.py together with some
friends, which will generate functions with declared prototypes marked
by the 'generated_co_wrapper' specifier.

The usage of new code generation is as follows:

    1. define the coroutine function somewhere

        int coroutine_fn bdrv_co_NAME(...) {...}

    2. declare in some header file

        int generated_co_wrapper bdrv_NAME(...);

       with same list of parameters (generated_co_wrapper is
       defined in "include/block/block.h").

    3. Make sure the block_gen_c declaration in block/meson.build
       mentions the file with your marker function.

Still, no function is now marked, this work is for the following
commit.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200924185414.28642-5-vsementsov@virtuozzo.com>
[Added encoding='utf-8' to open() calls as requested by Vladimir. Fixed
typo and grammar issues pointed out by Eric Blake. Removed clang-format
dependency that caused build test issues.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-05 10:59:06 +01:00
..
ci
coccinelle
codeconverter scripts/codeconverter: Update to latest version 2020-09-18 14:12:32 -04:00
coverity-scan Remove texinfo dependency from docker and CI configs 2020-09-29 17:55:39 +02:00
kvm
modules
oss-fuzz scripts/: fix some comment spelling errors 2020-09-17 20:37:55 +02:00
performance
qapi scripts/qapi: Remove texinfo generation support 2020-09-29 17:55:39 +02:00
qemu-guest-agent
qemugdb
qmp scripts/qmp/qom-fuse: Fix getattr(), read() for files in / 2020-09-03 09:44:33 +02:00
simplebench scripts/simplebench: compare write request performance 2020-09-18 14:00:32 -04:00
tracetool scripts/: fix some comment spelling errors 2020-09-17 20:37:55 +02:00
travis
analyse-9p-simpletrace.py
analyse-locks-simpletrace.py
analyze-inclusions
analyze-migration.py analyze-migration.py: fix read_migration_debug_json() return type 2020-09-18 14:00:32 -04:00
archive-source.sh
block-coroutine-wrapper.py scripts: add block-coroutine-wrapper.py 2020-10-05 10:59:06 +01:00
check_sparse.py
checkpatch.pl checkpatch: Detect '%#' or '%0#' in printf-style format strings 2020-09-30 19:11:36 +02:00
clean-header-guards.pl scripts/: fix some comment spelling errors 2020-09-17 20:37:55 +02:00
clean-includes
cleanup-trace-events.pl scripts/cleanup-trace-events: Emit files in alphabetical order 2020-09-09 17:17:00 +01:00
cocci-macro-file.h
coverity-model.c
decodetree.py scripts/: fix some comment spelling errors 2020-09-17 20:37:55 +02:00
device-crash-test
disas-objdump.pl
dump-guest-memory.py
extract-vsssdk-headers
feature_to_c.sh
fix-multiline-comments.sh
gensyscalls.sh
get_maintainer.pl
git-submodule.sh
git.orderfile Remove Texinfo related line from git.orderfile 2020-09-29 17:55:39 +02:00
hxtool
hxtool-conv.pl
kernel-doc qemu/atomic.h: rename atomic_ to qatomic_ 2020-09-23 16:07:44 +01:00
make-release
meson.build
minikconf.py
mtest2make.py mtest2make: add support for introspected test dependencies 2020-09-30 19:11:36 +02:00
ninjatool.py ninjatool: rebuild multi-output targets if outputs are missing 2020-09-30 19:09:19 +02:00
nsis.py
qapi-gen.py scripts/qapi: Remove texinfo generation support 2020-09-29 17:55:39 +02:00
qemu-binfmt-conf.sh
qemu-gdb.py
qemu-trace-stap
qemu-version.sh
refresh-pxe-roms.sh
render_block_graph.py
replay-dump.py
shaderinclude.pl
show-fixed-bugs.sh
signrom.py
simpletrace.py
switch-timer-api
tap-driver.pl
tap-merge.pl
test-driver.py mtest2make: hide output of successful tests 2020-09-08 07:17:09 +02:00
tracetool.py
u2f-setup-gen.py
undefsym.py meson: Convert undefsym.sh to undefsym.py 2020-09-08 11:43:16 +02:00
update-linux-headers.sh
update-mips-syscall-args.sh
update-syscalltbl.sh
vmstate-static-checker.py