1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-11-01 09:21:11 +03:00
Commit Graph

57 Commits

Author SHA1 Message Date
kay.sievers@vrfy.org
0345b86235 [PATCH] add enum tests
On Fri, Sep 10, 2004 at 01:09:07PM -0700, Greg KH wrote:
> On Tue, Sep 07, 2004 at 01:19:34PM +0200, David Zeuthen wrote:
> >
> >         KERNEL="sr*", NAME="%k", SYMLINK="cdrom%e"
> >         KERNEL="scd*", NAME="%k", SYMLINK="cdrom%e"
> >         KERNEL="pcd*", NAME="%k", SYMLINK="cdrom%e"
> >         KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="\%k", SYMLINK="cdrom%e"
> >         KERNEL="fd[0-9]", NAME="%k", SYMLINK="floppy%e"
> >         KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy", NAME=\"%k", SYMLINK="floppy%e"
> >
> > New patch is attached.
>
> Nice, I've applied this.
>
> How about sending a patch for the test/udev-test.pl script that adds a
> test for this new paramater, so we make sure to not break it in the
> future.

Here are the tests for the enumeration character %e. I've added a option
string to be able to do a whole sequence of tests without node removal,
so we can skip the "remove" event and get an increasing number to append
to the name. After the sequence test the whole directory is cleaned for
the next tests.
2005-04-26 21:37:01 -07:00
kay.sievers@vrfy.org
3db7fa2702 [PATCH] fix udev segfaults with bad permissions file
On Tue, Sep 14, 2004 at 02:53:12PM +0200, Loleslaw wrote:
> Hi,
> Since I started using udev-031 on my gentoo udevstart would just segfault
> (udev-030 worked). As it turned out I had a file in /etc/udev/permissions.d
> with a single space in one line. I've cleaned the file and it works all
> right, but I thought you could be interested.
> I've traced it to function namedev_init_permissions in namedev_parse.c
> I don't know C well enough to suggest a patch.

Yeah, thanks for pointing that out. It only happens if the file ends with
whitespace-only lines. Here is a fix and a test for udev-test.pl to
cover that case.
2005-04-26 21:37:01 -07:00
greg@kroah.com
0f36e68e8a [PATCH] add test for ! in partition name 2005-04-26 21:35:47 -07:00
greg@kroah.com
b86691919a [PATCH] Added expanded tests to the test framework from Leann Ogasawara <ogasawara@osdl.org> 2005-04-26 21:35:15 -07:00
kay.sievers@vrfy.org
bbbe503ec1 [PATCH] netdev - udevdb+dev.d changes
Here is a patch to change the netdev handling in the database and for
the dev.d/ calls. I applies on top of the udevd.patch, cause klibc has
no sysinfo().

 o netdev's are also put into our database now. I want this for the
   udevruler gui to get a list of all handled devices.
   All devices in the db are stamped with the system uptime value at
   the creation time. 'udevinfo -d' prints it.

 o the DEVPATH value is the key for udevdb, but if we rename
   a netdev, the name is replaced in the kernel, so we add
   the changed name to the db to match with the remove event.

   NOTE: The dev.d/ scripts still get the original name from the
   hotplug call. Should we replace DEVPATH with the new name too?

 o We now only add a device to the db, if we have successfully created
   the main node or successfully renamed a netdev. This is the main part
   of the patch, cause I needed to clean the retval passing trough all
   the functions used for node creation.

 o DEVNODE sounds a bit ugly for netdev's so I exported DEVNAME too.
   Can we change the name?

 o I've added a UDEV_NO_DEVD to possibly skip the script execution
   and used it in udev-test.pl.
   udevstart is the same horror now, if you have scripts with logging
   statements in dev.d/ it takes minutes to finish, can we skip the
   scripts here too?

 o The get_device_type() function is changed to be more strict, cause
   'udevinfo -a -p /block/' gets a class device for it and tries to
   print the major/minor values.

 o bugfix, the RESULT value has now a working newline removal and a test
   for this case.
2005-04-26 21:35:13 -07:00
kay.sievers@vrfy.org
f61d732a02 [PATCH] hmm, handle net devices with udev?
Hmm, Arndt Bergmann sent a patch like this one a few weeks ago and
I want to bring the question back, if we want to handle net device
naming with udev.

