Date: Thu, 26 Jan 2012 20:55:21 +0400 From: Andrey Chernov <ache@FreeBSD.ORG> To: John Baldwin <jhb@FreeBSD.ORG> Cc: svn-src-head@FreeBSD.ORG, David Schultz <das@FreeBSD.ORG>, src-committers@FreeBSD.ORG, Mark Murray <markm@FreeBSD.ORG>, svn-src-all@FreeBSD.ORG Subject: Re: svn commit: r230230 - head/sys/dev/random Message-ID: <20120126165521.GA92622@vniz.net> In-Reply-To: <201201261132.38320.jhb@freebsd.org> References: <E1Rny2A-000C3x-O6@groundzero.grondar.org> <20120126143819.GA88677@vniz.net> <20120126155626.GA92229@vniz.net> <201201261132.38320.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 26, 2012 at 11:32:38AM -0500, John Baldwin wrote: > On Thursday, January 26, 2012 10:56:27 am Andrey Chernov wrote: > > > On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote: > > > > atomic_cmpset_int(&iniseed_state, ARC4_ENTER_NONE, > ARC4_ENTER_HAVE); > > > > break; > > > > Updated version (I hope, final): > > > > --- sys/libkern.h.old 2012-01-16 07:15:12.000000000 +0400 > > +++ sys/libkern.h 2012-01-26 19:38:06.000000000 +0400 > > @@ -72,6 +72,8 @@ static __inline quad_t qabs(quad_t a) { > > > > /* Prototypes for non-quad routines. */ > > struct malloc_type; > > +enum arc4_is { ARC4_ENTR_NONE, ARC4_ENTR_HAVE, ARC4_ENTR_DONE }; > > +extern volatile enum arc4_is arc4rand_iniseed_state; > > Atomics don't operate on enums. You'll need to make it an int and just use > #define's for the 3 states. Although current version with current kernel flags works, I forget it is implementation defined in general and not always equal to sizeof(int), f.e. with gcc --short-enums. I'll remade it with #defines, thanx again. > I think the rest of this is fine. > > -- > John Baldwin -- http://ache.vniz.net/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120126165521.GA92622>