mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: Greg KH <greg@kroah.com>, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] /sys/block -> /sys/class/block  (Fedora 3 & 4	testers wanted)
Date: Thu, 24 May 2007 16:07:08 +0200	[thread overview]
Message-ID: <1180015628.3579.41.camel@lov.localdomain> (raw)
In-Reply-To: <4654A581.6010201@msgid.tls.msk.ru>

On Thu, 2007-05-24 at 00:35 +0400, Michael Tokarev wrote:
> Greg KH wrote:
> []
> > From: Kay Sievers <kay.sievers@vrfy.org>
> > Subject: Driver core: convert block from raw kobjects to core devices
> > 
> > This moves the block devices to /sys/class/block. It will create a
> > flat list of all block devices, with the disks and partitions in one
> > directory. For compatibility /sys/block is created and contains symlinks
> > to the disks.
> 
> What's the proper way now to figure out which device type it is --
> block or char?

>From the "subsystem" value of the device, only if it's "block" it's a
block node, everything else is a char node.

> Before, I had a function (in my udev-alike userspace app), something akin
> sysfs_scan_devices(char *topdir, mode_t type), and called it twice --
> 
>   sysfs_scan_devices("/block", S_IFBLK);
>   sysfs_scan_devices("/devices", S_IFCHR);
> 
> How it's supposed to work now?

You need to resolve the symlink, back to the originating subsystem the
device belongs to.
Just better read the flat directories /sys/bus/*/devices/*, /sys/class/*/*,
and you get the subsystem values for free, instead of searching through
the directory tree in /sys/devices/.

> (Note that it skips symlinks for obvious
> reason, hence it can't find anything in /sys/block, even with the compat
> "layer" in place)

Everything can be a symlink or a directory, you can't assume one or the
other. You better start from the buses and classes. The udevtrigger code
or the HAL coldplug code work with all versions of sysfs, just look at
these as an example.

Thanks,
Kay


  reply	other threads:[~2007-05-24 14:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-21 23:53 Greg KH
2007-05-22  8:25 ` Cornelia Huck
2007-05-22 16:28   ` Cornelia Huck
2007-05-23  0:32     ` Greg KH
2007-05-23  5:39       ` Cornelia Huck
2007-05-23 18:08         ` Greg KH
2007-05-23 20:34           ` Michael Tokarev
2007-05-23 20:35           ` Michael Tokarev
2007-05-24 14:07             ` Kay Sievers [this message]
2007-05-24  6:51           ` Cornelia Huck
2007-06-03 18:39 Alan Stern

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=1180015628.3579.41.camel@lov.localdomain \
    --to=kay.sievers@vrfy.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjt@tls.msk.ru \
    /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®