From patchwork Tue Nov 18 09:17:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 124605 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1935C385782C for ; Tue, 18 Nov 2025 09:20:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1935C385782C Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HOmQ/zlo X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 088293857709 for ; Tue, 18 Nov 2025 09:17:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 088293857709 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 088293857709 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763457439; cv=none; b=je3T7hR4/jMV3zw4z2HXU3iTDQDbOEW5c4ZGatSqPjslNUOmACgQpLLmWM+IUpsVrHe49/QE/+onrXHOIv6Qv4STbyBH9+5Jf6dkOXYCYM28wnC+5fItFpjg/Q+ffJpPbha1GoLKQNqEXjo/jROxUeCegdgZhyBIJHTryxbzttY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1763457439; c=relaxed/simple; bh=T6R9qrECnT/L9602VBUvmW3ASu9mX7+MsRRMvOizfo0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TBPiXYrR2grxK9BhRqUK4FgFbOqThUDbcMSJ4gAayRmXWmUMbH3YDB8mWl3MPDRSz3iNsnyHaQd/uWbOu5PhlqKMZFtYdb2X0toEKX9fPs1KXkw6MW7d76qfUsbRwW577CovNBaC2SS0oxOgHIDve2UdicIxXM7L7kl1bk2ZxcM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 088293857709 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763457438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=fAcF6pV6P36CzbZ77bwK5o5EQYqDP54/R17deUr9/Sw=; b=HOmQ/zlokU9UUHFx46sPMuROIAqI+yapU1EBUJ7esWQT9zxGHWboE+n/MfXsY23WXxSyP3 il8QuWaUYGRpvYWa5sAtgca9mE7nEF6/e6PUeHQxpRFXniqSdYqJU+bcKo9vYk7ZSgIxiH mwgNr7x6AS2Kz543RIDR3lBB8euLu8g= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-171-hzNeOZudO0iuVQjIYM6CBA-1; Tue, 18 Nov 2025 04:17:17 -0500 X-MC-Unique: hzNeOZudO0iuVQjIYM6CBA-1 X-Mimecast-MFC-AGG-ID: hzNeOZudO0iuVQjIYM6CBA_1763457436 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6FD031800359; Tue, 18 Nov 2025 09:17:16 +0000 (UTC) Received: from fweimer-oldenburg.csb.redhat.com (unknown [10.45.224.47]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6484F180049F; Tue, 18 Nov 2025 09:17:15 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Cc: Collin Funk Subject: [PATCH v2] nss: Remove effectively unused __nss_*_database variables Date: Tue, 18 Nov 2025 10:17:12 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: mhNfU0Hr1NEZYNbmUMxxyXKpWWdBxAMTWHUfQlZSO4A_1763457436 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Use of this cache was removed in commit f8847d83e17774ed5e9c0f75ef693 ("nsswitch: use new internal API (core)"). Reviewed-by: Collin Funk --- nss/XXX-lookup.c | 10 +++------- nss/nsswitch.c | 8 -------- nss/nsswitch.h | 7 +++---- nss/tst-rfc3484-2.c | 2 -- nss/tst-rfc3484-3.c | 2 -- nss/tst-rfc3484.c | 2 -- 6 files changed, 6 insertions(+), 25 deletions(-) base-commit: a025a9deef8ad0034e88785a6999014fa2808e12 diff --git a/nss/XXX-lookup.c b/nss/XXX-lookup.c index 525b4d6304..6f5ea35d29 100644 --- a/nss/XXX-lookup.c +++ b/nss/XXX-lookup.c @@ -41,19 +41,15 @@ #define CONCAT2_1(Pre, Name) CONCAT2_2 (Pre, Name) #define CONCAT2_2(Pre, Name) Pre##Name -#define DATABASE_NAME_SYMBOL CONCAT3_1 (__nss_, DATABASE_NAME, _database) -#define DATABASE_NAME_STRING STRINGIFY1 (DATABASE_NAME) -#define STRINGIFY1(Name) STRINGIFY2 (Name) -#define STRINGIFY2(Name) #Name - int DB_LOOKUP_FCT (nss_action_list *ni, const char *fct_name, const char *fct2_name, void **fctp) { - if (! __nss_database_get (DATABASE_NAME_ID, &DATABASE_NAME_SYMBOL)) + nss_action_list actions; + if (! __nss_database_get (DATABASE_NAME_ID, &actions)) return -1; - *ni = DATABASE_NAME_SYMBOL; + *ni = actions; /* We want to know about it if we've somehow got a NULL action list; in the past, we had bad state if seccomp interfered with setup. */ diff --git a/nss/nsswitch.c b/nss/nsswitch.c index d1bff6721d..b23bb4c2c1 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -42,14 +42,6 @@ #include #include -/* Declare external database variables. */ -#define DEFINE_DATABASE(name) \ - nss_action_list __nss_##name##_database attribute_hidden; \ - weak_extern (__nss_##name##_database) -#include "databases.def" -#undef DEFINE_DATABASE - - #ifdef USE_NSCD /* Flags whether custom rules for database is set. */ bool __nss_database_custom[NSS_DBSIDX_max]; diff --git a/nss/nsswitch.h b/nss/nsswitch.h index fd37379377..9799627aa2 100644 --- a/nss/nsswitch.h +++ b/nss/nsswitch.h @@ -184,10 +184,9 @@ libc_hidden_proto (__nss_hostname_digits_dots) #define MAX_NR_ADDRS 48 /* Prototypes for __nss_*_lookup2 functions. */ -#define DEFINE_DATABASE(arg) \ - extern struct nss_action *__nss_##arg##_database attribute_hidden; \ - int __nss_##arg##_lookup2 (struct nss_action **, const char *, \ - const char *, void **); \ +#define DEFINE_DATABASE(arg) \ + int __nss_##arg##_lookup2 (struct nss_action **, const char *, \ + const char *, void **); \ libc_hidden_proto (__nss_##arg##_lookup2) #include "databases.def" #undef DEFINE_DATABASE diff --git a/nss/tst-rfc3484-2.c b/nss/tst-rfc3484-2.c index a5f8f82c04..7f89e1527c 100644 --- a/nss/tst-rfc3484-2.c +++ b/nss/tst-rfc3484-2.c @@ -59,8 +59,6 @@ _res_hconf_init (void) #undef USE_NSCD #include "getaddrinfo.c" -nss_action_list __nss_hosts_database attribute_hidden; - /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */ diff --git a/nss/tst-rfc3484-3.c b/nss/tst-rfc3484-3.c index edf0b7db2e..23aebfd54a 100644 --- a/nss/tst-rfc3484-3.c +++ b/nss/tst-rfc3484-3.c @@ -59,8 +59,6 @@ _res_hconf_init (void) #undef USE_NSCD #include "getaddrinfo.c" -nss_action_list __nss_hosts_database attribute_hidden; - /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */ diff --git a/nss/tst-rfc3484.c b/nss/tst-rfc3484.c index 5b4a0c5b82..f882f95f84 100644 --- a/nss/tst-rfc3484.c +++ b/nss/tst-rfc3484.c @@ -59,8 +59,6 @@ _res_hconf_init (void) #undef USE_NSCD #include "getaddrinfo.c" -nss_action_list __nss_hosts_database attribute_hidden; - /* This is the beginning of the real test code. The above defines (among other things) the function rfc3484_sort. */