From patchwork Mon May 3 20:48:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12236969 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=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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 78BB1C433B4 for ; Mon, 3 May 2021 20:49:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CCCD611EE for ; Mon, 3 May 2021 20:49:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbhECUtv (ORCPT ); Mon, 3 May 2021 16:49:51 -0400 Received: from mga03.intel.com ([134.134.136.65]:53596 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229576AbhECUtt (ORCPT ); Mon, 3 May 2021 16:49:49 -0400 IronPort-SDR: YcVajbMePFOVsBM3LbJOX44iaEGchYCjcD+gu3pI3krHu5RCYxHG9/EfmbicnA38fnjoj5xYmz VE/tUU36AJSg== X-IronPort-AV: E=McAfee;i="6200,9189,9973"; a="197888950" X-IronPort-AV: E=Sophos;i="5.82,271,1613462400"; d="scan'208";a="197888950" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2021 13:48:54 -0700 IronPort-SDR: tnjWwfmLZU67Se0Tsk1xCFkgIUHlD9fFCrc1V2r3gWWcsYz/AFZwcSuyTvXVq7fg62CpkRNpjA I7xb/lFDL9FA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,271,1613462400"; d="scan'208";a="388536668" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 03 May 2021 13:48:51 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1295AD9; Mon, 3 May 2021 23:49:10 +0300 (EEST) From: Andy Shevchenko To: "J. Bruce Fields" , Kefeng Wang , 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 v1 00/12] lib/string_helpers: get rid of ugly *_escape_mem_ascii() API Date: Mon, 3 May 2021 23:48:55 +0300 Message-Id: <20210503204907.34013-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Get rid of ugly *_escape_mem_ascii() API since it's not flexible and has the only single user. Provide better approach based on usage of the string_escape_mem() with appropriate flags. Test cases has been expanded accordingly to cover new functionality. Andy Shevchenko (12): lib/string_helpers: Switch to use BIT() macro lib/string_helpers: Move ESCAPE_NP check inside 'else' branch in a loop lib/string_helpers: Introduce ESCAPE_NA for escaping non-ASCII lib/string_helpers: Introduce ESCAPE_NAP to escape non-ASCII and non-printable lib/string_helpers: Drop indentation level in string_escape_mem() lib/string_helpers: Allow to append additional characters to be escaped lib/test-string_helpers: Print flags in hexadecimal format lib/test-string_helpers: Get rid of trailing comma in terminators lib/test-string_helpers: Add test cases for new features nfsd: Avoid non-flexible API in seq_quote_mem() lib/string_helpers: Drop unused *_escape_mem_ascii() MAINTAINERS: Add myself as designated reviewer for generic string library MAINTAINERS | 8 ++ fs/nfsd/nfs4state.c | 8 +- fs/seq_file.c | 11 --- include/linux/seq_file.h | 1 - include/linux/string_helpers.h | 31 ++++--- lib/string_helpers.c | 102 ++++++++++++--------- lib/test-string_helpers.c | 157 +++++++++++++++++++++++++++++---- 7 files changed, 235 insertions(+), 83 deletions(-)