Commit Graph

1332 Commits

Author SHA1 Message Date
Lennart Poettering a0ee3d93bb
Merge pull request #10919 from yuwata/sd-device-monitor-fixes
sd-device-monitor: several fixes
2018-11-26 18:08:41 +01:00
Yu Watanabe 938dbb292a
Merge pull request #10901 from poettering/startswith-list
add new STARTSWITH_SET() macro
2018-11-26 22:40:51 +09:00
Lennart Poettering 49fe5c0996 tree-wide: port various places over to STARTSWITH_SET() 2018-11-26 14:08:46 +01:00
Yu Watanabe 6acf1ccba5 udevd: do not call udev_ctrl_enable_receiving() if the socket is passed from pid1
Before c4b69e990f, if the socket fd is
passed from pid1, `udev_ctrl_enable_receiving()` was not called.
Let's preserve the original logic.
2018-11-26 11:57:48 +09:00
Yu Watanabe 49c603bd5e udev: drop duplicate whitespaces 2018-11-26 11:53:21 +09:00
Yu Watanabe 572909a38a udev-ctrl: update log messages 2018-11-26 11:52:40 +09:00
Yu Watanabe b4ba2fe3f1 udev-rules: include device sysname in log messages 2018-11-26 11:37:29 +09:00
Yu Watanabe 9315f853c4 udev-ctrl: fix coding style isuues 2018-11-26 11:10:46 +09:00
Yu Watanabe 986ab0d2dc udevd: do not set buffer size if the socket is passed from pid1
Before c4b69e990f, if the socket fd is
passed from pid1, `udev_monitor_set_receive_buffer_size()` (now it is
a wrapper of `sd_device_monitor_set_receive_buffer_size()`) was not
called. Let's preserve the original logic.
2018-11-25 20:17:25 +09:00
Yu Watanabe 8c19dc54d3 udev-rules: update log messages 2018-11-23 01:15:42 +09:00
Yu Watanabe 20e97dd3de meson: add option for debugging udev 2018-11-23 00:28:27 +09:00
Yu Watanabe 67e4b38563 udev-rules: trivial coding style cleanups 2018-11-23 00:22:09 +09:00
Yu Watanabe 981fae90df udev: rename udev_rules_unref() to udev_rules_free()
As udev_rules do not have a reference counter.
2018-11-23 00:07:40 +09:00
Zbigniew Jędrzejewski-Szmek d4e98880e9 Also drop a few more unnecessary uses of synthethic errno 2018-11-22 10:54:38 +01:00
Zbigniew Jędrzejewski-Szmek 886cf317c4 coccinelle: also mark previous synthetic errnos as such 2018-11-22 10:54:38 +01:00
Zbigniew Jędrzejewski-Szmek baaa35ad70 coccinelle: make use of SYNTHETIC_ERRNO
Ideally, coccinelle would strip unnecessary braces too. But I do not see any
option in coccinelle for this, so instead, I edited the patch text using
search&replace to remove the braces. Unfortunately this is not fully automatic,
in particular it didn't deal well with if-else-if-else blocks and ifdefs, so
there is an increased likelikehood be some bugs in such spots.

