1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 15:21:37 +03:00
Commit Graph

49 Commits

Author SHA1 Message Date
Kay Sievers
8958da13c7 libudev: list - use bit flags for 'sort' and 'unique' 2011-04-24 00:22:23 +02:00
Kay Sievers
51f43b5329 selinux: do not label files in runtime dir
Do not label any files in the udev runtime directory, but only nodes,
links and directories below /dev.

In case the runtime directory falls back to /dev/.udev, label this
directory once at udevd startup, but never anything below it.
2011-04-08 01:09:20 +02:00
Kay Sievers
4ec9c3e797 use /run/udev/ if possible and fall back to /dev/.udev/ 2011-03-23 02:31:09 +01:00
Kay Sievers
5f59fa0900 move /dev/.udev/ to /dev/.run/udev/ and convert old udev database at udevd startup 2011-03-15 17:26:08 +01:00
Kay Sievers
cad40a5fe7 udevd: switch to common id_filename functions 2010-12-12 20:07:15 +01:00
Kay Sievers
24d1076696 udevd: simplify udev database and fix DEVNAME handling 2010-12-11 14:00:46 +01:00
Kay Sievers
2713e6ab0a udevd: always create /dev/{char,block}/$major:$minor 2010-12-10 13:27:03 +01:00
Kay Sievers
4281da1fa6 udevd: use dev_t or netif ifindex as database key
We need to preserve the database of network interfaces while we
rename them. Use the kernel's numbers wherever possible, instead
of the device names.

Fix wrong database filenames which contain a '/', translated
from '!' in the kernel name.

Fix segfault for kobject pathes where the subsystem can not be
determined from sysfs.
2010-12-10 01:18:15 +01:00
Kay Sievers
326c5fc3ea set SELinux context on 'add' but not on 'change' events 2010-08-31 21:29:21 +02:00
Kay Sievers
8e5a620b17 call util_delete_path() only when we actually deleted stuff 2010-08-03 12:13:53 +02:00
Kay Sievers
761dfddcc0 create static nodes provided by kernel modules to allow module autoloading 2010-05-20 17:09:04 +02:00
Kay Sievers
c7cdd8b2d2 remove unused parameter from udev_node_mknod() 2010-05-03 18:08:51 +02:00
Michael Thayer
c00b776880 fix device node deletion
Signed-off-by: Michael Thayer <michael.thayer@sun.com>
2010-05-01 17:29:24 +02:00
Kay Sievers
60067cc75a more readlink buffer size handling 2010-04-21 14:44:33 +02:00
Mathias Nyman
e925018786 remove buffer-overrun risk in readlink call
readlink does not write a nul character to the end of the
string it returns. Therefore ask for one fewer character
than the buffer size so there's always room for an extra \0.

Signed-off-by: Mathias Nyman <mathias.nyman@nokia.com>
Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2010-04-21 13:41:14 +02:00
Kay Sievers
9355f324e1 add O_NOFOLLOW when creating files in link stack 2010-04-19 18:55:10 +02:00
Kay Sievers
a89d342dfb remove "ignore_remove" option 2010-04-13 12:45:38 +02:00
Kay Sievers
1f084fe581 remove "all_partitions" option
We can not predict the major/minor of non-existing devices:
  $ grep . /sys/class/block/sd*/dev
  /sys/class/block/sda1/dev:259:524288
  /sys/class/block/sda2/dev:259:262144
  /sys/class/block/sda3/dev:259:786432
  /sys/class/block/sda4/dev:259:131072
  /sys/class/block/sda/dev:259:0
  /sys/class/block/sdb/dev:259:655360
  /sys/class/block/sdc/dev:259:393216

If this functionality is still needed for some broken hardware, it needs to be
solved with a tool not part of the udev package. Because such option is unreliable
and unsafe to use.
2010-04-13 08:52:48 +02:00
Kay Sievers
0ec5b5e142 unify/cleanup event handling 2010-04-12 15:51:16 +02:00
Kay Sievers
578cc8a808 do not reset SELinux context when the node was not touched 2010-03-17 09:15:18 +01:00
Kay Sievers
af24bb178e use major:minor as entries in symlink stack instead of devpath 2010-03-10 17:29:27 +01:00
Kay Sievers
fbb31cd6e1 libbudev-private: rename udev_list_entry_get_flag() 2010-03-10 14:52:42 +01:00
Kay Sievers
455f792e47 replace utimes() with utimensat() 2010-03-10 14:43:07 +01:00
Kay Sievers
7b4038a96f clarify message about not removed device node 2010-01-15 00:32:10 +01:00
Kay Sievers
889dd1061c do not remove device nodes of active kernel devices
We do no longer delete the primary device node while handling "remove"
events if the same kernel device is already re-created in the meantime.
This prevents the asynchronously running udev from removing and re-creating
primary device nodes for active devices.
2010-01-13 13:18:14 +01:00
Kay Sievers
5607391481 update mtime of nodes and links when we re-use them 2009-12-18 21:25:13 +01:00
Martin Pitt
495d408b36 fix major fd leak in link handling
link_find_prioritized(): Properly close directory handles to fix a major fd
leak which caused hotplugging to fail entirely in many cases due to having too
many open files.

