1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 06:52:22 +03:00
Commit Graph

95 Commits

Author SHA1 Message Date
Kay Sievers
68ab3e137b don't create $tempnode for devices without major 2007-04-30 21:48:30 +02:00
Kay Sievers
db6e59df56 unset variable with ENV{VAR}="" 2007-04-25 01:52:00 +02:00
Kay Sievers
019d666907 udevinfo: export all information stored in database 2007-04-06 19:50:19 +02:00
Kay Sievers
81313e1b48 make ACTION!="add|change" working
Thanks to Scott for the suggestion.
2007-03-31 02:46:32 +02:00
Kay Sievers
d2c9a56e0e don't write to sysfs files during test run 2007-03-23 17:18:03 +01:00
Kay Sievers
eb5b86405b update %n on netif name change 2007-03-19 09:56:53 +01:00
Kay Sievers
31de3a2ba1 read list of devices from index, make index private to database 2007-03-17 10:08:25 +01:00
Kay Sievers
2dbb47f860 add link_priority to rule options, and store it in database 2007-03-16 15:16:08 +01:00
Kay Sievers
4a7e6bcef0 update internal variables if we see $DEVPATH during IMPORT 2007-03-15 00:10:22 +01:00
Kay Sievers
6e82f66ea2 apply format chars to ATTR before writing to sysfs 2007-02-16 13:20:34 +01:00
Sergey Vlasov
c0c865d466 fix %c $string substitution
Fix udev_rules_apply_format() to give error messages for unknown
format elements and pass such elements to the output string
unmodified.

When truncating the substitution string to the length specified in the
format string, head[len] = '\0' could write outside the buffer if that
length was too large.
2007-02-01 20:18:52 +01:00
Kay Sievers
eef5447934 let $attr{symlink} return the last element of the path
Example for /block/sda:
  SUBSYSTEMS="scsi", ENV{COMMENT}="$attr{driver}"
sets COMMENT=sd
  SUBSYSTEMS="pci", ENV{COMMENT}="$attr{driver}"
sets COMMENT=ata_piix
2006-09-05 02:18:06 +02:00
Kay Sievers
ac528431dd fix ENV{TEST}="Test: $env{TEST}" 2006-09-05 00:50:25 +02:00
Kay Sievers
27b77df44d update source file headers 2006-08-28 00:29:11 +02:00
Kay Sievers
cea61f5c03 use fnmatch() instead of our own pattern match code 2006-08-24 09:03:15 +02:00
Kay Sievers
d0c8cb7d9c introduce ATTR{file}="value" to set sysfs attributes 2006-08-20 18:16:27 +02:00
Kay Sievers
95776dc6ec consistent key naming to match only the event device or include all parent devices
This scheme is more consistent and makes it obvious if a match happens
against the event device only, or the full chain of parent devices.

The old key names are now:
  BUS -> SUBSYSTEMS
  ID -> KERNELS
  SYSFS -> ATTRS
  DRIVER -> DRIVERS

Match keys for the event device:
  KERNEL
  SUBSYSTEM
  ATTR
  DRIVER (in a future release, for now the same as DRIVERS)

Match keys for all devices along the parent device chain:
  KERNELS
  SUBSYSTEMS
  ATTRS
  DRIVERS

