From: Paolo Bonzini <pbonzini@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, ehabkost@redhat.com,
qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com,
crosa@redhat.com, den@openvz.org
Subject: Re: [PATCH v7 4/7] scripts: add coroutine-wrapper.py
Date: Thu, 20 Aug 2020 09:38:26 +0200 [thread overview]
Message-ID: <f646e5fc-0a7f-4c34-77ff-70ec80be9968@redhat.com> (raw)
In-Reply-To: <20200610100336.23451-5-vsementsov@virtuozzo.com>
On 10/06/20 12:03, Vladimir Sementsov-Ogievskiy wrote:
> + {struct_name} s = {{
> + .poll_state.bs = {bs},
> + .poll_state.in_progress = true,
> +
> +{ func.gen_block(' .{name} = {name},') }
> + }};
> +
> + s.poll_state.co = qemu_coroutine_create({name}_entry, &s);
> +
> + return bdrv_poll_co(&s.poll_state);
> + }}
> +}}"""
> +
> +
> +def gen_wrappers_file(input_code: str) -> str:
> + res = gen_header()
> + for func in func_decl_iter(input_code):
> + res += '\n\n\n'
> + res += gen_wrapper(func)
> +
> + return prettify(res) # prettify to wrap long lines
> +
> +
> +if __name__ == '__main__':
> + print(gen_wrappers_file(sys.stdin.read()))
> --
For Meson support, you'll have to move the "cat" inside the script. But
since func_decl_iter can work separately on each file, it's enough to do
something like
for filename in sys.argv:
with open(filename, 'r') as f:
print(gen_wrappers_file(f.read()))
Paolo
next prev parent reply other threads:[~2020-08-20 7:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-10 10:03 [PATCH v7 0/7] coroutines: generate wrapper code Vladimir Sementsov-Ogievskiy
2020-06-10 10:03 ` [PATCH v7 1/7] block: return error-code from bdrv_invalidate_cache Vladimir Sementsov-Ogievskiy
2020-06-10 10:03 ` [PATCH v7 2/7] block/io: refactor coroutine wrappers Vladimir Sementsov-Ogievskiy
2020-06-10 10:03 ` [PATCH v7 3/7] block: declare some coroutine functions in block/coroutines.h Vladimir Sementsov-Ogievskiy
2020-06-10 10:03 ` [PATCH v7 4/7] scripts: add coroutine-wrapper.py Vladimir Sementsov-Ogievskiy
2020-08-20 7:38 ` Paolo Bonzini [this message]
2020-06-10 10:03 ` [PATCH v7 5/7] block: generate coroutine-wrapper code Vladimir Sementsov-Ogievskiy
2020-06-10 10:03 ` [PATCH v7 6/7] block: drop bdrv_prwv Vladimir Sementsov-Ogievskiy
2020-06-10 10:03 ` [PATCH v7 7/7] block/io: refactor save/load vmstate Vladimir Sementsov-Ogievskiy
2020-07-27 12:48 ` [PATCH v7 0/7] coroutines: generate wrapper code Stefan Hajnoczi
2020-07-27 12:59 ` Vladimir Sementsov-Ogievskiy
2020-08-20 1:33 ` Eric Blake
2020-08-20 7:34 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f646e5fc-0a7f-4c34-77ff-70ec80be9968@redhat.com \
--to=pbonzini@redhat.com \
--cc=crosa@redhat.com \
--cc=den@openvz.org \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).