Date: Sun, 02 Nov 2014 13:53:03 -0700 From: Ian Lepore <ian@FreeBSD.org> To: d@delphij.net Cc: Konstantin Belousov <kostikbel@gmail.com>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Mark R V Murray <mark@grondar.org> Subject: Re: svn commit: r273958 - head/sys/dev/random Message-ID: <1414961583.1200.27.camel@revolution.hippie.lan> In-Reply-To: <545693B4.8030602@delphij.net> References: <201411020201.sA221unt091493@svn.freebsd.org> <720EB74E-094A-43F3-8B1C-47BC7F6FECC3@grondar.org> <1414934579.17308.248.camel@revolution.hippie.lan> <6FB65828-6A79-4BDE-A9F7-BC472BA538CE@grondar.org> <CAJ-VmomeOwE3LOpehhJ__G=FCoBDRXrrn%2BSfjwPFODts6YYHNQ@mail.gmail.com> <20141102192057.GB53947@kib.kiev.ua> <29A795E1-19E2-49E4-9653-143D3F6F3F12@grondar.org> <20141102194625.GC53947@kib.kiev.ua> <751CD860-95B9-4F68-AE69-976B42823AD0@grondar.org> <54568E41.8030305@delphij.net> <20141102201331.GE53947@kib.kiev.ua> <545693B4.8030602@delphij.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2014-11-02 at 12:27 -0800, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > Hi, Mark, > > I'd like to propose the attached patch for review. It replaces > tsleep's with sx_sleep's, then checks the return value and quit the loop. > > Cheers, > - -- It still doesn't handle the partial read/write case Kostik mentioned, but there are plenty of other drivers that don't get that right. Given that the ra_read/ra_write functions can't return error, it would only be errors from uiomove() in play. I guess it would be something like this: nbytes = uio->uio_resid; while (uio->uio_resid && !error) { c = MIN(uio->uio_resid, PAGE_SIZE); (random_adaptor->ra_read)(random_buf, c); error = uiomove(random_buf, c, uio); } if (uio->uio_resid != nbytes) error = 0; /* Return partial read, not error. */ Also, there's now a mix of if (error == 0) and if (!error) near each other (I tend to prefer using ! only on boolean_t, but I even more prefer local consistancy. :) -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1414961583.1200.27.camel>