ID, BUS, SYSFS are no longer mentioned in the man page but still work.
DRIVER must be converted to DRIVERS to match the new scheme. For now,
an error is logged, if DRIVER is used. In a future release, the DRIVER
key behaviour will change.
2006-08-19 16:06:25 +02:00
Kay Sievers
c8ff4b3db4 remove broken %e enumeration 2006-07-04 12:27:00 +02:00
Kay Sievers
8912051213 remove MODALIAS key and substitution 2006-06-07 16:00:34 +02:00
Kay Sievers
3d6d12c6b1 vol_id: fix logging from libvolume_id's log function 2006-04-28 17:52:09 +02:00
Kay Sievers
d59c84effd allow NAME=="value" to check for already assigned value 2006-04-24 19:25:55 +02:00
Kay Sievers
7ba2d2e6ae apply format char to variables exported by ENV 2006-04-15 19:32:05 +02:00
Matt Kraai
00a074480e fix typo in error message 2006-04-11 19:35:52 +02:00
Kay Sievers
a4d5ca644e merge device event handling and make database content available on "remove" 2006-04-05 22:29:33 +02:00
Kay Sievers
7910248926 warn about %e, MODALIAS, $modalias 2006-03-07 23:20:10 +01:00
Kay Sievers
656ba91ee1 exit WAIT_FOR_SYSFS if the whole device goes away
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-02-15 20:43:28 +01:00
Kay Sievers
f8db897faa make WAIT_FOR_SYSFS usable in non "wait-only" rules
Thanks to Andrey Borzenkov <arvidjaar@mail.ru> for noticing this
and the initial patch to fix it.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-31 16:24:22 +01:00
Kay Sievers
9538b16d8b let SYSFS{} look at the device, not only the parent device
The stricter parent logic broke: BUS=="ide", SYSFS{removable}=="1", ...
cause removable is on the block device, which isn't a ide device.
Just look for matching attributes at the device and the selected parent
device at the same time now.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-29 17:08:44 +01:00
Kay Sievers
2c02716281 remove redundant substitution of RUN key
Thanks to Andrey Borzenkov <arvidjaar@mail.ru> for the initial patch.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-27 01:40:26 +01:00
Kay Sievers
a9bd2ed84a rename apply_format() cause it is public now
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-25 01:28:31 +01:00
Andrey Borzenkov
f5f0c34f6d substitute format chars in RUN after rule matching
Apply substitutions before running a program, not while the rule
is parsed. It allows to use environment variables set during rule
processing as command arguments.
2006-01-24 20:10:48 +01:00
Kay Sievers
03b24b71e0 fix BUS, ID, $id usage
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-16 06:12:49 +01:00
Kay Sievers
d548032795 better log test and comments
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-13 13:17:10 +01:00
Kay Sievers
1aa1e24848 replace libsysfs
We never used any of the libsysfs convenience features. Here we replace
it completely with 300 lines of code, which are much simpler and a bit
faster cause udev(d) does not open any syfs file for a simple event which
does not need any parent device information.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2006-01-09 21:18:00 +01:00
Kay Sievers
fc55cf68ca remove "udev_db" option from config file
All udev state is kept in /$udev_root/.udev/ now. No option to
configure that anymore, it will always be there.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-16 04:14:15 +01:00
Kay Sievers
c86be870ce remove all built-in wait_for_sysfs logic
Most of the issues are fixed with the kernel we depend on, for the
remaing ones see the RELEASE-NOTES for a special rule to add.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-11-12 04:17:48 +01:00
Marco d'Itri
ff3e4bed21 add strerror() to error logs 2005-11-07 18:44:18 +01:00
Olivier Blin
129979643f fix a debug text typo in udev_rules.c 2005-09-14 14:28:59 +02:00
Kay Sievers
2983db9745 check the udevdb before assigning a new %e
A second "add" event created a new enumeration with %e. Check the
udevdb first and if a matching name is already used.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-29 03:48:17 +02:00
Kay Sievers
b2c6818dc3 rename ...trailing_char() to ...trailing_chars()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 23:15:51 +02:00
Kay Sievers
764ce7f2ab start to enforce plain ascii or valid utf8
No device node or symlink can have other characters as plain
readable ascii or valid utf8. The /dev/disk/by-label/* symlinks
can no longer contain weird stuff read from untrusted sources.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-28 15:55:58 +02:00
Kay Sievers
7104c558da don't store devpath in udevdb, we don't need it
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 23:27:43 +02:00
Kay Sievers
fb17920701 add and use name_list_cleanup() for cleaning up the string lists
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 16:15:41 +02:00
Kay Sievers
314edf3ca4 change parameter order of udev_db_search_name()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-27 15:46:58 +02:00
Kay Sievers
8f847bb845 store ENV{key}="value" exported keys in the database
Just like the IMPORT values are stored in the udev database the
exported keys are stored in the udev database. The database is also
imported on a remove event before the rules are matched. So it
is possible to do:
  ACTION=="add", KERNEL=="sda", ENV{MY_DEVICE}="1234", RUN+="/bin/logger add $devpath"
  ACTION=="remove", ENV{MY_DEVICE}=="1234", RUN+="/bin/logger remove $devpath"

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-26 21:38:18 +02:00
Kay Sievers
5618b5611b ENV{TEST}=="1" compares and ENV{TEST}="1" sets the environment
This can be uses to export stuff to the event environment or
to carry a state from one rule to another, like enabling/disabling
later rules conditionally.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-16 04:25:20 +02:00
Kay Sievers
40caaeec51 cleanup some debug output and move to info level + unify select() loops
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-15 11:57:04 +02:00
Kay Sievers
853ccc433c fix more compiler warnings ...
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-13 00:18:44 +02:00
Kay Sievers
4937afa402 move some logging to the info level
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11 21:01:46 +02:00
Kay Sievers
27f877e60f allow logging of all output from executed tools
If USE_DEBUG=true and udev_log="debug", all output of the forked
programs to stdout and stderr is send to syslog.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
2005-08-11 17:32:59 +02:00