[LTP] [PATCH v2] open14: Rewrite to new API

Petr Vorel pvorel@suse.cz
Tue Jul 22 10:32:21 CEST 2025


Hi Martin,

> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---

> Changes since v1:
> - Added subtest info to test description
> - Added .needs_root = 1
Thank you!

...
> -#define _GNU_SOURCE
I also think that _GNU_SOURCE is not needed, hopefully this will not break some
non-glibc libc. But it looks to be ok for MUSL and uclibc-ng follows glibc API.

> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <unistd.h>
> -#include <errno.h>
> +/*\
> + * Check the functionality of O_TMPFILE flag for open() syscall:
Unfortunately, this requires a blank line otherwise the text in generated doc [1] will be inline:

Check the functionality of O_TMPFILE flag for open() syscall: 1) Creation and linking (naming) of a single temp file 2) Creation of multiple unlinked temp files in a hierarchy of directories 3) Access permissions of linked temp files match creation mode argument

I plan to modify doc/conf.py to add this blank line if it's missing. (I would
prefer this would be already in json generated metadata/metaparse.c but Cyril
wanted to be in the code which generates output from JSON.

[1] https://linux-test-project.readthedocs.io/en/latest/users/test_catalog.html#open14

> + * 1) Creation and linking (naming) of a single temp file
> + * 2) Creation of multiple unlinked temp files in a hierarchy of directories
> + * 3) Access permissions of linked temp files match creation mode argument
> + */
...

>  	for (i = 0; i < blocks_num; ++i)
> -		SAFE_WRITE(cleanup, SAFE_WRITE_ALL, fd, buf, size);
> +		SAFE_WRITE(1, fd, buf, size);
Although SAFE_WRITE_ALL is ugly it's IMHO more descriptive than 1.
It's also more widely used in LTP tests than 1, but I'm ok with it.

The rest LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>

If you don't mind I would amend the code before merge (diff below).

Kind regards,
Petr

+++ testcases/kernel/syscalls/open/open14.c
@@ -7,6 +7,7 @@
 
 /*\
  * Check the functionality of O_TMPFILE flag for open() syscall:
+ *
  * 1) Creation and linking (naming) of a single temp file
  * 2) Creation of multiple unlinked temp files in a hierarchy of directories
  * 3) Access permissions of linked temp files match creation mode argument
@@ -53,7 +54,7 @@ static void write_file(int fd)
 		SAFE_WRITE(1, fd, buf, size);
 }
 
-void test01(void)
+static void test01(void)
 {
 	struct stat st;
 	char path[PATH_MAX];


More information about the ltp mailing list