Skip to contentSkip to conversation

export module parameters in sysfs for modules _and_ built-in code: remove /sys/module/*parameters*

RFC PATCH In review Dominik Brodowski 2 participants 3 messages Aug 1, 2004 – Aug 2, 2004 Module support

lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/2 export module parameters in sysfs for modules _and_ built-in code: remove /sys/module/*parameters*

Remove the exporting of module parameters in sysfs in /sys/module, and clean up the exporting of the attribute "refcnt". One functionality
change: it is always exported now, and if !CONFIG_MODULE_UNLOAD, it reports 1.

 include/linux/module.h |   18 ++-----
 kernel/module.c        |  114 ++++++++++++++----------------------------------- 
 2 files changed, 39 insertions(+), 93 deletions(-)
include/linux/module.h +5 -13
diff -ruN linux-original/include/linux/module.h linux/include/linux/module.h
@@ -208,21 +208,16 @@
 	MODULE_STATE_GOING,
 };
 
-/* sysfs stuff */
-struct module_attribute
-{
-	struct attribute attr;
-	struct kernel_param *param;
+struct module_attribute {
+        struct attribute attr;
+        ssize_t (*show)(struct module *, char *);
+        ssize_t (*store)(struct module *, const char *, size_t count);
 };
 
 struct module_kobject
 {
-	/* Everyone should have one of these. */
 	struct kobject kobj;
-
-	/* We always have refcnt, we may have others from module_param(). */
-	unsigned int num_attributes;
-	struct module_attribute attr[0];
+	struct module *mod;
 };
 
 /* Similar stuff for section attributes. */
@@ -306,9 +301,6 @@
 
 	/* Destruction function. */
 	void (*exit)(void);
-
-	/* Fake kernel param for refcnt. */
-	struct kernel_param refcnt_param;
 #endif
 
 #ifdef CONFIG_KALLSYMS
kernel/module.c +34 -80

200 lines not on this page · raw message

#1 lore raw
Quoted 4 lines · Dominik Brodowski

Remove the exporting of module parameters in sysfs in /sys/module, and clean up the exporting of the attribute "refcnt". One functionality
change: it is always exported now, and if !CONFIG_MODULE_UNLOAD, it reports 1.

I don't think this is a good idea: we shouldn't lie to userspace unless we need to for compatibility reasons.

Rusty.

Signature · 1 line
Anyone who quotes me in their signature is an idiot -- Rusty Russell
#2 lore raw

PATCH 2/2 export module parameters in sysfs for modules _and_ built-in code: remove /sys/module/*parameters*

Quoted 8 lines · Rusty Russell
Quoted 4 lines · Dominik Brodowski

Remove the exporting of module parameters in sysfs in /sys/module, and clean up the exporting of the attribute "refcnt". One functionality
change: it is always exported now, and if !CONFIG_MODULE_UNLOAD, it reports 1.

I don't think this is a good idea: we shouldn't lie to userspace unless we need to for compatibility reasons.

Agreed.

Remove the exporting of module parameters in sysfs in /sys/module, and clean up the exporting of the attribute "refcnt" (which is only exported if CONFIG_MODULE_UNLOAD is set).

 include/linux/module.h |   18 ++-----
 kernel/module.c        |  115 +++++++++++++------------------------------------
 2 files changed, 37 insertions(+), 96 deletions(-)
include/linux/module.h +5 -13
diff -ruN linux-original/include/linux/module.h linux/include/linux/module.h
@@ -208,21 +208,16 @@
 	MODULE_STATE_GOING,
 };
 
-/* sysfs stuff */
-struct module_attribute
-{
-	struct attribute attr;
-	struct kernel_param *param;
+struct module_attribute {
+	struct attribute attr;
+	ssize_t (*show)(struct module *, char *);
+	ssize_t (*store)(struct module *, const char *, size_t count);
 };
 
 struct module_kobject
 {
-	/* Everyone should have one of these. */
 	struct kobject kobj;
-
-	/* We always have refcnt, we may have others from module_param(). */
-	unsigned int num_attributes;
-	struct module_attribute attr[0];
+	struct module *mod;
 };
 
 /* Similar stuff for section attributes. */
@@ -306,9 +301,6 @@
 
 	/* Destruction function. */
 	void (*exit)(void);
-
-	/* Fake kernel param for refcnt. */
-	struct kernel_param refcnt_param;
 #endif
 
 #ifdef CONFIG_KALLSYMS
kernel/module.c +32 -83

200 lines not on this page · raw message