[PATCH bpf-next 22/25] selftests/bpf: use the glob_match() from libbpf in test_progs.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The glob_match() in test_progs.c has almost the same logic with the
glob_match() in libbpf.c, so we replace it to make the code simple.

Signed-off-by: Menglong Dong <dongml2@xxxxxxxxxxxxxxx>
---
 tools/testing/selftests/bpf/test_progs.c | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 309d9d4a8ace..e246fe4b7b70 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -17,6 +17,7 @@
 #include <sys/un.h>
 #include <bpf/btf.h>
 #include <time.h>
+#include "bpf/libbpf_internal.h"
 #include "json_writer.h"
 
 #include "network_helpers.h"
@@ -129,28 +130,6 @@ static int traffic_monitor_print_fn(const char *format, va_list args)
 	return 0;
 }
 
-/* Adapted from perf/util/string.c */
-static bool glob_match(const char *str, const char *pat)
-{
-	while (*str && *pat && *pat != '*') {
-		if (*str != *pat)
-			return false;
-		str++;
-		pat++;
-	}
-	/* Check wild card */
-	if (*pat == '*') {
-		while (*pat == '*')
-			pat++;
-		if (!*pat) /* Tail wild card matches all */
-			return true;
-		while (*str)
-			if (glob_match(str++, pat))
-				return true;
-	}
-	return !*str && !*pat;
-}
-
 #define EXIT_NO_TEST		2
 #define EXIT_ERR_SETUP_INFRA	3
 
-- 
2.39.5





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux