From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6F0830677D for ; Sun, 5 Jul 2026 18:00:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783274407; cv=none; b=Tn7+vwOIFCO9XSp73d07JVjkX16eF6+eIjiKGcINhYCWxjIDtREeR+hTv/Bcfnch1w1jdNFGqN+HWvu+I40rS7ENTrEYI7OWnzqj33UbrG7Ebc0QuZO0AYQujZmqqnlrPU/4Wvj9EZqZUxb8CC5kAPVrWM6ACssBfmJIkOR47u4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783274407; c=relaxed/simple; bh=pcUt4ECBHp8fwLieJAcIrWj20xaV1v0BfHd+NcNrWjI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QmS2aF59FnRLXndTudbxNfVBbuCcBSzXu6J3trE9o80ZlvBGbSdOj3WjPIe+dOs3RZJI3b28sVCC3Ikny4xx5iMcP4sALXIULOSMNSRBOHjkdToDvfhUFW1GbAD9E/vRHKp5aUHISnLoNLZfhcvVO+JSQzEf+yugH6fNrZqMYUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=psAaykJR; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="psAaykJR" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-493c19bad03so19837445e9.2 for ; Sun, 05 Jul 2026 11:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783274401; x=1783879201; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ejKKZA+gzkTcRsPeUIx3jem6/jVbmODgcUaRcC0r+t8=; b=psAaykJRcXCQ9sSZbFL7GZiQuk4uW5zOK96wRH4ZnKimyJXT/ptXCJ2QLhYzoEpsx9 Ih2caGJrHIZrz2vgcwbbZwJMEpS8qa0wJ5gRwfrcmbjJn9jgZZ8AF/uLjHSeeU1foxlZ TxCNTP8AHO83dmxGrJvgNShz1G/UClNvgbjvuL6FCti4SWKnrE5oJjytROPMFfB22lh0 wP5CoTBUNXn+yeCD3IKTsDXG6pfOVmwVvDV0etjMqJwxln7AreYz64QWP7SCoGa6f14a xq7+HxYT6whcDVn6crxYUQmMXwlHGPuvDMdqfSfq5z4zpsrYskKGSjs7dU+B/k+Q+0n4 hbDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783274401; x=1783879201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ejKKZA+gzkTcRsPeUIx3jem6/jVbmODgcUaRcC0r+t8=; b=kMkDD3tWpqGWXI/0xyTwy3QtGOF0oRtJLrcaBoVBtr5gJLau6Wza6GAvWuHBemKP+e 33ZTNyyGwT9tT3bg8yxgbHj2shUIaTo1R4+KQySqji8SBgXdLWypLGV8jcag8HsapX0e H/x44MNo8d9CT2I8efBS9dIvzJDQ7hcWAiBLYH7Z4eF2zkBir9Y9mul80KaFeYcsFnSr 4r9cYP7xMrdgxOgsw4Fm4CpuritxXj9EC0vOYdG+Mu5wihxfFtsDOd9BYgZHKwC23Ebt kLPYel9MZ2aCr3zy75BQUmubK5dRbe22umbPBStBAN6QjhWjdCVQqjSfGb7kYoN52+tq QEfQ== X-Forwarded-Encrypted: i=1; AHgh+Rrfkhgz+Urlw0XLtC4XQPIk9gSlEr8dYb5u1eFVCbmYswPEntOGa1a75CU22YvbWR6jQyia/dSMK0T2CX8=@vger.kernel.org X-Gm-Message-State: AOJu0YzykFRqJn/RuTKQ5v6NZzsBMlHZFRIk2QjXwXMZP+aLe33+vMcX 31lBRs7Cy1NT27I6gPXa6kEcTy/zsg/yU3So/zVK5vZNyhVD44xfoduL X-Gm-Gg: AfdE7cmR8LSjRcQaeeWRt0BXCE6H4J6Ajoxjv1eKybuDe3mQVWjKBViEnj0qYQGFXyP 0SRKeRDCTNDg/+Eqc/NTSRnX5JuIBBjChTBdeiSsh//4WnzFo68Jmr6tM0Lbt2ITZ1sirqFKu/O V3aNyMXfLoKyE+YRbTolWQ0AOng2NgsHCpdhUtrYchSxdP7npITUyc65taQ22LYrELg9oAIOf+4 wJ7nq2Npe1kpJvvLRcqtQsKxI3p1s7OnzC6SoY5w/v+CuwykrIjG6MF/r3OfrR/qVofdnntpZ3w iUockveCNmP05JI29UO9HFv3/oJogSNqehUBqOOcIsoHHpWmlJr98Dkifqz3QAzhpo2Ph5vgwiY 9/MpUV1HJu85HpspRUuNFHqUibDQKvmpkQXRsNmYMCL4wryMkGYJ6ldHqrGBWsjpktfeCe79bAq u7zwPNHOGyGDdgQbiiIM59EMBh1NgvAtOx0A== X-Received: by 2002:a05:600c:358b:b0:492:3da4:81ef with SMTP id 5b1f17b1804b1-493d11f13d7mr99093575e9.18.1783274400696; Sun, 05 Jul 2026 11:00:00 -0700 (PDT) Received: from localhost (a89-182-201-232.net-htp.de. [89.182.201.232]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-47ad69519c2sm17994734f8f.37.2026.07.05.10.59.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Jul 2026 11:00:00 -0700 (PDT) From: Sergei Litvin To: nsc@kernel.org Cc: miguel.ojeda.sandonis@gmail.com, nathan@kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, ojeda@kernel.org, Sergei Litvin Subject: [PATCH] scripts/tags.sh: Add support for rust source files Date: Sun, 5 Jul 2026 19:59:57 +0200 Message-ID: <20260705175957.4672-1-litvindev@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit PROBLEM When executing the command `make cscope`, the `cscope.files` file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions. SOLUTION Modify the functions `find_arch_sources()`, `find_arch_include_sources()`, `find_include_sources()`, and `find_other_sources()` so that they can accept an unlimited number of filename patterns as parameters for the search. Add the `setup_name_pattern()` function to convert these filename pattern parameters into a list of parameters that can be passed to the `find` utility via the new `pattern` variable. This causes `make cscope` command to generate a `cscope.files` file that contains *.rs files along with *.h, *.c, *.S --- This is the second part of this patch: https://lore.kernel.org/lkml/20260602121521.11650-1-litvindev@gmail.com/ which I have split into two parts, as suggested by Nicolas Schier here: https://lore.kernel.org/lkml/akVkIrcpNxZrrfii@levanger/ Signed-off-by: Sergei Litvin --- scripts/tags.sh | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/scripts/tags.sh b/scripts/tags.sh index c9dc2763a505..41e38df96984 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -46,13 +46,31 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ') fi +setup_name_pattern() +{ + pattern=() + for ext; do + if [ ${#pattern[@]} -gt 0 ]; then + pattern+=("-o" "-name" "$ext") + else + pattern+=("(" "-name" "$ext") + fi + done + if [ ${#pattern[@]} -gt 0 ]; then + pattern+=(")") + fi +} + # find sources in arch/$1 find_arch_sources() { for i in $archincludedir; do local prune="$prune ( -path $i ) -prune -o" done - find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print; + local src=${tree}arch/$1 + shift + setup_name_pattern "$@" + find $src $ignore $prune "${pattern[@]}" -not -type l -print; } # find sources in arch/$1/include @@ -61,14 +79,17 @@ find_arch_include_sources() local include=$(find ${tree}arch/$1/ -name include -type d -print); if [ -n "$include" ]; then archincludedir="$archincludedir $include" - find $include $ignore -name "$2" -not -type l -print; + shift + setup_name_pattern "$@" + find $include $ignore "${pattern[@]}" -not -type l -print; fi } # find sources in include/ find_include_sources() { - find ${tree}include $ignore -name config -prune -o -name "$1" \ + setup_name_pattern "$@" + find ${tree}include $ignore -name config -prune -o "${pattern[@]}" \ -not -type l -print; } @@ -76,23 +97,24 @@ find_include_sources() # we could benefit from a list of dirs to search in here find_other_sources() { + setup_name_pattern "$@" find ${tree}* $ignore \ \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \ - -name "$1" -not -type l -print; + "${pattern[@]}" -not -type l -print; } all_sources() { - find_arch_include_sources ${SRCARCH} '*.[chS]' + find_arch_include_sources ${SRCARCH} '*.[chS]' '*.rs' if [ -n "$archinclude" ]; then - find_arch_include_sources $archinclude '*.[chS]' + find_arch_include_sources $archinclude '*.[chS]' '*.rs' fi - find_include_sources '*.[chS]' + find_include_sources '*.[chS]' '*.rs' for arch in $ALLSOURCE_ARCHS do - find_arch_sources $arch '*.[chS]' + find_arch_sources $arch '*.[chS]' '*.rs' done - find_other_sources '*.[chS]' + find_other_sources '*.[chS]' '*.rs' } all_compiled_sources() -- 2.54.0