From: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v6 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test
Date: Thu, 25 Jul 2019 18:13:58 +0800 [thread overview]
Message-ID: <5D3980E6.8010104@cn.fujitsu.com> (raw)
In-Reply-To: <CAOQ4uxg7w51AVD6fig9HH0s7vjC=G2fz8H1nauBZ3V5TiRzuVQ@mail.gmail.com>
on 2019/07/25 16:08, Amir Goldstein wrote:
> On Thu, Jul 25, 2019 at 8:44 AM Yang Xu<xuyang2018.jy@cn.fujitsu.com> wrote:
>> on 2019/07/25 13:24, Amir Goldstein wrote:
>>
>>> On Thu, Jul 25, 2019 at 8:02 AM Yang Xu<xuyang2018.jy@cn.fujitsu.com> wrote:
>>>>
>>>> static void setup(void)
>>>> {
>>>> syscall_info();
>>>> + char dev_path[1024];
>>> Why? What is the point of filling this string if you're not going to
>>> use it. That's exactly what tst_find_free_loopdev(NULL, 0) is for.
>>> I don't think you understood Cyril's comment about the API
>>> correctly.
>>> He meant he rather keep the *option* in the API to fill out the
>>> suggested loopdev file name. Not that you *have* to fill it.
>>>
>>> Thanks,
>>> Amir.
>>>
>> Hi Amir
>>
>> I think you don't see the whole patch.
>>
>> I use this dev_path as below:
>>
>> fd_blkdev = SAFE_OPEN(dev_path, O_RDWR, 0600);
>>
>> on v5 patch, I use tst_find_free_loopdev(NULL, 0) and create a customized loop dev named "file_block" by mknod .
>>
>> But why we don't use a path directly filled by tst_find_free_loopdev(dev_path, len)? It will not change lib internal state or overwirte data.
>>
>> I only use a standard loop device as same as char device use "/dev/null".
>>
> Right, sorry, missed that.
> It is generally better not to define 1024 array on the stack.
> Most LTP tests define test path vars as static char arrays in top of test file.
Hi Amir
I think it is a code-style preference. IMO, 1024 array is not enough large and this function is not
interate or recursion call. It don't make stack overflow. Also, this test path is only used in setup().
So, I think keeping it is no problem.
>
>>
>>>> if (access(FILE_DIR_PATH, F_OK) == -1)
>>>> SAFE_MKDIR(FILE_DIR_PATH, 0777);
>>>> + /*
>>>> + * call tst_find_free_loopdev(), avoid overwriting its
>>>> + * content on used loopdev.
>>>> + */
>>>> + loop_devn = tst_find_free_loopdev(dev_path, sizeof(dev_path));
>>>> +
>>>> + SAFE_MKNOD(FILE_FIFO, S_IFIFO | 0777, 0);
>>>>
>>>> fd_src = SAFE_OPEN(FILE_SRC_PATH, O_RDWR | O_CREAT, 0664);
>>>> fd_dest = SAFE_OPEN(FILE_DEST_PATH, O_RDWR | O_CREAT, 0664);
>>>> fd_rdonly = SAFE_OPEN(FILE_RDONL_PATH, O_RDONLY | O_CREAT, 0664);
>>>> - fd_mnted = SAFE_OPEN(FILE_MNTED_PATH, O_RDWR | O_CREAT, 0664);
>>>> fd_dir = SAFE_OPEN(FILE_DIR_PATH, O_DIRECTORY);
>>>> fd_closed = -1;
>>>> fd_append = SAFE_OPEN(FILE_DEST_PATH,
>>>> O_RDWR | O_CREAT | O_APPEND, 0664);
>>>> + fd_immutable = SAFE_OPEN(FILE_IMMUTABLE_PATH, O_RDWR | O_CREAT, 0664);
>>>> + fd_swapfile = SAFE_OPEN(FILE_SWAP_PATH, O_RDWR | O_CREAT, 0600);
>>>> +
>>>> + if (loop_devn == -1)
>>>> + fd_blkdev = SAFE_OPEN(dev_path, O_RDWR, 0600);
>>>> +
>> I use the dev_path string.
> (loop_devn != 1) ??
Sorry for the obvious error.
Hi Cyril
Would you mind me to send a v7 patch or you merge this patchset with changing this obvious error
if you think it is ok?
> Thanks,
> Amir.
>
>
>
next prev parent reply other threads:[~2019-07-25 10:13 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 3:41 [LTP] [PATCH] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-05 15:22 ` Amir Goldstein
2019-07-05 20:42 ` [LTP] [PATCH v2] " Yang Xu
2019-07-08 15:17 ` Amir Goldstein
2019-07-09 6:57 ` Yang Xu
2019-07-09 10:06 ` Amir Goldstein
2019-07-10 7:18 ` [LTP] [PATCH v3 1/3] lib: alter find_free_loopdev() Yang Xu
2019-07-10 7:18 ` [LTP] [PATCH v3 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-10 7:50 ` Amir Goldstein
2019-07-10 8:22 ` Yang Xu
2019-07-10 7:18 ` [LTP] [PATCH v3 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-10 7:57 ` Amir Goldstein
2019-07-10 9:31 ` Yang Xu
2019-07-10 10:53 ` [LTP] [PATCH v4 1/3] lib: alter find_free_loopdev() Yang Xu
2019-07-10 10:53 ` [LTP] [PATCH v4 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-10 15:56 ` Xiao Yang
2019-07-11 6:18 ` Yang Xu
2019-07-10 10:53 ` [LTP] [PATCH v4 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-10 13:57 ` [LTP] [PATCH v4 1/3] lib: alter find_free_loopdev() Cyril Hrubis
2019-07-11 4:00 ` Yang Xu
2019-07-11 12:51 ` Cyril Hrubis
2019-07-12 5:25 ` Yang Xu
2019-07-17 5:29 ` Yang Xu
2019-07-17 6:10 ` Amir Goldstein
2019-07-17 9:44 ` [LTP] [PATCH v5 " Yang Xu
2019-07-17 9:44 ` [LTP] [PATCH v5 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-29 13:56 ` Petr Vorel
2019-07-29 13:59 ` Petr Vorel
2019-07-17 9:44 ` [LTP] [PATCH v5 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-17 10:14 ` [LTP] [PATCH v5 1/3] lib: alter find_free_loopdev() Amir Goldstein
2019-07-17 10:34 ` Yang Xu
2019-07-17 10:54 ` Cyril Hrubis
2019-07-18 7:30 ` Yang Xu
2019-07-25 5:01 ` [LTP] [PATCH v6 " Yang Xu
2019-07-25 5:01 ` [LTP] [PATCH v6 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-29 14:00 ` Petr Vorel
2019-07-29 14:10 ` Petr Vorel
2019-07-30 8:31 ` Yang Xu
2019-07-30 13:35 ` Petr Vorel
2019-07-31 7:01 ` Yang Xu
2019-07-31 7:47 ` Petr Vorel
2019-07-25 5:01 ` [LTP] [PATCH v6 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-25 5:24 ` Amir Goldstein
2019-07-25 5:44 ` Yang Xu
2019-07-25 8:08 ` Amir Goldstein
2019-07-25 10:13 ` Yang Xu [this message]
2019-07-25 11:02 ` Amir Goldstein
2019-07-30 13:26 ` Petr Vorel
2019-07-31 7:09 ` Yang Xu
2019-07-29 13:01 ` [LTP] [PATCH v6 1/3] lib: alter find_free_loopdev() Cyril Hrubis
2019-07-30 10:42 ` Yang Xu
2019-07-30 11:05 ` Cyril Hrubis
2019-07-31 10:40 ` [LTP] [PATCH v7 " Yang Xu
2019-07-31 10:40 ` [LTP] [PATCH v7 2/3] syscalls/copy_file_range01: add cross-device test Yang Xu
2019-07-31 12:28 ` Petr Vorel
2019-07-31 10:40 ` [LTP] [PATCH v7 3/3] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-31 12:28 ` Petr Vorel
2019-08-05 6:58 ` Murphy Zhou
2019-08-05 7:11 ` Yang Xu
2019-08-05 10:22 ` Murphy Zhou
2019-08-05 11:01 ` Yang Xu
2019-08-06 6:37 ` Yang Xu
2019-08-06 9:29 ` Murphy Zhou
2019-08-06 16:27 ` Petr Vorel
2019-08-07 10:17 ` Murphy Zhou
2019-08-07 12:12 ` Dave Chinner
2019-08-08 3:46 ` Murphy Zhou
2019-08-08 3:11 ` Yang Xu
2019-08-08 3:57 ` Murphy Zhou
2019-08-27 10:04 ` Petr Vorel
2019-07-31 12:05 ` [LTP] [PATCH v7 1/3] lib: alter find_free_loopdev() Petr Vorel
2019-07-31 12:28 ` Cyril Hrubis
2019-07-31 12:48 ` Petr Vorel
2019-07-31 13:25 ` Cyril Hrubis
2019-07-31 21:06 ` Petr Vorel
2019-07-31 12:07 ` Petr Vorel
2019-07-10 7:47 ` [LTP] [PATCH v3 " Amir Goldstein
2019-07-10 7:32 ` [LTP] [PATCH v2] syscalls/copy_file_range02: increase coverage and remove EXDEV test Yang Xu
2019-07-08 10:38 ` [LTP] [PATCH] " Yang Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5D3980E6.8010104@cn.fujitsu.com \
--to=xuyang2018.jy@cn.fujitsu.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox