[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 29/34] block-coroutine-wrapper: allow non bdrv_ prefix
From: |
Eric Blake |
Subject: |
[PULL 29/34] block-coroutine-wrapper: allow non bdrv_ prefix |
Date: |
Tue, 15 Jun 2021 15:47:51 -0500 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
We are going to reuse the script to generate a nbd_ function in
further commit. Prepare the script now.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210610100802.5888-28-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
scripts/block-coroutine-wrapper.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/block-coroutine-wrapper.py
b/scripts/block-coroutine-wrapper.py
index 0461fd1c459c..85dbeb9ecf9c 100644
--- a/scripts/block-coroutine-wrapper.py
+++ b/scripts/block-coroutine-wrapper.py
@@ -98,12 +98,13 @@ def snake_to_camel(func_name: str) -> str:
def gen_wrapper(func: FuncDecl) -> str:
- assert func.name.startswith('bdrv_')
- assert not func.name.startswith('bdrv_co_')
+ assert not '_co_' in func.name
assert func.return_type == 'int'
assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *']
- name = 'bdrv_co_' + func.name[5:]
+ subsystem, subname = func.name.split('_', 1)
+
+ name = f'{subsystem}_co_{subname}'
bs = 'bs' if func.args[0].type == 'BlockDriverState *' else 'child->bs'
struct_name = snake_to_camel(name)
--
2.31.1
- [PULL 19/34] nbd: move connection code from block/nbd to nbd/client-connection, (continued)
- [PULL 19/34] nbd: move connection code from block/nbd to nbd/client-connection, Eric Blake, 2021/06/15
- [PULL 23/34] nbd/client-connection: shutdown connection on release, Eric Blake, 2021/06/15
- [PULL 25/34] block/nbd: use negotiation of NBDClientConnection, Eric Blake, 2021/06/15
- [PULL 26/34] block/nbd: don't touch s->sioc in nbd_teardown_connection(), Eric Blake, 2021/06/15
- [PULL 24/34] block/nbd: split nbd_handle_updated_info out of nbd_client_handshake(), Eric Blake, 2021/06/15
- [PULL 27/34] block/nbd: drop BDRVNBDState::sioc, Eric Blake, 2021/06/15
- [PULL 30/34] block/nbd: split nbd_co_do_establish_connection out of nbd_reconnect_attempt, Eric Blake, 2021/06/15
- [PULL 28/34] nbd/client-connection: return only one io channel, Eric Blake, 2021/06/15
- [PULL 31/34] nbd/client-connection: add option for non-blocking connection attempt, Eric Blake, 2021/06/15
- [PULL 29/34] block-coroutine-wrapper: allow non bdrv_ prefix,
Eric Blake <=
- [PULL 33/34] block/nbd: add nbd_client_connected() helper, Eric Blake, 2021/06/15
- [PULL 32/34] block/nbd: reuse nbd_co_do_establish_connection() in nbd_open(), Eric Blake, 2021/06/15
- [PULL 34/34] block/nbd: safer transition to receiving request, Eric Blake, 2021/06/15
- Re: [PULL 00/34] NBD patches for 2021-06-15, Peter Maydell, 2021/06/17