[LTP] [PATCH v2 02/10] syscalls/ioctl:add common c file for loop ioctl

Yang Xu xuyang2018.jy@cn.fujitsu.com
Tue Apr 21 08:19:35 CEST 2020


Hi Cyril


> Hi!
>> +void tst_assert_file_str(const char *file, const int lineno, const char
>> *path, const char *buf, const char *val)
>> +{
>> +       char sys_val[1024];
>> +
>> +       SAFE_FILE_LINES_SCANF(path, buf, sys_val);
> 
> We should call the file_lines_scanf() here and pass the filename and
> lineno that this functions takes as parameter instead.
I don't understand the meaning of adding filename and line parameter(If 
fail, it will report tst_assert.c: 29). Do you want to report the 
correct parsed filename when failed?

If so, I think lineno is meaningless and it also overides the place of 
the code meet problem . I prefer to add some path info in safe_file_ops.c.

> 
> Also I'm not sure that it's a good idea to pass the fmt to this
> function. I guess that it would be better to pass a prefix string such
> as "foo=" and to append the "%s" in this function. That way we could
> also encode the buffer length to the fmt string as well, in that case we
> would append "%1024s".
> 
Yes, it is a better way.

ps: I will send a patch about this api.

Best Regards
Yang Xu
>> +       if (!strcmp(val, sys_val)) {
>> +               tst_res_(file, lineno, TPASS, "%s %s field = %s", path,
>> buf, sys_val);
>> +               return;
>> +       }
>> +
>> +       tst_res_(file, lineno, TFAIL, "%s %s field != %s got %s", path,
>> buf, val, sys_val);
>> +}
> 
> 
> 




More information about the ltp mailing list