[LTP] [PATCH v5 1/2] splice02: Generate input in C
Cyril Hrubis
chrubis@suse.cz
Wed Apr 21 11:40:04 CEST 2021
Hi!
> Yep. In your code you expect that written letter change each time.
> But original code writes the same letter for whole buffer (using memset()).
Ah, right, the mapping in the original code maps the remaning size to be
written to a letter and uses it for whole block.
I guess that it may be easier to understand if the letter was defined as
an function of a position in the file like I have expected in my
snippet. That way we can also produce different patterns without
changing the test code (and we can later on introduce a library
functions to fill buffer and check buffer as well, these would generally
take a pointer to a buffer, size and an offset).
That would mean that we will have to fill the buffer in a for loop
instead of memset, but as long as the get_letter() function is inlined
it should be fast enough.
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list