[SYSFS QUESTION] How to add new sysfs attributes under /sys/module/<my module>

From: Bagalkote, Sreenivas
Date: Fri Jul 08 2005 - 17:59:10 EST


Sysfs Gurus,

I want to export few driver specific sysfs attributes when my driver loads.
This driver is a pci hotplug driver. I want to export these sysfs attributes
as soon as my pci_module_init succeeds.

1. I see that there is /sys/modules directory lists all the modules. Is this
a right place to have such information? Is this only for the insmod'ed
modules?
After pci_module_init, I have struct pci_driver object that gives me
kobject.
(pci_driver.driver.kobj). But from this kobject, I couldn't find a way to
reach /sys/modules/<my driver kobject>

2. When I used sysfs_create_file() on pci_driver.driver.kobj, the new
attribute
shows up under /sys/pci/drivers/<my driver>/ directory. But how do I
associate
my own show and store to this object?

I overwrote pci_driver.driver.kobj.ktype->sysfs_ops pointer with my own
sysfs_ops
structure pointer. When I cat the new attribute, I get a call to my show
attribute.
However, nothing seems to happen. The struct attribute.name that is passed
to my
show routine is NULL.

What am I doing wrong? Moreover, is it okay to overwrite the default
sysfs_ops
like this? I appreciate any help.

Sincerely,
Sreenivas
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/