On Mon, 7 Apr 2025 at 14:31, Marco Cavenati <marco.caven...@eurecom.fr> wrote: > As you said the capability is used internally. Its goal is to signal to > other QEMU code that the QIOChannel is seekable. > 'qio_channel_pwritev' and 'qio_channel_preadv' can be used only if > the QIOChannel has the 'QIO_CHANNEL_FEATURE_SEEKABLE' > capability. > > The mapped-ram migration checks if the channel has this capability > because it uses the aforementioned functions. Without the capability > and the functions implemented in this patch, the mapped-ram migration > won't work with QIOChannelBlock. > > You can have a look at the patch where those functions were > introduced here [0].
* _channel_preadv/_writev functions are generic. They are independent of whether the underlying channel is file or socket or memory or something else. They are called if and when they are defined and they in turn call channel specific preadv/pwritev functions. if (!klass->io_pwritev) { error_setg(errp, "Channel does not support pwritev"); return -1; } * io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel file -> https://gitlab.com/qemu-project/qemu/-/commit/401e311ff72e0a62c834bfe466de68a82cfd90cb This commit sets the *_FEATURE_SEEKABLE flag for the file channel when the lseek(2) call succeeds. * ie. 'file' OR 'fd' channel is seekable when lseek(2) call works. Similarly Block channel would be seekable when ->io_seek() method is defined and it works. And ->io_seek() method is also called if and when it is defined qio_channel_io_seek if (!klass->io_seek) { error_setg(errp, "Channel does not support random access"); return -1; } Setting '*_FEATURE_SEEKABLE' for the block channel does not ensure that ->io_seek() is defined and works. It seems redundant that way. Maybe I'm missing something here, not sure. Thank you. --- - Prasad