Skip to contentSkip to conversation

fs/seq_file: use seq_* helpers in seq_hex_dump()

PATCH New Andy Shevchenko 1 participant 1 message Sep 18, 2015 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/seq_file: use seq_* helpers in seq_hex_dump()

This improves code readability.

---
 fs/seq_file.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
fs/seq_file.c +7 -8
index 6f0c3d7..ade4ea2 100644
@@ -752,6 +752,8 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
 {
 	const u8 *ptr = buf;
 	int i, linelen, remaining = len;
+	char *buffer;
+	size_t size;
 	int ret;
 
 	if (rowsize != 16 && rowsize != 32)
@@ -773,15 +775,12 @@ void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
 			break;
 		}
 
+		size = seq_get_buf(m, &buffer);
 		ret = hex_dump_to_buffer(ptr + i, linelen, rowsize, groupsize,
-					 m->buf + m->count, m->size - m->count,
-					 ascii);
-		if (ret >= m->size - m->count) {
-			seq_set_overflow(m);
-		} else {
-			m->count += ret;
-			seq_putc(m, '\n');
-		}
+					 buffer, size, ascii);
+		seq_commit(m, ret < size ? ret : -1);
+
+		seq_putc(m, '\n');
 	}
 }
 EXPORT_SYMBOL(seq_hex_dump);
Signature · 1 line
2.5.1