Merge remote-tracking branch 'spi/fix/core' into spi-linus
[cascardo/linux.git] / include / linux / seq_file.h
index 4e32edc..52e0097 100644 (file)
@@ -20,6 +20,7 @@ struct seq_file {
        size_t size;
        size_t from;
        size_t count;
+       size_t pad_until;
        loff_t index;
        loff_t read_pos;
        u64 version;
@@ -79,6 +80,20 @@ static inline void seq_commit(struct seq_file *m, int num)
        }
 }
 
+/**
+ * seq_setwidth - set padding width
+ * @m: the seq_file handle
+ * @size: the max number of bytes to pad.
+ *
+ * Call seq_setwidth() for setting max width, then call seq_printf() etc. and
+ * finally call seq_pad() to pad the remaining bytes.
+ */
+static inline void seq_setwidth(struct seq_file *m, size_t size)
+{
+       m->pad_until = m->count + size;
+}
+void seq_pad(struct seq_file *m, char c);
+
 char *mangle_path(char *s, const char *p, const char *esc);
 int seq_open(struct file *, const struct seq_operations *);
 ssize_t seq_read(struct file *, char __user *, size_t, loff_t *);