Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slash
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
slash
Commits
f150bde0
Unverified
Commit
f150bde0
authored
Oct 02, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compatibility with xxHash 0.7.3
parent
b7392da0
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
9 deletions
+34
-9
fellow_cache.c
src/fellow_cache.c
+4
-2
fellow_hash.c
src/fellow_hash.c
+3
-1
fellow_log_test.c
src/fellow_log_test.c
+10
-4
fellow_tune.h
src/fellow_tune.h
+4
-0
fellow_hash.tbl.h
src/tbl/fellow_hash.tbl.h
+2
-0
fellow_tunables.h
src/tbl/fellow_tunables.h
+5
-0
vmod_slash.man.rst
src/vmod_slash.man.rst
+3
-1
vmod_slash.vcc
src/vmod_slash.vcc
+3
-1
No files found.
src/fellow_cache.c
View file @
f150bde0
...
@@ -5830,8 +5830,10 @@ main(int argc, char **argv)
...
@@ -5830,8 +5830,10 @@ main(int argc, char **argv)
l
=
FH_SHA256
+
1
;
l
=
FH_SHA256
+
1
;
#endif
#endif
for
(
hash
=
FH_SHA256
;
hash
<
l
;
hash
++
)
for
(
hash
=
FH_SHA256
;
hash
<
l
;
hash
++
)
{
if
(
fh_name
[
hash
])
t_cache
(
hash
);
t_cache
(
hash
);
}
printf
(
"OK
\n
"
);
printf
(
"OK
\n
"
);
return
(
0
);
return
(
0
);
}
}
...
...
src/fellow_hash.c
View file @
f150bde0
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <string.h>
#include <string.h>
#ifdef HAVE_XXHASH_H
#ifdef HAVE_XXHASH_H
#define MIN_XXH_VERSION
800
#define MIN_XXH_VERSION
703
#include <xxhash.h>
#include <xxhash.h>
#if XXH_VERSION_NUMBER < MIN_XXH_VERSION
#if XXH_VERSION_NUMBER < MIN_XXH_VERSION
#error "xxhash version unsupported"
#error "xxhash version unsupported"
...
@@ -92,12 +92,14 @@ fh(uint8_t fht, union fh *fhh, const void *p, size_t l)
...
@@ -92,12 +92,14 @@ fh(uint8_t fht, union fh *fhh, const void *p, size_t l)
}
}
}
}
#if XXH_VERSION_NUMBER >= 800
static
inline
int
static
inline
int
xxh3_128_cmp
(
const
uint8_t
v
[
16
],
const
void
*
p
,
size_t
l
)
xxh3_128_cmp
(
const
uint8_t
v
[
16
],
const
void
*
p
,
size_t
l
)
{
{
XXH128_hash_t
h
=
XXH3_128bits
(
p
,
l
);
XXH128_hash_t
h
=
XXH3_128bits
(
p
,
l
);
return
(
memcmp
(
v
,
&
h
,
sizeof
h
));
return
(
memcmp
(
v
,
&
h
,
sizeof
h
));
}
}
#endif
#define FH_C_SHA256(v, p, l) sha256cmp(v, p, l)
#define FH_C_SHA256(v, p, l) sha256cmp(v, p, l)
#define FH_C_XXH32(v, p, l) ((v) != XXH32(p, l, 0))
#define FH_C_XXH32(v, p, l) ((v) != XXH32(p, l, 0))
...
...
src/fellow_log_test.c
View file @
f150bde0
...
@@ -675,6 +675,8 @@ run(const struct tc *tc, void *t_priv)
...
@@ -675,6 +675,8 @@ run(const struct tc *tc, void *t_priv)
#endif
#endif
for
(
h
=
1
;
h
<
l
;
h
++
)
{
for
(
h
=
1
;
h
<
l
;
h
++
)
{
if
(
fh_name
[
h
]
==
NULL
)
continue
;
r
=
runh
(
tc
,
t_priv
,
h
);
r
=
runh
(
tc
,
t_priv
,
h
);
if
(
r
!=
0
)
if
(
r
!=
0
)
break
;
break
;
...
@@ -752,6 +754,10 @@ main(int argc, char **argv)
...
@@ -752,6 +754,10 @@ main(int argc, char **argv)
double
t
;
double
t
;
const
double
tmax
=
1
;
const
double
tmax
=
1
;
void
*
priv
=
NULL
;
void
*
priv
=
NULL
;
uint8_t
fht
[
2
];
fht
[
0
]
=
fh_name
[
FH_XXH3_128
]
?
FH_XXH3_128
:
FH_XXH32
;
fht
[
1
]
=
fh_name
[
FH_XXH3_64
]
?
FH_XXH3_64
:
FH_XXH32
;
if
(
argc
==
2
&&
*
argv
[
1
]
!=
'-'
)
if
(
argc
==
2
&&
*
argv
[
1
]
!=
'-'
)
filename
=
argv
[
1
];
filename
=
argv
[
1
];
...
@@ -767,7 +773,7 @@ main(int argc, char **argv)
...
@@ -767,7 +773,7 @@ main(int argc, char **argv)
// panic on "nothing must be resurrected"
// panic on "nothing must be resurrected"
AZ
(
runh
(
&
tc_resur_add
,
&
priv
,
FH_SHA256
));
AZ
(
runh
(
&
tc_resur_add
,
&
priv
,
FH_SHA256
));
#ifdef HAVE_XXHASH_H
#ifdef HAVE_XXHASH_H
AZ
(
runh
(
&
tc_resur_del
,
&
priv
,
FH_XXH3
_128
));
AZ
(
runh
(
&
tc_resur_del
,
&
priv
,
FH_XXH3
2
));
#else
#else
AZ
(
runh
(
&
tc_resur_del
,
&
priv
,
FH_SHA256
));
AZ
(
runh
(
&
tc_resur_del
,
&
priv
,
FH_SHA256
));
#endif
#endif
...
@@ -775,9 +781,9 @@ main(int argc, char **argv)
...
@@ -775,9 +781,9 @@ main(int argc, char **argv)
// same but keep across a close/open
// same but keep across a close/open
#ifdef HAVE_XXHASH_H
#ifdef HAVE_XXHASH_H
AZ
(
runh
(
&
tc_resur_add
,
&
priv
,
FH_XXH3_128
));
AZ
(
runh
(
&
tc_resur_add
,
&
priv
,
fht
[
0
]
));
AZ
(
runh
(
&
tc_adddel_keep
,
NULL
,
FH_
XXH32
));
AZ
(
runh
(
&
tc_adddel_keep
,
NULL
,
FH_
SHA256
));
AZ
(
runh
(
&
tc_resur_del
,
&
priv
,
FH_XXH3_64
));
AZ
(
runh
(
&
tc_resur_del
,
&
priv
,
fht
[
1
]
));
#else
#else
AZ
(
runh
(
&
tc_resur_add
,
&
priv
,
FH_SHA256
));
AZ
(
runh
(
&
tc_resur_add
,
&
priv
,
FH_SHA256
));
AZ
(
runh
(
&
tc_adddel_keep
,
NULL
,
FH_SHA256
));
AZ
(
runh
(
&
tc_adddel_keep
,
NULL
,
FH_SHA256
));
...
...
src/fellow_tune.h
View file @
f150bde0
...
@@ -20,6 +20,10 @@
...
@@ -20,6 +20,10 @@
* electronic and paper mail.
* electronic and paper mail.
*/
*/
#ifdef HAVE_XXHASH_H
#include <xxhash.h>
#endif
struct
stvfe_tune
{
struct
stvfe_tune
{
unsigned
magic
;
unsigned
magic
;
#define STVFE_TUNE_MAGIC 0x92d8d31c
#define STVFE_TUNE_MAGIC 0x92d8d31c
...
...
src/tbl/fellow_hash.tbl.h
View file @
f150bde0
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
FH
(
SHA256
,
sha256
,
FSHA256_LEN
)
FH
(
SHA256
,
sha256
,
FSHA256_LEN
)
#ifdef HAVE_XXHASH_H
#ifdef HAVE_XXHASH_H
FH
(
XXH32
,
xxh32
,
sizeof
(
XXH32_hash_t
))
FH
(
XXH32
,
xxh32
,
sizeof
(
XXH32_hash_t
))
#if XXH_VERSION_NUMBER >= 800
FH
(
XXH3_64
,
xxh3_64
,
sizeof
(
XXH64_hash_t
))
FH
(
XXH3_64
,
xxh3_64
,
sizeof
(
XXH64_hash_t
))
FH
(
XXH3_128
,
xxh3_128
,
sizeof
(
XXH128_hash_t
))
FH
(
XXH3_128
,
xxh3_128
,
sizeof
(
XXH128_hash_t
))
#endif
#endif
#endif
#undef FH
#undef FH
src/tbl/fellow_tunables.h
View file @
f150bde0
...
@@ -54,8 +54,13 @@ TUNE(unsigned, io_batch_min, 8, 1, UINT_MAX);
...
@@ -54,8 +54,13 @@ TUNE(unsigned, io_batch_min, 8, 1, UINT_MAX);
TUNE
(
unsigned
,
io_batch_max
,
512
,
1
,
UINT_MAX
);
TUNE
(
unsigned
,
io_batch_max
,
512
,
1
,
UINT_MAX
);
TUNE
(
int8_t
,
cram
,
1
,
-
64
,
64
);
TUNE
(
int8_t
,
cram
,
1
,
-
64
,
64
);
#ifdef HAVE_XXHASH_H
#ifdef HAVE_XXHASH_H
#if XXH_VERSION_NUMBER >= 800
TUNEH
(
uint8_t
,
hash_obj
,
FH_XXH3_64
,
FH_NONE
+
1
,
FH_LIM
-
1
);
TUNEH
(
uint8_t
,
hash_obj
,
FH_XXH3_64
,
FH_NONE
+
1
,
FH_LIM
-
1
);
TUNEH
(
uint8_t
,
hash_log
,
FH_XXH3_64
,
FH_NONE
+
1
,
FH_LIM
-
1
);
TUNEH
(
uint8_t
,
hash_log
,
FH_XXH3_64
,
FH_NONE
+
1
,
FH_LIM
-
1
);
#else
TUNEH
(
uint8_t
,
hash_obj
,
FH_XXH32
,
FH_NONE
+
1
,
FH_XXH32
);
TUNEH
(
uint8_t
,
hash_log
,
FH_XXH32
,
FH_NONE
+
1
,
FH_XXH32
);
#endif
#else
#else
TUNEH
(
uint8_t
,
hash_obj
,
FH_SHA256
,
FH_NONE
+
1
,
FH_LIM
-
1
);
TUNEH
(
uint8_t
,
hash_obj
,
FH_SHA256
,
FH_NONE
+
1
,
FH_LIM
-
1
);
TUNEH
(
uint8_t
,
hash_log
,
FH_SHA256
,
FH_NONE
+
1
,
FH_LIM
-
1
);
TUNEH
(
uint8_t
,
hash_log
,
FH_SHA256
,
FH_NONE
+
1
,
FH_LIM
-
1
);
...
...
src/vmod_slash.man.rst
View file @
f150bde0
...
@@ -722,7 +722,9 @@ fellow storage can be fine tuned:
...
@@ -722,7 +722,9 @@ fellow storage can be fine tuned:
* *hash_obj*, *hash_log*
* *hash_obj*, *hash_log*
- value: one of ``sha256``, ``xxh32``, ``xxh3_64``, ``xxh3_128``
- value: one of ``sha256``, ``xxh32``, ``xxh3_64``, ``xxh3_128``
- default: ``xxh3_64`` if xxhash has been compiled in, ``sha256`` otherwise
- default: ``xxh3_64`` if xxhash > 0.8.0 has been compiled in,
``xxh32`` if xxhash > 0.7.3 has been compiled in,
``sha256`` otherwise
*hash_obj* specifies the hash algorithm to ensure data integrity of
*hash_obj* specifies the hash algorithm to ensure data integrity of
objects and their data.
objects and their data.
...
...
src/vmod_slash.vcc
View file @
f150bde0
...
@@ -660,7 +660,9 @@ fellow storage can be fine tuned:
...
@@ -660,7 +660,9 @@ fellow storage can be fine tuned:
* *hash_obj*, *hash_log*
* *hash_obj*, *hash_log*
- value: one of ``sha256``, ``xxh32``, ``xxh3_64``, ``xxh3_128``
- value: one of ``sha256``, ``xxh32``, ``xxh3_64``, ``xxh3_128``
- default: ``xxh3_64`` if xxhash has been compiled in, ``sha256`` otherwise
- default: ``xxh3_64`` if xxhash > 0.8.0 has been compiled in,
``xxh32`` if xxhash > 0.7.3 has been compiled in,
``sha256`` otherwise
*hash_obj* specifies the hash algorithm to ensure data integrity of
*hash_obj* specifies the hash algorithm to ensure data integrity of
objects and their data.
objects and their data.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment