The patch titled Subject: seq_file: reuse string_escape_str() has been added to the -mm tree. Its filename is seq_file-re-use-string_escape_str.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/seq_file-re-use-string_escape_str.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/seq_file-re-use-string_escape_str.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Subject: seq_file: reuse string_escape_str() strint_escape_str() escapes input string by given criteria. In case of seq_escape() the criteria is to convert some characters to their octal representation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/seq_file.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff -puN fs/seq_file.c~seq_file-re-use-string_escape_str fs/seq_file.c --- a/fs/seq_file.c~seq_file-re-use-string_escape_str +++ a/fs/seq_file.c @@ -13,6 +13,7 @@ #include <linux/cred.h> #include <linux/mm.h> #include <linux/printk.h> +#include <linux/string_helpers.h> #include <asm/uaccess.h> #include <asm/page.h> @@ -377,26 +378,12 @@ EXPORT_SYMBOL(seq_release); */ void seq_escape(struct seq_file *m, const char *s, const char *esc) { - char *end = m->buf + m->size; - char *p; - char c; - - for (p = m->buf + m->count; (c = *s) != '\0' && p < end; s++) { - if (!strchr(esc, c)) { - *p++ = c; - continue; - } - if (p + 3 < end) { - *p++ = '\\'; - *p++ = '0' + ((c & 0300) >> 6); - *p++ = '0' + ((c & 070) >> 3); - *p++ = '0' + (c & 07); - continue; - } - seq_set_overflow(m); - return; - } - m->count = p - m->buf; + char *buf; + size_t size = seq_get_buf(m, &buf); + int ret; + + ret = string_escape_str(s, buf, size, ESCAPE_OCTAL, esc); + seq_commit(m, ret < size ? ret : -1); } EXPORT_SYMBOL(seq_escape); _ Patches currently in -mm which might be from andriy.shevchenko@xxxxxxxxxxxxxxx are fs-proc-arrayc-set-overflow-flag-in-case-of-error.patch seq_file-re-use-string_escape_str.patch fs-seq_file-use-seq_-helpers-in-seq_hex_dump.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html