With this patch it is actually possible to specify something like this
in udev.rules:

  KERNEL="dummy*", SYSFS{address}="00:00:00:00:00:00", SYSFS{features}="0x0", NAME="blind%n"
  KERNEL="eth*", SYSFS{address}="00:0d:60:77:30:91", NAME="private"

and you will get:

  [root@pim udev.kay]# cat /proc/net/dev
  Inter-|   Receive                                                | Transmit
   face |bytes    packets errs drop fifo frame compressed multicast|bytes   packets errs drop fifo colls carrier compressed
       lo:    1500     30    0    0    0     0          0         0    1500      30    0    0    0     0       0          0
  private:  278393   1114    0    0    0     0          0         0  153204    1468    0    0    0     0       0          0
     sit0:       0      0    0    0    0     0          0         0       0       0    0    0    0     0       0          0
   blind0:       0      0    0    0    0     0          0         0       0       0    0    0    0     0       0          0


The udevinfo program is also working:

  [root@pim udev.kay]# ./udevinfo -a -p /sys/class/net/private
    looking at class device '/sys/class/net/private':
      SYSFS{addr_len}="6"
      SYSFS{address}="00:0d:60:77:30:91"
      SYSFS{broadcast}="ff:ff:ff:ff:ff:ff"
      SYSFS{features}="0x3a9"
      SYSFS{flags}="0x1003"
      SYSFS{ifindex}="2"
      SYSFS{iflink}="2"
      SYSFS{mtu}="1500"
      SYSFS{tx_queue_len}="1000"
      SYSFS{type}="1"

  follow the class device's "device"
    looking at the device chain at '/sys/devices/pci0000:00/0000:00:1e.0/0000:02:01.0':
      BUS="pci"
      ID="0000:02:01.0"
      SYSFS{class}="0x020000"
      SYSFS{detach_state}="0"
      SYSFS{device}="0x101e"
      SYSFS{irq}="11"
      SYSFS{subsystem_device}="0x0549"
      SYSFS{subsystem_vendor}="0x1014"
      SYSFS{vendor}="0x8086"


The matching device will be renamed to the given name. The device name
will not be put into the udev database, cause the kernel renames the
device and the sysfs name disappears.

I like it, cause it plugs in nicely. We have all the naming features
and sysfs queries and walks inside of  udev. The sysfs timing races
are already solved and the management tools are working for net devices
too. nameif can only match the MAC address now. udev can match any sysfs
value of the device tree the net device is connected to.
But right, net devices do not have device nodes :)
2005-04-26 21:35:12 -07:00
kay.sievers@vrfy.org
c013b034ae [PATCH] udev-test.pl cleanup
Here is a small name change, so all expected values are named exp_*
2005-04-26 21:35:10 -07:00
greg@kroah.com
7d12d4e175 [PATCH] add big major tests to udev-test.pl 2005-04-26 21:35:09 -07:00
greg@kroah.com
a5e8d2b4a3 [PATCH] add a test for a minor over 255 2005-04-26 21:35:09 -07:00
greg@kroah.com
7ddb6f47d7 [PATCH] udev-test.pl: print out major:minor and perm test "ok" if is ok. 2005-04-26 21:35:09 -07:00
greg@kroah.com
b9a88fe756 [PATCH] make perm and major:minor test errors be reported properly. 2005-04-26 21:35:09 -07:00
kay.sievers@vrfy.org
fa19f1811c [PATCH] add dev node test to udev-test.pl
> Nice, that's a good start.  Now we need to check the major:minor values
> too somehow...

I better do it immediately, before you put it in the empty TODO :)

Patch is a bit big, cause spaces are changed to tabs to get
space for the longer names.
2005-04-26 21:35:09 -07:00
kay.sievers@vrfy.org
c612a0acc8 [PATCH] add permission tests
> Any chance on being able to add a test for this kind of stuff to the
> udev-test.pl script?

Sure, not brilliant but seems to work :)
Only numeric id's are supported so far.
2005-04-26 21:35:09 -07:00
kay.sievers@vrfy.org
0a5417a0eb [PATCH] "symlink only" test
Here is a test for the "symlink only" rule.

Any reason to do the apply_format() inside the loop?
I've changed it.
2005-04-26 21:35:09 -07:00
kay.sievers@vrfy.org
558f80ba64 [PATCH] callout part selector tweak
Martin Schwenke <martin@meltin.net> asked for this feature and posted a
patch:

 The following patch almost let's me have the following configuration:

  PROGRAM="/sbin/aliaser %b %k %n %M %m", RESULT="?*", NAME="%c{1}", SYMLINK="%c{2+}"

 allowing me to specify an arbitrary number of symlinks by saying
 "giveme the second and later words"."


