[PATCH v3 26/33] block-coroutine-wrapper: allow non bdrv_ prefix

Vladimir Sementsov-Ogievskiy posted 33 patches 4 years, 9 months ago
There is a newer version of this series
[PATCH v3 26/33] block-coroutine-wrapper: allow non bdrv_ prefix
Posted by Vladimir Sementsov-Ogievskiy 4 years, 9 months ago
We are going to reuse the script to generate a qcow2_ function in
further commit. Prepare the script now.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.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 0461fd1c45..85dbeb9ecf 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.29.2


Re: [PATCH v3 26/33] block-coroutine-wrapper: allow non bdrv_ prefix
Posted by Eric Blake 4 years, 8 months ago
On Fri, Apr 16, 2021 at 11:09:04AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> We are going to reuse the script to generate a qcow2_ function in
> further commit. Prepare the script now.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  scripts/block-coroutine-wrapper.py | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


Re: [PATCH v3 26/33] block-coroutine-wrapper: allow non bdrv_ prefix
Posted by Eric Blake 4 years, 8 months ago
On Fri, Apr 16, 2021 at 11:09:04AM +0300, Vladimir Sementsov-Ogievskiy wrote:
> We are going to reuse the script to generate a qcow2_ function in

Is qcow2_ right here?  Looking ahead to patch 30/33, it looks like you
meant nbd_, at least in the context of this series.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


Re: [PATCH v3 26/33] block-coroutine-wrapper: allow non bdrv_ prefix
Posted by Vladimir Sementsov-Ogievskiy 4 years, 8 months ago
03.06.2021 23:53, Eric Blake wrote:
> On Fri, Apr 16, 2021 at 11:09:04AM +0300, Vladimir Sementsov-Ogievskiy wrote:
>> We are going to reuse the script to generate a qcow2_ function in
> 
> Is qcow2_ right here?  Looking ahead to patch 30/33, it looks like you
> meant nbd_, at least in the context of this series.
> 

will change. This because the patch was taken from my parallel qcow2 series

-- 
Best regards,
Vladimir