Date: Thu, 14 Oct 2010 01:48:51 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r213822 - projects/ofed/head/sys/ofed/include/asm Message-ID: <201010140148.o9E1mpJ9008543@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Thu Oct 14 01:48:51 2010 New Revision: 213822 URL: http://svn.freebsd.org/changeset/base/213822 Log: - Correct sign of return values from atomic functions. This was preventing atomic_add_negative() from detecting negative values. Sponsored by: Isilon Systems, iX Systems, and Panasas. Modified: projects/ofed/head/sys/ofed/include/asm/atomic-long.h projects/ofed/head/sys/ofed/include/asm/atomic.h Modified: projects/ofed/head/sys/ofed/include/asm/atomic-long.h ============================================================================== --- projects/ofed/head/sys/ofed/include/asm/atomic-long.h Thu Oct 14 01:47:47 2010 (r213821) +++ projects/ofed/head/sys/ofed/include/asm/atomic-long.h Thu Oct 14 01:48:51 2010 (r213822) @@ -39,7 +39,7 @@ typedef struct { #define atomic_long_add(i, v) atomic_long_add_return((i), (v)) #define atomic_long_inc_return(v) atomic_long_add_return(1, (v)) -static inline u_long +static inline long atomic_long_add_return(long i, atomic_long_t *v) { return i + atomic_fetchadd_long(&v->counter, i); Modified: projects/ofed/head/sys/ofed/include/asm/atomic.h ============================================================================== --- projects/ofed/head/sys/ofed/include/asm/atomic.h Thu Oct 14 01:47:47 2010 (r213821) +++ projects/ofed/head/sys/ofed/include/asm/atomic.h Thu Oct 14 01:48:51 2010 (r213822) @@ -46,13 +46,13 @@ typedef struct { #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) -static inline u_int +static inline int atomic_add_return(int i, atomic_t *v) { return i + atomic_fetchadd_int(&v->counter, i); } -static inline u_int +static inline int atomic_sub_return(int i, atomic_t *v) { return atomic_fetchadd_int(&v->counter, -i) - i;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010140148.o9E1mpJ9008543>