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>
Showing
- block.c 2 additions, 2 deletionsblock.c
- block/backup.c 2 additions, 2 deletionsblock/backup.c
- block/blkdebug.c 2 additions, 2 deletionsblock/blkdebug.c
- block/blkreplay.c 1 addition, 1 deletionblock/blkreplay.c
- block/block-backend.c 4 additions, 4 deletionsblock/block-backend.c
- block/commit.c 2 additions, 2 deletionsblock/commit.c
- block/gluster.c 1 addition, 1 deletionblock/gluster.c
- block/io.c 23 additions, 22 deletionsblock/io.c
- block/iscsi.c 2 additions, 2 deletionsblock/iscsi.c
- block/linux-aio.c 1 addition, 1 deletionblock/linux-aio.c
- block/mirror.c 3 additions, 3 deletionsblock/mirror.c
- block/nbd-client.c 3 additions, 3 deletionsblock/nbd-client.c
- block/nfs.c 1 addition, 1 deletionblock/nfs.c
- block/qcow.c 2 additions, 2 deletionsblock/qcow.c
- block/qcow2.c 2 additions, 2 deletionsblock/qcow2.c
- block/qed.c 2 additions, 2 deletionsblock/qed.c
- block/sheepdog.c 7 additions, 7 deletionsblock/sheepdog.c
- block/ssh.c 1 addition, 1 deletionblock/ssh.c
- block/stream.c 2 additions, 2 deletionsblock/stream.c
- block/vmdk.c 2 additions, 2 deletionsblock/vmdk.c
Loading
Please register or sign in to comment