From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753401AbbERJV4 (ORCPT ); Mon, 18 May 2015 05:21:56 -0400 Received: from helcar.hengli.com.au ([209.40.204.226]:50715 "EHLO helcar.hengli.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752282AbbERJVr (ORCPT ); Mon, 18 May 2015 05:21:47 -0400 Date: Mon, 18 May 2015 17:21:31 +0800 From: Herbert Xu To: Stephan Mueller Cc: pebolle@tiscali.nl, andreas.steffen@strongswan.org, tytso@mit.edu, sandyinchina@gmail.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH v6 1/5] random: Blocking API for accessing nonblocking_pool Message-ID: <20150518092131.GA18659@gondor.apana.org.au> References: <1921857.OvxEu6y28S@tachyon.chronox.de> <34087343.u7K3uzbyiZ@tachyon.chronox.de> <20150515064626.GA16704@gondor.apana.org.au> <3672239.xqA2RrDaZY@tachyon.chronox.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3672239.xqA2RrDaZY@tachyon.chronox.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt