/* Convert a text string to a bitmask */
int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
int *oldmask, int minmask, int allmask);
-/* trim leading and trailing space characters */
-char *cfs_firststr(char *str, size_t size);
/**
* Structure to represent NULL-less strings.
}
EXPORT_SYMBOL(cfs_str2mask);
-/* get the first string out of @str */
-char *cfs_firststr(char *str, size_t size)
-{
- size_t i = 0;
- char *end;
-
- /* trim leading spaces */
- while (i < size && *str && isspace(*str)) {
- ++i;
- ++str;
- }
-
- /* string with all spaces */
- if (*str == '\0')
- goto out;
-
- end = str;
- while (i < size && *end != '\0' && !isspace(*end)) {
- ++i;
- ++end;
- }
-
- *end = '\0';
-out:
- return str;
-}
-EXPORT_SYMBOL(cfs_firststr);
-
/**
* Extracts tokens from strings.
*
*/
if (copy_from_user(kbuf, buf, min_t(unsigned long, BUFLEN - 1, count)))
GOTO(out, rc = -EFAULT);
- tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
+ tmpbuf = skip_spaces(kbuf);
+ tmpbuf = strsep(&tmpbuf, " \t\n\f\v\r");
if (strncmp(tmpbuf, "nid:", 4) != 0) {
count = lprocfs_evict_client_seq_write(file, buf, count, off);
count = -EFAULT;
goto out;
}
- tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
+ tmpbuf = skip_spaces(kbuf);
+ tmpbuf = strsep(&tmpbuf, " \t\n\f\v\r");
class_incref(obd, __func__, current);
if (strncmp(tmpbuf, "nid:", 4) == 0)