[lkml]   [2002]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Why /dev/sdc1 doesn't show up...

    On Wed, 20 Nov 2002, Rusty Russell wrote:
    > Linus, I would like an answer: how does one register two /proc
    > entries?

    I think the answer is simple: you don't.

    In practice this doesn't happen. And even in theory when it does happen,
    trying to do it right is _worse_ than just letting it be. So what if one
    of them fails? Big deal. You didn't get the file, because you are playing
    with modules that do something that they shouldn't have done.

    Rule #1: KISS

    Rule #2: "don't overdesign" aka "perfect is the enemy of the good"

    In other words, screw the cases that don't matter, we only need to verify
    that we don't oops. Which means that the _right_ approach for proc entries
    is something like this:

    if (register_device(....))
    return -ENOMEM;

    if (!create_proc_entry("foo"...))
    printk("Unable to create '/proc/foo'\n");
    if (!create_proc_entry("bar"...))
    printk("Unable to create '/proc/bar'\n");
    return 0;

    and simply face the fact that trying to fail the module load at a late
    time is a bad idea, and if somebody already has registered your /proc
    entries then the system maintainer is doing something wrong and it is
    _his_ problem and he can

    The kernel shouldn't oops. And if that means that we should just leave the
    module loaded (not return an error), then so what? Hey, it may work fine
    without the /proc entries, erroring out might be _worse_.

    This is what happens with built-in drivers already. Modules are nothing
    but a convenience. They're not "worthy" of complexity.


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

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