diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c index d9eae45d0145..b565eaeff7e6 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -824,9 +824,34 @@ static inline void module_unload_init(struct module *mod) | |||
824 | } | 824 | } |
825 | #endif /* CONFIG_MODULE_UNLOAD */ | 825 | #endif /* CONFIG_MODULE_UNLOAD */ |
826 | 826 | ||
827 | static ssize_t show_initstate(struct module_attribute *mattr, | ||
828 | struct module *mod, char *buffer) | ||
829 | { | ||
830 | const char *state = "unknown"; | ||
831 | |||
832 | switch (mod->state) { | ||
833 | case MODULE_STATE_LIVE: | ||
834 | state = "live"; | ||
835 | break; | ||
836 | case MODULE_STATE_COMING: | ||
837 | state = "coming"; | ||
838 | break; | ||
839 | case MODULE_STATE_GOING: | ||
840 | state = "going"; | ||
841 | break; | ||
842 | } | ||
843 | return sprintf(buffer, "%s\n", state); | ||
844 | } | ||
845 | |||
846 | static struct module_attribute initstate = { | ||
847 | .attr = { .name = "initstate", .mode = 0444, .owner = THIS_MODULE }, | ||
848 | .show = show_initstate, | ||
849 | }; | ||
850 | |||
827 | static struct module_attribute *modinfo_attrs[] = { | 851 | static struct module_attribute *modinfo_attrs[] = { |
828 | &modinfo_version, | 852 | &modinfo_version, |
829 | &modinfo_srcversion, | 853 | &modinfo_srcversion, |
854 | &initstate, | ||
830 | #ifdef CONFIG_MODULE_UNLOAD | 855 | #ifdef CONFIG_MODULE_UNLOAD |
831 | &refcnt, | 856 | &refcnt, |
832 | #endif | 857 | #endif |