summaryrefslogtreecommitdiff
path: root/src/udev
AgeCommit message (Collapse)Author
2017-04-25meson: also indent scripts with 8 spacesZbigniew Jędrzejewski-Szmek
2017-04-23meson: use "sh -eu" and make .sh +x, .py -xZbigniew Jędrzejewski-Szmek
Shell scripts should be executable so that meson reports their invocation succinctly (does not print 'sh' '-e'). Python scripts should not be executable so that meson does the detection of the right python binary itself. Add -u everywhere to catch potential errors.
2017-04-23meson: add libblkid as libudev-core dep to fix include dirZbigniew Jędrzejewski-Szmek
Follow-up for 6b5cf3ea62. v2: - also link udevadm and systemd-udev statically if requested v3: - fix install_rpath for udevadm (Michael Biebl)
2017-04-23meson: reindent all files with 8 spacesZbigniew Jędrzejewski-Szmek
The indentation for emacs'es meson-mode is added .dir-locals. All files are reindented automatically, using the lasest meson-mode from git. Indentation should now be fairly consistent.
2017-04-23meson: allow optional static linking of shared code in udev helpersZbigniew Jędrzejewski-Szmek
This makes the helper binaries significantly bigger (in some cases, the final size depends on link options and optimization level), and is only useful for distributions which want to provide the option to install udev without systemd. As the linking is improved, the difference between the columns might shrink, but it's unlikely that linking libshared statically could ever be more efficient. E.g. with -O0, no -flto: (static) (shared) src/udev/ata_id 999176 85696 src/udev/cdrom_id 1024344 111656 src/udev/collect 990344 81280 src/udev/scsi_id 1023592 115656 src/udev/v4l_id 811736 17744 When linked dynamically, install_rpath must be specified, so add that.
2017-04-23meson: eliminate libsystemd_journal_internal and use libsystemd_internal lessZbigniew Jędrzejewski-Szmek
This simplifies things and leads to a smaller installation footprint. libsystemd_internal and libsystemd_journal_internal are linked into libystemd-shared and available to all programs linked to libsystemd-shared. libsystemd_journal_internal is not needed anymore, and libsystemd-shared is used everwhere. The few exceptions are: libsystemd.so, test-engine, test-bus-error, and various loadable modules.
2017-04-23meson: use join_paths consistentlyMichael Biebl
With -Dsplit-usr=true, we set rootprefix to /. This leads to //lib/systemd or //lib/udev for various dir variables. Using join_paths() avoids this.
2017-04-23meson: make cpp invocations cross-compilation friendlyZbigniew Jędrzejewski-Szmek
This implementation assumes that the arguments in compiler.cmd_array() don't contain any spaces. Since we are only interested in compilation on Linux, I think this is a safe assumption. Solution suggested by Nirbheek Chauhan.
2017-04-23meson: update linking for fixed meson linkingZbigniew Jędrzejewski-Szmek
With mesonbuid/meson#1545, meson does not propagate deps of a library when linking with that library. That's of course the right thing to do, but it exposes a bunch of missing deps. This compiles with both meson-0.39.1 and meson-git + pr/1545.
2017-04-23meson: create dirs and touch /usrZbigniew Jędrzejewski-Szmek
This is the equivalent of $(INSTALL_DIRS) and install-touch-usr-hook. I did not bother to create the directories into which we install files, since they will be created anyway. v2: - remove bashism
2017-04-23meson: define testsZbigniew Jędrzejewski-Szmek
Tests can be run with 'ninja-build test' or using 'mesontest'. '-Dtests=unsafe' can be used to include the "unsafe" tests in the test suite, same as with autotools. v2: - use more conf.get guards are optional components - declare deps on generated headers for test-{af,arphrd,cap}-list v3: - define environment for tests Most test don't need this, but to be consistent with autotools-based build, and to avoid questions which tests need it and which don't, set the same environment for all tests. v4: - rework test generation Use a list of lists to define each test. This way we can reduce the boilerplate somewhat, although the test listings are still pretty verbose. We can also move the definitions of the tests to the subdirs. Unfortunately some subdirs are included earlier than some of the libraries that test binaries are linked to. So just dump all definitions of all tests that cannot be defined earlier into src/test. The `executable` definitions are still at the top level, so the binaries are compiled into the build root. v5: - tag test-dnssec-complex as manual v6: - fix HAVE_LIBZ typo - add missing libgobject/libgio defs - mark test-qcow2 as manual
2017-04-23meson: build systemd using mesonZbigniew Jędrzejewski-Szmek
It's crucial that we can build systemd using VS2010! ... er, wait, no, that's not the official reason. We need to shed old systems by requring python 3! Oh, no, it's something else. Maybe we need to throw out 345 years of knowlege accumulated in autotools? Whatever, this new thing is cool and shiny, let's use it. This is not complete, I'm throwing it out here for your amusement and critique. - rules for sd-boot are missing. Those might be quite complicated. - rules for tests are missing too. Those are probably quite simple and repetitive, but there's lots of them. - it's likely that I didn't get all the conditions right, I only tested "full" compilation where most deps are provided and nothing is disabled. - busname.target and all .busname units are skipped on purpose. Otherwise, installation into $DESTDIR has the same list of files and the autoconf install, except for .la files. It'd be great if people had a careful look at all the library linking options. I added stuff until things compiled, and in the end there's much less linking then in the old system. But it seems that there's still a lot of unnecessary deps. meson has a `shared_module` statement, which sounds like something appropriate for our nss and pam modules. Unfortunately, I couldn't get it to work. For the nss modules, we need an .so version of '2', but `shared_module` disallows the version argument. For the pam module, it also didn't work, I forgot the reason. The handling of .m4 and .in and .m4.in files is rather awkward. It's likely that this could be simplified. If make support is ever dropped, I think it'd make sense to switch to a different templating system so that two different languages and not required, which would make everything simpler yet. v2: - use get_pkgconfig_variable - use sh not bash - use add_project_arguments v3: - drop required:true and fix progs/prog typo v4: - use find_library('bz2') - add TTY_GID definition - define __SANE_USERSPACE_TYPES__ - use join_paths(prefix, ...) is used on all paths to make them all absolute v5: - replace all declare_dependency's with [] - add more conf.get guards around optional components v6: - drop -pipe, -Wall which are the default in meson - use compiler.has_function() and compiler.has_header_symbol instead of the hand-rolled checks. - fix duplication in 'liblibsystemd' library name - use the right .sym file for pam_systemd - rename 'compiler' to 'cc': shorter, and more idiomatic. v7: - use ENABLE_ENVIRONMENT_D not HAVE_ENVIRONMENT_D - rename prefix to prefixdir, rootprefix to rootprefixdir ("prefix" is too common of a name and too easy to overwrite by mistake) - wrap more stuff with conf.get('ENABLE...') == 1 - use rootprefix=='/' and rootbindir as install_dir, to fix paths under split-usr==true. v8: - use .split() also for src/coredump. Now everything is consistent ;) - add rootlibdir option and use it on the libraries that require it v9: - indentation v10: - fix check for qrencode and libaudit v11: - unify handling of executable paths, provide options for all progs This makes the meson build behave slightly differently than the autoconf-based one, because we always first try to find the executable in the filesystem, and fall back to the default. I think different handling of loadkeys, setfont, and telinit was just a historical accident. In addition to checking in $PATH, also check /usr/sbin/, /sbin for programs. In Fedora $PATH includes /usr/sbin, (and /sbin is is a symlink to /usr/sbin), but in Debian, those directories are not included in the path. C.f. https://github.com/mesonbuild/meson/issues/1576. - call all the options 'xxx-path' for clarity. - sort man/rules/meson.build properly so it's stable
2017-04-17Merge pull request #5708 from vcatechnology/arm-cross-compileLennart Poettering
ARM32 cross-compile fixes
2017-04-06Remove BTN_DPAD_* keys from ID_INPUT_KEY test (#5701)Nathaniel R. Lewis
At present, devices implementing the BTN_DPAD_UP/DOWN/LEFT/RIGHT codes will be incorrectly classified as key devices. This causes devices respecting the Linux gamepad spec (such as the DS3 as of kernel 4.12) to be classified as keyboards by X11. This is caused by the test_key function checking all codes on [KEY_OK, BTN_TRIGGER_HAPPY). Unfortunately the BTN_DPAD_* codes are placed between KEY_LIGHTS_TOGGLE and KEY_ALS_TOGGLE. This patch splits the upper key block check into the block before and after the BTN_DPAD_* codes. An array is used to avoid dedicated, per block loops in the event that more event codes are added in the future.
2017-04-06build-sys: correct blkid.h includesMatt Clarkson
When using pkg-config to determine the include flags for blkid the flags are returned as: $ pkg-config blkid --cflags -I/usr/include/blkid -I/usr/include/uuid We use the <blkid/blkid.h> include which would be correct when using the default compiler /usr/include header search path. However, when cross-compiling the blkid.h will not be installed at /usr/include and highly likely in a temporary system root. It is futher compounded if the cross-compile packages are split up and the blkid package is not available in the same sysroot as the compiler. Regardless of the compilation setup, the correct include path should be <blkid.h> if using the pkg-config returned CFLAGS.
2017-04-05Merge pull request #5706 from keszybz/make-cleanupsLennart Poettering
Move busctl to its own dir and other cleanups
2017-04-04udev: rename gperf struct name to match other headersZbigniew Jędrzejewski-Szmek
This makes it easier to use the same generator script as for other gperf scripts. With automake each gperf file had it's own rule, but with meson I'm trying to use one script, and this inconsistency made that harder.
2017-04-04tree-wide: standardize on $(PACKAGE_VERSION) for the version stringZbigniew Jędrzejewski-Szmek
We defined both $(VERSION) and $(PACKAGE_VERSION) with the same contents. $(PACKAGE_VERSION) is slightly more descriptive, so settle on that, and drop the other define.
2017-03-31udev: net_id - support predictable ifnames on vio buses (#5675)Franck Bui
For IBM PowerVM Virtual I/O network devices, we can build predictable names based on the slot number passed as part of the OF "reg" property. Valid slot numbers range between 2-32767, so we only need the bottom half of the unit address passed. For example: /proc/device-tree/vdevice/l-lan@30000002 /proc/device-tree/vdevice/vnic@30000005 would initially map to something like: /sys/devices/vio/30000002/net/eth0 /sys/devices/vio/30000005/net/eth1 and would then translate to env2 and env5 This patch ignores the bus number, as there should only ever be one bus, and then remove leading zeros.
2017-03-01udev: Use parent bus id for virtio disk builtin path-id (#5500)Viktor Mihajlovski
The builtin path id for virtio block devices has been changed to use the bus id without a prefix "virtio-pci" to be compatible with all virtio transport types. In order to not break existing setups, the by-path symlinks for virtio block devices on the PCI bus are reintroduced by udev rules. The virtio-pci symlinks are considered to be deprecated and should be replaced by the native PCI symlinks. Example output for a virtio disk in PCI slot 7: $ ls /dev/disk/by-path pci-0000:00:07.0 pci-0000:00:07.0-part1 virtio-pci-0000:00:07.0 virtio-pci-0000:00:07.0-part1 See also [1] https://lists.freedesktop.org/archives/systemd-devel/2017-February/038326.html [2] https://lists.freedesktop.org/archives/systemd-devel/2017-March/038397.html This reverts f073b1b but keeps the same symlinks for compatibility.
2017-02-21udev-builtin-blkid: use -errno not -1 as error codeZbigniew Jędrzejewski-Szmek
The code that calls this function doesn't care, but it looks bad.
2017-02-21tree-wide: simplify handling of blkid errorsZbigniew Jędrzejewski-Szmek
2017-02-19udev-builtin-net_id: fix warning about discarded "const" attribute (#5385)Zbigniew Jędrzejewski-Szmek
2017-02-17Merge pull request #5373 from poettering/coredump-timestamp-fixesZbigniew Jędrzejewski-Szmek
various coredump fixes
2017-02-17udev: fix id_net_name_path for virtio-ccw interfaces (#5357)Viktor Mihajlovski
The CCW id_net_name_path detection didn't account for virtio interfaces on the CCW bus. As a result the default interface names for virtio-ccw interfaces would use the old eth<x> format instead of enc<busid>. Since virtio-pci interface naming follows the naming rules of the parent bus, the names_ccw() logic was changed to apply the CCW interface naming rules to virtio interfaces as well, e.g. enc2000 for an interface with a CCW bus id 0.0.2000. As virtio interfaces are apt to get the otherwise unusual CCW bus id 0.0.0000, the last '0' is now preserved in this case. The virtio subsystem skipping loop has been moved from names_pci() into a function skip_virtio() that can be reused for all bus types with virtio network devices. Since virtio-ccw interfaces use single CCW addresses the ccwgroup requirement was relaxed and the C definitions were changed accordingly.
2017-02-17udevd: use signal_to_string() instead of strsignal() at one placeLennart Poettering
strsignal() sucks, as it tries to generate human readable strings from something that isn't really human readable by concept. Let's use signal_to_string() instead, making this more grokkable. Difference is: SIGINT gets translated → "SIGINT" rather than → "Interrupted".
2017-01-27udev-event: use in-place whitespace replacementDan Streetman
Instead of using a temp buffer to replace whitespace in variable substitutions, just allow util_replace_whitespace to replace in-place. Add a comment to util_replace_whitespace indicating it is used to replace in-place, to prevent accidental future breakage.
2017-01-27udev-event: refactor udev_event_apply_formatDan Streetman
Move the large case statement into its own function
2017-01-15udev: fix variable assignmentZbigniew Jędrzejewski-Szmek
gcc doesn't like &, even though &sbuf and buf are the same things afaiu. Follow-up for e20a917105b.
2017-01-14Merge pull request #4879 from poettering/systemdZbigniew Jędrzejewski-Szmek
2017-01-11Merge pull request #4837 from ddstreet/masterZbigniew Jędrzejewski-Szmek
Replace spaces in expanded fields in SYMLINK properties by default.
2017-01-10build-sys: add check for gperf lookup function signature (#5055)Mike Gilbert
gperf-3.1 generates lookup functions that take a size_t length parameter instead of unsigned int. Test for this at configure time. Fixes: https://github.com/systemd/systemd/issues/5039
2017-01-10udev: add ID_INPUT_SWITCH for devices with switch capability (#5057)Peter Hutterer
2017-01-03udev-rules: perform whitespace replacement for symlink subst valuesDan Streetman
If the string_escape option is either unset or 'replace' (i.e. if it is not 'none'), then enable whitespace replacement in SYMLINK variable substitution values, as added in the last patch. This will keep any whitespace that is directly contained in a SYMLINK value, but will replace any whitespace that is added to the SYMLINK value as a result of variable substitution (except $result/%c). This fixes bug 4833.
2017-01-03udev-event: add replace_whitespace param to udev_event_apply_formatDan Streetman
If replace_whitespace is true, each substitution value has all its whitespace removed/replaced by util_replace_whitespace (except the SUBST_RESULT substitution - $result{} or %c{} - which handles spaces itself as field separators). All existing callers are updated to pass false, so no functional change is made by this patch. This is needed so the SYMLINK assignment can replace any spaces introduced through variable substitution, becuase the SYMLINK value is a space-separated list of symlinks to create. Any variables that contain spaces will thus unexpectedly change the symlink value from a single symlink to multiple incorrectly-named symlinks. This is used in the next patch, which enables the whitespace replacement for SYMLINK variable substitution.
2016-12-21util-lib: various improvements to kernel command line parsingLennart Poettering
This improves kernel command line parsing in a number of ways: a) An kernel option "foo_bar=xyz" is now considered equivalent to "foo-bar-xyz", i.e. when comparing kernel command line option names "-" and "_" are now considered equivalent (this only applies to the option names though, not the option values!). Most of our kernel options used "-" as word separator in kernel command line options so far, but some used "_". With this change, which was a source of confusion for users (well, at least of one user: myself, I just couldn't remember that it's systemd.debug-shell, not systemd.debug_shell). Considering both as equivalent is inspired how modern kernel module loading normalizes all kernel module names to use underscores now too. b) All options previously using a dash for separating words in kernel command line options now use an underscore instead, in all documentation and in code. Since a) has been implemented this should not create any compatibility problems, but normalizes our documentation and our code. c) All kernel command line options which take booleans (or are boolean-like) have been reworked so that "foobar" (without argument) is now equivalent to "foobar=1" (but not "foobar=0"), thus normalizing the handling of our boolean arguments. Specifically this means systemd.debug-shell and systemd_debug_shell=1 are now entirely equivalent. d) All kernel command line options which take an argument, and where no argument is specified will now result in a log message. e.g. passing just "systemd.unit" will no result in a complain that it needs an argument. This is implemented in the proc_cmdline_missing_value() function. e) There's now a call proc_cmdline_get_bool() similar to proc_cmdline_get_key() that parses booleans (following the logic explained in c). f) The proc_cmdline_parse() call's boolean argument has been replaced by a new flags argument that takes a common set of bits with proc_cmdline_get_key(). g) All kernel command line APIs now begin with the same "proc_cmdline_" prefix. h) There are now tests for much of this. Yay!
2016-12-09tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853)Reverend Homer
2016-12-06udev: remove duplicate flagThomas Hindoe Paaboel Andersen
One SA_RESTART is enough. Fall out from e28c7cd0665364bb910fe2cead882623c23c28ac
2016-12-01Spot inconsistent quoting (just one single quote) (#4732)Tobias Stoeckmann
It is possible to specify only one quote in udev rules, which is not detected as an invalid quoting (" instead of "" for empty string). Technically this doesn't lead to a bug, because the string ends in two terminating nul characters at this position, but a user should still be reminded that his configuration is invalid.
2016-12-01tree-wide: set SA_RESTART for signal handlers we installLennart Poettering
We already set it in most cases, but make sure to set it in all others too, and document that that's a good idea.
2016-11-28udevd: check correct return value of fcntl() (#4758)Daniel Wagner
This looks like a copy&paste error from the code block above.
2016-11-14link: fix offload features initialization (#4639)Maks Naumov
2016-11-10Link: port to new ethtool ETHTOOL_xLINKSETTINGSSusant Sahani
Link: port to new ethtool ETHTOOL_xLINKSETTINGS This patch defines a new ETHTOOL_GLINKSETTINGS/SLINKSETTINGS API, handled by the new get_link_ksettings/set_link_ksettings . This is a WIP version based on this [kernel patch](https://patchwork.kernel.org/patch/8411401/). commit 0527f1c http://github.com/torvalds/linux/commit/3f1ac7a700d039c61d8d8b99f28d605d489a60cfommit 35afb33
2016-11-07Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek
We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
2016-11-03Merge pull request #4510 from keszybz/tree-wide-cleanupsLennart Poettering
Tree wide cleanups
2016-11-02udev/udev-watch: calculate the real buffer sizes neededZbigniew Jędrzejewski-Szmek
2016-11-02Revert some uses of xsprintfZbigniew Jędrzejewski-Szmek
This reverts some changes introduced in d054f0a4d4. xsprintf should be used in cases where we calculated the right buffer size by hand (using DECIMAL_STRING_MAX and such), and never in cases where we are printing externally specified strings of arbitrary length. Fixes #4534.
2016-11-01udev: net_id: add support for phys_port_name attribute (#4506)Jiří Pírko
Switch drivers uses phys_port_name attribute to pass front panel port name to user. Use it to generate netdev names. Signed-off-by: Jiri Pirko <jiri@mellanox.com>
2016-10-28udev: allow substitutions for SECLABEL key (#4505)Michal Sekletar
2016-10-23tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek
This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/systemd -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libsystemd/sd-bus -I ./src/libsystemd/sd-event -I ./src/libsystemd/sd-login -I ./src/libsystemd/sd-netlink -I ./src/libsystemd/sd-network -I ./src/libsystemd/sd-hwdb -I ./src/libsystemd/sd-device -I ./src/libsystemd/sd-id128 -I ./src/libsystemd-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.