I also removed part of the patch that coccinelle generated for udev, where we
returns -1 for failure. This should be fixed independently.
2018-11-22 10:54:38 +01:00
Lennart Poettering b390455cbb
Merge pull request #10866 from yuwata/libudev-util-cleanups
libudev-util: several cleanups and tests
2018-11-21 11:15:35 +01:00
Yu Watanabe 3839535a53 libudev: make util_resolve_subsys_kernel() return negative errno
This also replaces udev_device by sd_device in the function.
2018-11-21 17:31:16 +09:00
Yu Watanabe c0c591544a udev/scsi_id: fix buffer length 2018-11-21 17:30:49 +09:00
Zbigniew Jędrzejewski-Szmek 0c5a109a25 udevd: define main through macro
This removes the call to log_close(), and refactors how fork() is done. Now
the parent also goes through normal cleanup. This isn't necessary to use the
macro, but it feels cleaner this way.
2018-11-21 09:14:00 +01:00
Zbigniew Jędrzejewski-Szmek 138715dc12 udevadm: define main through macro
This removes a call to log_close(). I don't think this should matter.
The call to mac_selinux_init() is moved after parse_argv(). We probably
don't need selinux when printing help().
2018-11-21 09:14:00 +01:00
Zbigniew Jędrzejewski-Szmek 294bf0c34a Split out pretty-print.c and move pager.c and main-func.h to shared/
This is high-level functionality, and fits better in shared/ (which is for
our executables), than in basic/ (which is also for libraries).
2018-11-20 18:40:02 +01:00
Yu Watanabe 5ea78a39e5 libudev-list: move libudev-list related definitions to libudev-list-internal.h
This also rename libudev-private.h to libudev-util.h, and cleanups
several unnecessary headers from udev.h and libudev-util.h
2018-11-20 14:38:35 +09:00
Yu Watanabe 02edd80d87 udev: move definition of READ_END and WRITE_END from libudev-private.h to udev.h 2018-11-20 14:38:35 +09:00
Lennart Poettering e16f425654
Merge pull request #10698 from yuwata/udevd-replace-udev-device
udevd: replace udev_device by sd_device
2018-11-19 11:28:45 +01:00
Zbigniew Jędrzejewski-Szmek 64d9f7568b basic/missing: drop _ETHTOOL_LINK_MODE_MAX
It was only used in one place, where we don't actually need it, and
it is too easy to forget to update it when adding new items to the table.
Let's just drop it.
2018-11-18 16:14:21 +01:00
Zbigniew Jędrzejewski-Szmek 5dd101186b udev: use an "inline" array instead of allocating for advertise mode
The code is a bit shorter and we don't allocate the uint32_t[127] array.
2018-11-18 16:14:19 +01:00
Yu Watanabe 2d18ac4491 ethtool: drop NetDevAdvertise
Fixes #10807.
2018-11-18 14:33:50 +09:00
Yu Watanabe eb546b3532 udevd: replace udev_device in struct event by sd_device 2018-11-17 21:45:03 +09:00
Yu Watanabe 044497e2a3 udevd: update several log messages 2018-11-17 21:45:03 +09:00
Yu Watanabe ba47b71c2d udevd: decrease indentation 2018-11-17 21:45:03 +09:00
Yu Watanabe d8f462b435 udevd: rename event sources in struct event 2018-11-17 21:45:03 +09:00
Yu Watanabe dc7faf2a6f udevd: capitalize log messages in on_sigchld() 2018-11-17 21:45:03 +09:00
Yu Watanabe e2130348ef udevd: also use sd_device_monitor_start() in worker_main() 2018-11-17 21:45:03 +09:00
Yu Watanabe f00d2b6dd2 udevd: use sd_device_monitor_start() in manager_new() 2018-11-17 21:45:03 +09:00
Yu Watanabe 7f2e3a1409 udevd: replace udev_monitor by sd_device_monitor 2018-11-17 21:45:03 +09:00
Yu Watanabe 7443654e5f udevd: use safe_fork() to spawn worker process 2018-11-17 21:45:03 +09:00
Yu Watanabe abde5ea854 udevd: make worker_process_device() take sd_device instead of udev_device 2018-11-17 21:45:03 +09:00
Yu Watanabe b97897e3e8 udevd: make worker_lock_block_device() take sd_device instead of udev_device
Also adds many debug logs.
2018-11-17 21:45:02 +09:00
Yu Watanabe 0bed242cbe udevd: split worker_spawn() and manager_free() in small pieces 2018-11-17 21:45:02 +09:00
Yu Watanabe 0725c4b9d1 udevd: use event_source_disable() 2018-11-16 22:57:42 +09:00
Yu Watanabe 6d63048a77 udevd: use event_reset_time() to update kill_workers_event 2018-11-16 22:57:42 +09:00
Yu Watanabe a6da77b71b udev-rules: fix possible assertion
On 'remove' action, event->dev_db_clone is NULL. So, `IMPORT{db}` rule
on 'remove' action triggers assertion. This fixes the issue.
2018-11-15 15:50:27 +01:00
Lennart Poettering 042cad5737
Merge pull request #10753 from keszybz/pager-no-interrupt
Add mode in journalctl where ^C is handled by the pager
2018-11-14 20:09:39 +01:00
Zbigniew Jędrzejewski-Szmek fde32028a4 Move LONG_LINE_MAX definition to fileio.h
All users of the macro (except for one, in serialize.c), use the macro in
connection with read_line(), so they must include fileio.h.  Let's not play
libc games and require multiple header file to be included for the most common
use of a function.

The removal of def.h includes is not exact. I mostly went over the commits that
switch over to use read_line() and add def.h at the same time and reverted the
addition of def.h in those files.
2018-11-14 16:25:32 +01:00
Lennart Poettering 8755568681
Merge pull request #10759 from keszybz/udevd-more-configuration
Udevd more configuration options
2018-11-14 16:21:14 +01:00
Zbigniew Jędrzejewski-Szmek 7fe0d0d5c0 udev: downgrade message when we fail to set inotify watch up
My logs are full of:

systemd-udevd[6586]: seq 13515 queued, 'add' 'block'
systemd-udevd[6586]: seq 13516 queued, 'change' 'block'
systemd-udevd[6586]: seq 13517 queued, 'change' 'block'
systemd-udevd[6586]: seq 13518 queued, 'remove' 'bdi'
systemd-udevd[6586]: seq 13519 queued, 'remove' 'block'
systemd-udevd[9865]: seq 13514 processed
systemd-udevd[9865]: seq 13515 running
systemd-udevd[9865]: GROUP 6 /usr/lib/udev/rules.d/50-udev-default.rules:59
systemd-udevd[9865]: IMPORT builtin 'blkid' /usr/lib/udev/rules.d/60-persistent-storage.rules:95
systemd-udevd[9865]: IMPORT builtin 'blkid' fails: No such file or directory
systemd-udevd[9865]: loop4: Failed to add device '/dev/loop4' to watch: No such file or directory
(the last line is at error level).
If we are too slow to set up a watch and the device is already gone by the time
we try, this is not an error.
2018-11-13 22:02:55 +01:00
Zbigniew Jędrzejewski-Szmek a14e7af162 udev: also allow resolve_names= to be specified in udev.conf 2018-11-13 14:35:36 +01:00
Zbigniew Jędrzejewski-Szmek bc768f0475 udev: move ResolveNameTiming definition and parsers to udev-util.h
Follow-up for c4d44cba4d. No functional change,
but the parser is moved to libsystemd-shared.so.
2018-11-13 14:04:29 +01:00
Zbigniew Jędrzejewski-Szmek 4b3ca79ea9 udevd: allow more parameters to be set through udev.conf
Rebooting to set change the kernel command line to set some udev parameters is
inconvenient. Let's allow setting more stuff in the config file.

Also drop quotes from around "info" in udev.conf. We need to accept them for
compatibility, but there is no reason to use them.
2018-11-13 14:03:47 +01:00