lkml.org 
[lkml]   [2003]   [May]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: try_then_request_module
    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/

    \
     
     \ /
      Last update: 2005-03-22 13:35    [W:0.022 / U:29.184 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site