Whamcloud - gitweb
LU-18173 obdclass: remove lprocfs_strnstr() 66/56166/5
authorEtienne AUJAMES <etienne.aujames@cea.fr>
Tue, 27 Aug 2024 12:51:23 +0000 (14:51 +0200)
committerOleg Drokin <green@whamcloud.com>
Sun, 8 Sep 2024 16:05:33 +0000 (16:05 +0000)
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 <eaujames@ddn.com>
Change-Id: Id2e3c948dd506b2d983ff776a9136c244d54f6ce
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56166
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
lustre/include/lprocfs_status.h
lustre/obdclass/lprocfs_status.c

index e3a678f..ec45686 100644 (file)
@@ -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);
index 7f5f80d..d1b86bd 100644 (file)
@@ -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;