Here is the actual version with tests and a few words in the man page.
2005-04-26 21:35:09 -07:00
kay.sievers@vrfy.org
35b38379ba [PATCH] cleanup callout fork
Here I change the callout fork logic.
The current cersion is unable to read a pipe which is not flushed at once,
Now we read until it's closed.

The maximum argument count is calculated by the strlen now. We have 100
chars for our result buffer so we can't have more than 50 parameters.
So it's much more clear what will happen now and not some magic boundary
where we use shell behind it.

Parameter can be combined to one by using apostrophes.

this on works now:
  BUS="scsi", PROGRAM="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed  s/foo9/bar9/'", KERNEL="sda3", NAME="%c{7}"

Two new test are also added.
2005-04-26 21:35:09 -07:00
kay.sievers@vrfy.org
d5f91372dd [PATCH] conditional remove of trailing sysfs whitespace
Hey, it may never happen, that one wants to distinguish attributes by
trailing spaces, but we should not lose the control over it, just for
being lazy :)

Here we remove the trailing spaces of the sysfs attribute only if the
configured value to match doesn't have any trailing spaces by itself.
So if you put a attribute in a rule with spaces at the end, the sysfs
attribute _must_ match exactly.

Is that cool for everyone?

As usual, 2 tests are added for it with a artificial sysfs file and
a few words to the man page.
2005-04-26 21:35:08 -07:00
patmans@us.ibm.com
56c963dc4d [PATCH] add tests for NAME="foo-%c{N}"
Here is a patch for some new tests.
2005-04-26 21:35:08 -07:00
kay.sievers@vrfy.org
63ead27c22 [PATCH] udev - activate formt length attribute
We carried the the old callout part selector syntax for two releases
now after it was replaced by the new %c{1} syntax. So here we remove
the old syntax and use the code to possibly specify the maximum count
of chars to insert into the string. It will work with all of our format
chars.
I don't know if somebody will use it, but the code is already there :)

's%3s{vendor}' returns "IBM" now, instead of "IBM-ESXS".

Also added is a test for it and a few words in the man page.
2005-04-26 21:34:29 -07:00
greg@kroah.com
dde05ccb8d [PATCH] remove limit of the number of args passed to PROGRAM
If we go over our internal limit of 7, then we call out to /bin/sh
otherwise we handle it ourself without relying on a shell.
2005-04-26 21:32:31 -07:00
greg@kroah.com
595251156b [PATCH] add a "old style" SYSFS_attribute test to udev-test.pl 2005-04-26 21:32:28 -07:00
kay.sievers@vrfy.org
88f09368b3 [PATCH] udev - switch callout part selector to {attribute}
Here we change the magic callout part number selector to the new
atribute syntax. The syntax to select the second part of the callout string:

 '%2c' is now '%c{2}'

I think it's more clear and we no longer misuse the length argument.

The old syntax is still supported, but we should remove it some
time in the future.
2005-04-26 21:32:28 -07:00
kay.sievers@vrfy.org
16378373cb [PATCH] udev - switch SYSFS_file to SYSFS{file}
Here we switch the configs and man pages to the new attribute syntax.
Also the 'partition trick' is mentioned in udev.8

I think it's more clear visible now, that inside the brackets are user
supplied values used and not some magic keys handled:

  'SYSFS_dev' is now 'SYSFS{dev}'

The old syntax is still supported.
2005-04-26 21:32:28 -07:00
patmans@us.ibm.com
93656247f3 [PATCH] udev add some ID tests
Patch against current udev bk to add a few ID rule tests.
2005-04-26 21:32:28 -07:00
kay.sievers@vrfy.org
50e5de03d1 [PATCH] udev - create all partitions of blockdevice
Here is the first try to create all partitons of a blockdevice, since
removable media devices may need to acces the expected partition to
revalidate the media.

It uses the attribute syntax introduced with the last %s{file} patch.
I'm using this with my multi-slot-flash-card-reader:

  SYSFS{model}="USB Storage-SMC ", NAME{all_partitions}="smartmedia"
  SYSFS{model}="USB Storage-CFC ", NAME{all_partitions}="compactflash"
  SYSFS{model}="USB Storage-MSC ", NAME{all_partitions}="memorystick"
  SYSFS{model}="USB Storage-MMC ", NAME{all_partitions}="multimedia"

