CLEANUP: Add haproxy/xxhash.h to avoid modifying import/xxhash.h

This solves setting XXH_INLINE_ALL in a cleaner way, because the imported
header is not modified, easing future updates.

see 6f7cc11e6d
This commit is contained in:
Tim Duesterhus 2021-09-11 17:51:13 +02:00 committed by Willy Tarreau
parent 949b6ca961
commit d5fc8fcb86
12 changed files with 55 additions and 19 deletions

View File

@ -1,7 +1,6 @@
#include <stdio.h>
#include <import/lru.h>
#include <import/xxhash.h>
#include <haproxy/api.h>
#include <haproxy/arg.h>
#include <haproxy/buf-t.h>
@ -15,6 +14,7 @@
#include <haproxy/sample.h>
#include <haproxy/thread.h>
#include <haproxy/tools.h>
#include <haproxy/xxhash.h>
#include <51Degrees.h>
struct _51d_property_names {

View File

@ -14,7 +14,8 @@
#include <stdlib.h>
#include <stdarg.h>
#include <arpa/inet.h>
#include <import/xxhash.h>
#include <haproxy/xxhash.h>
__attribute__((noreturn)) void die(int code, const char *format, ...)
{

View File

@ -22,11 +22,11 @@
#ifndef _HAPROXY_ACTIVITY_H
#define _HAPROXY_ACTIVITY_H
#include <import/xxhash.h>
#include <haproxy/activity-t.h>
#include <haproxy/api.h>
#include <haproxy/freq_ctr.h>
#include <haproxy/time.h>
#include <haproxy/xxhash.h>
extern unsigned int profiling;
extern unsigned long task_profiling_mask;

View File

@ -30,7 +30,6 @@
#include <import/ebmbtree.h>
#include <import/ist.h>
#include <import/xxhash.h>
#include <haproxy/api-t.h>
#include <haproxy/buf-t.h>
@ -38,6 +37,7 @@
#include <haproxy/port_range-t.h>
#include <haproxy/protocol-t.h>
#include <haproxy/thread-t.h>
#include <haproxy/xxhash.h>
/* referenced below */
struct connection;

View File

@ -404,13 +404,6 @@
#define MAX_POLLERS 10
#endif
/* Make all xxhash functions inline, with implementations being directly
* included within xxhash.h.
*/
#ifndef XXH_INLINE_ALL
#define XXH_INLINE_ALL
#endif
/* system sysfs directory */
#define NUMA_DETECT_SYSTEM_SYSFS_PATH "/sys/devices/system"

45
include/haproxy/xxhash.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Copyright (C) 2020 Dragan Dosen <ddosen@haproxy.com>
* Copyright (C) 2021 Tim Duesterhus <tim@bastelstu.be>
*
* BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _HAPROXY_XXHASH_H
#define _HAPROXY_XXHASH_H
/* Make all xxhash functions inline, with implementations being directly
* included within xxhash.h.
*/
#ifndef XXH_INLINE_ALL
#define XXH_INLINE_ALL
#else
#error "XXH_INLINE_ALL is already defined."
#endif
#include <import/xxhash.h>
#endif

View File

@ -75,8 +75,6 @@ XXH32 6.8 GB/s 6.0 GB/s
extern "C" {
#endif
#include <haproxy/defaults.h>
/* ****************************
* INLINE mode
******************************/

View File

@ -16,7 +16,6 @@
#include <import/ebsttree.h>
#include <import/lru.h>
#include <import/xxhash.h>
#include <haproxy/api.h>
#include <haproxy/global.h>
@ -26,6 +25,7 @@
#include <haproxy/regex.h>
#include <haproxy/sample.h>
#include <haproxy/tools.h>
#include <haproxy/xxhash.h>
const char *const pat_match_names[PAT_MATCH_NUM] = {

View File

@ -18,7 +18,6 @@
#include <import/mjson.h>
#include <import/sha1.h>
#include <import/xxhash.h>
#include <haproxy/api.h>
#include <haproxy/arg.h>
@ -43,6 +42,7 @@
#include <haproxy/tools.h>
#include <haproxy/uri_auth-t.h>
#include <haproxy/vars.h>
#include <haproxy/xxhash.h>
/* sample type names */
const char *smp_to_type[SMP_TYPES] = {

View File

@ -16,8 +16,6 @@
#include <ctype.h>
#include <errno.h>
#include <import/xxhash.h>
#include <haproxy/api.h>
#include <haproxy/applet-t.h>
#include <haproxy/backend.h>
@ -46,6 +44,7 @@
#include <haproxy/tcpcheck.h>
#include <haproxy/time.h>
#include <haproxy/tools.h>
#include <haproxy/xxhash.h>
static void srv_update_status(struct server *s);

View File

@ -13,7 +13,6 @@
#include <errno.h>
#include <import/eb64tree.h>
#include <import/xxhash.h>
#include <import/ebistree.h>
#include <haproxy/api.h>
@ -29,6 +28,7 @@
#include <haproxy/server.h>
#include <haproxy/ssl_sock.h>
#include <haproxy/tools.h>
#include <haproxy/xxhash.h>
/* Update a server state using the parameters available in the params list.

View File

@ -43,7 +43,6 @@
#include <import/ebpttree.h>
#include <import/ebsttree.h>
#include <import/lru.h>
#include <import/xxhash.h>
#include <haproxy/api.h>
#include <haproxy/arg.h>
@ -79,6 +78,7 @@
#include <haproxy/tools.h>
#include <haproxy/vars.h>
#include <haproxy/xprt_quic.h>
#include <haproxy/xxhash.h>
/* ***** READ THIS before adding code here! *****