Author: hselasky Date: Mon Aug 14 13:15:13 2017 New Revision: 322501 URL: https://svnweb.freebsd.org/changeset/base/322501
Log: MFC r292537 and r314878: Implement ACCESS_ONCE(), WRITE_ONCE() and READ_ONCE(). Sponsored by: Mellanox Technologies Modified: stable/9/sys/ofed/include/linux/compiler.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/compiler.h ============================================================================== --- stable/9/sys/ofed/include/linux/compiler.h Mon Aug 14 12:59:14 2017 (r322500) +++ stable/9/sys/ofed/include/linux/compiler.h Mon Aug 14 13:15:13 2017 (r322501) @@ -63,4 +63,21 @@ #define uninitialized_var(x) x = x +#define ACCESS_ONCE(x) (*(volatile __typeof(x) *)&(x)) + +#define WRITE_ONCE(x,v) do { \ + barrier(); \ + ACCESS_ONCE(x) = (v); \ + barrier(); \ +} while (0) + +#define READ_ONCE(x) ({ \ + __typeof(x) __var = ({ \ + barrier(); \ + ACCESS_ONCE(x); \ + }); \ + barrier(); \ + __var; \ +}) + #endif /* _LINUX_COMPILER_H_ */ _______________________________________________ svn-src-stable-9@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9 To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"