]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - fs/seq_file.c
Merge tag 'xtensa-20190917' of git://github.com/jcmvbkbc/linux-xtensa
[linux.git] / fs / seq_file.c
index abe27ec431766f9ae05cd0b87c6acf3f680f2981..1600034a929bb1c89df6ce7134ecaad994bd1491 100644 (file)
@@ -119,6 +119,7 @@ static int traverse(struct seq_file *m, loff_t offset)
                }
                if (seq_has_overflowed(m))
                        goto Eoverflow;
+               p = m->op->next(m, p, &m->index);
                if (pos + m->count > offset) {
                        m->from = offset - pos;
                        m->count -= m->from;
@@ -126,7 +127,6 @@ static int traverse(struct seq_file *m, loff_t offset)
                }
                pos += m->count;
                m->count = 0;
-               p = m->op->next(m, p, &m->index);
                if (pos == offset)
                        break;
        }
@@ -384,6 +384,17 @@ void seq_escape(struct seq_file *m, const char *s, const char *esc)
 }
 EXPORT_SYMBOL(seq_escape);
 
+void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz)
+{
+       char *buf;
+       size_t size = seq_get_buf(m, &buf);
+       int ret;
+
+       ret = string_escape_mem_ascii(src, isz, buf, size);
+       seq_commit(m, ret < size ? ret : -1);
+}
+EXPORT_SYMBOL(seq_escape_mem_ascii);
+
 void seq_vprintf(struct seq_file *m, const char *f, va_list args)
 {
        int len;