https://launchpad.net/bugs/463347
2009-11-03 00:03:43 +01:00
Kay Sievers
6834a44299 break loops if util_create_path() returns error
Dangling symlinks in path components return -ENOENT. Do not retry
to create the file in a loop in such case.
2009-10-28 11:37:20 +01:00
Kay Sievers
b6a2637524 put util_create_path() and file creastion in a retry loop
On 8/29/09, Florian Zumbiehl <florz@florz.de> wrote:
> Could it happen that > util_create_path() and util_delete_path()
> do run in parallel for > the same directory? After all, util_create_path()
> does handle > the case where creation of the directory happens in parallel
> to it running, so it doesn't seem all that unlikely to me ...
2009-09-10 02:08:05 +02:00
Kay Sievers
676d294c23 reorder create_path() and node/link creation to be called in a direct sequence 2009-09-10 01:35:48 +02:00
Kay Sievers
6c29f2b942 simplify "symlink name stack"
With well defined and kernel-supplied node names, we no longer need
to support a possible stack of conflicting symlinks and node names.
Only symlinks with identical names can be claimed by multiple devices.

This shrinks the former /dev/.udev/names/ significantly.

Also the /dev/{block,char}/MAJ:MIN" links are excluded from the name
stack - they are unique and can not conflict.
2009-09-09 18:49:07 +02:00
Kay Sievers
2ffc9cc191 change database file names
With very deeply nested devices, We can not use a single file
name to carry an entire DEVPATH. Use <subsystem>:<sysname> as
the database filename, which should also simplify the handling
of devices moving around, as these values will not change but
still be unique.

For the name stack we use the <maj>:<min> now as the filename.

> On Tue, Aug 18, 2009 at 09:59:56AM -0400, Ric Wheeler wrote:
> The first is that udev grumbles during boot about "file name too long"
> like the following:
>
> Aug 17 06:49:58 megadeth udevd-event[20447]: unable to create db file
> '/dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:04.0\x2f0000:17:00.0\x2f0000:18:0a.0\x2f0000:1f:00.0\x2fhost11\x2fport-11:0\x2fexpander-11:0\x2fport-11:0:0\x2fexpander-11:1\x2fport-11:1:0\x2fexpander-11:2\x2fport-11:2:17\x2fexpander-11:3\x2fport-11:3:1\x2fend_device-11:3:1\x2fbsg\x2fend_device-11:3:1':
> File name too long
2009-08-19 20:49:49 +02:00
Kay Sievers
fc206fbe3e update a few years of copyright 2009-08-01 09:39:18 -04:00
Kay Sievers
065db05221 use more efficient string copying 2009-05-20 17:57:52 +02:00
Kay Sievers
cb14f4543a handle devtmpfs nodes
UDev follows the kernel given name, and re-uses the kernel created
device node. If the kernel and spcecified udev rules disagree, the
udev specified node node is created and the kernel-created on is
deleted.
2009-05-04 04:52:31 +02:00
Kay Sievers
37ed4f5619 drop "extern" keyword from non-static function 2009-04-26 13:59:39 +02:00
Kay Sievers
540f46698d udevd: at startup create /dev/null, /dev/console, /dev/kmsg 2009-04-19 03:25:04 +02:00
Kay Sievers
8257730d39 remove name from index if the node name has changed
Scott discovered that a changed rule, which renames a device node
leaves the old node name around as a symlink. So drop the reference
to the old name.
2009-01-16 21:14:13 +01:00
Kay Sievers
ec2dd02e2a udevadm: test - remove --force option
Since a while we change the database with a "test" run, but do not update
the node and symlinks. We need to "force" all the time, to keep things
in sync.
2009-01-15 20:20:16 +01:00
Kay Sievers
f408fd919a fix handling of swapping node name with symlink name 2008-11-24 02:21:12 +01:00
Kay Sievers
6e0cb78c9d fix cleanup of possible left-over symlinks 2008-11-05 04:45:23 +01:00
Kay Sievers
5755d586e1 fix udev_node_update_old_links() logic
No need to check if links that still belong to us, need to be updated.
2008-11-01 20:05:41 +01:00
Kay Sievers
1822e9b033 do not init string arrays, just clear first byte 2008-10-26 02:31:54 +01:00
Kay Sievers
6880b25d40 replace in-memory rules array with match/action token list
The in-memory rule array of a common desktop distro install took:
  1151088 bytes
with the token list:
  109232 bytes tokens (6827 * 16 bytes), 71302 bytes buffer
2008-10-23 00:13:59 +02:00
Kay Sievers
54808d77a3 prefix udev-util.c functions with util_* 2008-10-18 20:12:55 +02:00
Kay Sievers
eb8837e15c udev_list_cleanup() -> udev_list_cleanup_entries() 2008-10-18 19:27:38 +02:00
Kay Sievers
c7521974a3 merge udev-rules.c and udev-rules-parse.c 2008-10-18 14:33:37 +02:00
Kay Sievers
7db6580f42 udev-node: name_list -> udev_list 2008-10-16 19:23:07 +02:00
Kay Sievers
8460299b57 rename udev source files 2008-10-16 18:13:48 +02:00