From 67f36c7922fe5053549ec9aa7f60ed2c5c2d65b4 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 23 Nov 2017 14:08:11 +0100 Subject: nss: Export nscd hash function as __nss_hash [BZ #22459] --- nscd/Makefile | 4 ++-- nscd/cache.c | 6 +++--- nscd/nscd_hash.c | 19 ------------------- nscd/nscd_hash.h | 21 --------------------- nscd/nscd_helper.c | 5 ++--- 5 files changed, 7 insertions(+), 48 deletions(-) delete mode 100644 nscd/nscd_hash.c delete mode 100644 nscd/nscd_hash.h (limited to 'nscd') diff --git a/nscd/Makefile b/nscd/Makefile index 095f3e53d4..85e1c387d7 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 nscd_hash +aux := nscd_helper 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 nscd_hash + netgroupcache ifeq ($(build-nscd)$(have-thread-library),yesyes) diff --git a/nscd/cache.c b/nscd/cache.c index 4a17c3371b..72c73d31d3 100644 --- a/nscd/cache.c +++ b/nscd/cache.c @@ -29,10 +29,10 @@ #include #include #include +#include #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 = __nscd_hash (key, len) % table->head->module; + unsigned long int hash = __nss_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 = __nscd_hash (key, len) % table->head->module; + unsigned long int hash = __nss_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 deleted file mode 100644 index 1572af616a..0000000000 --- a/nscd/nscd_hash.c +++ /dev/null @@ -1,19 +0,0 @@ -/* 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 deleted file mode 100644 index e56d71015c..0000000000 --- a/nscd/nscd_hash.h +++ /dev/null @@ -1,21 +0,0 @@ -/* 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 a42a4a7da5..ac04a2f572 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -36,10 +36,9 @@ #include #include #include +#include #include "nscd-client.h" -#include "nscd_hash.h" - /* Extra time we wait if the socket is still receiving data. This value is in milliseconds. Note that the other side is nscd on the @@ -451,7 +450,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 = __nscd_hash (key, keylen) % mapped->head->module; + unsigned long int hash = __nss_hash (key, keylen) % mapped->head->module; size_t datasize = mapped->datasize; ref_t trail = mapped->head->array[hash]; -- cgit 1.4.1