From f21f1e4ee58f0ec5985916bd0c3976682ac7ae22 Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Tue, 2 Jan 2024 23:39:35 +0100 Subject: [PATCH] tst_fs_setup.c: Add tst_ prefix to new API functions 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. Link: https://lore.kernel.org/ltp/20240102223935.1012840-2-pvorel@suse.cz/ Reviewed-by: Cyril Hrubis Reviewed-by: Martin Doucha Signed-off-by: Petr Vorel --- 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 401f6ee253c..0d8819594ab 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 aaa8f3bc912..d3284a145d4 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)