From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] Interface to PCI device list
Date: Tue, 05 Sep 2006 10:05:06 +0000 [thread overview]
Message-ID: <20060905120506.616c1450.khali@linux-fr.org> (raw)
In-Reply-To: <20060902164248.9a0075e4.khali@linux-fr.org>
> > I'd recommend using sysfs, and following the rules of walking the tree
> > and not relying on specific files to be present that might not be in the
> > future. Also please be able to handle any directory turning into a
> > symlink at any point in the future too, but since you aren't messing
> > with the /sys/class/ directories, I don't think this will be a problem
> > for you.
>
> I don't see how it can be a problem at all, given that symbolic links
> are meant to be transparent to applications by design. I know recent
> events prove me wrong though :(
>
> My algorithm is simple, I do (pseudocode):
>
> opendir("/sys/bus/pci/devices")
> for each entry that matches %x:%x:%x.%x (or %x:%x.%x, just in case),
> add an element to my list of pci devices
> read attribute file "vendor" and store the value
> read attribute file "device" and store the value
> read attribute file "class" and store the value
> closedir("/sys/bus/pci/devices")
>
> Now I admit that the code getting the info from /proc was more compact,
> but it misses the domain and the class, and adding them would make the
> code MUCH more complex, so I'm not gonna do it.
>
> I attached the real code in case someone wants to take a look and
> comment. I'll probably apply it soon if no objections arise.
I just applied a cleaned-up version of this patch to SVN.
--
Jean Delvare
prev parent reply other threads:[~2006-09-05 10:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-02 14:42 [lm-sensors] Interface to PCI device list Jean Delvare
2006-09-02 18:30 ` Greg KH
2006-09-02 20:41 ` Jean Delvare
2006-09-03 1:56 ` Greg KH
2006-09-03 8:28 ` Jean Delvare
2006-09-05 10:05 ` Jean Delvare [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060905120506.616c1450.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.