Skip to contentSkip to conversation

libs: adopt lib* prefix instead of tst_* for libs/

PATCH In review Li Wang via ltp 2 participants 16 messages Jan 9 – Jan 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libs: adopt lib* prefix instead of tst_* for libs/

The intention of moving these headers under include/ was to expose them as global interfaces, but using the tst_* prefix there is misleading. Headers corresponding to ltp/libs* code should follow the libs* naming to distinguish them from the core tst_* API.

Rename the following headers/sources to use a lib* prefix and update all includes accordingly:

include/ipcmsg.h -> include/libipcmsg.h include/ipcsem.h -> include/libipcsem.h include/tst_numa.h -> include/libnuma.h libs/numa/tst_numa.c -> libs/numa/libnuma.c include/tst_uinput.h -> include/libuinput.h libs/uinput/tst_uinput.c -> libs/uinput/libuinput.c include/parse_vdso.h -> include/libparse_vdso.h libs/vdso/parse_vdso.c -> libs/vdso/libparse_vdso.c libs/sigwait/sigwait.c -> libs/sigwait/libsigwait.c

Also adjust include guards to match the new header names.

No functional changes intended.

==== NOTE ====
From Petr Vorel:

"Although lib/ vs libs/ is a bit strange, kept these libraries separate (i.e. no move libs/*/ into lib/), because these libraries are built only when they are needed. I.e. for testing random test one does not need to wait for building these additional libraries (although building them does not take long, building LTP main library and tests takes much longer)."

Cc Pradeep Susarla <[email protected]>
---
 include/{ipcmsg.h => libipcmsg.h}                         | 8 ++++----
 include/{ipcsem.h => libipcsem.h}                         | 6 +++---
 include/{tst_numa.h => libnuma.h}                         | 6 +++---
 include/{parse_vdso.h => libparse_vdso.h}                 | 6 +++---
 include/libsigwait.h                                      | 6 +++---
 include/libswap.h                                         | 4 ++--
 include/{tst_uinput.h => libuinput.h}                     | 6 +++---
 include/tst_uid.h                                         | 6 +++---
 include/ujson.h                                           | 6 +++---
 include/ujson_common.h                                    | 6 +++---
 include/ujson_reader.h                                    | 6 +++---
 include/ujson_utf.h                                       | 6 +++---
 libs/ipc/libipc.c                                         | 4 ++--
 libs/numa/{tst_numa.c => libnuma.c}                       | 2 +-
 libs/sigwait/{sigwait.c => libsigwait.c}                  | 0
 libs/uinput/{tst_uinput.c => libuinput.c}                 | 2 +-
 libs/vdso/{parse_vdso.c => libparse_vdso.c}               | 0
 libs/vdso/vdso_helpers.c                                  | 2 +-
 testcases/kernel/input/input_common.h                     | 2 +-
 testcases/kernel/mem/cpuset/cpuset02.c                    | 2 +-
 testcases/kernel/mem/ksm/ksm06.c                          | 2 +-
 testcases/kernel/syscalls/clock_gettime/clock_gettime04.c | 2 +-
 testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c | 2 +-
 testcases/kernel/syscalls/get_mempolicy/get_mempolicy02.c | 2 +-
 testcases/kernel/syscalls/ipc/semctl/semctl06.c           | 2 +-
 testcases/kernel/syscalls/mbind/mbind01.c                 | 2 +-
 testcases/kernel/syscalls/mbind/mbind02.c                 | 2 +-
 testcases/kernel/syscalls/mbind/mbind03.c                 | 2 +-
 testcases/kernel/syscalls/mbind/mbind04.c                 | 2 +-
 testcases/kernel/syscalls/set_mempolicy/set_mempolicy01.c | 2 +-
 testcases/kernel/syscalls/set_mempolicy/set_mempolicy02.c | 2 +-
 testcases/kernel/syscalls/set_mempolicy/set_mempolicy03.c | 2 +-
 testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c | 2 +-
 testcases/kernel/uevents/uevent03.c                       | 2 +-
 34 files changed, 57 insertions(+), 57 deletions(-)
 rename include/{ipcmsg.h => libipcmsg.h} (93%)
 rename include/{ipcsem.h => libipcsem.h} (95%)
 rename include/{tst_numa.h => libnuma.h} (97%)
 rename include/{parse_vdso.h => libparse_vdso.h} (93%)
 rename include/{tst_uinput.h => libuinput.h} (93%)
 rename libs/numa/{tst_numa.c => libnuma.c} (99%)
 rename libs/sigwait/{sigwait.c => libsigwait.c} (100%)
 rename libs/uinput/{tst_uinput.c => libuinput.c} (99%)
 rename libs/vdso/{parse_vdso.c => libparse_vdso.c} (100%)
