Commit Graph

324 Commits

Author SHA1 Message Date
Frantisek Sumsal
86b52a3958 tree-wide: fix spelling errors
Based on a report from Fossies.org using Codespell.

Followup to #15436
2020-04-21 23:21:08 +02:00
Yu Watanabe
455fa9610c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
Yu Watanabe
f5947a5e92 tree-wide: drop missing.h 2019-10-31 17:57:03 +09:00
Bastien Nocera
64db4c3cbd libudev: Update list of possible actions
Add "move" action as per src/libsystemd/sd-device/device-private.c
2019-07-24 05:14:52 +09:00
Yu Watanabe
538bdb48d8 libudev: hide definition of struct udev_device 2019-06-12 23:59:08 +09:00
Yu Watanabe
56fa3682b9 libudev: rescan devices when filter is updated
Fixes #12776.
2019-06-12 23:59:08 +09:00
Yu Watanabe
c01130824f libudev: re-implement libudev-list with LIST and hashmap 2019-06-12 23:59:02 +09:00
Yu Watanabe
dcf557f7b0 libudev: hide definition of struct udev_list from other libudev components
In the later commit, udev_list will be just a wrapper of hashmap or LIST.
So, allocating udev_list does not increase much cost.
2019-06-12 23:55:26 +09:00
Yu Watanabe
337405d439 libudev: drop unused variable 2019-06-12 15:18:05 +09:00
Ben Boeckel
5238e95759 codespell: fix spelling errors 2019-04-29 16:47:18 +02:00
Lennart Poettering
0a9707187b util: split out memcmp()/memset() related calls into memory-util.[ch]
Just some source rearranging.
2019-03-13 12:16:43 +01:00
Yu Watanabe
40769ccc73 libudev: use device_get_seqnum() and device_get_action() 2019-03-12 03:49:53 +09:00
Zbigniew Jędrzejewski-Szmek
92e068b465 basic/utf8: do not read past end of string when looking for a multi-byte character
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9341.
2019-02-26 12:37:40 +01:00
Yu Watanabe
e022bf664c sd-device-enumerator: support multiple parents
When sd_device_enumerator_add_match_parent() is called
multiple times, then previously set parents are discarded.

This adds device_enumerator_add_match_parent_incremental() to make
sd-device-enumerator scan devices under all specified parents.

