[LTP] [PATCH 4/5] API/cgroup: remove ltp_ prefix from static vars

Richard Palethorpe rpalethorpe@suse.com
Tue Dec 14 11:36:44 CET 2021


LTP-003 reserves this prefix for use in public symbols. Also it tends
to be used in parts of the old API. The new API uses tst_.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
 lib/tst_cgroup.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
index 8eeb98a26..c22f5b32c 100644
--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -199,11 +199,11 @@ static const struct tst_cgroup_opts default_opts = { 0 };
 /* We should probably allow these to be set in environment
  * variables
  */
-static const char *ltp_cgroup_dir = "ltp";
-static const char *ltp_cgroup_drain_dir = "drain";
-static char test_cgroup_dir[NAME_MAX + 1];
-static const char *ltp_mount_prefix = "/tmp/cgroup_";
-static const char *ltp_v2_mount = "unified";
+static const char *cgroup_ltp_dir = "ltp";
+static const char *cgroup_ltp_drain_dir = "drain";
+static char cgroup_test_dir[NAME_MAX + 1];
+static const char *cgroup_mount_ltp_prefix = "/tmp/cgroup_";
+static const char *cgroup_v2_ltp_mount = "unified";
 
 #define first_root				\
 	(roots[0].ver ? roots : roots + 1)
@@ -464,7 +464,7 @@ static void cgroup_mount_v2(void)
 {
 	char mnt_path[PATH_MAX];
 
-	sprintf(mnt_path, "%s%s", ltp_mount_prefix, ltp_v2_mount);
+	sprintf(mnt_path, "%s%s", cgroup_mount_ltp_prefix, cgroup_v2_ltp_mount);
 
 	if (!mkdir(mnt_path, 0777)) {
 		roots[0].mnt_dir.we_created_it = 1;
@@ -506,7 +506,7 @@ static void cgroup_mount_v1(struct cgroup_ctrl *const ctrl)
 	char mnt_path[PATH_MAX];
 	int made_dir = 0;
 
-	sprintf(mnt_path, "%s%s", ltp_mount_prefix, ctrl->ctrl_name);
+	sprintf(mnt_path, "%s%s", cgroup_mount_ltp_prefix, ctrl->ctrl_name);
 
 	if (!mkdir(mnt_path, 0777)) {
 		made_dir = 1;
@@ -653,7 +653,7 @@ mkdirs:
 	}
 
 	if (!root->ltp_dir.dir_fd)
-		cgroup_dir_mk(&root->mnt_dir, ltp_cgroup_dir, &root->ltp_dir);
+		cgroup_dir_mk(&root->mnt_dir, cgroup_ltp_dir, &root->ltp_dir);
 	else
 		root->ltp_dir.ctrl_field |= root->mnt_dir.ctrl_field;
 
@@ -668,10 +668,10 @@ mkdirs:
 			cgroup_copy_cpuset(root);
 	}
 
-	cgroup_dir_mk(&root->ltp_dir, ltp_cgroup_drain_dir, &root->drain_dir);
+	cgroup_dir_mk(&root->ltp_dir, cgroup_ltp_drain_dir, &root->drain_dir);
 
-	sprintf(test_cgroup_dir, "test-%d", getpid());
-	cgroup_dir_mk(&root->ltp_dir, test_cgroup_dir, &root->test_dir);
+	sprintf(cgroup_test_dir, "test-%d", getpid());
+	cgroup_dir_mk(&root->ltp_dir, cgroup_test_dir, &root->test_dir);
 }
 
 static void cgroup_drain(const enum tst_cgroup_ver ver,
-- 
2.34.0



More information about the ltp mailing list