All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] seq_file: Move seq_escape() to a header
@ 2021-10-01 12:29 Andy Shevchenko
  2021-10-01 23:39 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2021-10-01 12:29 UTC (permalink / raw)
  To: Andy Shevchenko, linux-fsdevel, linux-kernel
  Cc: Alexander Viro, Andrew Morton, jic23

Move seq_escape() to the header as inliner.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 fs/seq_file.c            | 16 ----------------
 include/linux/seq_file.h | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index 4a2cda04d3e2..f8e1f4ee87ff 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -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;
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index dd99569595fd..103776e18555 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -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,
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] seq_file: Move seq_escape() to a header
  2021-10-01 12:29 [PATCH v1 1/1] seq_file: Move seq_escape() to a header Andy Shevchenko
@ 2021-10-01 23:39 ` Andrew Morton
  2021-10-02  7:57   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2021-10-01 23:39 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-fsdevel, linux-kernel, Alexander Viro, jic23

On Fri,  1 Oct 2021 15:29:17 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> 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?

> --- a/include/linux/seq_file.h
> +++ b/include/linux/seq_file.h
> @@ -4,6 +4,7 @@
>  
>  #include <linux/types.h>
>  #include <linux/string.h>
> +#include <linux/string_helpers.h>

Why was this added?

>  #include <linux/bug.h>
>  #include <linux/mutex.h>
>  #include <linux/cpumask.h>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1 1/1] seq_file: Move seq_escape() to a header
  2021-10-01 23:39 ` Andrew Morton
@ 2021-10-02  7:57   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-10-02  7:57 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andy Shevchenko, Linux FS Devel, Linux Kernel Mailing List,
	Alexander Viro, Jonathan Cameron

On Sat, Oct 2, 2021 at 2:41 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> On Fri,  1 Oct 2021 15:29:17 +0300 Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > 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.

...

> > +#include <linux/string_helpers.h>
>
> Why was this added?

The definition of ESCAPE_OCTAL is there.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-02  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 12:29 [PATCH v1 1/1] seq_file: Move seq_escape() to a header Andy Shevchenko
2021-10-01 23:39 ` Andrew Morton
2021-10-02  7:57   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.