and I get:

  tree /udev/
  /udev/
  |-- memorystick
  |-- memorystick1
  |-- memorystick10
  |-- memorystick11
  |-- memorystick12
  |-- memorystick13
  |-- memorystick14
  |-- memorystick15
  |-- memorystick2
  |-- memorystick3
  |-- memorystick4
  |-- memorystick5
  |-- memorystick6
  |-- memorystick7
  |-- memorystick8
  |-- memorystick9
  |-- multimedia
  |-- multimedia1
  |-- multimedia10
  |-- multimedia11
  |-- multimedia12
  |-- multimedia13
  |-- multimedia14
  |-- multimedia15
  |-- multimedia2
  |-- multimedia3
  |-- multimedia4
  |-- multimedia5
  |-- multimedia6
  |-- multimedia7
  |-- multimedia8
  |-- multimedia9
  ...


If needed, we can make the number of partions to create
adjustable with the attribute?
2005-04-26 21:32:28 -07:00
kay.sievers@vrfy.org
bb73864724 [PATCH] allow SYSFS{file}
On Sun, Feb 15, 2004 at 03:36:00AM +0100, Kay Sievers wrote:
>
> Since we have %s{file} it may be nice to allow SYSFS{file}.
> This patch allows:
>
>   BUS="usb", SYSFS{idProduct}="a511", NAME="video%n"
>
> compared to the current:
>
>   BUS="usb", SYSFS_idProduct="a511", NAME="video%n"
>
> The curent syntax is still supported.
> Looks a bit nicer and less hackish, I think.

Better patch with infrastructure to easily implement KEY{attribute}
for every other key. The first user is the SYSFS{file} key.
Both versions, brackets or underscore is supported for the attribute.
2005-04-26 21:32:28 -07:00
kay.sievers@vrfy.org
a27cd06c6d [PATCH] Adding '%s' format specifier to NAME and SYMLINK
On Thu, Feb 12, 2004 at 05:34:57PM -0800, Greg KH wrote:
> On Tue, Feb 10, 2004 at 09:14:20AM +0100, Hannes Reinecke wrote:
> > Hi all,
> >
> > this patch makes the format for NAME and SYMLINK a bit more flexible:
> > I've added a new format specifier '%s{<SYSFS_var>}', which allows for
> > the value of any sysfs entry found for this device to be inserted.
> > Example (for our S/390 fcp adapter):
> >
> > BUS="ccw", SYSFS_devtype="1732/03", NAME="%k" \
> > SYMLINK="zfcp-%s{hba_id}-%s{wwpn}:%s{fcp_lun}"
> >
> > I know this could also be done with an external program, but having this
> > incorporated into udev makes life easier, especially if run from
> > initramfs. Plus it makes the rules easier to follow, as the result is
> > directly visible and need not to be looked up in some external program.
> >
> > Comments etc. welcome.
>
> Oops, sorry I missed this for the 017 release.  I'll look at it tomorrow
> and get back to you.  At first glance it looks like a good thing.
>
> Oh, you forgot to update the documentation, that's important to do if
> you want this change to make it in :)

I took a part of the code and made a version that uses already implemented
attribute finding logic.

The parsing of the format length '%3x' and the '%x{attribute}' is a fuction now,
maybe there are more possible users in the future.

I've also added the test to udev-test.pl.
2005-04-26 21:32:28 -07:00
greg@kroah.com
b9fc973b9a [PATCH] Add another test to udev-test.pl and fix a bug when only running 1 test. 2005-04-26 21:32:27 -07:00
greg@kroah.com
2e31718495 [PATCH] let udev-test.pl run an individual test if you ask it to.
just put the test number on the command line:
	udev-test.pl 3
will run test number 3

If no test number is specified, all of the tests will be run, just like before.
2005-04-26 21:32:26 -07:00
greg@kroah.com
f0142622b8 [PATCH] add a block device with a ! in the name, and a test for this. 2005-04-26 21:32:26 -07:00
greg@kroah.com
724257d97b [PATCH] add support for figuring out which device on the sysfs "chain" the rule applies to.
This should fix one of the more annoying things to me about udev, and
gets rid of a TODO item.
2005-04-26 21:13:17 -07:00
kay.sievers@vrfy.org
7780509143 [PATCH] udev - kill %D from udev-test.pl
Kill the two tests with %D.
2005-04-26 21:13:17 -07:00
kay.sievers@vrfy.org
8ffb636f01 [PATCH] udev - introduce format escape char
This patch adds a '%' to the format char list, so that a external
program may called with a non expanded '%' like:

  PROGRAM="/bin/date +%%s"

