[LTP] [PATCH v3] syscalls: add new test for copy_file_range(2)

Li Wang liwang@redhat.com
Tue Apr 25 05:26:11 CEST 2017


On Mon, Apr 24, 2017 at 02:23:41PM +0200, Jan Stancek wrote:
> On 04/24/2017 12:46 PM, Li Wang wrote:
> >>> These variables names are a bit confusing. But larger problem is
> >
> > Currently have no idea to improve the confusing issue.
> >
>
> I'm attaching copy_file_range01.c, that I made from your v3 version.
> It doesn't use static list of parameters, but instead iterates
> over possible values for len/off_in/off_out in all possible combinations.
>
> Let me know what you think about this approach.

To split data structure into arrays is more clear than before, and involve
the different function make things simple too. I agree to use this approach.

> static void setup(void)
> {
>       int i, fd, page_size;
>
>       page_size = getpagesize();
>
>       fd = SAFE_OPEN(TEST_FILE_1, O_RDWR | O_CREAT, 0664);
>       /* Writing page_size * 4 of data into test file */
>       for (i = 0; i < (int)(page_size * 4); i++)
>               SAFE_WRITE(1, fd, STR, strlen(STR));
>       SAFE_CLOSE(fd);
>
>       len_sz = 4;
>       len_arr = malloc(sizeof(size_t) * len_sz);
>       len_arr[0] = 11;
> ...
>       *off_arr[2] = 17;

These two values(11, 17) are just randomized or have special means here?


Regards,
Li Wang


More information about the ltp mailing list