include/libipcmsg.h renamed from include/ipcmsg.h +4 -4
similarity index 93%
rename from include/ipcmsg.h
rename to include/libipcmsg.h
index 3b3fa32c0..3cca7386b 100644
@@ -18,11 +18,11 @@
  */
 
 /*
- * ipcmsg.h - common definitions for the IPC message tests.
+ * libipcmsg.h - common definitions for the IPC message tests.
  */
 
-#ifndef __IPCMSG_H
-#define __IPCMSG_H	1
+#ifndef LIBIPCMSG_H__
+#define LIBIPCMSG_H__	1
 
 #include <errno.h>
 #include <sys/ipc.h>
@@ -63,4 +63,4 @@ int getuserid(char *);
 int get_max_msgqueues(void);
 int get_used_msgqueues(void);
 
-#endif /* ipcmsg.h */
+#endif /* libipcmsg.h */
include/libipcsem.h renamed from include/ipcsem.h +3 -3
similarity index 95%
rename from include/ipcsem.h
rename to include/libipcsem.h
index 09a0b3cbe..fff98f7ab 100644
@@ -21,8 +21,8 @@
  * ipcsem.h - common definitions for the IPC semaphore tests
  */
 
-#ifndef __IPCSEM_H
-#define __IPCSEM_H
+#ifndef LIBIPCSEM_H__
+#define LIBIPCSEM_H__
 
 #include <errno.h>
 #include <sys/ipc.h>
@@ -52,4 +52,4 @@ void rm_sema(int sem_id);
 int getipckey();
 int getuserid(char *);
 
-#endif /* ipcsem.h */
+#endif /* libipcsem.h */
include/libnuma.h renamed from include/tst_numa.h +3 -3
similarity index 97%
rename from include/tst_numa.h
rename to include/libnuma.h
index a1f961630..2a3b99dac 100644
@@ -2,8 +2,8 @@
  * Copyright (c) 2018 Cyril Hrubis <[email protected]>
  */
 
-#ifndef TST_NUMA_H__
-#define TST_NUMA_H__
+#ifndef LIBNUMA_H__
+#define LIBNUMA_H__
 
 #include <string.h>
 
