aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@FreeBSD.org>2023-09-07 07:48:51 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2023-09-18 21:13:45 +0000
commit15314c51e810ca9da6785e90fbf591adcfcd52da (patch)
tree9b7139913547eaea570ba4772ff501632dc32089
parentf829556e3b8541f676db914c1d3a9604e15b4b31 (diff)
downloadsrc-15314c51e810ca9da6785e90fbf591adcfcd52da.tar.gz
src-15314c51e810ca9da6785e90fbf591adcfcd52da.zip
kern: Globally define abs64
So we can use it in non-linuxkpi sources. Reviewed by: emaste, mmel Differential Revision: https://reviews.freebsd.org/D41767 Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 229c65a83fbe0ede8c617e35d8f8c14d5ebadc19)
-rw-r--r--sys/compat/linuxkpi/common/include/linux/kernel.h6
-rw-r--r--sys/sys/libkern.h1
2 files changed, 1 insertions, 6 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 1490505a02fe..2ee452cb39ed 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -623,12 +623,6 @@ mult_frac(uintmax_t x, uintmax_t multiplier, uintmax_t divisor)
return ((q * multiplier) + ((r * multiplier) / divisor));
}
-static inline int64_t
-abs64(int64_t x)
-{
- return (x < 0 ? -x : x);
-}
-
typedef struct linux_ratelimit {
struct timeval lasttime;
int counter;
diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h
index 86b4c90333e5..92698a3f9b23 100644
--- a/sys/sys/libkern.h
+++ b/sys/sys/libkern.h
@@ -113,6 +113,7 @@ static __inline off_t omax(off_t a, off_t b) { return (a > b ? a : b); }
static __inline off_t omin(off_t a, off_t b) { return (a < b ? a : b); }
static __inline int abs(int a) { return (a < 0 ? -a : a); }
static __inline long labs(long a) { return (a < 0 ? -a : a); }
+static __inline int64_t abs64(int64_t a) { return (a < 0 ? -a : a); }
static __inline quad_t qabs(quad_t a) { return (a < 0 ? -a : a); }
#ifndef RANDOM_FENESTRASX