Olaf Hering asked for the feature.
A tricky test is also added :)
2005-04-26 21:13:16 -07:00
kay.sievers@vrfy.org
ac28b86d63 [PATCH] udev - drop all methods :)
> Hi,
> as promised yesterday, here is a patch that drops the explicit methods
> given in the udev config and implement only one type of rule.
>
> A rule now consists only of a number of keys to match. All known keys
> are valid in any combination. The former configs should work with a few
> changes:
>
>   o the "<METHOD>, " at the beginning of the line should be removed
>
>   o the result of the externel program is matched with RESULT= instead if ID=
>     the PROGRAM= key is only valid if the program exits with zero
>     (just exit with nozero in a script if the rule should not match)
>
>   o rules are processed in order they appear in the file, no priority
>
>   o if NAME="" is given, udev is instructed to ignore this device,
>     no node will be created
>
>
>   EXAMPLE:
>
>   # combined BUS, SYSFS and KERNEL
>   BUS="usb", KERNEL="video*", SYSFS_model="Creative Labs WebCam*", NAME="test/webcam%n"
>
>   # exec script only for the first ide drive (hda), all other will be skipped
>   BUS="ide", KERNEL="hda*", PROGRAM="/home/kay/src/udev.kay/extras/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c"
>
>
> The udev-test.pl and test.block works fine here.
> Please adapt your config and give it a try.
>


Here is a slightly better version of the patch.
After a conversation with Patrick, we are now able to execute the PROGRAM
and also match in all following rules with the RESULT value from this exec.


EXAMPLE:
  We have 7 rules with RESULT and 2 with PROGRAM.
  Only the 5th rule matches with the callout result from the exec in the 4th rule.

RULES:
  PROGRAM="/bin/echo abc", RESULT="no_match", NAME="web-no-2"
  KERNEL="video*", RESULT="123", NAME="web-no-3"
  KERNEL="video*", RESULT="123", NAME="web-no-4"
  PROGRAM="/bin/echo 123", RESULT="no_match", NAME="web-no-5"
  KERNEL="video*", RESULT="123", NAME="web-yes"


RESULT:
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check PROGRAM
  Jan 11 23:36:52 pim udev[26050]: execute_program: executing '/bin/echo abc'
  Jan 11 23:36:52 pim udev[26050]: execute_program: result is 'abc'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: PROGRAM returned successful
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='no_match', udev->program_result='abc'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='abc'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='abc'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check PROGRAM
  Jan 11 23:36:52 pim udev[26050]: execute_program: executing '/bin/echo 123'
  Jan 11 23:36:52 pim udev[26050]: execute_program: result is '123'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: PROGRAM returned successful
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='no_match', udev->program_result='123'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='123'
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT matches
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: found matching rule, 'video*' becomes ''
  Jan 11 23:36:52 pim udev[26050]: namedev_name_device: name, 'web-yes' is going to have owner='', group='', mode = 0600
2005-04-26 21:13:15 -07:00
greg@kroah.com
64682333bb [PATCH] add tests for LABEL rule with a device that has no bus. 2005-04-26 21:13:11 -07:00
greg@kroah.com
1d936fbca0 [PATCH] If a CALLOUT rule has a BUS id, then we must check to see if the device is on a bus.
Thanks to Martin Schlemmer <azarah@nosferatu.za.org> for pointing this out.
2005-04-26 21:13:11 -07:00
greg@kroah.com
8ff8bbbadd [PATCH] add test for callout rule with a device that has no bus. 2005-04-26 21:13:11 -07:00
kay.sievers@vrfy.org
5cac7def78 [PATCH] fix udev-test.pl
Here is a small fix for udev-test.pl, to print the METHOD also
for the "whitespace config" tests.

  TEST: Handle comment lines in config file (and replace kernel name)
  method '' for 'class/tty/ttyUSB0' expecting node 'visor'
  add: ok    remove: ok
