git: 229c65a83fbe - main - kern: Globally define abs64

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Fri, 08 Sep 2023 08:08:08 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=229c65a83fbe0ede8c617e35d8f8c14d5ebadc19

commit 229c65a83fbe0ede8c617e35d8f8c14d5ebadc19
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2023-09-07 07:48:51 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-09-08 07:44:06 +0000

    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
---
 sys/compat/linuxkpi/common/include/linux/kernel.h | 6 ------
 sys/sys/libkern.h                                 | 1 +
 2 files changed, 1 insertion(+), 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