All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Patrick Mansfield <patmans@us.ibm.com>
Cc: linux-hotplug-devel@lists.sourceforge.net, dm-devel@redhat.com
Subject: Re: udev user specified or human readable /dev names
Date: Wed, 2 Nov 2005 01:05:31 +0100	[thread overview]
Message-ID: <20051102000531.GB17207@vrfy.org> (raw)
In-Reply-To: <20051101225357.GA13215@us.ibm.com>

On Tue, Nov 01, 2005 at 02:53:57PM -0800, Patrick Mansfield wrote:
> Per posts and an accepted patch on dm-devel about dm multipath user
> friendly names:
> 
> https://www.redhat.com/archives/dm-devel/2005-October/msg00004.html
> https://www.redhat.com/archives/dm-devel/2005-October/msg00067.html
> 
> But the above is a dm multipath only solution.
> 
> It's a good idea to allow user specified names on top of the
> /dev/disk/by-* device names. Though dm likely needs a dm_id in order to
> support the method outlined here.
> 
> If we could set and compare environment variables

Sure we can do that with ENV. '=' sets, '==' compares.

> or compare SYMLINK,

How would we compare the list of sysmlinks?
True, if on of them matches?

> separate rules file (doesn't have to be separate, just seems like a good
> idea) could be used to add symlinks to user specified names.

All the persistent symlinks are composed from variables still available
to match anytime later to add more links.

> i.e. move udev_rules.c:apply_format() into udev_utils.c, and call it
> before comparison as well as before (AFAIUI) generating names, though I
> somehow doubt the change is that simple.
> 
> Then, we could have rules like:
> 
> KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_FULL_PATH}="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
> ENV{ID_FULL_PATH}=="?*", SYMLINK+="$env{ID_FULL_PATH}"

Hmm, why this indirection? Can't you just use ID_SERIAL and ID_BUS in
the second rule again?

> And for each device that we want to give a user specified name, use (would
> also need partition specific rules):
> 
> ENV{ID_FULL_PATH}=="disk/by-id/scsi-360a98000686f68656c6e7a416f4b6849" SYMLINK+="media-files"
> 
> And similar for the other disk/by-* methods.
>
> Any comments on the above? 
>
> Is my rule just wrong, or is there a better method?
> 
> Running with udev 069 on FC rawhide, with these rules:
> 
> SYMLINK=="*foo*" SYMLINK+="user/bar"

SYMLINK lists can't be matched until now.

> KERNEL="sdm" ENV{VAL1}="somevalue"
> KERNEL="sdm" ENV{VAL2}="$env{VAL1}"

The value does not get expanded at the time you assign it, so the later compare
will look like:
  'somevalue' == '$env{VAL1}'

which does not match.

> KERNEL="sdm" SYMLINK+="user/show-val1-$env{VAL1}"
> KERNEL="sdm" SYMLINK+="user/show-val2-$env{VAL2}"
> 
> ENV{VAL1}=="somevalue" SYMLINK+="user/val1"
> ENV{VAL2}=="somevalue" SYMLINK+="user/val2"
> 
> Do not work as might be expected: since the env values are not expanded,
> the last rule never matches, and user/val2 link is never created. The
> above generated (sdaz is the last device found):
> 
> [elm3a49 ~]$ ls -l /dev/user
> total 0
> lrwxrwxrwx  1 root root 7 Nov  1 14:18 bar -> ../sdaz
> lrwxrwxrwx  1 root root 6 Nov  1 14:18 show-val1-somevalue -> ../sdm
> lrwxrwxrwx  1 root root 6 Nov  1 14:18 show-val2-somevalue -> ../sdm
> lrwxrwxrwx  1 root root 6 Nov  1 14:18 val1 -> ../sdm

Thanks,
Kay


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php

WARNING: multiple messages have this Message-ID (diff)
From: Kay Sievers <kay.sievers@vrfy.org>
To: Patrick Mansfield <patmans@us.ibm.com>
Cc: linux-hotplug-devel@lists.sourceforge.net, dm-devel@redhat.com
Subject: Re: udev user specified or human readable /dev names
Date: Wed, 02 Nov 2005 00:05:31 +0000	[thread overview]
Message-ID: <20051102000531.GB17207@vrfy.org> (raw)
In-Reply-To: <20051101225357.GA13215@us.ibm.com>

