lkml.org 
[lkml]   [2015]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 1/5] random: Blocking API for accessing nonblocking_pool
On Mon, May 18, 2015 at 07:32:01AM +0200, Stephan Mueller wrote:
>
> Thanks for the hint to the list. Before handing in another formal patch, may i ask for checking the following approach? I would think that this one should cover your concerns.

Yes this is definitely going in the right direction.

> +/*
> + * Equivalent function to get_random_bytes with the difference that this
> + * function blocks the request until the nonblocking_pool is initialized.
> + */
> +int get_blocking_random_bytes_cb(void *buf, int nbytes, void *private,
> + void (*cb)(void *buf, int buflen,
> + void *private))

You can simplify this further and get rid of buf/nbytes. All
we need to know is whether the pool is ready. Everything else
can come from private.

> + struct random_work *rw = NULL;
> + int ret = 0;

I think this function should return 0 if the pool is ready now,
-EINPROGRESS if it's not (indicating that the callback will be
called when it is ready) and otherwise an error.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


\
 
 \ /
  Last update: 2015-05-18 12:01    [W:0.179 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site