seq_file: Simplify __seq_puts()

Change the implementation of the out-of-line __seq_puts() to simply be
a seq_write() call instead of duplicating the overflow/memcpy logic.

Suggested-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/7cebc1412d8d1338a7e52cc9291d00f5368c14e4.1713781332.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christophe JAILLET 2024-04-22 12:24:07 +02:00 committed by Christian Brauner
parent 45751097ae
commit e035af9f6e
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -671,14 +671,7 @@ EXPORT_SYMBOL(seq_putc);
void __seq_puts(struct seq_file *m, const char *s) void __seq_puts(struct seq_file *m, const char *s)
{ {
int len = strlen(s); seq_write(m, s, strlen(s));
if (m->count + len >= m->size) {
seq_set_overflow(m);
return;
}
memcpy(m->buf + m->count, s, len);
m->count += len;
} }
EXPORT_SYMBOL(__seq_puts); EXPORT_SYMBOL(__seq_puts);