[lkml]   [2000]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Subject[idea] request_module(const char *fmt, ...);
    Hi guys,

    Here is the idea:

    Instead of current way of switching request_module() depending on
    CONFIG_KMOD inside <linux/kmod.h> and having each driver contain a block
    of code like this (see e.g. fs/block_device.c:get_blkfops())

    #ifdef CONFIG_KMOD
    if (!blkdevs[major].bdops) {
    char name[20];
    sprintf(name, "block-major-%d", major);

    have a request_module() function with printf()-like syntax inside

    int request_module(const char *fmt, ...)
    #ifdef CONFIG_KMOD
    va_list args;
    return -1;

    so, the drivers just call request_module("block-major-%d", major);


    0. an extra function call even if CONFIG_KMOD is not defined. This is not
    serious as request_module() is never called on a hot path (usually opening
    a device etc.)


    0. Code is not polluted with a multitude of #ifdef CONFIG_KMOD, thus
    making disassembly output look more immediately recognizeable.

    1. No dependency on CONFIG_KMOD spread around the entire kernel. So, if
    you reconfigure the kernel changing CONFIG_KMOD, only the kernel/kmod.c is

    Let me know your ideas and I shall knock up a patch this evening, if your
    feedback is positive.

    Tigran A. Aivazian |
    Escalations Research Group | tel: +44-(0)1923-813796
    Santa Cruz Operation Ltd |

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

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