On Tue, Nov 01, 2005 at 02:53:57PM -0800, Patrick Mansfield wrote:
> Per posts and an accepted patch on dm-devel about dm multipath user
> friendly names:
> 
> https://www.redhat.com/archives/dm-devel/2005-October/msg00004.html
> https://www.redhat.com/archives/dm-devel/2005-October/msg00067.html
> 
> But the above is a dm multipath only solution.
> 
> It's a good idea to allow user specified names on top of the
> /dev/disk/by-* device names. Though dm likely needs a dm_id in order to
> support the method outlined here.
> 
> If we could set and compare environment variables

Sure we can do that with ENV. '=' sets, '=' compares.

> or compare SYMLINK,

How would we compare the list of sysmlinks?
True, if on of them matches?

> separate rules file (doesn't have to be separate, just seems like a good
> idea) could be used to add symlinks to user specified names.

All the persistent symlinks are composed from variables still available
to match anytime later to add more links.

> i.e. move udev_rules.c:apply_format() into udev_utils.c, and call it
> before comparison as well as before (AFAIUI) generating names, though I
> somehow doubt the change is that simple.
> 
> Then, we could have rules like:
> 
> KERNEL="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}="?*", ENV{ID_FULL_PATH}="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
> ENV{ID_FULL_PATH}="?*", SYMLINK+="$env{ID_FULL_PATH}"

Hmm, why this indirection? Can't you just use ID_SERIAL and ID_BUS in
the second rule again?

> And for each device that we want to give a user specified name, use (would
> also need partition specific rules):
> 
> ENV{ID_FULL_PATH}="disk/by-id/scsi-360a98000686f68656c6e7a416f4b6849" SYMLINK+="media-files"
> 
> And similar for the other disk/by-* methods.
>
> Any comments on the above? 
>
> Is my rule just wrong, or is there a better method?
> 
> Running with udev 069 on FC rawhide, with these rules:
> 
> SYMLINK="*foo*" SYMLINK+="user/bar"

SYMLINK lists can't be matched until now.

> KERNEL="sdm" ENV{VAL1}="somevalue"
> KERNEL="sdm" ENV{VAL2}="$env{VAL1}"

The value does not get expanded at the time you assign it, so the later compare
will look like:
  'somevalue' = '$env{VAL1}'

which does not match.

> KERNEL="sdm" SYMLINK+="user/show-val1-$env{VAL1}"
> KERNEL="sdm" SYMLINK+="user/show-val2-$env{VAL2}"
> 
> ENV{VAL1}="somevalue" SYMLINK+="user/val1"
> ENV{VAL2}="somevalue" SYMLINK+="user/val2"
> 
> Do not work as might be expected: since the env values are not expanded,
> the last rule never matches, and user/val2 link is never created. The
> above generated (sdaz is the last device found):
> 
> [elm3a49 ~]$ ls -l /dev/user
> total 0
> lrwxrwxrwx  1 root root 7 Nov  1 14:18 bar -> ../sdaz
> lrwxrwxrwx  1 root root 6 Nov  1 14:18 show-val1-somevalue -> ../sdm
> lrwxrwxrwx  1 root root 6 Nov  1 14:18 show-val2-somevalue -> ../sdm
> lrwxrwxrwx  1 root root 6 Nov  1 14:18 val1 -> ../sdm

Thanks,
Kay


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
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

  reply	other threads:[~2005-11-02  0:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01 22:53 udev user specified or human readable /dev names Patrick Mansfield
2005-11-01 22:53 ` Patrick Mansfield
2005-11-02  0:05 ` Kay Sievers [this message]
2005-11-02  0:05   ` Kay Sievers
2005-11-02  0:35   ` Patrick Mansfield
2005-11-02  0:35     ` Patrick Mansfield
2005-11-02  1:06     ` Kay Sievers
2005-11-02  1:06       ` Kay Sievers
2005-11-02  2:01       ` Patrick Mansfield
2005-11-02  2:01         ` Patrick Mansfield
2005-11-02  2:53         ` Kay Sievers
2005-11-02  2:53           ` Kay Sievers
2005-11-02 15:30           ` Patrick Mansfield
2005-11-02 15:30             ` Patrick Mansfield
2005-11-02 23:49             ` Kay Sievers
2005-11-02 23:49               ` Kay Sievers

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=20051102000531.GB17207@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=dm-devel@redhat.com \
    --cc=linux-hotplug-devel@lists.sourceforge.net \
    --cc=patmans@us.ibm.com \
    /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.