Skip to contentSkip to conversation

tst_cmd.h: Convert the rest of comments to kerneldoc

PATCH In review Petr Vorel 2 participants 4 messages Oct 10, 2025 – Jan 8

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 tst_cmd.h: Convert the rest of comments to kerneldoc

Move docs from the private function implementations (functions with trailing underscore) to functions used into functions used in the new API.

This avoids to document private functions.

---
FYI I dared to merge the obvious part of the conversion:

https://github.com/linux-test-project/ltp/commit/58708049bb24000af947e00fa611501aa284999a

Kind regards,
Petr

 include/tst_cmd.h | 52 +++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)
include/tst_cmd.h +26 -26
index cf63829550..8397510ed6 100644
@@ -19,38 +19,12 @@ enum tst_cmd_flags {
 	TST_CMD_TCONF_ON_MISSING = 2,
 };
 
-/*
- * vfork() + execvp() specified program.
- *
- * @param argv A list of two (at least program name + NULL) or more pointers that
- * represent the argument list to the new program. The array of pointers
- * must be terminated by a NULL pointer.
- * @param stdout_fd File descriptor where to redirect stdout. Set -1 if
- * redirection is not needed.
- * @param stderr_fd File descriptor where to redirect stderr. Set -1 if
- * redirection is not needed.
- * @param flags enum tst_cmd_flags.
- * @return The exit status of the program.
- */
 int tst_cmd_fds_(void (cleanup_fn)(void),
 			const char *const argv[],
 			int stdout_fd,
 			int stderr_fd,
 			enum tst_cmd_flags flags);
 
