seq_file: Move seq_escape() to a header
PATCH 1/1 seq_file: Move seq_escape() to a header
Move seq_escape() to the header as inliner.
Signed-off-by Andy Shevchenko <[email protected]>
--- fs/seq_file.c | 16 ---------------- include/linux/seq_file.h | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 17 deletions(-)
fs/seq_file.c +0 -16
@@ -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;
include/linux/seq_file.h +16 -1
@@ -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>
@@ -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,
Signature · 1 line
2.33.0
Quoted 1 line · On Fri, 1 Oct 2021 15:29:17 +0300 Andy Shevchenko…
Move
seq_escape()to the header as inliner.
Some reason for doing this would be nice. Does it make the kernel smaller? Is this performance-sensitive?
include/linux/seq_file.h line 7
Quoted 7 lines
include/linux/seq_file.h +1
-0@@ -4,6 +4,7 @@#include <linux/types.h> #include <linux/string.h> +#include <linux/string_helpers.h>
Why was this added?
Quoted 3 lines
include/linux/seq_file.h +0
-0#include <linux/bug.h> #include <linux/mutex.h> #include <linux/cpumask.h>
Quoted 6 lines · Andrew Morton
Quoted 1 line · On Fri, 1 Oct 2021 15:29:17 +0300 Andy Shevchenko…
Move
seq_escape()to the header as inliner.Some reason for doing this would be nice. Does it make the kernel smaller? Is this performance-sensitive?
It reduces exported namespace, hence makes it smaller, yes.
...
Quoted 3 lines
Quoted 1 line
+#include <
linux/string_helpers.h>Why was this added?
The definition of ESCAPE_OCTAL is there.
Signature · 2 lines
With Best Regards, Andy Shevchenko