Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262499AbTESRIl (ORCPT ); Mon, 19 May 2003 13:08:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262525AbTESRIk (ORCPT ); Mon, 19 May 2003 13:08:40 -0400 Received: from meg.hrz.tu-chemnitz.de ([134.109.132.57]:33511 "EHLO meg.hrz.tu-chemnitz.de") by vger.kernel.org with ESMTP id S262499AbTESRIj (ORCPT ); Mon, 19 May 2003 13:08:39 -0400 Date: Mon, 19 May 2003 11:08:32 +0200 From: Ingo Oeser To: Rusty Russell Cc: linux-kernel@vger.kernel.org Subject: Re: try_then_request_module Message-ID: <20030519110832.G626@nightmaster.csn.tu-chemnitz.de> References: <20030519014233.5BF032C08C@lists.samba.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <20030519014233.5BF032C08C@lists.samba.org>; from rusty@rustcorp.com.au on Mon, May 19, 2003 at 11:41:20AM +1000 X-Spam-Score: -3.7 (---) X-Scanner: exiscan for exim4 (http://duncanthrax.net/exiscan/) *19HoKO-0000BD-00*TjJY0J2qyCI* Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1230 Lines: 46 Hi Rusty, hi LKML, On Mon, May 19, 2003 at 11:41:20AM +1000, Rusty Russell wrote: > If someone is feeling eager, many callers could change to > try_then_request_module(), eg: [search || request_module] Many implementation do this with a search and retry the search (if clever with a goto and a flag variable to save kernel size) after module loading. All that implemented in the search routine, which you have to supply anyway. So try_then_request_module() will consolidate the the branch or in the worst case just duplicating that code everywhere (depends on wether you implement it as a non-inline function or define). Usally this is all as simple as: int module_loaded_flag=0; retry_with_module_loaded: /* search code */ if (!module_loaded_flag && !found) { module_loaded_flag=1; if (!request_module(bla)) goto retry_with_module_loaded; } return found; which is very space effecient and also still readable. Regards Ingo Oeser - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/