coroutine: move entry argument to qemu_coroutine_create
commit0b8b8753e4d94901627b3e86431230f2319215c4
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 4 Jul 2016 17:10:01 +0000 (4 19:10 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 13 Jul 2016 11:26:02 +0000 (13 13:26 +0200)
treef258eafcb1b3ad4fc50434de2ba4e622de9fc353
parent7e70cdba9f220bef3f3481c663c066c2b80469aa
coroutine: move entry argument to qemu_coroutine_create

In practice the entry argument is always known at creation time, and
it is confusing that sometimes qemu_coroutine_enter is used with a
non-NULL argument to re-enter a coroutine (this happens in
block/sheepdog.c and tests/test-coroutine.c).  So pass the opaque value
at creation time, for consistency with e.g. aio_bh_new.

Mostly done with the following semantic patch:

@ entry1 @
expression entry, arg, co;
@@
- co = qemu_coroutine_create(entry);
+ co = qemu_coroutine_create(entry, arg);
  ...
- qemu_coroutine_enter(co, arg);
+ qemu_coroutine_enter(co);

@ entry2 @
expression entry, arg;
identifier co;
@@
- Coroutine *co = qemu_coroutine_create(entry);
+ Coroutine *co = qemu_coroutine_create(entry, arg);
  ...
- qemu_coroutine_enter(co, arg);
+ qemu_coroutine_enter(co);

@ entry3 @
expression entry, arg;
@@
- qemu_coroutine_enter(qemu_coroutine_create(entry), arg);
+ qemu_coroutine_enter(qemu_coroutine_create(entry, arg));

@ reentry @
expression co;
@@
- qemu_coroutine_enter(co, NULL);
+ qemu_coroutine_enter(co);

except for the aforementioned few places where the semantic patch
stumbled (as expected) and for test_co_queue, which would otherwise
produce an uninitialized variable warning.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
37 files changed:
block.c
block/backup.c
block/blkdebug.c
block/blkreplay.c
block/block-backend.c
block/commit.c
block/gluster.c
block/io.c
block/iscsi.c
block/linux-aio.c
block/mirror.c
block/nbd-client.c
block/nfs.c
block/qcow.c
block/qcow2.c
block/qed.c
block/sheepdog.c
block/ssh.c
block/stream.c
block/vmdk.c
blockjob.c
hw/9pfs/9p.c
hw/9pfs/coth.c
include/qemu/coroutine.h
include/qemu/main-loop.h
io/channel.c
migration/migration.c
nbd/server.c
qemu-io-cmds.c
tests/test-blockjob-txn.c
tests/test-coroutine.c
tests/test-thread-pool.c
thread-pool.c
util/qemu-coroutine-io.c
util/qemu-coroutine-lock.c
util/qemu-coroutine-sleep.c
util/qemu-coroutine.c