@@ -119,4 +119,4 @@ enum tst_numa_types {
  */
 struct tst_nodemap *tst_get_nodemap(int type, size_t min_mem_kb);
 
-#endif /* TST_NUMA_H__ */
+#endif /* LIBNUMA_H__ */
include/libparse_vdso.h renamed from include/parse_vdso.h +3 -3
similarity index 93%
rename from include/parse_vdso.h
rename to include/libparse_vdso.h
index 5212fc659..2170c553c 100644
@@ -4,8 +4,8 @@
  * Author: Viresh Kumar <[email protected]>
  */
 
-#ifndef PARSE_VDSO_H__
-#define PARSE_VDSO_H__
+#ifndef LIBPARSE_VDSO_H__
+#define LIBPARSE_VDSO_H__
 
 #include <stdint.h>
 
@@ -38,4 +38,4 @@ extern void *vdso_sym(const char *version, const char *name);
 typedef int (*gettime_t)(clockid_t clk_id, void *ts);
 void find_clock_gettime_vdso(gettime_t *ptr_vdso_gettime,
 			     gettime_t *ptr_vdso_gettime64);
-#endif /* PARSE_VDSO_H__ */
+#endif /* LIBPARSE_VDSO_H__ */
include/libsigwait.h +3 -3
index 2fca578b1..3dcd7eb85 100644
@@ -4,8 +4,8 @@
  * Author: Viresh Kumar <[email protected]>
  */
 
-#ifndef SIGWAIT_H__
-#define SIGWAIT_H__
+#ifndef LIBSIGWAIT_H__
+#define LIBSIGWAIT_H__
 
 #include "tst_test.h"
 #include "tst_timer.h"
@@ -41,4 +41,4 @@ void test_bad_address2(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
 void test_bad_address3(swi_func sigwaitinfo, int signo LTP_ATTRIBUTE_UNUSED,
 		       enum tst_ts_type type LTP_ATTRIBUTE_UNUSED);
 void sigwait_setup(void);
-#endif /* SIGWAIT_H__ */
+#endif /* LIBSIGWAIT_H__ */
include/libswap.h +2 -2
index b22b992ee..bf0fe2356 100644
@@ -11,8 +11,8 @@
  * Contains common content for all swapon/swapoff tests.
  */
 
-#ifndef __LIBSWAP_H__
-#define __LIBSWAP_H__
+#ifndef LIBSWAP_H__
+#define LIBSWAP_H__
 
 enum swapfile_method {
     SWAPFILE_BY_SIZE,
include/libuinput.h renamed from include/tst_uinput.h +3 -3
similarity index 93%
rename from include/tst_uinput.h
rename to include/libuinput.h
index cf351cdfb..f21268339 100644
@@ -3,8 +3,8 @@
  * Copyright (c) 2019 Cyril Hrubis <[email protected]>
  */
 
-#ifndef TST_UINPUT_H__
-#define TST_UINPUT_H__
+#ifndef LIBUINPUT_H__
+#define LIBUINPUT_H__
 
 /**
  * Tries to open the uinput device.
@@ -44,4 +44,4 @@ void setup_mouse_events(int fd);
  */
 void destroy_input_device(int fd);
 
-#endif	/* TST_UINPUT_H__ */
+#endif	/* LIBUINPUT_H__ */
include/tst_uid.h +3 -3
index e604effce..2237ddcbf 100644
@@ -2,8 +2,8 @@
  * Copyright (c) 2021 Linux Test Project
  */
 
-#ifndef TST_UID_H_
-#define TST_UID_H_
+#ifndef TST_UID_H__
+#define TST_UID_H__
 
 #include <sys/types.h>
 
@@ -37,4 +37,4 @@ int tst_check_resgid_(const char *file, const int lineno, const char *callstr,
 #define tst_check_resgid(cstr, rgid, egid, sgid) \
 	tst_check_resgid_(__FILE__, __LINE__, (cstr), (rgid), (egid), (sgid))
 
-#endif /* TST_UID_H_ */
+#endif /* TST_UID_H__ */
include/ujson.h +3 -3
index 8faeb18f0..1a4bb6bd9 100644
@@ -3,11 +3,11 @@
  * Copyright (C) 2021-2024 Cyril Hrubis <[email protected]>
  */
 
-#ifndef UJSON_H
-#define UJSON_H
+#ifndef UJSON_H__
+#define UJSON_H__
 
 #include <ujson_common.h>
 #include <ujson_reader.h>
 #include <ujson_writer.h>
 
-#endif /* UJSON_H */
+#endif /* UJSON_H__ */
include/ujson_common.h +3 -3
index ed31c090d..11382c4fb 100644
@@ -8,8 +8,8 @@
  * @brief Common JSON reader/writer definitions.
  */
 
-#ifndef UJSON_COMMON_H
-#define UJSON_COMMON_H
+#ifndef UJSON_COMMON_H__
+#define UJSON_COMMON_H__
 
 /** @brief Maximal error message length. */
 #define UJSON_ERR_MAX 128
@@ -66,4 +66,4 @@ typedef struct ujson_val ujson_val;
 /** @brief An array size macro. */
 #define UJSON_ARRAY_SIZE(array) (sizeof(array) / sizeof(*array))
 
-#endif /* UJSON_COMMON_H */
+#endif /* UJSON_COMMON_H__ */
include/ujson_reader.h +3 -3
index 273fe624a..8608b6c81 100644
@@ -14,8 +14,8 @@
  * if error has happened at the end of the sequence.
  */
 
-#ifndef UJSON_READER_H
-#define UJSON_READER_H
+#ifndef UJSON_READER_H__
+#define UJSON_READER_H__
 
 #include <stdio.h>
 #include <ujson_common.h>
@@ -540,4 +540,4 @@ static inline int ujson_reader_consumed(ujson_reader *self)
 	return self->off >= self->len;
 }
 
-#endif /* UJSON_H */
+#endif /* UJSON_H__ */
include/ujson_utf.h +3 -3
index f939fbe8c..313213d8e 100644
@@ -8,8 +8,8 @@
  * @brief Unicode helper macros and functions.
  */
 
-#ifndef UJSON_UTF_H
-#define UJSON_UTF_H
+#ifndef UJSON_UTF_H__
+#define UJSON_UTF_H__
 
 #include <stdint.h>
 #include <stddef.h>
@@ -165,4 +165,4 @@ static inline int ujson_to_utf8(uint32_t unicode, char *buf)
 	return 4;
 }
 
-#endif /* UJSON_UTF_H */
+#endif /* UJSON_UTF_H__ */
libs/ipc/libipc.c +2 -2
index c2ecbf02d..7ccb3eb68 100644
@@ -35,8 +35,8 @@
  */
 
 #define LIBIPC
-#include "ipcmsg.h"
-#include "ipcsem.h"
+#include "libipcmsg.h"
+#include "libipcsem.h"
 
 #include <pwd.h>
 #include <sys/ipc.h>
libs/numa/libnuma.c renamed from libs/numa/tst_numa.c +1 -1
similarity index 99%
rename from libs/numa/tst_numa.c
rename to libs/numa/libnuma.c
index c3297013b..802b45dd4 100644
@@ -14,7 +14,7 @@
 
 #define TST_NO_DEFAULT_MAIN
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 #include "lapi/numaif.h"
 
 void tst_nodemap_print_counters(struct tst_nodemap *nodes)
libs/sigwait/libsigwait.c renamed from libs/sigwait/sigwait.c +0 -0
similarity index 100%
rename from libs/sigwait/sigwait.c
rename to libs/sigwait/libsigwait.c
libs/uinput/libuinput.c renamed from libs/uinput/tst_uinput.c +1 -1
similarity index 99%
rename from libs/uinput/tst_uinput.c
rename to libs/uinput/libuinput.c
index 16e689153..00f3d3498 100644
@@ -12,7 +12,7 @@
 #define TST_NO_DEFAULT_MAIN
 #include "tst_test.h"
 
-#include "tst_uinput.h"
+#include "libuinput.h"
 #include "tst_safe_stdio.h"
 
 #define VIRTUAL_DEVICE "virtual-device-ltp"
libs/vdso/libparse_vdso.c renamed from libs/vdso/parse_vdso.c +0 -0
similarity index 100%
rename from libs/vdso/parse_vdso.c
rename to libs/vdso/libparse_vdso.c
libs/vdso/vdso_helpers.c +1 -1
index 208c12f65..6f7a2fd9d 100644
@@ -7,7 +7,7 @@
 #define TST_NO_DEFAULT_MAIN
 #include "tst_test.h"
 
-#include "parse_vdso.h"
+#include "libparse_vdso.h"
 #include "config.h"
 
 #ifdef HAVE_GETAUXVAL
testcases/kernel/input/input_common.h +1 -1
index 5b1755771..9caff2b77 100644
@@ -10,7 +10,7 @@
 #include <poll.h>
 
 #include "tst_test.h"
-#include "tst_uinput.h"
+#include "libuinput.h"
 
 static inline int open_event_device(void)
 {
testcases/kernel/mem/cpuset/cpuset02.c +1 -1
index ccfddd6a2..3bc20c6c2 100644
@@ -18,7 +18,7 @@
 
 #ifdef HAVE_NUMA_V2
 #include <numaif.h>
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #define MNTPOINT "hugetlbfs/"
 #define HUGE_PAGE_FILE MNTPOINT "hugepagefile"
testcases/kernel/mem/ksm/ksm06.c +1 -1
index a8e73275d..41102a577 100644
@@ -32,7 +32,7 @@
 #include <limits.h>
 
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 #include "ksm_helper.h"
 #include "ksm_test.h"
 
testcases/kernel/syscalls/clock_gettime/clock_gettime04.c +1 -1
index 4f262da00..08d1b2d43 100644
@@ -13,7 +13,7 @@
  */
 
 #include "config.h"
-#include "parse_vdso.h"
+#include "libparse_vdso.h"
 #include "time64_variants.h"
 #include "tst_timer.h"
 #include "tst_safe_clocks.h"
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +1 -1
index 3c854d109..9b7f1eb09 100644
@@ -22,7 +22,7 @@
 #include <numa.h>
 #include <numaif.h>
 #include <errno.h>
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #define MEM_LENGTH	(4 * 1024 * 1024)
 #define PAGES_ALLOCATED 16u
testcases/kernel/syscalls/get_mempolicy/get_mempolicy02.c +1 -1
index 79ff5d94f..dad1d8b64 100644
@@ -22,7 +22,7 @@
 #include <numa.h>
 #include <numaif.h>
 #include <errno.h>
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #define PAGES_ALLOCATED 16u
 
testcases/kernel/syscalls/ipc/semctl/semctl06.c +1 -1
index b8734c2fa..2c2c72fd0 100644
@@ -53,7 +53,7 @@
 #include <signal.h>
 #include "test.h"
 #include <sys/wait.h>
-#include "ipcsem.h"
+#include "libipcsem.h"
 
 int local_flag = 1;
 
testcases/kernel/syscalls/mbind/mbind01.c +1 -1
index 4b8d168cd..d6610630f 100644
@@ -17,7 +17,7 @@
 #include "config.h"
 #include "numa_helper.h"
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 #include "lapi/numaif.h"
 
 #ifdef HAVE_NUMA_V2
testcases/kernel/syscalls/mbind/mbind02.c +1 -1
index cd6a03226..06b0a564d 100644
@@ -21,7 +21,7 @@
 # include <numaif.h>
 #endif
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #ifdef HAVE_NUMA_V2
 
testcases/kernel/syscalls/mbind/mbind03.c +1 -1
index 3d477c9cb..8e04b6802 100644
@@ -18,7 +18,7 @@
 # include "mbind.h"
 #endif
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #ifdef HAVE_NUMA_V2
 
testcases/kernel/syscalls/mbind/mbind04.c +1 -1
index 50028835f..0fd6b94c3 100644
@@ -18,7 +18,7 @@
 # include "mbind.h"
 #endif
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #ifdef HAVE_NUMA_V2
 
testcases/kernel/syscalls/set_mempolicy/set_mempolicy01.c +1 -1
index 39e7156d0..9c038131f 100644
@@ -17,7 +17,7 @@
 # include <numaif.h>
 #endif
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #ifdef HAVE_NUMA_V2
 
testcases/kernel/syscalls/set_mempolicy/set_mempolicy02.c +1 -1
index 3db9c2009..19443da61 100644
@@ -18,7 +18,7 @@
 # include <numaif.h>
 #endif
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #ifdef HAVE_NUMA_V2
 
testcases/kernel/syscalls/set_mempolicy/set_mempolicy03.c +1 -1
index 5cfcda6d8..578ba2513 100644
@@ -15,7 +15,7 @@
 # include <numa.h>
 #endif
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #define MNTPOINT "mntpoint"
 #define PAGES_ALLOCATED 16u
testcases/kernel/syscalls/set_mempolicy/set_mempolicy04.c +1 -1
index 2a1d2e1b9..2d83453f0 100644
@@ -26,7 +26,7 @@
 # include <numaif.h>
 #endif
 #include "tst_test.h"
-#include "tst_numa.h"
+#include "libnuma.h"
 
 #define MNTPOINT "mntpoint"
 #define FILES 10
testcases/kernel/uevents/uevent03.c +1 -1
index 126c924f1..aa2f9752a 100644
@@ -18,7 +18,7 @@
 #include <sys/sysmacros.h>
 #include <linux/uinput.h>
 #include "tst_test.h"
-#include "tst_uinput.h"
+#include "libuinput.h"
 #include "uevent.h"
 
 static int mouse_fd;
Signature · 5 lines
2.52.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw
Quoted 4 lines
 include/ujson.h                                           | 6 +++---
 include/ujson_common.h                                    | 6 +++---
 include/ujson_reader.h                                    | 6 +++---
 include/ujson_utf.h                                       | 6 +++---

Btw, I intentionally did _not_ rename the ujson header file with the prefix lib*.

Unlike the other header files, ujson is a standalone library with a clear target (which is for tst_run_shell.c), and it is completely different to the tst_* test function API.

Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Li Wang via ltp

Hi!

I generally agree with this approach, but I have the feeling we are mixing naming a bit here. For instance, we have headers like ipcmsg.h that has no functions starting with tst_*, while tst_numa.h does. Also, the tst_* prefix for files has the clear goal to state we are importing some LTP functionalities inside the tests code.

Said so, I would rather rename all LTP libraries as tst_*.h and to rename functions inside them with tst_* prefix. In this way, we know at the very first look, when a library is imported from LTP and not from other sources.

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


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

Hi Andrea, All,

Quoted 8 lines · Andrea Cervesato

Hi!

I generally agree with this approach, but I have the feeling we are mixing naming a bit here. For instance, we have headers like ipcmsg.h that has no functions starting with tst_*, while tst_numa.h does. Also, the tst_* prefix for files has the clear goal to state we are importing some LTP functionalities inside the tests code.

Quoted 5 lines

Said so, I would rather rename all LTP libraries as tst_*.h and to rename functions inside them with tst_* prefix. In this way, we know at the very first look, when a library is imported from LTP and not from other sources.

I indeed thought about all use tst_* for those global header files. But to distinguish lib/ with libs/ I finally feel that libs/ is not the core LTP API
and sometimes built only when they are needed, if we rename all these header file with tst_* that will mislead people to find the *.c file in lib/, which
is not the right place.

So in my patch, keep define tst_* only for the core LTP API, and lib* prefix reserve for libs/ that will be clear at a glance.

Or, if go with tst_*.h for all (and rename functions with tst_*), I think the libs/ should be merged into lib/.

@Cyril, Petr, any comments?

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw
Quoted 17 lines

Hi Andrea, All,

Quoted 12 lines · Andrea Cervesato

Hi!

I generally agree with this approach, but I have the feeling we are mixing naming a bit here. For instance, we have headers like ipcmsg.h that has no functions starting with tst_*, while tst_numa.h does. Also, the tst_* prefix for files has the clear goal to state we are importing some LTP functionalities inside the tests code.

Said so, I would rather rename all LTP libraries as tst_*.h and to rename functions inside them with tst_* prefix. In this way, we know at the very first look, when a library is imported from LTP and not from other sources.

'tst_' prefix is only for *new* C API. That's why ipcmsg.h/libs/ipc/libipc.c don't use it. I would prefer to keep that way (not use 'tst_' for legacy C API library source).

That's why I quite like Li's approach (I'm ok if libs/ sources' headers will have 'lib' prefix instead of 'tst_'), although I liked more libs/sigwait/sigwait.c than libs/sigwait/libsigwait.c.

Quoted 10 lines

I indeed thought about all use tst_* for those global header files. But to distinguish lib/ with libs/ I finally feel that libs/ is not the core LTP API
and sometimes built only when they are needed, if we rename all these header file with tst_* that will mislead people to find the *.c file in lib/, which
is not the right place.

So in my patch, keep define tst_* only for the core LTP API, and lib* prefix reserve for libs/ that will be clear at a glance.

+1

Quoted 2 lines

Or, if go with tst_*.h for all (and rename functions with tst_*), I think the libs/ should be merged into lib/.

I don't think this would be good. It would require also changing a build system, touch too many files. And I don't even see a benefit for a such change.

Kind regards,
Petr

Quoted 1 line

@Cyril, Petr, any comments?

I also wonder Cyril's and Jan's opinion.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
Quoted 38 lines · Petr Vorel
Quoted 18 lines

Hi Andrea, All,

Quoted 12 lines · Andrea Cervesato

Hi!

I generally agree with this approach, but I have the feeling we are mixing naming a bit here. For instance, we have headers like ipcmsg.h that has no functions starting with tst_*, while tst_numa.h does. Also, the tst_* prefix for files has the clear goal to state we are importing some LTP functionalities inside the tests code.

Said so, I would rather rename all LTP libraries as tst_*.h and to rename functions inside them with tst_* prefix. In this way, we know at the very first look, when a library is imported from LTP and not from other sources.

'tst_' prefix is only for *new* C API. That's why ipcmsg.h/libs/ipc/libipc.c don't use it. I would prefer to keep that way (not use 'tst_' for legacy C API library source).

That's why I quite like Li's approach (I'm ok if libs/ sources' headers will have 'lib' prefix instead of 'tst_'), although I liked more libs/sigwait/sigwait.c than libs/sigwait/libsigwait.c.

Quoted 10 lines

I indeed thought about all use tst_* for those global header files. But to distinguish lib/ with libs/ I finally feel that libs/ is not the core LTP API
and sometimes built only when they are needed, if we rename all these header file with tst_* that will mislead people to find the *.c file in lib/, which
is not the right place.

So in my patch, keep define tst_* only for the core LTP API, and lib* prefix reserve for libs/ that will be clear at a glance.

Quoted 7 lines

+1

Quoted 2 lines

Or, if go with tst_*.h for all (and rename functions with tst_*), I think the libs/ should be merged into lib/.

I don't think this would be good. It would require also changing a build system, touch too many files. And I don't even see a benefit for a such change.

I'd keep them separate from core library. For non-core libraries, I'd go with something more distinct, like "ltp" prefix for file and function names.

When I look at "libnuma.h" I'd have to think for a bit if this is header from numa-devel
or LTP. "ltpnuma.h" seems (to me) more clear that it's not LTP core nor numa-devel.

my 2 cents,
Jan

Quoted 11 lines

Kind regards,
Petr

Quoted 1 line

@Cyril, Petr, any comments?

I also wonder Cyril's and Jan's opinion.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw
Quoted 4 lines

I'd keep them separate from core library. For non-core libraries, I'd go with something more distinct, like "ltp" prefix for file and function names.

Quoted 8 lines

When I look at "libnuma.h" I'd have to think for a bit if this is header from numa-devel
or LTP. "ltpnuma.h" seems (to me) more clear that it's not LTP core nor numa-devel.

my 2 cents,
Jan

That's exactly why I was suggesting to keep tst_*, which is more for code-library. The lib* prefix is pretty generic and we need something more specific for LTP.

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw
Quoted 4 lines
Quoted 1 line

I'd keep them separate from core library. For non-core libraries, I'd go

with

Quoted 1 line

something more distinct, like "ltp" prefix for file and function names.

Thanks!

Quoted 5 lines
Quoted 4 lines

When I look at "libnuma.h" I'd have to think for a bit if this is header from numa-devel
or LTP. "ltpnuma.h" seems (to me) more clear that it's not LTP core nor numa-devel.

Good point, but the ltp* prefix sounds too serious to me. Anything with the ltp* prefix inside an LTP makes me think it's critical information.

Perhaps we can use a lightweight name for the extra libs/:

est_*: extra test library
xst_*: extened test library
lst_*: ltp test library

I prefer to use lst_*, which is not only different from tst_*, but also implies
this is ltp tst_ things.

What do you think? or any better prefix?

Quoted 9 lines
Quoted 4 lines

my 2 cents,
Jan

That's exactly why I was suggesting to keep tst_*, which is more for code-library. The lib* prefix is pretty generic and we need something more specific for LTP.

Indeed.

Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I'd keep them separate from core library. For non-core libraries, I'd go

with

Quoted 1 line

something more distinct, like "ltp" prefix for file and function names.

Thanks!

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

When I look at "libnuma.h" I'd have to think for a bit if this is header from numa-devel
or LTP. "ltpnuma.h" seems (to me) more clear that it's not LTP core nor numa-devel.

Good point, but the ltp* prefix sounds too serious to me. Anything with the ltp* prefix inside an LTP makes me think it's critical information.

+1

Quoted 11 lines

Perhaps we can use a lightweight name for the extra libs/:

est_*: extra test library
xst_*: extened test library
lst_*: ltp test library

I prefer to use lst_*, which is not only different from tst_*, but also implies
this is ltp tst_ things.

What do you think? or any better prefix?

Given that include "libfoo.h" should be local header and include <foo.h> should be header from /usr/lib* I would be ok with either keep things as they are or use the original Li's proposal.

For me personally is more useful to know whether header can be used in the old API (i.e. "tst_" prefix means source is converted in the new C API) than whether header is from extra library.

Kind regards,
Petr

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

my 2 cents,
Jan

That's exactly why I was suggesting to keep tst_*, which is more for code-library. The lib* prefix is pretty generic and we need something more specific for LTP.

Indeed.

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#9 lore raw
Quoted 31 lines · Petr Vorel
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I'd keep them separate from core library. For non-core libraries, I'd go

with

Quoted 1 line

something more distinct, like "ltp" prefix for file and function names.

Thanks!

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

When I look at "libnuma.h" I'd have to think for a bit if this is header from numa-devel
or LTP. "ltpnuma.h" seems (to me) more clear that it's not LTP core nor numa-devel.

Good point, but the ltp* prefix sounds too serious to me. Anything with the ltp* prefix inside an LTP makes me think it's critical information.

+1

Quoted 11 lines

Perhaps we can use a lightweight name for the extra libs/:

est_*: extra test library
xst_*: extened test library
lst_*: ltp test library

I prefer to use lst_*, which is not only different from tst_*, but also implies
this is ltp tst_ things.

What do you think? or any better prefix?

Quoted 7 lines

Given that include "libfoo.h" should be local header and include <foo.h> should be header from /usr/lib* I would be ok with either keep things as they are or use the original Li's proposal.

For me personally is more useful to know whether header can be used in the old API (i.e. "tst_" prefix means source is converted in the new C API) than whether header is from extra library.

Well, we might subconsciously think that libfoo.h means an older version, but we can change that minds. Something like "lst_" can also be used in older APIs (and implies extra libs/).

Furthermore, I believe these additional 'libs/' directories will continue to be developed and exist long-term; we currently have no plans to migrate them to the core API, so explicit naming becomes crucial for maintenance.

By now, the situation is, inlcude/ contains different prefix header files:
'ltp_', 'old_', 'lib': meant old LTP API, but should eventually be dropped.
tst_: meant the new core LTP API.

Next, I hope that we only keep two prefixes in LTP API:
tst_: new core LTP API
lst_: extra (non-core) LTP API

Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#10 lore raw
Quoted 48 lines · Petr Vorel
Quoted 31 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I'd keep them separate from core library. For non-core libraries, I'd go

with

Quoted 1 line

something more distinct, like "ltp" prefix for file and function names.

Thanks!

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

When I look at "libnuma.h" I'd have to think for a bit if this is header from numa-devel
or LTP. "ltpnuma.h" seems (to me) more clear that it's not LTP core nor numa-devel.

Good point, but the ltp* prefix sounds too serious to me. Anything with the ltp* prefix inside an LTP makes me think it's critical information.

+1

Quoted 11 lines

Perhaps we can use a lightweight name for the extra libs/:

est_*: extra test library
xst_*: extened test library
lst_*: ltp test library

I prefer to use lst_*, which is not only different from tst_*, but also implies
this is ltp tst_ things.

What do you think? or any better prefix?

Quoted 7 lines

Given that include "libfoo.h" should be local header and include <foo.h> should be header from /usr/lib* I would be ok with either keep things as they are or use the original Li's proposal.

For me personally is more useful to know whether header can be used in the old API (i.e. "tst_" prefix means source is converted in the new C API) than whether header is from extra library.

Well, we might subconsciously think that libfoo.h means an older version, but we can change that minds. Something like "lst_" can also be used in older APIs (and implies extra libs/).

Furthermore, I believe these additional 'libs/' directories will continue to be developed and exist long-term; we currently have no plans to migrate them to the core API, so explicit naming becomes crucial for maintenance.

Quoted 7 lines

By now, the situation is, inlcude/ contains different prefix header files:
'ltp_', 'old_', 'lib': meant old LTP API, but should eventually be dropped.
tst_: meant the new core LTP API.

Next, I hope that we only keep two prefixes in LTP API:
tst_: new core LTP API
lst_: extra (non-core) LTP API

I'm not a big fun of 'lst_' (I might need time to get used to it :)) but I'm not against it. If we agree on this it'd be great to document it, so that new contributors will not have to think which prefix to use.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#11 lore raw
Quoted 12 lines
Quoted 11 lines

Well, we might subconsciously think that libfoo.h means an older version, but we can change that minds. Something like "lst_" can also be used in older APIs (and implies extra libs/).

Furthermore, I believe these additional 'libs/' directories will continue to be developed and exist long-term; we currently have no plans to migrate them to the core API, so explicit naming becomes crucial for maintenance.

By now, the situation is, inlcude/ contains different prefix header files:
'ltp_', 'old_', 'lib': meant old LTP API, but should eventually be dropped.
tst_: meant the new core LTP API.

Quoted 7 lines
Quoted 3 lines

Next, I hope that we only keep two prefixes in LTP API:
tst_: new core LTP API
lst_: extra (non-core) LTP API

I'm not a big fun of 'lst_' (I might need time to get used to it :)) but I'm not against it. If we agree on this it'd be great to document it, so that new contributors will not have to think which prefix to use.

Understand, we can treat lst_ as an alternative. This approach allows us to replace all lst_ values with the desired prefix using a single 'sed' command.

Here only demo lst_ for an overview, I am still open-minded to find a proper name :).

     include/{ipcmsg.h => lst_ipcmsg.h}
     include/{ipcsem.h => lst_ipcsem.h}
     include/{libmsgctl.h => lst_msgctl.h}
     include/{libnewipc.h => lst_newipc.h}
     include/{tst_numa.h => lst_numa.h}
     include/{parse_vdso.h => lst_parse_vdso.h}
     include/{libsigwait.h => lst_sigwait.h}
     include/{libswap.h => lst_swap.h}
     include/{tst_uinput.h => lst_uinput.h}
     libs/ipc/{libipc.c => lst_ipc.c}
     libs/ipc/{libmsgctl.c => lst_msgctl.c}
     libs/newipc/{libnewipc.c => lst_newipc.c}
     libs/numa/{tst_numa.c => lst_numa.c}
     libs/sigwait/{sigwait.c => lst_sigwait.c}
     libs/swap/{libswap.c => lst_swap.c}
     libs/uinput/{tst_uinput.c => lst_uinput.c}
     libs/vdso/{parse_vdso.c => lst_parse_vdso.c}
Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#12 lore raw
In reply to Petr Vorel
Quoted 1 line · Petr Vorel

ltp* prefix sounds too serious to me

ltpx_ ?

Quoted 3 lines

I'm not a big fun of 'lst_' (I might need time to get used to it :)) but I'm not against it. If we agree on this it'd be great to document it, so that new contributors will not have to think which prefix to use.

Me neither, it's a bit too similar visually to "tst". Others I could probably get used to.

Quoted 4 lines

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#13 lore raw
In reply to Li Wang via ltp
Quoted 7 lines

Perhaps we can use a lightweight name for the extra libs/:

est_*: extra test library
xst_*: extened test library
lst_*: ltp test library

Otherwise we can have tst_ tag for all libraries inside LTP, but divide them into categories according to their meaning:

- tst_*: test library
- tst_lib_*: libraries inside LTP
- tst_old_*: old test libraries

This will clearly state what are the LTP libraries, but separate them according to their purpose.

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#14 lore raw
Quoted 7 lines
Quoted 6 lines

Perhaps we can use a lightweight name for the extra libs/:

est_*: extra test library
xst_*: extened test library
lst_*: ltp test library

Quoted 6 lines

Otherwise we can have tst_ tag for all libraries inside LTP, but divide them into categories according to their meaning:

- tst_*: test library
- tst_lib_*: libraries inside LTP
- tst_old_*: old test libraries

It might not be good (too long) to use tst_lib_ in the function names, which not easy to distinguish from tst_.

To combine with ltpx_ suggestion, I guess we could use:

tst_*: core test library
etst_*: non-core (extended) test library
otst_*: old test library

The reason I'm not using the word "ltp" is that it's too broad, we're better off naming it around *tst*.

Signature · 6 lines
Regards,
Li Wang


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#15 lore raw
Quoted 17 lines · Li Wang
Quoted 7 lines
Quoted 6 lines

Perhaps we can use a lightweight name for the extra libs/:

est_*: extra test library
xst_*: extened test library
lst_*: ltp test library

Quoted 6 lines

Otherwise we can have tst_ tag for all libraries inside LTP, but divide them into categories according to their meaning:

- tst_*: test library
- tst_lib_*: libraries inside LTP
- tst_old_*: old test libraries

It might not be good (too long) to use tst_lib_ in the function names, which not easy to distinguish from tst_.

Quoted 8 lines

To combine with ltpx_ suggestion, I guess we could use:

tst_*: core test library
etst_*: non-core (extended) test library
otst_*: old test library

The reason I'm not using the word "ltp" is that it's too broad, we're better off naming it around *tst*.

I guess we reached a point where 5 engineers found 7 different solutions. For me it's all good as long as we keep the "tst" tag to make sure we know we are importing LTP stuff :-)

Signature · 7 lines
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]


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