diff mbox series

[2/2] tst_fs_setup.c: Add tst_ prefix to new API functions

Message ID 20240102223935.1012840-2-pvorel@suse.cz
State Accepted
Headers show
Series [1/2] include: Move new API only functions to new API header | expand

Commit Message

Petr Vorel Jan. 2, 2024, 10:39 p.m. UTC
To fix our warning due not following our policy:
tst_fs_setup.c:14:6: warning: LTP-003: Symbol 'create_overlay_dirs' is a public library function, but is missing the 'tst_' prefix
tst_fs_setup.c:27:5: warning: LTP-003: Symbol 'mount_overlay' is a public library function, but is missing the 'tst_' prefix

+ Fix missing blank line.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/tst_safe_file_ops.h | 8 ++++----
 lib/tst_fs_setup.c          | 7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

Comments

Cyril Hrubis Feb. 26, 2024, 2:20 p.m. UTC | #1
Hi!
> To fix our warning due not following our policy:
> tst_fs_setup.c:14:6: warning: LTP-003: Symbol 'create_overlay_dirs' is a public library function, but is missing the 'tst_' prefix
> tst_fs_setup.c:27:5: warning: LTP-003: Symbol 'mount_overlay' is a public library function, but is missing the 'tst_' prefix
> 
> + Fix missing blank line.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Martin Doucha March 13, 2024, 2:12 p.m. UTC | #2
Hi,
for both patches:
Reviewed-by: Martin Doucha <mdoucha@suse.cz>

On 02. 01. 24 23:39, Petr Vorel wrote:
> To fix our warning due not following our policy:
> tst_fs_setup.c:14:6: warning: LTP-003: Symbol 'create_overlay_dirs' is a public library function, but is missing the 'tst_' prefix
> tst_fs_setup.c:27:5: warning: LTP-003: Symbol 'mount_overlay' is a public library function, but is missing the 'tst_' prefix
> 
> + Fix missing blank line.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>   include/tst_safe_file_ops.h | 8 ++++----
>   lib/tst_fs_setup.c          | 7 ++++---
>   2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/include/tst_safe_file_ops.h b/include/tst_safe_file_ops.h
> index 401f6ee25..0d8819594 100644
> --- a/include/tst_safe_file_ops.h
> +++ b/include/tst_safe_file_ops.h
> @@ -59,13 +59,13 @@
>   /* New API only functions */
>   
>   /* helper functions to setup overlayfs mountpoint */
> -void create_overlay_dirs(void);
> -int mount_overlay(const char *file, const int lineno, int strict);
> +void tst_create_overlay_dirs(void);
> +int tst_mount_overlay(const char *file, const int lineno, int strict);
>   
>   #define SAFE_MOUNT_OVERLAY() \
> -	((void) mount_overlay(__FILE__, __LINE__, 1))
> +	((void) tst_mount_overlay(__FILE__, __LINE__, 1))
>   
>   #define TST_MOUNT_OVERLAY() \
> -	(mount_overlay(__FILE__, __LINE__, 0) == 0)
> +	(tst_mount_overlay(__FILE__, __LINE__, 0) == 0)
>   
>   #endif /* TST_SAFE_FILE_OPS */
> diff --git a/lib/tst_fs_setup.c b/lib/tst_fs_setup.c
> index aaa8f3bc9..d3284a145 100644
> --- a/lib/tst_fs_setup.c
> +++ b/lib/tst_fs_setup.c
> @@ -11,9 +11,10 @@
>   #define TST_FS_SETUP_OVERLAYFS_MSG "overlayfs is not configured in this kernel"
>   #define TST_FS_SETUP_OVERLAYFS_CONFIG "lowerdir="OVL_LOWER",upperdir="OVL_UPPER",workdir="OVL_WORK
>   
> -void create_overlay_dirs(void)
> +void tst_create_overlay_dirs(void)
>   {
>   	DIR *dir = opendir(OVL_LOWER);
> +
>   	if (dir == NULL) {
>   		SAFE_MKDIR(OVL_LOWER, 0755);
>   		SAFE_MKDIR(OVL_UPPER, 0755);
> @@ -24,11 +25,11 @@ void create_overlay_dirs(void)
>   	closedir(dir);
>   }
>   
> -int mount_overlay(const char *file, const int lineno, int strict)
> +int tst_mount_overlay(const char *file, const int lineno, int strict)
>   {
>   	int ret;
>   
> -	create_overlay_dirs();
> +	tst_create_overlay_dirs();
>   	ret = mount("overlay", OVL_MNT, "overlay", 0,
>   				TST_FS_SETUP_OVERLAYFS_CONFIG);
>   	if (ret == 0)
Petr Vorel March 13, 2024, 9:15 p.m. UTC | #3
Hi Martin,

> Hi,
> for both patches:
> Reviewed-by: Martin Doucha <mdoucha@suse.cz>

Thanks, merged!

Kind regards,
Petr
diff mbox series

Patch

diff --git a/include/tst_safe_file_ops.h b/include/tst_safe_file_ops.h
index 401f6ee25..0d8819594 100644
--- a/include/tst_safe_file_ops.h
+++ b/include/tst_safe_file_ops.h
@@ -59,13 +59,13 @@ 
 /* New API only functions */
 
 /* helper functions to setup overlayfs mountpoint */
-void create_overlay_dirs(void);
-int mount_overlay(const char *file, const int lineno, int strict);
+void tst_create_overlay_dirs(void);
+int tst_mount_overlay(const char *file, const int lineno, int strict);
 
 #define SAFE_MOUNT_OVERLAY() \
-	((void) mount_overlay(__FILE__, __LINE__, 1))
+	((void) tst_mount_overlay(__FILE__, __LINE__, 1))
 
 #define TST_MOUNT_OVERLAY() \
-	(mount_overlay(__FILE__, __LINE__, 0) == 0)
+	(tst_mount_overlay(__FILE__, __LINE__, 0) == 0)
 
 #endif /* TST_SAFE_FILE_OPS */
diff --git a/lib/tst_fs_setup.c b/lib/tst_fs_setup.c
index aaa8f3bc9..d3284a145 100644
--- a/lib/tst_fs_setup.c
+++ b/lib/tst_fs_setup.c
@@ -11,9 +11,10 @@ 
 #define TST_FS_SETUP_OVERLAYFS_MSG "overlayfs is not configured in this kernel"
 #define TST_FS_SETUP_OVERLAYFS_CONFIG "lowerdir="OVL_LOWER",upperdir="OVL_UPPER",workdir="OVL_WORK
 
-void create_overlay_dirs(void)
+void tst_create_overlay_dirs(void)
 {
 	DIR *dir = opendir(OVL_LOWER);
+
 	if (dir == NULL) {
 		SAFE_MKDIR(OVL_LOWER, 0755);
 		SAFE_MKDIR(OVL_UPPER, 0755);
@@ -24,11 +25,11 @@  void create_overlay_dirs(void)
 	closedir(dir);
 }
 
-int mount_overlay(const char *file, const int lineno, int strict)
+int tst_mount_overlay(const char *file, const int lineno, int strict)
 {
 	int ret;
 
-	create_overlay_dirs();
+	tst_create_overlay_dirs();
 	ret = mount("overlay", OVL_MNT, "overlay", 0,
 				TST_FS_SETUP_OVERLAYFS_CONFIG);
 	if (ret == 0)