Skip to content

Commit

Permalink
seq_file: move seq_escape() to a header
Browse files Browse the repository at this point in the history
Move seq_escape() to the header as inliner, for a small kernel text size
reduction.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[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 9, 2021
1 parent f266636 commit 372904c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
16 changes: 0 additions & 16 deletions fs/seq_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,22 +383,6 @@ void seq_escape_mem(struct seq_file *m, const char *src, size_t len,
}
EXPORT_SYMBOL(seq_escape_mem);

/**
* seq_escape - print string into buffer, escaping some characters
* @m: target buffer
* @s: string
* @esc: set of characters that need escaping
*
* Puts string into buffer, replacing each occurrence of character from
* @esc with usual octal escape.
* Use seq_has_overflowed() to check for errors.
*/
void seq_escape(struct seq_file *m, const char *s, const char *esc)
{
seq_escape_str(m, s, ESCAPE_OCTAL, esc);
}
EXPORT_SYMBOL(seq_escape);

void seq_vprintf(struct seq_file *m, const char *f, va_list args)
{
int len;
Expand Down
17 changes: 16 additions & 1 deletion include/linux/seq_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <linux/types.h>
#include <linux/string.h>
#include <linux/string_helpers.h>
#include <linux/bug.h>
#include <linux/mutex.h>
#include <linux/cpumask.h>
Expand Down Expand Up @@ -135,7 +136,21 @@ static inline void seq_escape_str(struct seq_file *m, const char *src,
seq_escape_mem(m, src, strlen(src), flags, esc);
}

void seq_escape(struct seq_file *m, const char *s, const char *esc);
/**
* seq_escape - print string into buffer, escaping some characters
* @m: target buffer
* @s: NULL-terminated string
* @esc: set of characters that need escaping
*
* Puts string into buffer, replacing each occurrence of character from
* @esc with usual octal escape.
*
* Use seq_has_overflowed() to check for errors.
*/
static inline void seq_escape(struct seq_file *m, const char *s, const char *esc)
{
seq_escape_str(m, s, ESCAPE_OCTAL, esc);
}

void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,
int rowsize, int groupsize, const void *buf, size_t len,
Expand Down

0 comments on commit 372904c

Please sign in to comment.