Mon Aug 27 07:45:43 2018 UTC ()
Just define ACCESS_ONCE rather than patch it out.


(riastradh)
diff -r1.18 -r1.19 src/sys/external/bsd/common/include/linux/kernel.h

cvs diff -r1.18 -r1.19 src/sys/external/bsd/common/include/linux/kernel.h (expand / switch to unified diff)

--- src/sys/external/bsd/common/include/linux/kernel.h 2018/08/27 07:42:55 1.18
+++ src/sys/external/bsd/common/include/linux/kernel.h 2018/08/27 07:45:43 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: kernel.h,v 1.18 2018/08/27 07:42:55 riastradh Exp $ */ 1/* $NetBSD: kernel.h,v 1.19 2018/08/27 07:45:43 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -118,26 +118,32 @@ @@ -118,26 +118,32 @@
118#define swap(X, Y) do \ 118#define swap(X, Y) do \
119{ \ 119{ \
120 /* XXX Kludge for type-safety. */ \ 120 /* XXX Kludge for type-safety. */ \
121 if (&(X) != &(Y)) { \ 121 if (&(X) != &(Y)) { \
122 CTASSERT(sizeof(X) == sizeof(Y)); \ 122 CTASSERT(sizeof(X) == sizeof(Y)); \
123 /* XXX Can't do this much better without typeof. */ \ 123 /* XXX Can't do this much better without typeof. */ \
124 char __swap_tmp[sizeof(X)]; \ 124 char __swap_tmp[sizeof(X)]; \
125 (void)memcpy(__swap_tmp, &(X), sizeof(X)); \ 125 (void)memcpy(__swap_tmp, &(X), sizeof(X)); \
126 (void)memcpy(&(X), &(Y), sizeof(X)); \ 126 (void)memcpy(&(X), &(Y), sizeof(X)); \
127 (void)memcpy(&(Y), __swap_tmp, sizeof(X)); \ 127 (void)memcpy(&(Y), __swap_tmp, sizeof(X)); \
128 } \ 128 } \
129} while (0) 129} while (0)
130 130
 131#define ACCESS_ONCE(X) ({ \
 132 typeof(X) __access_once_tmp = (X); \
 133 __insn_barrier(); \
 134 __access_once_tmp; \
 135})
 136
131static inline int64_t 137static inline int64_t
132abs64(int64_t x) 138abs64(int64_t x)
133{ 139{
134 return (x < 0? (-x) : x); 140 return (x < 0? (-x) : x);
135} 141}
136 142
137static inline uintmax_t 143static inline uintmax_t
138mult_frac(uintmax_t x, uintmax_t multiplier, uintmax_t divisor) 144mult_frac(uintmax_t x, uintmax_t multiplier, uintmax_t divisor)
139{ 145{
140 uintmax_t q = (x / divisor); 146 uintmax_t q = (x / divisor);
141 uintmax_t r = (x % divisor); 147 uintmax_t r = (x % divisor);
142 148
143 return ((q * multiplier) + ((r * multiplier) / divisor)); 149 return ((q * multiplier) + ((r * multiplier) / divisor));