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

88 Commits

Author SHA1 Message Date
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
dbba7e4029 libudev: update documentation 2010-03-25 16:45:48 +01:00
Kay Sievers
23325a66cc add LGPL COPYING to libudev and GUdev 2010-03-18 09:57:44 +01:00
Kay Sievers
fc8d61c53d libudev: add udev_device_new_from_environment() 2010-03-17 17:42:35 +01:00
Kay Sievers
9d1a67e956 libudev: docs - .gitignore backup files 2010-03-11 13:01:48 +01:00
Kay Sievers
fbb31cd6e1 libbudev-private: rename udev_list_entry_get_flag() 2010-03-10 14:52:42 +01:00
David Zeuthen
e32d5237ea Increase UTIL_LINE_SIZE from 2048 to 16384
Recent udisks versions, for LVM2 integration, ships with probers that
produce very long lines such as

UDISKS_LVM2_PV_VG_PV_LIST=
  uuid=98lyZl-Ya7U-p26Z-Ia7b-xf8u-xZqP-jc4njb;size=2000397795328;allocated_size=2000397795328
  uuid=iFs0cM-sxCF-ceQK-hZl1-kbwo-ZTjq-gSewQR;size=2000397795328;allocated_size=2000397795328
  [...]

e.g. roughly 100 bytes per LVM2 physical volume for each LVM2
PV encountered.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-03-02 17:11:10 -05:00
David Zeuthen
3a19299202 Use UTIL_LINE_SIZE, not UTIL_PATH_SIZE to truncate properties
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-03-02 17:07:14 -05:00
David Zeuthen
ecd42de2c5 Decrease buffer size when advancing past NUL byte
Otherwise we'll overflow the buffer if space is tight. Also add a comment explaining this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-03-02 17:06:33 -05:00
Scott James Remnant
a571c23e95 libudev: export udev_monitor_set_receive_buffer_size()
This function is useful for anything that's likely to be running
alongside udevd during cold-plugging, and is using libudev to
receive the events.

It makes little sense for it to be private, or to require other
software to relearn how to adjust the buffer size.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2010-02-17 15:26:00 +00:00
Kay Sievers
7c34949019 libudev: device - create db file atomically
We need to prevent that libudev parses half-written database files.

Also for "change" events, we need to make sure, that database files
always exist to be read by libudev, and that they are not first deleted
before they are re-created.
2010-01-13 13:26:56 +01:00
Kay Sievers
43cb1551d5 work around gtk-doc which breaks distcheck 2010-01-07 17:11:06 +01:00
Kay Sievers
1a259f1ac8 libudev: doc - add symbols to sections.txt 2010-01-07 16:42:23 +01:00
Thomas de Grenier de Latour
9bdcffd738 libudev: enumerate - fix move_later logic
The move_later_prefix variable was reset to zero on each
loop iteration, and thus the move_later entry (if any) was
not added right after changing to another syspath prefix,
but rather after exiting the enumeration loop.
2009-12-30 16:21:59 +01:00
Kay Sievers
f46d2e54a8 remove UDEV_RUN environment variable
It handles only RUN but not IMPORT and PROGRAM. There is no sane way
to suppress program execution. Most important programs run with IMPORT
these days. Also events can no longer suppressed with the libudev
netlink messages, so UDEV_RUN does nothing useful and is just
inconsistent.
2009-12-25 15:23:45 +01:00
Kay Sievers
1d67ec16c4 fix typo in log message priority handling 2009-12-25 14:47:59 +01:00
Kay Sievers
58b533f417 remove remaining support for CONFIG_SYSFS_DEPRECATED 2009-12-24 22:10:40 +01:00
Martin Pitt
b73bf332c2 Speed up udev_enumerate_scan_*
Check property match earlier, to avoid lots of readlink() and stat()
calls when we check property matches.
2009-12-21 15:41:25 +01:00
Kay Sievers
3c1898863f remove remaining support for CONFIG_SYSFS_DEPRECATED 2009-12-15 16:14:14 +01:00
Daniel Elstner
3fac12b9a0 libudev: wrap in extern "C" block for C++
When libudev.h is included from C++ code, wrap the declarations in an
extern "C" { ... } block.  This tells the C++ compiler that symbols
are exported with C linkage and no name-mangling.
2009-12-15 12:49:25 +01:00
Kay Sievers
99eb7c451c util_unlink_secure(): chmod() before chown() 2009-12-08 18:44:45 +01:00
Kay Sievers
79ef2e97d9 libudev: doc - use #NULL 2009-12-03 13:31:27 +01:00
Martin Pitt
54d4f54e85 udev_device_get_parent_with_subsystem_devtype(): Clarify documentation
devtype can be NULL, in which case it is ignored for matching.
2009-12-03 13:25:19 +01:00
Alan Jenkins
88fbff03df udevd: queue-export - remove retry loop
These retry loops are required where create_path() could race with
delete_path().  But only the main udevd process writes to the queue,
so no races will happen here.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-10-30 12:39:04 +01:00
Kay Sievers
26347a4c55 use CLOEXEC flags instead of fcntl() 2009-10-30 12:39:04 +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
Peter Rajnoha
1230d021bd libudev: allow to store negative values in the udev database 2009-10-20 06:55:42 +09:00
Scott James Remnant
49c3a01d44 util_run_program: *really* restore signal mask before executing event RUN commands
The previous patch was almost, but not quite, correct.  Rather than
restoring the signal mask it actually tried to make an even more
restrictive signal mask (had SIGALRM been blocked when udevd started,
anyway).

