From: Andrey Borzenkov <arvidjaar@mail.ru>
To: Olaf Hering <olh@suse.de>
Cc: Greg KH <greg@kroah.com>, jw schultz <jw@pegasys.ws>,
linux-kernel@vger.kernel.org,
linux-hotplug-devel@lists.sourceforge.net
Subject: Re: Does sysfs really provides persistent hardware path to devices?
Date: Sun, 14 Mar 2004 11:53:56 +0000 [thread overview]
Message-ID: <200403141453.59145.arvidjaar@mail.ru> (raw)
In-Reply-To: <20040119130817.GA27953@suse.de>
On Monday 19 January 2004 16:08, Olaf Hering wrote:
> On Sat, Jan 17, Andrey Borzenkov wrote:
> > > > Well, we did not move a tiny bit since the beginning of this thread
> > > > :) You still did not show me namedev configuration that implements
> > > > persistent name for a device based on its physical location :)))
> > >
> > > Ok, do you have any other ideas of how to do this?
> >
> > given current sysfs implementation - using wildcards remains the only
> > solution. I for now am using this trivial script:
> >
> > pts/0}% cat /etc/udev/scripts/removables
> > #!/usr/bin/perl
> >
> > my $devpath, $base;
> >
> > $base = $1 if ($ARGV[0] =~ /(.*\D)\d*$/);
> > $devpath = readlink "/sys/block/$base/device";
> >
> > if ($devpath =~
> > m|/devices/pci0000:00/0000:00:1f.4/usb2/2-2/2-2.4/2-2.4:1.0/host\d+/\d+:0
> >:0:0|) {
> > print "flash0";
> > } elsif ($devpath =~
> > m|/devices/pci0000:00/0000:00:1f.4/usb2/2-2/2-2.1/2-2.1:1.0/host\d+/\d+:0
> >:0:0|) {
> > print "flash1";
> > } elsif ($devpath =~ m|/devices/legacy/host\d+/\d+:0:4:0|) {
> > print "jaz";
> > } else {
> > exit(1);
> > }
>
> I'm not sure what you are trying to do.
I am trying to assign name for a USB slot on my PCs front so that when I plug
in USB stick or USB drive or whatever I get the same name. Always.
> Working with the 'physical
> location' of removeable devices will probably fail.
why? The 'physical location' is the only thing that is unlikely to change
unless you physically change you hardware.
Anyway - it appears that udev (as of 022 now) still does not support doing it.
Once more - I want to make sure that SCSI disk plugged in specific USB slot
(that does not ever change) always gets the same name. So that I always know
how to access it.
naive user would think that something like
KERNEL="sd*" BUS="usb" PLACE="2.4:1.0" SYMLINK="flash0/sd%n"
would work. Surely it does not. When udev sees "sd*" it does not see bus USB.
When udev sees bus USB it does not see "sd*". It does (probably) see sd* on
bus SCSI but it does not help me in any way because I have no way to
associate SCSI ID with USB port. While kernel does know that "sda" is a child
of USB port 2.4:0.1 I do not see any way to express it in udev.
Could somebody explain what am I doing wrong. Thank you.
> The usb-storage
> devices here have a serial field, I really hope it is unique, use it.
Sigh ... let me quote:
> I have 6 different firewire hard drives, and an iPod, a usb stick, a usb
> stick/camera combo, and a bunch of flash memory products (CF, SM, SD) so
> such a thing would be incredibly useful to me. I'm always modifying my
> fstab to keep things in order.
so you suggest him to add every device separately? And if he has half a dozen
friends having half a dozen devices each - do you suggest adding yet another
40 lines for all of them? And keep it in sync with all updates and upgrades?
On the contrary he likely has just a couple of USB ports and one firewire and
he just needs three lines for *any* device which is ever going to be plugged
in. Or he would need if it was supported.
thank you
-andrey
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
WARNING: multiple messages have this Message-ID (diff)
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: Olaf Hering <olh@suse.de>
Cc: Greg KH <greg@kroah.com>, jw schultz <jw@pegasys.ws>,
linux-kernel@vger.kernel.org,
linux-hotplug-devel@lists.sourceforge.net
Subject: Re: Does sysfs really provides persistent hardware path to devices?
Date: Sun, 14 Mar 2004 14:53:56 +0300 [thread overview]
Message-ID: <200403141453.59145.arvidjaar@mail.ru> (raw)
In-Reply-To: <20040119130817.GA27953@suse.de>
On Monday 19 January 2004 16:08, Olaf Hering wrote:
> On Sat, Jan 17, Andrey Borzenkov wrote:
> > > > Well, we did not move a tiny bit since the beginning of this thread
> > > > :) You still did not show me namedev configuration that implements
> > > > persistent name for a device based on its physical location :)))
> > >
> > > Ok, do you have any other ideas of how to do this?
> >
> > given current sysfs implementation - using wildcards remains the only
> > solution. I for now am using this trivial script:
> >
> > pts/0}% cat /etc/udev/scripts/removables
> > #!/usr/bin/perl
> >
> > my $devpath, $base;
> >
> > $base = $1 if ($ARGV[0] =~ /(.*\D)\d*$/);
> > $devpath = readlink "/sys/block/$base/device";
> >
> > if ($devpath =~
> > m|/devices/pci0000:00/0000:00:1f.4/usb2/2-2/2-2.4/2-2.4:1.0/host\d+/\d+:0
> >:0:0|) {
> > print "flash0";
> > } elsif ($devpath =~
> > m|/devices/pci0000:00/0000:00:1f.4/usb2/2-2/2-2.1/2-2.1:1.0/host\d+/\d+:0
> >:0:0|) {
> > print "flash1";
> > } elsif ($devpath =~ m|/devices/legacy/host\d+/\d+:0:4:0|) {
> > print "jaz";
> > } else {
> > exit(1);
> > }
>
> I'm not sure what you are trying to do.
I am trying to assign name for a USB slot on my PCs front so that when I plug
in USB stick or USB drive or whatever I get the same name. Always.
> Working with the 'physical
> location' of removeable devices will probably fail.
why? The 'physical location' is the only thing that is unlikely to change
unless you physically change you hardware.
Anyway - it appears that udev (as of 022 now) still does not support doing it.
Once more - I want to make sure that SCSI disk plugged in specific USB slot
(that does not ever change) always gets the same name. So that I always know
how to access it.
naive user would think that something like
KERNEL="sd*" BUS="usb" PLACE="2.4:1.0" SYMLINK="flash0/sd%n"
would work. Surely it does not. When udev sees "sd*" it does not see bus USB.
When udev sees bus USB it does not see "sd*". It does (probably) see sd* on
bus SCSI but it does not help me in any way because I have no way to
associate SCSI ID with USB port. While kernel does know that "sda" is a child
of USB port 2.4:0.1 I do not see any way to express it in udev.
Could somebody explain what am I doing wrong. Thank you.
> The usb-storage
> devices here have a serial field, I really hope it is unique, use it.
Sigh ... let me quote:
> I have 6 different firewire hard drives, and an iPod, a usb stick, a usb
> stick/camera combo, and a bunch of flash memory products (CF, SM, SD) so
> such a thing would be incredibly useful to me. I'm always modifying my
> fstab to keep things in order.
so you suggest him to add every device separately? And if he has half a dozen
friends having half a dozen devices each - do you suggest adding yet another
40 lines for all of them? And keep it in sync with all updates and upgrades?
On the contrary he likely has just a couple of USB ports and one firewire and
he just needs three lines for *any* device which is ever going to be plugged
in. Or he would need if it was supported.
thank you
-andrey
next prev parent reply other threads:[~2004-03-14 11:53 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-18 6:21 "Andrey Borzenkov"
2003-08-18 20:42 ` your mail Greg KH
2003-08-31 10:54 ` Does sysfs really provides persistent hardware path to devices? Andrey Borzenkov
2003-09-24 21:18 ` Greg KH
2004-01-17 20:34 ` Andrey Borzenkov
2004-01-17 20:34 ` Andrey Borzenkov
2004-01-17 21:34 ` Greg KH
2004-01-17 21:34 ` Greg KH
2004-01-18 1:03 ` Kay Sievers
2004-01-18 14:05 ` Kay Sievers
2004-01-19 19:51 ` Greg KH
2004-03-14 19:25 ` Horst von Brand
2004-03-14 19:25 ` Horst von Brand
2004-01-19 13:08 ` Olaf Hering
2004-01-19 13:08 ` Olaf Hering
2004-01-19 13:59 ` Andries Brouwer
2004-01-19 13:59 ` Andries Brouwer
2004-01-19 14:04 ` Olaf Hering
2004-01-19 14:04 ` Olaf Hering
2004-03-14 11:53 ` Andrey Borzenkov [this message]
2004-03-14 11:53 ` Andrey Borzenkov
-- strict thread matches above, loose matches on Subject: below --
2003-08-19 17:56 David Brownell
2003-07-26 16:36 Andrey Borzenkov
2003-07-26 16:43 ` Randy.Dunlap
2003-07-26 16:50 ` Greg KH
2003-07-28 16:44 ` Andrey Borzenkov
2003-07-28 17:03 ` Greg KH
2003-08-17 16:41 ` Andrey Borzenkov
2003-08-17 18:28 ` Greg KH
2003-08-18 2:04 ` jw schultz
2003-08-18 20:47 ` Greg KH
2003-07-26 16:54 ` OSDL
2003-07-26 16:59 ` J.C. Wren
2003-07-26 17:07 ` Greg KH
2003-07-26 22:51 ` Dax Kelson
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=200403141453.59145.arvidjaar@mail.ru \
--to=arvidjaar@mail.ru \
--cc=greg@kroah.com \
--cc=jw@pegasys.ws \
--cc=linux-hotplug-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=olh@suse.de \
/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.