lkml.org 
[lkml]   [2006]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5/14] Driver core: show "initstate" of module
    Date
    From: Kay Sievers <kay.sievers@vrfy.org>

    Show the initialization state(live, coming, going) of the module:
    $ cat /sys/module/usbcore/initstate
    live

    Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    kernel/module.c | 25 +++++++++++++++++++++++++
    1 files changed, 25 insertions(+), 0 deletions(-)

    diff --git a/kernel/module.c b/kernel/module.c
    index d9eae45..b565eae 100644
    --- a/kernel/module.c
    +++ b/kernel/module.c
    @@ -824,9 +824,34 @@ static inline void module_unload_init(struct module *mod)
    }
    #endif /* CONFIG_MODULE_UNLOAD */

    +static ssize_t show_initstate(struct module_attribute *mattr,
    + struct module *mod, char *buffer)
    +{
    + const char *state = "unknown";
    +
    + switch (mod->state) {
    + case MODULE_STATE_LIVE:
    + state = "live";
    + break;
    + case MODULE_STATE_COMING:
    + state = "coming";
    + break;
    + case MODULE_STATE_GOING:
    + state = "going";
    + break;
    + }
    + return sprintf(buffer, "%s\n", state);
    +}
    +
    +static struct module_attribute initstate = {
    + .attr = { .name = "initstate", .mode = 0444, .owner = THIS_MODULE },
    + .show = show_initstate,
    +};
    +
    static struct module_attribute *modinfo_attrs[] = {
    &modinfo_version,
    &modinfo_srcversion,
    + &initstate,
    #ifdef CONFIG_MODULE_UNLOAD
    &refcnt,
    #endif
    --
    1.4.4.2
    -
    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: 2006-12-13 20:57    [W:4.117 / U:0.308 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site