2005-04-26 21:13:10 -07:00
greg@kroah.com
358c8c2023 [PATCH] add tests for multi-file LABEL rules. 2005-04-26 21:13:10 -07:00
greg@kroah.com
281ff00a61 [PATCH] add tests to catch whitespace and comment config file parsing errors. 2005-04-26 21:13:09 -07:00
kay.sievers@vrfy.org
d94df23242 [PATCH] don't rely on field order in namedev_parse
o change the parsing to get a key from the rule and sort it
    into our list of known keys instead of expecting a special order
  o the key to match a sysfs file must be prependend by 'SYSFS_' now
    to match with the new parsing.
    (The config must be changed, but it's a bit more descriptive too.)
  o put names of fields in define's, like the name of the methods
  o update all tests and the man page
2005-04-26 21:13:08 -07:00
kay.sievers@vrfy.org
b1c5e3339d [PATCH] get part of callout return string
Try this patch if you like, to get special parts of the callout output.
This beast works now:
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"

The callout returned string is separated by spaces and is
addressed by the "len" value of the 'c' format char.
Since we support symlinks, this my be useful for other uses of callout too.

  introduce 'len number' for format chars
  the first use is 'c'-the callout return to select a part of the output string like:
  CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c"
  (note: first part is requested by len=1, len=0 will return the whole string)
  add a test to udev-test.pl
2005-04-26 21:13:07 -07:00
greg@kroah.com
525d07e78e [PATCH] change devfs disk name rule from 'disk' to 'disc' 2005-04-26 21:13:07 -07:00
kay.sievers@vrfy.org
4763256c65 [PATCH] allow multiple symlinks
Here is a patch to allow the creation of multiple symlinks.
The names must be separated by a space character.


REPLACE, KERNEL="ttyUSB0", NAME="visor", SYMLINK="first-%n second-%n third-%n"

results in:

Dec  9 05:28:51 pim udev[12019]: create_node: mknod(udev-root/visor, 020666, 188, 0)
Dec  9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/first-0' to node 'visor' requested
Dec  9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/first-0)
Dec  9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/second-0' to node 'visor' requested
Dec  9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/second-0)
Dec  9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/third-0' to node 'visor' requested
Dec  9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/third-0)
2005-04-26 21:13:07 -07:00
kay.sievers@vrfy.org
3d150dfb28 [PATCH] experimental (very simple) SYMLINK creation
> > here is a experimental symlink creation patch - for discussion,
> > in which direction we should go.
> > It is possible now to define SYMLINK= after the NAME= in udev.rules.
> > The link is relative to the node, but the path is not optimized now
> > if the node and the link are in the same nested directory.
> > Only one link is supported, cause i need to sleep now :)
> >
> > 06-simple-symlink-creation.diff
> >   simple symlink creation
> >   reorganized udev-remove to have access to the symlink field
> >   subdir creation/removal are functions now
> >   udev-test.pl tests for link creation/removal

Here is a new version with relative link target path optimization
an better tests in udev-test.pl:

LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"

  Dec  7 06:48:34 pim udev[13789]: create_node: symlink 'udev-root/1/2/c/d/symlink' to node '1/2/a/b/node' requested
  Dec  7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c'
  Dec  7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c/d'
  Dec  7 06:48:34 pim udev[13789]: create_node: symlink(../../a/b/node, udev-root/1/2/c/d/symlink)
2005-04-26 21:13:06 -07:00
kay.sievers@vrfy.org
83be97ba21 [PATCH] pattern match for label method
switch LABEL search to pattern match
  add a test for pattern match in LABEL
  remove useless rule from udev.rules
2005-04-26 21:13:06 -07:00
greg@kroah.com
72ffa78deb [PATCH] fix up the tests to work without all of the environ variables. 2005-04-26 21:13:05 -07:00
kay.sievers@vrfy.org
9f1da36138 [PATCH] pattern matching for namedev
As promised yesterday, here is a patch to implement a more advanced
pattern matching instead of the simple '*'.

We can remove the "tty"="tty" line from udev.rules now and
replace "tty*" by "tty[0-9]*" to catch only the vc's.


  implement pattern matching in namedev
  '*'  - to match zero or more chars
  '?'  - to match exactly one char
  '[]' - character classes with ranges '[0-9]'and negation [!A]
2005-04-26 21:13:05 -07:00
greg@kroah.com
fd9594b61f [PATCH] fix up the tests to support the rules file name change 2005-04-26 21:13:05 -07:00
kay.sievers@vrfy.org
0db6d4cc61 [PATCH] catch replace device by wildcard
catch device name by wildcard to support a whole class of devices
  by just one config line like:
  REPLACE, KERNEL="tty*", NAME="vc/%n"
2005-04-26 21:13:05 -07:00