aaaa20b69b
We have a very frequent pattern of creating a coroutine from a function with several arguments: - create a structure to pack parameters - create _entry function to call original function taking parameters from struct - do different magic to handle completion: set ret to NOT_DONE or EINPROGRESS or use separate bool field - fill the struct and create coroutine from _entry function with this struct as a parameter - do coroutine enter and BDRV_POLL_WHILE loop Let's reduce code duplication by generating coroutine wrappers. This patch adds scripts/block-coroutine-wrapper.py together with some friends, which will generate functions with declared prototypes marked by the 'generated_co_wrapper' specifier. The usage of new code generation is as follows: 1. define the coroutine function somewhere int coroutine_fn bdrv_co_NAME(...) {...} 2. declare in some header file int generated_co_wrapper bdrv_NAME(...); with same list of parameters (generated_co_wrapper is defined in "include/block/block.h"). 3. Make sure the block_gen_c declaration in block/meson.build mentions the file with your marker function. Still, no function is now marked, this work is for the following commit. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20200924185414.28642-5-vsementsov@virtuozzo.com> [Added encoding='utf-8' to open() calls as requested by Vladimir. Fixed typo and grammar issues pointed out by Eric Blake. Removed clang-format dependency that caused build test issues. --Stefan] Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
126 lines
3.7 KiB
Meson
126 lines
3.7 KiB
Meson
block_ss.add(genh)
|
|
block_ss.add(files(
|
|
'accounting.c',
|
|
'aio_task.c',
|
|
'amend.c',
|
|
'backup.c',
|
|
'backup-top.c',
|
|
'blkdebug.c',
|
|
'blklogwrites.c',
|
|
'blkreplay.c',
|
|
'blkverify.c',
|
|
'block-backend.c',
|
|
'block-copy.c',
|
|
'commit.c',
|
|
'copy-on-read.c',
|
|
'create.c',
|
|
'crypto.c',
|
|
'dirty-bitmap.c',
|
|
'filter-compress.c',
|
|
'io.c',
|
|
'mirror.c',
|
|
'nbd.c',
|
|
'null.c',
|
|
'qapi.c',
|
|
'qcow2-bitmap.c',
|
|
'qcow2-cache.c',
|
|
'qcow2-cluster.c',
|
|
'qcow2-refcount.c',
|
|
'qcow2-snapshot.c',
|
|
'qcow2-threads.c',
|
|
'qcow2.c',
|
|
'quorum.c',
|
|
'raw-format.c',
|
|
'snapshot.c',
|
|
'throttle-groups.c',
|
|
'throttle.c',
|
|
'vhdx-endian.c',
|
|
'vhdx-log.c',
|
|
'vhdx.c',
|
|
'vmdk.c',
|
|
'vpc.c',
|
|
'write-threshold.c',
|
|
), zstd, zlib)
|
|
|
|
block_ss.add(when: 'CONFIG_QCOW1', if_true: files('qcow.c'))
|
|
block_ss.add(when: 'CONFIG_VDI', if_true: files('vdi.c'))
|
|
block_ss.add(when: 'CONFIG_CLOOP', if_true: files('cloop.c'))
|
|
block_ss.add(when: 'CONFIG_BOCHS', if_true: files('bochs.c'))
|
|
block_ss.add(when: 'CONFIG_VVFAT', if_true: files('vvfat.c'))
|
|
block_ss.add(when: 'CONFIG_DMG', if_true: files('dmg.c'))
|
|
block_ss.add(when: 'CONFIG_QED', if_true: files(
|
|
'qed-check.c',
|
|
'qed-cluster.c',
|
|
'qed-l2-cache.c',
|
|
'qed-table.c',
|
|
'qed.c',
|
|
))
|
|
block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: files('parallels.c'))
|
|
block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
|
|
block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
|
|
block_ss.add(when: 'CONFIG_LIBISCSI', if_true: files('iscsi-opts.c'))
|
|
block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
|
|
block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
|
|
block_ss.add(when: 'CONFIG_SHEEPDOG', if_true: files('sheepdog.c'))
|
|
block_ss.add(when: ['CONFIG_LINUX_AIO', libaio], if_true: files('linux-aio.c'))
|
|
block_ss.add(when: ['CONFIG_LINUX_IO_URING', linux_io_uring], if_true: files('io_uring.c'))
|
|
|
|
block_modules = {}
|
|
|
|
modsrc = []
|
|
foreach m : [
|
|
['CONFIG_CURL', 'curl', [curl, glib], 'curl.c'],
|
|
['CONFIG_GLUSTERFS', 'gluster', glusterfs, 'gluster.c'],
|
|
['CONFIG_LIBISCSI', 'iscsi', libiscsi, 'iscsi.c'],
|
|
['CONFIG_LIBNFS', 'nfs', libnfs, 'nfs.c'],
|
|
['CONFIG_LIBSSH', 'ssh', libssh, 'ssh.c'],
|
|
['CONFIG_RBD', 'rbd', rbd, 'rbd.c'],
|
|
]
|
|
if config_host.has_key(m[0])
|
|
if enable_modules
|
|
modsrc += files(m[3])
|
|
endif
|
|
module_ss = ss.source_set()
|
|
module_ss.add(when: m[2], if_true: files(m[3]))
|
|
block_modules += {m[1] : module_ss}
|
|
endif
|
|
endforeach
|
|
|
|
# those are not exactly regular block modules, so treat them apart
|
|
if 'CONFIG_DMG' in config_host
|
|
foreach m : [
|
|
['CONFIG_LZFSE', 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
|
|
['CONFIG_BZIP2', 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
|
|
]
|
|
if config_host.has_key(m[0])
|
|
module_ss = ss.source_set()
|
|
module_ss.add(when: m[2], if_true: files(m[3]))
|
|
block_modules += {m[1] : module_ss}
|
|
endif
|
|
endforeach
|
|
endif
|
|
|
|
module_block_py = find_program('../scripts/modules/module_block.py')
|
|
module_block_h = custom_target('module_block.h',
|
|
output: 'module_block.h',
|
|
input: modsrc,
|
|
command: [module_block_py, '@OUTPUT0@', modsrc])
|
|
block_ss.add(module_block_h)
|
|
|
|
wrapper_py = find_program('../scripts/block-coroutine-wrapper.py')
|
|
block_gen_c = custom_target('block-gen.c',
|
|
output: 'block-gen.c',
|
|
input: files('../include/block/block.h',
|
|
'coroutines.h'),
|
|
command: [wrapper_py, '@OUTPUT@', '@INPUT@'])
|
|
block_ss.add(block_gen_c)
|
|
|
|
block_ss.add(files('stream.c'))
|
|
|
|
softmmu_ss.add(files('qapi-sysemu.c'))
|
|
|
|
subdir('export')
|
|
subdir('monitor')
|
|
|
|
modules += {'block': block_modules}
|