Skip to content

Commit

Permalink
fs/seq_file: use seq_* helpers in seq_hex_dump()
Browse files Browse the repository at this point in the history
This improves code readability.

Signed-off-by: Andy Shevchenko <[email protected]>
Cc: Alexander Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
andy-shev authored and torvalds committed Nov 7, 2015
1 parent d61ba58 commit 8b91a31
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions fs/seq_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,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)
Expand All @@ -794,15 +796,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);
Expand Down

0 comments on commit 8b91a31

Please sign in to comment.