From patchwork Tue May 4 10:26:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12237899 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1F78C43600 for ; Tue, 4 May 2021 10:27:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9946C611AB for ; Tue, 4 May 2021 10:27:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbhEDK2H (ORCPT ); Tue, 4 May 2021 06:28:07 -0400 Received: from mga18.intel.com ([134.134.136.126]:14053 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230410AbhEDK17 (ORCPT ); Tue, 4 May 2021 06:27:59 -0400 IronPort-SDR: gGjV75/uYplp6PFQl7YWh6Q51VZPouPlKza0smrOucavtt4EoBoLoE0uv0x5P3QBdtMjuwezVT k6sknERUwjlw== X-IronPort-AV: E=McAfee;i="6200,9189,9973"; a="185417082" X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="185417082" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2021 03:27:03 -0700 IronPort-SDR: eXcqOwNNpn1fI7Y0s4Mi/uGEa85XGjkziJb+faAlqt0Dfo+pxkHEDZ96fExfkAS/H5I2HvDLUw 1iFTMuqRSlLA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,272,1613462400"; d="scan'208";a="618429779" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 04 May 2021 03:27:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DF9E5AFA; Tue, 4 May 2021 13:27:17 +0300 (EEST) From: Andy Shevchenko To: "J. Bruce Fields" , Andy Shevchenko , linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: "J. Bruce Fields" , Chuck Lever , Alexander Viro , Andy Shevchenko , Andrew Morton Subject: [PATCH v2 12/14] seq_file: Replace seq_escape() with inliner Date: Tue, 4 May 2021 13:26:46 +0300 Message-Id: <20210504102648.88057-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210504102648.88057-1-andriy.shevchenko@linux.intel.com> References: <20210504102648.88057-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Convert seq_escape() to use seq_escape_mem() rather than using a separate symbol. At the same time move it to header as inliner. Signed-off-by: Andy Shevchenko Reported-by: kernel test robot Reported-by: kernel test robot Reported-by: kernel test robot --- fs/seq_file.c | 21 --------------------- include/linux/seq_file.h | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/fs/seq_file.c b/fs/seq_file.c index 532cac2eae0f..d78801403a2f 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -380,27 +380,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) -{ - char *buf; - size_t size = seq_get_buf(m, &buf); - int ret; - - ret = string_escape_str(s, buf, size, ESCAPE_OCTAL, esc); - seq_commit(m, ret < size ? ret : -1); -} -EXPORT_SYMBOL(seq_escape); - void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz) { char *buf; diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 6de442182784..0b3a6096bed3 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -128,7 +129,23 @@ void seq_put_hex_ll(struct seq_file *m, const char *delimiter, void seq_escape_mem(struct seq_file *m, const char *src, size_t len, unsigned int flags, const char *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_mem(m, s, strlen(s), ESCAPE_OCTAL, esc); +} + void seq_escape_mem_ascii(struct seq_file *m, const char *src, size_t isz); void seq_hex_dump(struct seq_file *m, const char *prefix_str, int prefix_type,