From patchwork Tue Oct 3 13:01:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 147864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2066250vqb; Tue, 3 Oct 2023 06:02:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEq5YbkOe9DgCVZQSTfae8UjlXzeoz9oHYHau0eKtpsoCxaKgLYzzForr3YFY/fjnQTbf3D X-Received: by 2002:a05:6a20:7d85:b0:14c:a2e1:65ec with SMTP id v5-20020a056a207d8500b0014ca2e165ecmr19441711pzj.38.1696338132437; Tue, 03 Oct 2023 06:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696338132; cv=none; d=google.com; s=arc-20160816; b=aRyGze03RcKugXdmGtbAiQAziuv3hyRlYzx/j2mTHbTaCl/pzlYpKhpUAiiBLQIFiG Wt2r5tDeAFsOPBvXVZ1zcA9KS5dLNN01xcqPDGbyapSKP53kg5+AfdXK7H9fJaxbVYJx lZaOzWC/Y2q/zXyHk8+3IehvZbwFNm5/jfkALfPoh1edmU7H2fXooJGmyVj1EpiDwBbv YuGIRuf19WyDHntVRYoNqILTW6LbslMSrxV/6DrMMnDcqJOvZ7uW6YJRk3X+EkzSOamy y9EhlTBHPdTrQtEVzHt/wcY2hxDPi5XFtiu+ZgtqDJnT0SC4XQAK7k76IvqTuLPyl3Cw IoeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6vVk0usuBh+I65xNcsB2rYYymAPEDtXgxIQfZ2zT37c=; fh=+1ZS4OwaGS/9ekJCnV/+lEiyviHWOtg4+8wOxV0EA9E=; b=X/9bmWaj+FPtD1x+oFNTUHBoLrsHhT74U5Ox3knz/t33iG68d6P3b8UAbcLgjF7upJ KpHzCM8/KvSgqBvjDKLgw0kFwPWUoHP9nQrluFVDfKId4knPUhvsgiTqTVO4iGRA7f07 JzbaBxUTmdZL3vWReycQPdUoDAvXhtw/w39KEaKpDHF9t9mGDgwWpREfdIiLLNze3GYK X3gqOsoTGWdboB8BJpOSdBSkWXG7hCfuMG5UIrcGXYEUJePK/lE/NRyc3zVzA1Qf88b6 1Sm/OViSADIWa9PFscERsujP59BdkiPNuVyKeU4AUElpContt4K12eWXBpxibaeYCfeg ZVCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FqUn7Kpe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 38-20020a631066000000b0056f8fdb4430si1456337pgq.893.2023.10.03.06.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 06:02:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FqUn7Kpe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A6C6B80DFA42; Tue, 3 Oct 2023 06:02:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232475AbjJCNBw (ORCPT + 17 others); Tue, 3 Oct 2023 09:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230283AbjJCNBv (ORCPT ); Tue, 3 Oct 2023 09:01:51 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0756693; Tue, 3 Oct 2023 06:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696338109; x=1727874109; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=5BuiHCbUGxDTXwBye3t5k+Ijkv31TrOL/+KCudCyRS8=; b=FqUn7KpepFTyNqXzdElUcBDwZoLpH+mPPbz7O2O2c3Xs3AbrOtJXpUha 7cj9RRxKoC4PDlBHccCS+IQtA6bsHc8+L2HeW7F1fAyyFrXEHuOdv4Ygr PqnEOLDHiPP8a5BzZb3YLXQU1Jne5bYd6sij91YS9L2+0ebVJxiTqueR1 HQlg0VpR+keKEP+0WGETeWTqv205JNCaWMMg+2frIT+GopxjySzCFT8YC FOAMe62ZFIvA5ok97jLK27zWufP2akDY3/52trYKcIibhIm4bsJ7lDDo7 13yhlRzVgEGiHwEtqCm/hTNBXP4B19WR2KB4d3uVLCC+C81RhjaQbG27S w==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="381745967" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="381745967" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2023 06:01:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="786085405" X-IronPort-AV: E=Sophos;i="6.03,197,1694761200"; d="scan'208";a="786085405" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 03 Oct 2023 06:01:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9AEE118A0; Tue, 3 Oct 2023 16:01:45 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Cc: Kees Cook , Andy Shevchenko Subject: [PATCH v1 1/1] kernel.h: Move lib/cmdline.c prototypes to string.h Date: Tue, 3 Oct 2023 16:01:42 +0300 Message-Id: <20231003130142.2936503-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 03 Oct 2023 06:02:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778739453522145601 X-GMAIL-MSGID: 1778739453522145601 The lib/cmdline.c is basically a set of some small string parsers which are wide used in the kernel. Their prototypes belong to the string.h rather then kernel.h. Signed-off-by: Andy Shevchenko --- include/linux/kernel.h | 6 ------ include/linux/string.h | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index c07f9c779d45..3e6c5ac08f8b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -195,12 +195,6 @@ static inline void might_fault(void) { } void do_exit(long error_code) __noreturn; -extern int get_option(char **str, int *pint); -extern char *get_options(const char *str, int nints, int *ints); -extern unsigned long long memparse(const char *ptr, char **retptr); -extern bool parse_option_str(const char *str, const char *option); -extern char *next_arg(char *args, char **param, char **val); - extern int core_kernel_text(unsigned long addr); extern int __kernel_text_address(unsigned long addr); extern int kernel_text_address(unsigned long addr); diff --git a/include/linux/string.h b/include/linux/string.h index 3c920b6d609b..0995f2a737ef 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -181,9 +181,17 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); +/* lib/argv_split.c */ extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); +/* lib/cmdline.c */ +extern int get_option(char **str, int *pint); +extern char *get_options(const char *str, int nints, int *ints); +extern unsigned long long memparse(const char *ptr, char **retptr); +extern bool parse_option_str(const char *str, const char *option); +extern char *next_arg(char *args, char **param, char **val); + extern bool sysfs_streq(const char *s1, const char *s2); int match_string(const char * const *array, size_t n, const char *string); int __sysfs_match_string(const char * const *array, size_t n, const char *s);