From patchwork Wed Oct 11 08:59:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 824305 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-85629-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="gRRTfu3T"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yBnxK6Z4wz9sNr for ; Wed, 11 Oct 2017 20:00:05 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=EVCngUHVA2CqfANpaqbV2VqdjSQ5u 9nZvh6EgtYNOfUmF9c057ow+UlpKzckteoRY4/lWguoeA1ok5lhF3aphmYprJB0c rpyjILTTELUjscB+O35iCJFHDyNqDnC/84GcHiRdz5EGFg8ckc1kq6kDtJE6PI9M ZU68Elwg7LxvFE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=zgSoC2tpoEkXBE0p0XgWeof2L0I=; b=gRR Tfu3Ty1P+ImUVIGbU5lNQ5gXdLvi6UK5JpY4GTf7+ORaEYNapR9hFWKIKWiXZptw polfSZzOZwhG0NOSje6DznTR/RZ3Yvtpew7+mSIMJRGrqJHYlxH3fE3csHWPlWYB /lApiTTToKfPe8UyJ6iv3bfnGG40lMdKCc6Jiar8= Received: (qmail 14470 invoked by alias); 11 Oct 2017 08:59:54 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11167 invoked by uid 89); 11 Oct 2017 08:59:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=gai X-HELO: mx2.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] nscd: remove reference to libnsl X-Yow: DON'T go!! I'm not HOWARD COSELL!! I know POLISH JOKES... WAIT!! Don't go!! I AM Howard Cosell!... And I DON'T know Polish jokes!! Date: Wed, 11 Oct 2017 10:59:24 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 This removes the dependency on libnsl from nscd. It only used __nis_hash, build its own copy under the name __nscd_hash. * nis/Makefile (aux): Remove. * nscd/Makefile (aux): Add nscd_hash. (nscd-modules): Likewise. ($(objpfx)nscd): Don't depend on libnsl. * nscd/nscd_hash.c: New file. * nscd/nscd_hash.h: Likewise. * nscd/cache.c: Include "nscd_hash.h" instead of . (cache_search, cache_add): Use __nscd_hash instead of __nis_hash. * nscd/nscd_helper.c: Include and "nscd_hash.h" instead of . (__nscd_cache_search): Use __nscd_hash instead of __nis_hash. Reviewed-by: Carlos O'Donell --- nis/Makefile | 2 -- nscd/Makefile | 8 ++++---- nscd/cache.c | 6 +++--- nscd/nscd_hash.c | 19 +++++++++++++++++++ nscd/nscd_hash.h | 21 +++++++++++++++++++++ nscd/nscd_helper.c | 11 +++-------- 6 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 nscd/nscd_hash.c create mode 100644 nscd/nscd_hash.h diff --git a/nis/Makefile b/nis/Makefile index 023916f446..e602b09e37 100644 --- a/nis/Makefile +++ b/nis/Makefile @@ -22,8 +22,6 @@ subdir := nis include ../Makeconfig -aux := nis_hash - ifeq ($(build-obsolete-nsl),yes) headers := $(wildcard rpcsvc/*.[hx]) diff --git a/nscd/Makefile b/nscd/Makefile index 4126996887..095f3e53d4 100644 --- a/nscd/Makefile +++ b/nscd/Makefile @@ -25,7 +25,7 @@ include ../Makeconfig ifneq ($(use-nscd),no) routines := nscd_getpw_r nscd_getgr_r nscd_gethst_r nscd_getai \ nscd_initgroups nscd_getserv_r nscd_netgroup -aux := nscd_helper +aux := nscd_helper nscd_hash endif # To find xmalloc.c @@ -36,7 +36,7 @@ nscd-modules := nscd connections pwdcache getpwnam_r getpwuid_r grpcache \ getsrvbynm_r getsrvbypt_r servicescache \ dbg_log nscd_conf nscd_stat cache mem nscd_setup_thread \ xmalloc xstrdup aicache initgrcache gai res_hconf \ - netgroupcache + netgroupcache nscd_hash ifeq ($(build-nscd)$(have-thread-library),yesyes) @@ -97,7 +97,7 @@ include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left)) $(objpfx)nscd: $(nscd-modules:%=$(objpfx)%.o) ifeq ($(build-shared),yes) -$(objpfx)nscd: $(shared-thread-library) $(common-objpfx)nis/libnsl.so +$(objpfx)nscd: $(shared-thread-library) else -$(objpfx)nscd: $(static-thread-library) $(common-objpfx)nis/libnsl.a +$(objpfx)nscd: $(static-thread-library) endif diff --git a/nscd/cache.c b/nscd/cache.c index b9dbc7a0bd..4a17c3371b 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -33,6 +32,7 @@ #include "nscd.h" #include "dbg_log.h" +#include "nscd_hash.h" /* Wrapper functions with error checking for standard functions. */ @@ -74,7 +74,7 @@ struct datahead * cache_search (request_type type, const void *key, size_t len, struct database_dyn *table, uid_t owner) { - unsigned long int hash = __nis_hash (key, len) % table->head->module; + unsigned long int hash = __nscd_hash (key, len) % table->head->module; unsigned long int nsearched = 0; struct datahead *result = NULL; @@ -153,7 +153,7 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet, first ? _(" (first)") : ""); } - unsigned long int hash = __nis_hash (key, len) % table->head->module; + unsigned long int hash = __nscd_hash (key, len) % table->head->module; struct hashentry *newp; newp = mempool_alloc (table, sizeof (struct hashentry), 0); diff --git a/nscd/nscd_hash.c b/nscd/nscd_hash.c new file mode 100644 index 0000000000..1572af616a --- /dev/null +++ b/nscd/nscd_hash.c @@ -0,0 +1,19 @@ +/* Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define __nis_hash __nscd_hash +#include diff --git a/nscd/nscd_hash.h b/nscd/nscd_hash.h new file mode 100644 index 0000000000..e56d71015c --- /dev/null +++ b/nscd/nscd_hash.h @@ -0,0 +1,21 @@ +/* Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +extern uint32_t __nscd_hash (const void *__keyarg, size_t __len) + attribute_hidden; diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index 56e6d1421f..a42a4a7da5 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -34,10 +35,10 @@ #include #include #include -#include #include #include "nscd-client.h" +#include "nscd_hash.h" /* Extra time we wait if the socket is still receiving data. This @@ -443,12 +444,6 @@ __nscd_get_map_ref (request_type type, const char *name, #define MINIMUM_HASHENTRY_SIZE \ (offsetof (struct hashentry, dellist) + sizeof (int32_t)) -/* __nis_hash is defined in nis_hash.c which is included both libnsl - and libc. Since the one in libnsl is exported and the one in libc - is hidden, __nis_hash is marked as hidden where it is referenced, - not where it is defined. */ -extern __typeof (__nis_hash) __nis_hash attribute_hidden; - /* Don't return const struct datahead *, as eventhough the record is normally constant, it can change arbitrarily during nscd garbage collection. */ @@ -456,7 +451,7 @@ struct datahead * __nscd_cache_search (request_type type, const char *key, size_t keylen, const struct mapped_database *mapped, size_t datalen) { - unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module; + unsigned long int hash = __nscd_hash (key, keylen) % mapped->head->module; size_t datasize = mapped->datasize; ref_t trail = mapped->head->array[hash];