mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Rob Landley <rob@landley.net>
Cc: linux-kernel@vger.kernel.org, "Greg KH" <greg@kroah.com>,
	Michael-Luke Jones <mlj28@cam.ac.uk>,
	Krzysztof Halasa <khc@pm.waw.pl>, Rod Whitby <rod@whitby.id.au>,
	Russell King <rmk@arm.linux.org.uk>,
	david@lang.hm
Subject: Re: Documentation for sysfs, hotplug, and firmware loading.
Date: Thu, 19 Jul 2007 10:16:17 +0200	[thread overview]
Message-ID: <20070719101617.08c867a7@gondolin.boeblingen.de.ibm.com> (raw)
In-Reply-To: <200707181339.54192.rob@landley.net>

On Wed, 18 Jul 2007 13:39:53 -0400,
Rob Landley <rob@landley.net> wrote:

> Nope.  If you recurse down under /sys/class following symlinks, you go into an 
> endless loop bouncing off of /sys/devices and getting pointed back.  If you 
> don't follow symlinks, it works fine up until about 2.6.20 at which point 
> things that were previously directories BECAME symlinks because the 
> directories got moved, and it all broke.

I have no idea what you're doing.

> Which is why I want it documented where to look for these suckers.  Just give 
> me ONE STABLE WAY TO FIND THIS INFORMATION, PLEASE.

See Documentation/sysfs-rules.txt.

> This document is trying to document just enough information to make hotplug 
> work using sysfs (which includes firmware loading if necessary).
> 
> > (And how about referring to Documentation/sysfs-rules.txt?)
> 
> Because there isn't one in 2.6.22, and I've been writing this file on and off 
> for a month as I tracked down various bits of information?

That was a _suggestion_.

> I know.  I'm just trying to show people how to do it.  Notice that this script 
> doesn't DO anything, it just dumps the variables (and proves 
> that /sys/hotplug got called).  You're worried about the scalability of a 
> debugging script.

If you use bash scripts as examples, people will write bash scripts.

> (Rummage)  Seems to be "add, remove, change, online, offline, move"?
> 
> I can list 'em.  Now I'm vaguely curious what generates online and offline 
> events (MII transciever state transitions on a network card, or does this 
> have to do with power saving modes?)  And I have no idea what the difference 
> between "change" and "move" is....

"change" - something about the device has changed
"move" - the device is in a different position in the tree now

You may want to grep for the usage...

> 
> > >   DEVPATH
> > >     Path under /sys at which this device's sysfs directory can be found.
> > >     If $DEVPATH begins with /block/ the event refers to a block device,
> > >     otherwise it refers to a char device.
> >
> > Huh? That's just the path in sysfs. And there's more than block and
> > char :) Check SUBSYSTEM for what your device actually is.
> 
> If you are doing mknod, you need three pieces of information:
> 1) Major, 2) Minor, 3) Block or Char device.  That's pretty much it.  If 
> you're trying to populate /dev you need that info.
> 
> > >   SUBSYSTEM
> > >     If this is "block", it's a block device.  Anything else is a char
> > > device.
> >
> > No. For devices, SUBSYSTEM may be the class (like 'scsi_device') or the
> > bus (like 'pci').
> 
> Do you make a /dev node for either one?
> 
> I'm trying to, at minimum, document what you pass to mknod.  I consider it 
> important to know.

The problem is that your information is wrong. Imagine someone reading
this document, thinking "cool, I'll create a char node if
SUBSYSTEM!=block" and subsequently getting completely confused about
all those SUBSYSTEM==pci events.

> 
> > >   DRIVER
> > >     If present, a suggested driver (module) for handling this device.  No
> > >     relation to whether or not a driver is currently handling the device.
> >
> > No, this actually is the current driver.
> 
> I've had it suggest drivers for devices that didn't have any loaded, and I had 
> it _not_ specify drivers for devices that were loaded.  (I checked.)

The code disagrees with you. If a driver matches and probing succeeds,
it will be specified, otherwise not. Maybe you were checking the wrong
devices?

> Ah yes.  I replied to that when it was first posted.  It's still "here's a 
> list of things NOT to do" rather then telling you what you CAN do.  I'm 
> trying to document what you can do.
> 
> Useful documentation is not "Doing THIS is forbidden.  Doing THIS is 
> forbidden.  Doing THIS is forbidden.  What are you allowed to do?  Guess!  
> Oh, and anything I didn't explicitly mention could change at any time.  Have 
> fun."

It _does_ specify what you may rely on. Don't rely on anything else.

> Sysfs CAN export a stable API.  It may only be a subset of what it's 
> exporting, but it can still do so.

And that is exactly what sysfs-rules.txt is doing. I don't understand
your problem.

If you think that getting this information from sysfs-rules.txt could
be made easier, do a patch against it.

  parent reply	other threads:[~2007-07-19  8:16 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-17 21:03 Rob Landley
2007-07-17 21:55 ` Randy Dunlap
2007-07-18  7:58 ` Cornelia Huck
2007-07-18 17:39   ` Rob Landley
2007-07-18 23:33     ` Kay Sievers
2007-07-20  5:14       ` Rob Landley
2007-07-20  7:00         ` Greg KH
2007-07-20  7:54           ` Cornelia Huck
2007-07-20  8:09             ` Greg KH
2007-07-21  3:48               ` Rob Landley
2007-07-21  6:23           ` Rob Landley
2007-07-18 23:40     ` Greg KH
2007-07-21  0:37       ` Rob Landley
2007-07-19  8:16     ` Cornelia Huck [this message]
2007-07-21  0:21       ` Rob Landley
2007-07-21  0:43         ` Greg KH
2007-07-23 23:26           ` Rob Landley
2007-07-24  7:38             ` Cornelia Huck
2007-07-21  0:49         ` Greg KH
2007-07-21  0:52         ` Greg KH
2007-07-21  6:32           ` Rob Landley
2007-07-18 10:33 ` Kay Sievers
     [not found] <8I2t1-7jt-5@gated-at.bofh.it>
     [not found] ` <8IlPa-3Gl-61@gated-at.bofh.it>
     [not found]   ` <8IzyM-86P-47@gated-at.bofh.it>
     [not found]     ` <8Jb1c-7vL-3@gated-at.bofh.it>
     [not found]       ` <8Jbuh-84N-3@gated-at.bofh.it>
2007-07-21 12:14         ` Bodo Eggert
2007-07-23 21:49           ` Rob Landley
2007-08-05 12:57             ` Bodo Eggert
2007-07-24  6:38           ` Greg KH
2007-07-25 19:28             ` Rob Landley

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=20070719101617.08c867a7@gondolin.boeblingen.de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=david@lang.hm \
    --cc=greg@kroah.com \
    --cc=khc@pm.waw.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlj28@cam.ac.uk \
    --cc=rmk@arm.linux.org.uk \
    --cc=rob@landley.net \
    --cc=rod@whitby.id.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®