summaryrefslogtreecommitdiff
path: root/fs/seq_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r--fs/seq_file.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 7d19816c4cc9..55c293f7024d 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -659,7 +659,8 @@ int seq_put_decimal_ull(struct seq_file *m, char delimiter,
if (m->count + 2 >= m->size) /* we'll write 2 bytes at least */
goto overflow;
- m->buf[m->count++] = delimiter;
+ if (delimiter)
+ m->buf[m->count++] = delimiter;
if (num < 10) {
m->buf[m->count++] = num + '0';
@@ -677,6 +678,24 @@ overflow:
}
EXPORT_SYMBOL(seq_put_decimal_ull);
+int seq_put_decimal_ll(struct seq_file *m, char delimiter,
+ long long num)
+{
+ if (num < 0) {
+ if (m->count + 3 >= m->size) {
+ m->count = m->size;
+ return -1;
+ }
+ if (delimiter)
+ m->buf[m->count++] = delimiter;
+ num = -num;
+ delimiter = '-';
+ }
+ return seq_put_decimal_ull(m, delimiter, num);
+
+}
+EXPORT_SYMBOL(seq_put_decimal_ll);
+
/**
* seq_write - write arbitrary data to buffer
* @seq: seq_file identifying the buffer to which data should be written