Commit Graph

12 Commits

Author SHA1 Message Date
Mark Johnston
b9625b0d3b Move zstd malloc()/free()/calloc() macros to stdlib.h.
The definitions otherwise leak into anything that includes zstd.h,
which is not desirable for native FreeBSD code.

Reviewed by:	allanjude, cem, imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D14352
2018-02-13 19:18:00 +00:00
Pedro F. Giffuni
86446f5610 zstd: Use mallocarray(9) for calloc macro.
This is in contrib code but since we only have mallocarray(9) in current
we will not upstream this.

This effectively brings back r327934, which was reverted to correct the
log message.
2018-01-13 19:02:51 +00:00
Pedro F. Giffuni
8c3720bfc1 Revert r327934 to fix the log message. 2018-01-13 18:56:42 +00:00
Pedro F. Giffuni
d195572171 zstd: Use memalloc(9) for calloc macro.
This is in contrib code but since we only have memalloc(9) in current we
will not upstream this.
2018-01-13 18:09:09 +00:00
Conrad Meyer
8fb95dc265 Zstd: Add bswap intrinsics for small MIPS systems (e.g., Onion Omega)
Reported by:	mizhka
Sponsored by:	Dell EMC Isilon
2018-01-11 06:30:50 +00:00
Conrad Meyer
8038068a2a Finally, fix Zstd kernel build on MIPS and RISC-V
Add an implementation of the intrinsics invoked by __builtin_ctz{,ll} and
__builtin_clz{,ll}, and include this compilation unit on platforms that lack
assembly intrinsics for those builtins (MIPS and RISC-V).

Future cleanup work might involve bringing these into a mini libcompiler-rt
for the standalone kernel environment.  Or cleaning up the approach upstream
takes for builtins in standalone environments (or just FreeBSD).  For now,
at least this builds, and doesn't require modifying the vendor code.

Reported by:	jeff, markj, mizhka
Reviewed by:	jhb (earlier version), rpokala (comment text earlier version)
Sponsored by:	Dell EMC Isilon
2018-01-10 06:30:59 +00:00
Conrad Meyer
d3692a4dee Integrate zstd into the kernel
Mock userspace headers and include mocked headers first in compilation
command to inject kernel headers and override e.g., malloc(3) with
malloc(9).

Submitted by:	allanjude
Reviewed by:	imp (earlier version), bapt (earlier version)
Differential Revision:	https://reviews.freebsd.org/D10407
2018-01-08 20:14:16 +00:00
Baptiste Daroussin
1ad8ac7a1d Revert local changes made to make zstd(1) frontend behave like gzip(1) and friends
This change was made to allow zstd(1) to be a dropin replacement for gzip(1) and
friends, allowing easy integration, in particular with newsyslog(8). At the
price of having a zstd(1) command which by default behaves differently than what
upstream default, confusing users.

newsyslog(8) has been adapted to now be more flexible in what it accepts as
compression program, so we can switch back zstd(1) to its default behaviour

Reported by:	many
2017-12-06 09:53:10 +00:00
Allan Jude
90edb2ac5b Use __has_builtin() to ensure clz and clzll builtins are available
The existing check of the GCC version number is not sufficient

This fixes the build on sparc64 in preparation for integrating ZSTD into
the kernel for ZFS and Crash Dumps.
2017-12-04 01:16:26 +00:00
Baptiste Daroussin
6247019ec2 Actually commit the right patch for r325929 2017-11-17 09:33:29 +00:00
Baptiste Daroussin
5cdf66d629 Do not remove the sources when zstd is called as zstdcat 2017-11-17 09:29:26 +00:00
Warner Losh
0c16b53773 Move zstd from contrib to sys/contrib so it can be used in the
kernel. Adjust the Makefiles that referenced it to the new path.

Sponsored by: Netflix
OK'd by: cem@ and AllanJude@
2017-11-14 05:03:38 +00:00