-/*
- * Executes tst_cmd_fds() and redirects its output to a file.
- *
- * @param argv A list of two (at least program name + NULL) or more pointers that
- * represent the argument list to the new program. The array of pointers
- * must be terminated by a NULL pointer.
- * @param stdout_path Path where to redirect stdout. Set NULL if redirection is
- * not needed.
- * @param stderr_path Path where to redirect stderr. Set NULL if redirection is
- * not needed.
- * @param flags enum tst_cmd_flags.
- * @return The exit status of the program.
- */
 int tst_cmd_(void (cleanup_fn)(void),
 		const char *const argv[],
 		const char *stdout_path,
@@ -58,6 +32,20 @@ int tst_cmd_(void (cleanup_fn)(void),
 		enum tst_cmd_flags flags);
 
 #ifdef TST_TEST_H__
+/**
+ * tst_cmd_fds() - :man2:`vfork` + :man2:`execvp` specified program.
+ *
+ * @argv: A list of two (at least program name + NULL) or more pointers that
+ * represent the argument list to the new program. The array of pointers
+ * must be terminated by a NULL pointer.
+ * @stdout_fd: File descriptor where to redirect stdout. Set -1 if
+ * redirection is not needed.
+ * @stderr_fd: File descriptor where to redirect stderr. Set -1 if
+ * redirection is not needed.
+ * @flags: enum tst_cmd_flags.
+ *
+ * Return: The exit status of the program.
+ */
 static inline int tst_cmd_fds(const char *const argv[],
 				  int stdout_fd,
 				  int stderr_fd,
@@ -67,6 +55,18 @@ static inline int tst_cmd_fds(const char *const argv[],
 	                        stdout_fd, stderr_fd, flags);
 }
 
+/**
+ * tst_cmd() - Executes tst_cmd_fds() and redirects its output to a file.
+ *
+ * @argv: A list of two (at least program name + NULL) or more pointers that
+ * @stdout_path: Path where to redirect stdout. Set NULL if redirection is
+ * not needed.
+ * @stderr_path: Path where to redirect stderr. Set NULL if redirection is
+ * not needed.
+ * @flags: enum tst_cmd_flags.
+ *
+ * Return: The exit status of the program.
+ */
 static inline int tst_cmd(const char *const argv[],
 			      const char *stdout_path,
 			      const char *stderr_path,
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by Li Wang on v1 1/1
#1 lore raw
Quoted 8 lines · Petr Vorel

Move docs from the private function implementations (functions with trailing underscore) to functions used into functions used in the new API.

This avoids to document private functions.

---

Quoted 108 lines

FYI I dared to merge the obvious part of the conversion:

https://github.com/linux-test-project/ltp/commit/58708049bb24000af947e00fa611501aa284999a

Kind regards,
Petr

 include/tst_cmd.h | 52 +++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)
include/tst_cmd.h +0 -4
index cf63829550..8397510ed6 100644
@@ -19,38 +19,12 @@ enum tst_cmd_flags {
        TST_CMD_TCONF_ON_MISSING = 2,
 };
 
-/*
- * vfork() + execvp() specified program.
- *
- * @param argv A list of two (at least program name + NULL) or more

pointers that
- * represent the argument list to the new program. The array of pointers
- * must be terminated by a NULL pointer.
- * @param stdout_fd File descriptor where to redirect stdout. Set -1 if
- * redirection is not needed.
- * @param stderr_fd File descriptor where to redirect stderr. Set -1 if
- * redirection is not needed.
- * @param flags enum tst_cmd_flags.
- * @return The exit status of the program.
- */
int tst_cmd_fds_(void (cleanup_fn)(void),

                        const char *const argv[],
                        int stdout_fd,
                        int stderr_fd,
                        enum tst_cmd_flags flags);

-/*
- * Executes tst_cmd_fds() and redirects its output to a file.
- *
- * @param argv A list of two (at least program name + NULL) or more pointers that
- * represent the argument list to the new program. The array of pointers
- * must be terminated by a NULL pointer.
- * @param stdout_path Path where to redirect stdout. Set NULL if redirection is
- * not needed.
- * @param stderr_path Path where to redirect stderr. Set NULL if redirection is
- * not needed.
- * @param flags enum tst_cmd_flags.
- * @return The exit status of the program.
- */
int tst_cmd_(void (cleanup_fn)(void),
const char *const argv[],
const char *stdout_path,

include/tst_cmd.h +4 -0
@@ -58,6 +32,20 @@ int tst_cmd_(void (cleanup_fn)(void),
                enum tst_cmd_flags flags);
 
 #ifdef TST_TEST_H__
+/**
+ * tst_cmd_fds() - :man2:`vfork` + :man2:`execvp` specified program.
+ *
+ * @argv: A list of two (at least program name + NULL) or more pointers

that
+ * represent the argument list to the new program. The array of pointers
+ * must be terminated by a NULL pointer.
+ * @stdout_fd: File descriptor where to redirect stdout. Set -1 if
+ * redirection is not needed.
+ * @stderr_fd: File descriptor where to redirect stderr. Set -1 if
+ * redirection is not needed.
+ * @flags: enum tst_cmd_flags.
+ *
+ * Return: The exit status of the program.
+ */
static inline int tst_cmd_fds(const char *const argv[],
int stdout_fd,
int stderr_fd,

include/tst_cmd.h +4 -0
@@ -67,6 +55,18 @@ static inline int tst_cmd_fds(const char *const argv[],
                                stdout_fd, stderr_fd, flags);
 }
 
+/**
+ * tst_cmd() - Executes tst_cmd_fds() and redirects its output to a file.
+ *
+ * @argv: A list of two (at least program name + NULL) or more pointers

that
+ * @stdout_path: Path where to redirect stdout. Set NULL if redirection is
+ * not needed.
+ * @stderr_path: Path where to redirect stderr. Set NULL if redirection is
+ * not needed.
+ * @flags: enum tst_cmd_flags.
+ *
+ * Return: The exit status of the program.
+ */
static inline int tst_cmd(const char *const argv[],
const char *stdout_path,
const char *stderr_path,
--
2.51.0

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw

Hi all,

...

Quoted 1 line

@Li FYI if you put space before RBT it's not taken.

I created a ticket for it:
https://github.com/getpatchwork/patchwork/issues/645

...

Quoted 3 lines
Quoted 3 lines

#ifdef TST_TEST_H__
+/**
+ * tst_cmd_fds() - :man2:vfork + :man2:execvp specified program.

execvp is man3, I fixed it before merge.

Thanks for your review, merged!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp