summaryrefslogtreecommitdiff
path: root/src/libudev
Commit message (Collapse)AuthorAgeFilesLines
* test: also test all _public_ functions are listed in .sym filesYu Watanabe2023-05-011-2/+4
| | | | Co-authored-by: Frantisek Sumsal <frantisek@sumsal.cz>
* meson: Introduce userspace depJan Janssen2023-03-101-0/+1
| | | | This will help in a later commit to separate userspace from EFI builds.
* meson: Use dicts for test definitionsJan Janssen2023-02-211-3/+7
| | | | | | | Although this slightly more verbose it makes it much easier to reason about. The code that produces the tests heavily benefits from this. Test lists are also now sorted by test name.
* meson: Do not include headers in source listsJan Janssen2023-01-241-4/+1
| | | | | | Meson+ninja+compiler do this for us and are better at it. https://mesonbuild.com/FAQ.html#do-i-need-to-add-my-headers-to-the-sources-list-like-in-autotools
* tree-wide: use -EBADF for fd initializationZbigniew Jędrzejewski-Szmek2022-12-191-1/+1
| | | | | | | | | | | | | | | | -1 was used everywhere, but -EBADF or -EBADFD started being used in various places. Let's make things consistent in the new style. Note that there are two candidates: EBADF 9 Bad file descriptor EBADFD 77 File descriptor in bad state Since we're initializating the fd, we're just assigning a value that means "no fd yet", so it's just a bad file descriptor, and the first errno fits better. If instead we had a valid file descriptor that became invalid because of some operation or state change, the other errno would fit better. In some places, initialization is dropped if unnecessary.
* tree-wide: Use devnum helpers in a few more placesJan Janssen2022-09-011-1/+2
|
* tree-wide: Use correct format specifiersJan Janssen2022-08-301-1/+1
| | | | gcc will complain about all these with -Wformat-signedness.
* meson: add build targets for libudev, libsystemd and pkg-configLuca Boccassi2022-06-121-1/+1
| | | | Mirror install tags with the same names and content
* meson: add 'devel' install_tag to libsystemd.pc and libudev.pcMike Gilbert2022-05-141-0/+1
|
* meson: also allow setting GIT_VERSION via templatesZbigniew Jędrzejewski-Szmek2022-04-051-1/+1
| | | | | | | | | GIT_VERSION is not available as a config.h variable, because it's rendered into version.h during builds. Let's rework jinja2 rendering to also parse version.h. No functional change, the new variable is so far unused. I guess this will make partial rebuilds a bit slower, but it's useful to be able to use the full version string.
* various: inline some iterator variablesZbigniew Jędrzejewski-Szmek2022-03-231-2/+1
|
* sd-device-enumerator: support to list only initialized or uninitialized devicesYu Watanabe2022-03-221-1/+1
|
* list: make LIST_FOREACH() and LIST_FOREACH_BACKWARDS() saferYu Watanabe2022-03-191-1/+1
|
* list: declare iterator of LIST_FOREACH() in the loopYu Watanabe2022-03-191-2/+0
|
* meson: Use files() for testsJan Janssen2022-01-111-1/+1
| | | | | | Not having to provide the full path in the source tree is much nicer and the produced lists can also be used anywhere in the source tree.
* meson: drop convenience library that was only used in one placeZbigniew Jędrzejewski-Szmek2021-12-161-7/+1
| | | | | | | | | | | | It doesn't make much sense to do this, the result is very similar to including to objects directly in the output binary without going through an intermediate target. The linkage of test-libudev was rather strange too: udev_link_with is used to allow udev to be linked to a static version of libshared, so that udev is not linked to libshared.so. But here we were using both, defeating the purpose of udev_link_with. I don't think it matters what the test is linked to, so let's use the non-static linkage to save space.
* meson: stop building out convenience libraries by defaultZbigniew Jędrzejewski-Szmek2021-12-161-1/+2
| | | | | | | | | | | | | | | | | The meson default for static_library() are: build_by_default=true, install=false. We never interact with the static libraries, and we only care about them as a stepping-stone towards the installable executables or libraries. Thus let's only build them if they are a dependency of something else we are building. While at it, let's drop install:false, since this appears to be the default. This change would have fixed the issue with lib_import_common failing to build too: we wouldn't attempt to build it. In practice this changes very little, because we generally only declare static libraries where there's something in the default target that will make use of them. But it seems to be a better pattern to set build_by_default to false.
* build: preserve correct mode when generating files via jinja2Christian Brauner2021-11-081-2/+1
| | | | | | | | | When using "capture : true" in custom_target()s the mode of the source file is not preserved when the generated file is not installed and so needs to be tweaked manually. Switch from output capture to creating the target file and copy the permissions from the input file. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* meson: use a/b instead of join_paths(a,b)Zbigniew Jędrzejewski-Szmek2021-07-271-2/+2
| | | | It is nicer and shorter.
* libudev: add "Libs.private: -lrt -pthread" to libudev.pcMike Gilbert2021-07-111-0/+1
| | | | | | | | | | This resolves a failure when linking cryptsetup.static against libudev.a. ``` libtool: link: x86_64-pc-linux-gnu-gcc -Wall -O2 -pipe -march=amdfam10 -static -O2 -o cryptsetup.static lib/utils_crypt.o lib/utils_loop.o lib/utils_io.o lib/utils_blkid.o src/utils_tools.o src/utils_password.o src/utils_luks2.o src/utils_blockdev.o src/cryptsetup.o -pthread -pthread -Wl,--as-needed ./.libs/libcryptsetup.a -largon2 -lrt -ljson-c -lpopt -luuid -lblkid -lssl -lcrypto -lz -ldl -ldevmapper -lm -lpthread -ludev -pthread /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libudev.a(src_libsystemd_sd-daemon_sd-daemon.c.o): in function `sd_is_mq': (.text.sd_is_mq+0x3a): undefined reference to `mq_getattr' ```
* tree-wide: "a" -> "an"Yu Watanabe2021-06-301-1/+1
|
* meson: use jinja2 for src/libudev/Zbigniew Jędrzejewski-Szmek2021-05-192-8/+11
|
* meson: simplify the BUILD_MODE conditionalZbigniew Jędrzejewski-Szmek2021-04-141-1/+1
| | | | | | | Using a enum is all nice and generic, but at this point it seems unlikely that we'll add further build modes. But having an enum means that we need to include the header file with the enumeration whenerever the conditional is used. I want to use the conditional in log.h, which makes it hard to avoid circular imports.
* libudev: fix return of udev_monitor_filter_add_match_subsystem_devtype()Zbigniew Jędrzejewski-Szmek2021-04-011-2/+8
| | | | | | | | | | | | | | | | Follow-up for 7117842657c0fc5a3446b6fe158615279cf2d650. sd_device_monitor_filter_add_match_subsystem_devtype() now returns 1 to signify that something was done, and 0 to signify that nothing was done, but udev_monitor_filter_add_match_subsystem_devtype() needs to return 0 as documented. udev_monitor_filter_add_match_tag() is adjusted to match. This makes gdm start successfully here again. Before, it would just not boot, with nothing very obvious in the logs: gdm[1756]: Gdm: GdmDisplay: Session never registered, failing Replaces #19171.
* tests: drop calls to unsetenv SYSTEMD_MEMPOOLZbigniew Jędrzejewski-Szmek2021-03-261-2/+0
| | | | | | | | | | | | Coverity was complaining that we don't check the return value, which we stopped doing in 772e0a76f34914f6f81205e912e4744c6b23f704. But it seems that we don't want those calls at all. The test was originally added with the call in a6ee01caf3409ba9820e8824b9262fbac31a9f77, but I don't see why we should override this. If the user wants to execute the test with mempool disabled, we shouldn't ignore that. Coverity CID#1444464, CID#1444466.
* libudev: shorten code a bitYu Watanabe2021-03-041-5/+3
| | | | fd_wait_for_event() or ppoll() does not return -EAGAIN.
* libudev: fix typo in docstringZbigniew Jędrzejewski-Szmek2021-02-251-1/+1
|
* sd-device: add sd_device_get_action() + sd_device_get_seqnum() + ↵Lennart Poettering2021-02-181-3/+3
| | | | | | | | | | | | | | | | sd_device_new_from_stat_rdev() To make sd-device properly usable for all programs we need to provide an API for the "action" field of an event, it's one of the most relevant ones, and it was so far missing. This also adds sd_device_get_seqnum(), which isn't that interesting, except for generating pretty debug output, which we use it ourselves for. This also makes device_new_from_stat_rdev() public, as it is truly useful, as we can see in our own uses of it, and I think is fairly generic to show up in the public APIs.
* libudev: add one more assertionYu Watanabe2021-02-021-0/+1
|
* libudev: unset uptodate flag before free()ing entriesYu Watanabe2021-02-021-1/+1
| | | | | udev_list_entry_free() also removes the entry from LIST if the flag is set. This slightly optimizes the cleanup logic.
* libudev: also drop the entry from LIST even if unique flag is setYu Watanabe2021-02-021-2/+3
| | | | | | | | Otherwise, the list becomes dirty when an entry is freed. This also remove the entry from the hashmap only when its name is set. The name should be always set, so that does not change anything. But just for safety.
* libudev: set entry->list after the entry is stored in the listYu Watanabe2021-02-021-1/+2
| | | | | | | This should not change anything. As hashmap_remove() is called before hashmap_ensure_put(). So, even if hashmap_ensure_put() fails, a wrong entry will not removed from the hashmap by udev_list_entry_free(). But anyway, just for safety.
* libudev: use hashmap_ensure_put()Yu Watanabe2021-02-021-7/+1
|
* meson: move test or fuzzer definitions to relevant meson.build in subdirectoriesYu Watanabe2021-01-191-0/+8
|
* meson: move libudev related definitions to src/libudev/meson.buildYu Watanabe2021-01-191-15/+32
| | | | Also, this makes libudev.so built in build directory.
* test: rewrite test-sd-device-thread.c to depend only on libsystemdYu Watanabe2021-01-191-9/+26
| | | | Similarly, this makes test-udev-device-thread.c depend only on libudev.
* test: move tests for libudev into src/libudevYu Watanabe2021-01-192-0/+531
|
* udev: introduce udev_queue_is_empty() and udev_queue_init()Yu Watanabe2020-12-161-19/+11
|
* libudev: fix indentationYu Watanabe2020-12-161-1/+1
|
* libudev: drop unnecessary headers from libudev-util.cYu Watanabe2020-12-161-8/+0
|
* udev: rename UTIL_LINE_SIZE -> UDEV_LINE_SIZE and friendsYu Watanabe2020-12-161-5/+0
| | | | This also moves them to udev-util.h
* udev: move util_resolve_subsys_kernel() to udev-util.cYu Watanabe2020-12-162-58/+0
|
* udev: move util_replace_chars() to udev-util.cYu Watanabe2020-12-162-45/+0
|
* udev: move util_path_encode() and rename it to escape_path()Yu Watanabe2020-12-162-35/+0
|
* udev: move util_replace_whitespace() to udev-util.cYu Watanabe2020-12-162-46/+0
|
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-0915-15/+15
|
* tree-wide: define iterator inside of the macroZbigniew Jędrzejewski-Szmek2020-09-081-2/+1
|
* libudev: also expose API to check for current tags in libudevLennart Poettering2020-09-013-15/+55
|
* tree-wide: avoid some loaded termsLennart Poettering2020-06-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | https://tools.ietf.org/html/draft-knodel-terminology-02 https://lwn.net/Articles/823224/ This gets rid of most but not occasions of these loaded terms: 1. scsi_id and friends are something that is supposed to be removed from our tree (see #7594) 2. The test suite defines an API used by the ubuntu CI. We can remove this too later, but this needs to be done in sync with the ubuntu CI. 3. In some cases the terms are part of APIs we call or where we expose concepts the kernel names the way it names them. (In particular all remaining uses of the word "slave" in our codebase are like this, it's used by the POSIX PTY layer, by the network subsystem, the mount API and the block device subsystem). Getting rid of the term in these contexts would mean doing some major fixes of the kernel ABI first. Regarding the replacements: when whitelist/blacklist is used as noun we replace with with allow list/deny list, and when used as verb with allow-list/deny-list.