* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
@ 2007-02-24 4:48 ` Andrey Borzenkov
2007-02-24 14:34 ` Kay Sievers
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Andrey Borzenkov @ 2007-02-24 4:48 UTC (permalink / raw)
To: linux-hotplug
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1252", Size: 1134 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On СÑббоÑа 24 ÑевÑÐ°Ð»Ñ 2007, Jean Tourrilhes wrote:
> Hi,
>
> I was looking into using the key name RUN and PROGRAM in udev,
> and I realised that udev attempt to run those programs even if they
> don't exist.
Why would you want to set those keys to none-existent program?
- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFF38OaR6LMutpd94wRAgeNAJ4ov2WytfqoaRdfpJxtiV8nm/O3RQCdHdOK
g/BYOwZ32nT36VTUpY1HQE4=IWel
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
2007-02-24 4:48 ` Andrey Borzenkov
@ 2007-02-24 14:34 ` Kay Sievers
2007-02-24 14:58 ` Marco d'Itri
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Kay Sievers @ 2007-02-24 14:34 UTC (permalink / raw)
To: linux-hotplug
On 2/24/07, Jean Tourrilhes <jt@hpl.hp.com> wrote:
> I was looking into using the key name RUN and PROGRAM in udev,
> and I realised that udev attempt to run those programs even if they
> don't exist. This is a bit wasteful timewise...
Well, having rules for non-existent programs seems like the "real
waste", and I call it an configuration error. Care to explain the
benefit of such rules and extension?
Thank,
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
2007-02-24 4:48 ` Andrey Borzenkov
2007-02-24 14:34 ` Kay Sievers
@ 2007-02-24 14:58 ` Marco d'Itri
2007-02-26 17:42 ` Jean Tourrilhes
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Marco d'Itri @ 2007-02-24 14:58 UTC (permalink / raw)
To: linux-hotplug
On Feb 24, Kay Sievers <kay.sievers@vrfy.org> wrote:
> Well, having rules for non-existent programs seems like the "real
> waste", and I call it an configuration error. Care to explain the
> benefit of such rules and extension?
It's useful for distributions because it allows maintaining some rules
in a different package.
OTOH I highly doubt that adding this code is an useful optimization.
--
ciao,
Marco
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
` (2 preceding siblings ...)
2007-02-24 14:58 ` Marco d'Itri
@ 2007-02-26 17:42 ` Jean Tourrilhes
2007-02-27 12:47 ` Kay Sievers
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Jean Tourrilhes @ 2007-02-26 17:42 UTC (permalink / raw)
To: linux-hotplug
On Sat, Feb 24, 2007 at 03:34:34PM +0100, Kay Sievers wrote:
> On 2/24/07, Jean Tourrilhes <jt@hpl.hp.com> wrote:
> > I was looking into using the key name RUN and PROGRAM in udev,
> >and I realised that udev attempt to run those programs even if they
> >don't exist. This is a bit wasteful timewise...
>
> Well, having rules for non-existent programs seems like the "real
> waste", and I call it an configuration error. Care to explain the
> benefit of such rules and extension?
>
> Thank,
> Kay
Hi again,
Sorry for the delay, my wife was keeping me busy over the week
end ;-)
Thanks for your comments. I think you are only looking at it
from a strict udev perspective, while I'm looking at it from the other
end. I'll try to explain it a bit better...
Obviously, you never want to put rules for non-existent
programs. However, life is usually messy, and it's difficult to
guarantee that the rules and the program stays in sync over the full
lifetime of a system. I usually clone my HDD and config files between
the various systems I manage. By accident, the user may have the rules
still exist and the program gone or moved.
Then, I do shell programming, and in shell this type of
conditional construct is quite common. For example, check the
net.agent script in the udev package for the function
check_program(). If it's good practice over there, it's probably good
practice over here.
But, if it was only for those two reasons, I would agree with
you that it's not a big deal. That's why I designed it so that it's as
generic as possible and can be used for many other things.
For example, you can do :
------------------------------------------
KERNEL="sdc1", MODEMASK{/mnt/media}="0100", RUN="mount /dev/%k /mnt/media"
------------------------------------------
You could also do :
------------------------------------------
KERNEL="sdb", MODEMASK{sda}="0001", MODEMASK{sda}="0002", MODE="0666"
------------------------------------------
If you let your imagination wild, you'll probably find many
other use.
Have fun...
Jean
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
` (3 preceding siblings ...)
2007-02-26 17:42 ` Jean Tourrilhes
@ 2007-02-27 12:47 ` Kay Sievers
2007-02-27 17:19 ` Jean Tourrilhes
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Kay Sievers @ 2007-02-27 12:47 UTC (permalink / raw)
To: linux-hotplug
On Mon, 2007-02-26 at 09:42 -0800, Jean Tourrilhes wrote:
> On Sat, Feb 24, 2007 at 03:34:34PM +0100, Kay Sievers wrote:
> > On 2/24/07, Jean Tourrilhes <jt@hpl.hp.com> wrote:
> > > I was looking into using the key name RUN and PROGRAM in udev,
> > >and I realised that udev attempt to run those programs even if they
> > >don't exist. This is a bit wasteful timewise...
> I designed it so that it's as
> generic as possible and can be used for many other things.
> For example, you can do :
> ------------------------------------------
> KERNEL="sdc1", MODEMASK{/mnt/media}="0100", RUN="mount /dev/%k /mnt/media"
> ------------------------------------------
Hmm, this should also work, and give you all the usual shell magic:
RUN+="/bin/sh -c 'test -r /mnt/media && mount $root/%k /mnt/media'"
I doubt that optimizing not to spawn sh is really noticeable.
> You could also do :
> ------------------------------------------
> KERNEL="sdb", MODEMASK{sda}="0001", MODEMASK{sda}="0002", MODE="0666"
> ------------------------------------------
The node usually doesn't exist at this time. :)
Thanks,
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
` (4 preceding siblings ...)
2007-02-27 12:47 ` Kay Sievers
@ 2007-02-27 17:19 ` Jean Tourrilhes
2007-03-16 0:55 ` Kay Sievers
2007-03-16 1:04 ` Jean Tourrilhes
7 siblings, 0 replies; 9+ messages in thread
From: Jean Tourrilhes @ 2007-02-27 17:19 UTC (permalink / raw)
To: linux-hotplug
On Tue, Feb 27, 2007 at 01:47:27PM +0100, Kay Sievers wrote:
> On Mon, 2007-02-26 at 09:42 -0800, Jean Tourrilhes wrote:
>
> > I designed it so that it's as
> > generic as possible and can be used for many other things.
> > For example, you can do :
> > ------------------------------------------
> > KERNEL="sdc1", MODEMASK{/mnt/media}="0100", RUN="mount /dev/%k /mnt/media"
> > ------------------------------------------
>
> Hmm, this should also work, and give you all the usual shell magic:
> RUN+="/bin/sh -c 'test -r /mnt/media && mount $root/%k /mnt/media'"
> I doubt that optimizing not to spawn sh is really noticeable.
During boot time, it's death by the thousands cuts. Spawning a
shell on my box is 4ms.
-------------------------------------------
# time 'test -r /mnt/media'
-su: test -r /mnt/media: No such file or directory
real 0m0.004s
user 0m0.004s
sys 0m0.000s
-------------------------------------------
> > You could also do :
> > ------------------------------------------
> > KERNEL="sdb", MODEMASK{sda}="0001", MODEMASK{sda}="0002", MODE="0666"
> > ------------------------------------------
>
> The node usually doesn't exist at this time. :)
Check again the rule, it's more subtle than that.
> Thanks,
> Kay
Jean
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
` (5 preceding siblings ...)
2007-02-27 17:19 ` Jean Tourrilhes
@ 2007-03-16 0:55 ` Kay Sievers
2007-03-16 1:04 ` Jean Tourrilhes
7 siblings, 0 replies; 9+ messages in thread
From: Kay Sievers @ 2007-03-16 0:55 UTC (permalink / raw)
To: linux-hotplug
On Tue, 2007-02-27 at 09:19 -0800, Jean Tourrilhes wrote:
> On Tue, Feb 27, 2007 at 01:47:27PM +0100, Kay Sievers wrote:
> > On Mon, 2007-02-26 at 09:42 -0800, Jean Tourrilhes wrote:
> >
> > > I designed it so that it's as
> > > generic as possible and can be used for many other things.
> > > For example, you can do :
> > > ------------------------------------------
> > > KERNEL="sdc1", MODEMASK{/mnt/media}="0100", RUN="mount /dev/%k /mnt/media"
> > > ------------------------------------------
> > > You could also do :
> > > ------------------------------------------
> > > KERNEL="sdb", MODEMASK{sda}="0001", MODEMASK{sda}="0002", MODE="0666"
> > > ------------------------------------------
> >
> > The node usually doesn't exist at this time. :)
>
> Check again the rule, it's more subtle than that.
We don't know, if sda is created before sdb. I don't think we should
match on other device properties, that just asks for timing trouble,
especially during coldplug where everything (that hasn't a parent-child
relation) runs in parallel.
How about a TEST{<mask>}=<file> key that accepts the usual:
e, f, d, r, w, x, or an octal bitmask?
It would look like:
TEST{r}="/etc/foo"
TEST{w}="/tmp/foo"
TEST{0002}="/tmp/foo"
I don't think, we should default to /dev, reading from there is nothing
we want to encourage anybody to do. And I think a single key per rule
would be fine for a start.
Thanks,
Kay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: PATCH : new key MODEFILE
2007-02-24 2:36 PATCH : new key MODEFILE Jean Tourrilhes
` (6 preceding siblings ...)
2007-03-16 0:55 ` Kay Sievers
@ 2007-03-16 1:04 ` Jean Tourrilhes
7 siblings, 0 replies; 9+ messages in thread
From: Jean Tourrilhes @ 2007-03-16 1:04 UTC (permalink / raw)
To: linux-hotplug
On Fri, Mar 16, 2007 at 01:55:40AM +0100, Kay Sievers wrote:
> On Tue, 2007-02-27 at 09:19 -0800, Jean Tourrilhes wrote:
> >
> > Check again the rule, it's more subtle than that.
>
> We don't know, if sda is created before sdb. I don't think we should
> match on other device properties, that just asks for timing trouble,
> especially during coldplug where everything (that hasn't a parent-child
> relation) runs in parallel.
Ok, I admit that my rule was contrieved. And most likely useless.
>
> How about a TEST{<mask>}=<file> key that accepts the usual:
> e, f, d, r, w, x, or an octal bitmask?
> It would look like:
> TEST{r}="/etc/foo"
> TEST{w}="/tmp/foo"
> TEST{0002}="/tmp/foo"
It seems to me that accepting the letters would be a lot of
work, because of the variety of combinations, unless we can grab that
from a library. But we don't want to depend on libraries.
As the setting of mode with MODE="" seems to accept only octal
bitmask, I was trying to match both with the same functionality. In
any case, if you implement letters, MODE="" would be the first place
where I would use it ;-)
> I don't think, we should default to /dev, reading from there is nothing
> we want to encourage anybody to do. And I think a single key per rule
> would be fine for a start.
>
> Thanks,
> Kay
Thinking over it, we may want to think a bit more about
it. Just drop it in your todo list and in a few months check if it
still make sense. I use that method to great effect ;-)
Thanks, and have fun...
Jean
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
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
^ permalink raw reply [flat|nested] 9+ messages in thread