diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/libcfs/libcfs_string.c')
-rw-r--r-- | drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 54 |
1 files changed, 8 insertions, 46 deletions
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index 922debd0a412..ed0a6b531058 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -42,26 +42,6 @@ #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 */ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), int *oldmask, int minmask, int allmask) @@ -101,7 +81,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), debugstr = bit2str(i); if (debugstr != NULL && strlen(debugstr) == len && - cfs_strncasecmp(str, debugstr, len) == 0) { + strncasecmp(str, debugstr, len) == 0) { if (op == '-') newmask &= ~(1 << i); else @@ -111,7 +91,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), } } if (!found && len == 3 && - (cfs_strncasecmp(str, "ALL", len) == 0)) { + (strncasecmp(str, "ALL", len) == 0)) { if (op == '-') newmask = minmask; else @@ -129,7 +109,6 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), *oldmask = newmask; return 0; } -EXPORT_SYMBOL(cfs_str2mask); /* get the first string out of @str */ char *cfs_firststr(char *str, size_t size) @@ -164,12 +143,12 @@ cfs_trimwhite(char *str) { char *end; - while (cfs_iswhite(*str)) + while (isspace(*str)) str++; end = str + strlen(str); while (end > str) { - if (!cfs_iswhite(end[-1])) + if (!isspace(end[-1])) break; end--; } @@ -199,7 +178,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) /* skip leading white spaces */ while (next->ls_len) { - if (!cfs_iswhite(*next->ls_str)) + if (!isspace(*next->ls_str)) break; next->ls_str++; next->ls_len--; @@ -226,14 +205,13 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) /* skip ending whitespaces */ while (--end != res->ls_str) { - if (!cfs_iswhite(*end)) + if (!isspace(*end)) break; } res->ls_len = end - res->ls_str + 1; return 1; } -EXPORT_SYMBOL(cfs_gettok); /** * Converts string to integer. @@ -256,13 +234,12 @@ cfs_str2num_check(char *str, int nob, unsigned *num, return 0; for (; endp < str + nob; endp++) { - if (!cfs_iswhite(*endp)) + if (!isspace(*endp)) return 0; } return (*num >= min && *num <= max); } -EXPORT_SYMBOL(cfs_str2num_check); /** * Parses \<range_expr\> token of the syntax. If \a bracketed is false, @@ -277,7 +254,7 @@ EXPORT_SYMBOL(cfs_str2num_check); * \retval 0 will be returned if it can be parsed, otherwise -EINVAL or * -ENOMEM will be returned. */ -int +static int cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, unsigned max, int bracketed, struct cfs_range_expr **expr) { @@ -340,7 +317,6 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, unsigned max, LIBCFS_FREE(re, sizeof(*re)); return -EINVAL; } -EXPORT_SYMBOL(cfs_range_expr_parse); /** * Matches value (\a value) against ranges expression list \a expr_list. @@ -361,7 +337,6 @@ cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list) return 0; } -EXPORT_SYMBOL(cfs_expr_list_match); /** * Convert express list (\a expr_list) to an array of all matched values @@ -432,18 +407,6 @@ cfs_expr_list_free(struct cfs_expr_list *expr_list) } EXPORT_SYMBOL(cfs_expr_list_free); -void -cfs_expr_list_print(struct cfs_expr_list *expr_list) -{ - struct cfs_range_expr *expr; - - list_for_each_entry(expr, &expr_list->el_exprs, re_link) { - CDEBUG(D_WARNING, "%d-%d/%d\n", - expr->re_lo, expr->re_hi, expr->re_stride); - } -} -EXPORT_SYMBOL(cfs_expr_list_print); - /** * Parses \<cfs_expr_list\> token of the syntax. * @@ -526,7 +489,6 @@ cfs_expr_list_free_list(struct list_head *list) cfs_expr_list_free(el); } } -EXPORT_SYMBOL(cfs_expr_list_free_list); int cfs_ip_addr_parse(char *str, int len, struct list_head *list) |