Note that for backward compatibility, sd_device_enumerator_add_match_parent()
and udev_enumerate_add_match_parent() still discard previous assignments.
2019-01-23 15:15:56 +09:00
Topi Miettinen
a1e92eee3e Remove 'inline' attributes from static functions in .c files (#11426)
Let the compiler perform inlining (see #11397).
2019-01-15 08:12:28 +01:00
Yu Watanabe
577ab71c58 libudev-util: make util_replace_whitespace() read only len characters
This effectively reverts df8ba4fa0e.

Fixes #11264.
2019-01-03 15:10:57 +01:00
Zbigniew Jędrzejewski-Szmek
3d3075e309 meson: simplify handling of pkgconfigdatadir=no, pkgconfiglibdir=no
The idea was that those vars could be configured to 'no' to not install the .pc
files, or they could be set to '', and then they would be built but not
installed. This was inherited from the autoconf build system. This couldn't
work because '' is replaced by the default value. Also, having this level of
control doesn't seem necessary, since creating those files is very
quick. Skipping with 'no' was implemented only for systemd.pc and not the other
.pc files. Let's simplify things and skip installation if the target dir
is configured as 'no' for all .pc files.
2018-12-21 13:43:20 +01:00
Zbigniew Jędrzejewski-Szmek
a67c318df8 meson: define PROJECT_VERSION as the "bare" project version
Let's not use atoi() if we can simply provide the project version as a number.

In C code, this is the numerical project version. In substitutions in other
files, this is just the bare substitution.

The "PACKAGE_" prefix is from autotools, and is strange. We call systemd a
"project", and "package" is something that distros build. Let's rename.

PACKAGE_URL is renamed to PROJECT_URL for the same reasons and for consistency.

(This leave PACKAGE_VERSION as the stringified define for C code.)
2018-12-20 21:35:29 +01:00
Zbigniew Jędrzejewski-Szmek
527ead383d libudev: drop unnecessary check
sd_device_get_subsystem returns -ENOENT if subsystem is not set.
2018-11-23 09:16:11 +01:00
Yu Watanabe
3f14e7217a libudev: do not ignore error in udev_list_entry_add() 2018-11-22 23:50:02 +09:00
Yu Watanabe
fd05c424c0 libudev: introduce return_with_errno() and use it where applicable 2018-11-22 23:49:55 +09:00
Yu Watanabe
f349626bed libudev-list: drop unused udev argument from udev_list_init() 2018-11-22 23:19:25 +09:00
Yu Watanabe
876affad43 libudev-list: drop unused private functions 2018-11-22 23:19:17 +09: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
df8ba4fa0e libudev-util: make util_replace_whitespace() not count leading white spaces 2018-11-21 17:30:45 +09:00
Yu Watanabe
646acebd58 libudev-util: make util_replace_*() return size_t 2018-11-21 16:35:20 +09:00
Yu Watanabe
805a7097ee libudev-util: add assertions 2018-11-21 16:32:54 +09:00
Yu Watanabe
f921b457a7 libudev: coding style fixes 2018-11-20 14:38:35 +09: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
170e4380b6 libudev: drop prototypes for nonexistent functions 2018-11-20 14:38:35 +09:00
Yu Watanabe
c84954e8ed libudev-monitor: drop unused private functions 2018-11-20 14:38:35 +09:00
Yu Watanabe
53369277ec libudev-device: drop unused private functions 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
012c2f761b tree-wide: use __ prefixed gcc attributes (#10843)
As suggest here:

https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html#Attribute-Syntax

    "You may optionally specify attribute names with ‘__’ preceding and
    following the name. This allows you to use them in header files without
    being concerned about a possible macro of the same name. For example,
    you may use the attribute name __noreturn__ instead of noreturn. "
2018-11-20 12:34:08 +09:00
Yu Watanabe
46f0fbd8fd udev: drop util_log_priority() and use log_level_from_string()
The function util_log_priority() is almost same as
log_level_from_string(). The difference between them is only that
util_log_priority() accepts such that '3 hogehoge'.
2018-11-12 23:25:40 +09:00
Yu Watanabe
8ecbc4b880 libudev: conserve previous behavior
The commit dcfbde3a43 changes
sd_device_get_ifindex() returns -ENOENT instead of zero if the device
does not have ifindex.
Let's keep the original behavior of udev_device_get_ifindex().

Fixes #10699.
2018-11-12 13:00:30 +09:00
Yu Watanabe
5a937ea2f6 sd-device: make sd_device_get_is_initialized() returns is_initialized by return value 2018-10-29 17:33:33 +09:00
Yu Watanabe
14cb109d45 tree-wide: replace 'unsigned int' with 'unsigned' 2018-10-19 22:19:12 +02:00
Yu Watanabe
e39b4d254d libudev: re-implement udev-monitor by sd_device_monitor 2018-10-17 03:31:20 +09:00
Lennart Poettering
6d5e65f645 tree-wide: add a single version of "static const int one = 1"
All over the place we define local variables for the various sockopts
that take a bool-like "int" value. Sometimes they are const, sometimes
static, sometimes both, sometimes neither.

Let's clean this up, introduce a common const variable "const_int_one"
(as well as one matching "const_int_zero") and use it everywhere, all
acorss the codebase.
2018-10-15 19:40:51 +02:00
Yu Watanabe
dcfbde3a43 sd-device: make sd_device_get_*() return -ENOENT if the values are not set 2018-09-23 17:18:19 +09:00
Zbigniew Jędrzejewski-Szmek
32397af3d4 Merge pull request #9928 from yuwata/libudev-cleanups
libudev: coding style updates
2018-09-15 22:36:38 +02:00
Yu Watanabe
8aae9a66fa sd-device,libudev: make an argument for *_set_sysattr_value() const 2018-09-11 12:45:21 +09:00
Yu Watanabe
7f9e03952a libudev-monitor: use assert_return() in many places 2018-09-11 12:45:21 +09:00
Yu Watanabe
e38242b03a libudev-monitor: add missing error checks in udev_monitor_enable_receiving() 2018-09-11 12:45:21 +09:00
Yu Watanabe
a9808d8445 libudev-monitor: introduce udev_monitor_send_sd_device()
And use it in udev_monitor_send_device().
2018-09-11 12:45:21 +09:00
Yu Watanabe
23c457a7fb libudev-monitor: re-implement udev_monitor_receive_sd_device() 2018-09-11 12:45:21 +09:00
Yu Watanabe
759d9f3f8d libudev-monitor: use Hashmap or Set to store filters 2018-09-11 12:45:21 +09:00
Yu Watanabe
5e1e4c247b libudev-monitor: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe
a062a72f1b libudev-monitor: rename monitor_set_nl_address() and make it return negative errno 2018-09-11 12:45:21 +09:00