cconv: Support pattern buffers of arbitrary size
authorLogan Gunthorpe <logang@deltatee.com>
Fri, 18 Nov 2022 23:15:56 +0000 (16:15 -0700)
committerVincent Fu <vincent.fu@samsung.com>
Sat, 19 Nov 2022 00:36:10 +0000 (19:36 -0500)
commit7f812e878210490e7fe68b3312fafbd864137165
treea320902c11f322a5803f94e07a548da96772d1bd
parent78054a76da3c29e1a97ca01acbec85170f6db1e6
cconv: Support pattern buffers of arbitrary size

Change the thread_options_pack structure to support pattern buffers
of arbitrary size by using a flexible array at the end of the the
structure to store both the verify_pattern and the buffer_pattern
in that order.

In this way, only the actual bytes of each pattern will be sent over
the wire and patterns of an arbitrary size can be used with the packed
structure.

In order to determine the required size of the structure the function
thread_options_pack_size() is introduced which returns the total
number of bytes required for a given thread_options instance.

The two callsites of convert_thread_options_to_net() are then converted
to dynamically allocate a pdu of the appropriate size and the
two callsites of convert_thread_options_to_cpu() are modified to
take the size of the received data to prevent buffer overruns.

Also add specific testing of this feature in fio_test_cconv().

Seeing this changes the client/server protocol, the FIO_SERVER_VER
is bumped.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
cconv.c
client.c
gclient.c
server.c
server.h
thread_options.h