[LTP] [PATCH 05/13] testcases/kernel/mem: Move update_shm_size()
Cyril Hrubis
chrubis@suse.cz
Wed Dec 18 19:45:10 CET 2024
Move update_shm_size() from the lib to the libhugetlb.c since the
function is used only by the hugetlb testcases.
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
testcases/kernel/mem/hugetlb/lib/hugetlb.c | 11 +++++++++++
testcases/kernel/mem/hugetlb/lib/hugetlb.h | 3 +++
testcases/kernel/mem/include/mem.h | 2 --
testcases/kernel/mem/lib/mem.c | 13 -------------
4 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.c b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
index 43a677ce9..6a2976a53 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.c
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.c
@@ -130,3 +130,14 @@ int do_readback(void *p, size_t size, char *desc)
}
return 0;
}
+
+void update_shm_size(size_t * shm_size)
+{
+ size_t shmmax;
+
+ SAFE_FILE_SCANF(PATH_SHMMAX, "%zu", &shmmax);
+ if (*shm_size > shmmax) {
+ tst_res(TINFO, "Set shm_size to shmmax: %zu", shmmax);
+ *shm_size = shmmax;
+ }
+}
diff --git a/testcases/kernel/mem/hugetlb/lib/hugetlb.h b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
index a694514d2..abc88e25e 100644
--- a/testcases/kernel/mem/hugetlb/lib/hugetlb.h
+++ b/testcases/kernel/mem/hugetlb/lib/hugetlb.h
@@ -56,4 +56,7 @@ int getipckey(void);
int getuserid(char *user);
void rm_shm(int shm_id);
int do_readback(void *p, size_t size, char *desc);
+
+void update_shm_size(size_t *shm_size);
+
#endif /* hugetlb.h */
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 35a1f0834..03dbe91d7 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -68,6 +68,4 @@ void write_memcg(void);
/* cpuset/memcg - include/tst_cgroup.h */
void write_cpusets(const struct tst_cg_group *cg, long nd);
-void update_shm_size(size_t *shm_size);
-
#endif
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 06271f5d3..de9388a80 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -590,16 +590,3 @@ void write_cpusets(const struct tst_cg_group *cg, long nd)
SAFE_CG_PRINT(cg, "cpuset.cpus", "0");
}
}
-
-/* shared */
-
-void update_shm_size(size_t * shm_size)
-{
- size_t shmmax;
-
- SAFE_FILE_SCANF(PATH_SHMMAX, "%zu", &shmmax);
- if (*shm_size > shmmax) {
- tst_res(TINFO, "Set shm_size to shmmax: %zu", shmmax);
- *shm_size = shmmax;
- }
-}
--
2.45.2
More information about the ltp
mailing list