From 0de36294746022f9cf01577b04d0de14bd139e8e Mon Sep 17 00:00:00 2001 From: Etienne AUJAMES Date: Tue, 27 Aug 2024 14:51:23 +0200 Subject: [PATCH] LU-18173 obdclass: remove lprocfs_strnstr() strnstr() was added in the kernel since RHEL6, we no longer need lprocfs_strnstr() and it can be removed. Test-Parameters: trivial Signed-off-by: Etienne AUJAMES Change-Id: Id2e3c948dd506b2d983ff776a9136c244d54f6ce Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56166 Reviewed-by: Andreas Dilger Reviewed-by: Timothy Day Reviewed-by: Feng Lei Reviewed-by: Oleg Drokin Reviewed-by: James Simmons Tested-by: Maloo Tested-by: jenkins --- lustre/include/lprocfs_status.h | 1 - lustre/obdclass/lprocfs_status.c | 20 +------------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index e3a678f..ec45686 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -640,7 +640,6 @@ lprocfs_pinger_recov_seq_write(struct file *file, const char __user *buffer, int string_to_size(u64 *size, const char *buffer, size_t count); int sysfs_memparse(const char *buffer, size_t count, u64 *val, const char *defunit); -char *lprocfs_strnstr(const char *s1, const char *s2, size_t len); char *lprocfs_find_named_value(const char *buffer, const char *name, size_t *count); void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value); diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 7f5f80d..d1b86bd 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -1915,23 +1915,6 @@ int sysfs_memparse(const char *buffer, size_t count, u64 *val, } EXPORT_SYMBOL(sysfs_memparse); -char *lprocfs_strnstr(const char *s1, const char *s2, size_t len) -{ - size_t l2; - - l2 = strlen(s2); - if (!l2) - return (char *)s1; - while (len >= l2) { - len--; - if (!memcmp(s1, s2, l2)) - return (char *)s1; - s1++; - } - return NULL; -} -EXPORT_SYMBOL(lprocfs_strnstr); - /** * Find the string \a name in the input \a buffer, and return a pointer to the * value immediately following \a name, reducing \a count appropriately. @@ -1943,8 +1926,7 @@ char *lprocfs_find_named_value(const char *buffer, const char *name, char *val; size_t buflen = *count; - /* there is no strnstr() in rhel5 and ubuntu kernels */ - val = lprocfs_strnstr(buffer, name, buflen); + val = strnstr(buffer, name, buflen); if (!val) return (char *)buffer; -- 1.8.3.1