From d6b85d82d797d391a8cb087311e01a1d73142f65 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sat, 14 Sep 2024 14:57:44 +0100 Subject: [PATCH] testsuite: remove *lstat* wrappers The majority of these were initially introduced with commit 123e827 ("testsuite preload: Factorize into macros, add more stat and open variants"). The commit itself was meant to refactor existing wrappers and add new _xstat (aka stat) variants. The lstat variants were never used in kmod directly nor indirectly via header macros. The rest were added to mimic the original, without much testing it seems. They are all dead code - remove them. In theory one could have a macro/helper that calls `lstat` for `stat` itself, although that isn't a practical solution for a few reasons. The functionality across the two varies, where if the path provided is a symlink `stat` follows it, while `lstat` gets the details for the link itself. To fix this, the wrapper would need second syscall to resolve the symlink, which will cause notable performance regression wrt using using the `stat`/`stat64` syscall alone. Signed-off-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/131 Signed-off-by: Lucas De Marchi --- testsuite/path.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/testsuite/path.c b/testsuite/path.c index eae7d268..9a7918c0 100644 --- a/testsuite/path.c +++ b/testsuite/path.c @@ -187,29 +187,23 @@ WRAP_2ARGS(FILE*, NULL, fopen, const char*); WRAP_2ARGS(int, -1, mkdir, mode_t); WRAP_2ARGS(int, -1, access, int); WRAP_2ARGS(int, -1, stat, struct stat*); -WRAP_2ARGS(int, -1, lstat, struct stat*); WRAP_OPEN(); #if HAVE_DECL___GLIBC__ WRAP_2ARGS(FILE*, NULL, fopen64, const char*); WRAP_2ARGS(int, -1, stat64, struct stat64*); -WRAP_2ARGS(int, -1, lstat64, struct stat64*); struct __stat64_t64; extern int __stat64_time64 (const char *file, struct __stat64_t64 *buf); -extern int __lstat64_time64 (const char *file, struct __stat64_t64 *buf); WRAP_2ARGS(int, -1, __stat64_time64, struct __stat64_t64*); -WRAP_2ARGS(int, -1, __lstat64_time64, struct __stat64_t64*); WRAP_OPEN(64); #endif #ifdef HAVE___XSTAT WRAP_VERSTAT(__x,); -WRAP_VERSTAT(__lx,); #if HAVE_DECL___GLIBC__ WRAP_VERSTAT(__x,64); -WRAP_VERSTAT(__lx,64); #endif #endif -- 2.47.2