Fix it harder.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-09-22 14:39:23 -07: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
78715f65c9 fix randonm findings from llvm-clang-analyzer
Thanks to Lennart for the log file!
2009-09-08 22:11:04 +02:00
Florian Zumbiehl
04d4a6f858 util_run_program(): fix possible buffer overflow #2
I'm not sure how likely it is for UTIL_PATH_SIZE to have an odd value
(maybe it has right now? :-), but I guess making this universally correct
doesn't hurt ...
2009-09-08 21:42:21 +02:00
Kay Sievers
f55083ce34 util_run_program(): skip multiple spaces in argv creation 2009-09-07 12:13:50 +02:00
Jeremy Kerr
d412a68573 util_run_program: restore signal mask before executing event RUN commands
External programs triggered by events (via RUN=) will inherit udev's
signal mask, which is set to block all but SIGALRM. For most utilities,
this is OK, but if we start daemons from RUN=, we run into trouble
(especially as SIGCHLD is blocked).

This change saves the original sigmask when udev starts, and restores it
just before we exec() the external command.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
2009-09-07 12:13:50 +02:00
Florian Zumbiehl
9e6273c713 udev_queue_get_seqnum_sequence_is_finished(): fix possible file handle leak 2009-09-07 12:13:50 +02:00
Florian Zumbiehl
8cfcf9980a udev_util_encode_string(): fix possible buffer overflow 2009-09-01 12:54:21 +02:00
Kay Sievers
0652604912 libudev-util.c: get_sys_link() - return error for empty link target 2009-09-01 12:39:57 +02:00
Florian Zumbiehl
32ecabb15d util_resolve_sys_link(): fix possible buffer overflow 2009-09-01 12:38:16 +02:00
Florian Zumbiehl
4c21b7156d util_create_path(): fix possible out of bounds array access 2009-08-30 21:40:13 +02:00
Florian Zumbiehl
b0de6a6327 util_delete_path(): handle multiple leading slashes 2009-08-29 16:50:43 +02:00
Kay Sievers
28da1a6186 util_create_path(): fix errno usage
Based on a patch from: Florian Zumbiehl <florz@florz.de>
2009-08-29 16:38:01 +02:00
Florian Zumbiehl
72c0373f79 util_lookup_group(): fix memory leak if realloc() fails 2009-08-29 16:25:47 +02:00
Florian Zumbiehl
f46b9c2628 util_delete_path(): use util_strscpy() 2009-08-29 16:17:54 +02:00
Kay Sievers
39087d3bdd util_unlink_secure(): chmod() before chown()
Suggested by Florian Zumbiehl <florz@florz.de>.
2009-08-29 16:10:24 +02:00
Kay Sievers
4851d131d6 assign errno for getgrnam_r()/getpwnam_r()
On Mon, Aug 24, 2009 at 19:50, Lennart Poettering<lennart@poettering.net> wrote:
> One little comment here: on POSIX getrnam_r() doesn't touch
> errno. Instead it returns the error value as return value.
2009-08-25 21:09:22 +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
Daniel Mierswa
8eefdffb6b don't compare a non-existing function with NULL
Obviously someone forgot something here or didn't use -ansi. Either way,
index is nowhere declared so I assume the current behaviour is to check
against the index() function coming from somewhere in the POSIX headers.
The comparison doesn't make sense then.

Signed-off-by: Daniel Mierswa <impulze@impulze.org>
2009-08-18 02:00:39 +02:00
Alan Jenkins
214a6c791c fix spelling
Fix spelling in docbook comments, code comments, and a local variable
name.  Thanks to "ispell -h" for docbook HTML and "scspell" for source
code.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-08-08 15:42:05 +02:00