staging/lustre/libcfs: remove cfs_strncasecmp
The only difference against generic strncasecmp() is that cfs_strncasecmp() check NULL pointers and zero length parameter, which all callers have already taken care of. Cc: Andreas Dilger <andreas.dilger@intel.com> Cc: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Peng Tao <bergwolf@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
82a2390c3c
commit
7a72458266
2 changed files with 4 additions and 24 deletions
|
@ -837,8 +837,8 @@ static int __proc_lnet_portal_rotor(void *data, int write,
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
lnet_res_lock(0);
|
lnet_res_lock(0);
|
||||||
for (i = 0; portal_rotors[i].pr_name != NULL; i++) {
|
for (i = 0; portal_rotors[i].pr_name != NULL; i++) {
|
||||||
if (cfs_strncasecmp(portal_rotors[i].pr_name, tmp,
|
if (strncasecmp(portal_rotors[i].pr_name, tmp,
|
||||||
strlen(portal_rotors[i].pr_name)) == 0) {
|
strlen(portal_rotors[i].pr_name)) == 0) {
|
||||||
portal_rotor = portal_rotors[i].pr_value;
|
portal_rotor = portal_rotors[i].pr_value;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -42,26 +42,6 @@
|
||||||
|
|
||||||
#include <linux/libcfs/libcfs.h>
|
#include <linux/libcfs/libcfs.h>
|
||||||
|
|
||||||
/* non-0 = don't match */
|
|
||||||
int cfs_strncasecmp(const char *s1, const char *s2, size_t n)
|
|
||||||
{
|
|
||||||
if (s1 == NULL || s2 == NULL)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (n == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
while (n-- != 0 && tolower(*s1) == tolower(*s2)) {
|
|
||||||
if (n == 0 || *s1 == '\0' || *s2 == '\0')
|
|
||||||
break;
|
|
||||||
s1++;
|
|
||||||
s2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tolower(*(unsigned char *)s1) - tolower(*(unsigned char *)s2);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(cfs_strncasecmp);
|
|
||||||
|
|
||||||
/* Convert a text string to a bitmask */
|
/* Convert a text string to a bitmask */
|
||||||
int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
|
int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
|
||||||
int *oldmask, int minmask, int allmask)
|
int *oldmask, int minmask, int allmask)
|
||||||
|
@ -101,7 +81,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
|
||||||
debugstr = bit2str(i);
|
debugstr = bit2str(i);
|
||||||
if (debugstr != NULL &&
|
if (debugstr != NULL &&
|
||||||
strlen(debugstr) == len &&
|
strlen(debugstr) == len &&
|
||||||
cfs_strncasecmp(str, debugstr, len) == 0) {
|
strncasecmp(str, debugstr, len) == 0) {
|
||||||
if (op == '-')
|
if (op == '-')
|
||||||
newmask &= ~(1 << i);
|
newmask &= ~(1 << i);
|
||||||
else
|
else
|
||||||
|
@ -111,7 +91,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found && len == 3 &&
|
if (!found && len == 3 &&
|
||||||
(cfs_strncasecmp(str, "ALL", len) == 0)) {
|
(strncasecmp(str, "ALL", len) == 0)) {
|
||||||
if (op == '-')
|
if (op == '-')
|
||||||
newmask = minmask;
|
newmask = minmask;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue