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


_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to