Commit Graph

51 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
Yu Watanabe fd05c424c0 libudev: introduce return_with_errno() and use it where applicable 2018-11-22 23:49:55 +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 bc54df90e4 libudev: modernize code a bit 2018-09-11 12:45:21 +09:00
Yu Watanabe 5ccb44a53f libudev: use structured initializer 2018-09-11 12:45:21 +09:00
Yu Watanabe 2454727d5a libudev: drop unused element in udev struct 2018-09-11 12:45:21 +09:00
Yu Watanabe ff6f97f0cf libudev: drop outdated comments 2018-09-11 12:45:21 +09:00
Yu Watanabe 3c6ac21929 libudev: use DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC() macro where applicable 2018-09-11 12:45:21 +09:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Zbigniew Jędrzejewski-Szmek e8112e67e4 Make MANAGER_TEST_RUN_MINIMAL just allocate data structures
When running tests like test-unit-name, there is not point in setting
up the cgroup and signals and interacting with the environment. Similarly
when running fuzz testing of the parser.

Add new MANAGER_TEST_RUN_BASIC which takes the role of MANAGER_TEST_RUN_MINIMAL,
and redefine MANAGER_TEST_RUN_MINIMAL to just create the basic data structures.
2018-03-11 16:33:59 +01:00
Daniel Lockyer 5fecf46d76 Replace free and return NULL with return mfree 2017-11-24 10:31:49 +00:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Lennart Poettering 309f631d41 libudev: add missing errno initialization/error propagation (#6781)
In libudev (which es much older code than the rest of systemd), we
propagate errors in functions not returning an int, via (positive) errno
(i.e. libc-style), and as negative Exyz values in those returning an int
(much preferred, i.e. Linux kernel style). Let's fix up a few place,
where this was incorrectly done, or not done at all.

Fixes: #6613
2017-09-09 22:31:09 +02:00
Zbigniew Jędrzejewski-Szmek ab430161ee libudev: unused variable 2017-07-12 14:26:38 -04:00
Zbigniew Jędrzejewski-Szmek b237a168df Rip out setting of the log level from udev_new and put it in a new function
This function is internal to systemd code, so external users of libudev
will not see those log messages. I think this is better. If we want to
allow that, the function could be put in libudev and exported.

v2: check that the string is more than one char before stripping quotes
2017-05-07 22:49:12 -04:00
Lennart Poettering b90ef60fbc Revert "udev: Introduce UDEV_PROPAGATE_LOG macro (#5302)"
This reverts commit c22569eeea.

Let's revert this for now, since it apparently doesn't fix the problem
at hand.
2017-02-23 12:36:25 +01:00
Susant Sahani c22569eeea udev: Introduce UDEV_PROPAGATE_LOG macro (#5302)
As per commit 25e773e "udev: switch to systemd logging functions"
Now log_set_max_level() in udev_new() overwites system wide log level.

Propagate the udev.conf setting to log_set_max_level()
only if udev_new() is called from within udevd or one of its helpers.

Introduce a UDEV_PROPAGATE_LOG macro that we set with -D on
the gcc command line for all udev binaries we build, but not
for any others. The log_set_max_level() call is guarded by an
ifdef check for that macro, so that it only effects the various
udev binaries.

closes: #4525
2017-02-22 00:16:13 +01:00
Lennart Poettering 9e70a49dc7 libudev: set errno if udev_new() fails
All other constructors in libudev do that, let's also do this for udev_new().
2016-12-07 18:38:40 +01:00
Tobias Stoeckmann cd05bb8baf Spot inconsistent quoting (just one single quote) (#4732)
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-01 18:46:36 -05:00
Thomas Hindoe Paaboel Andersen b4bbcaa9c4 tree-wide: group include of libudev.h with sd-* 2015-11-17 07:06:08 +01:00
Thomas Hindoe Paaboel Andersen cf0fbc49e6 tree-wide: sort includes
Sort the includes accoding to the new coding style.
2015-11-16 22:09:36 +01:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Michal Schmidt ff49bc3212 treewide: drop unnecessary trailing \n in log_*() calls 2014-11-28 14:26:31 +01:00
Kay Sievers 41b848b0ea udev: move global property handling from libudev to udevd 2014-11-13 13:50:01 +01:00
Kay Sievers 25e773eeb4 udev: switch to systemd logging functions 2014-11-13 13:12:57 +01:00
Kay Sievers a974cacd9a libudev: we do not log errors from libraries 2014-11-13 11:42:24 +01:00
Colin Walters ea55caa60c libudev: Use correct free function
FILE * wants cleanup_fclose().

Spotted by udev hwdb segfaulting in gnome-continuous' buildroot
construction.
2014-11-01 16:04:25 -04:00
Zbigniew Jędrzejewski-Szmek f47ad59316 Use log "level" instead of "priority"
The term "priority" is misleading because higher levels have lower
priority. "Level" is clearer and shorter.

This commit touches only the textual descriptions, not function and variable
names themselves. "Priority" is used in various command-line switches and
protocol constants, so completly getting rid of "priority" is hard.

I also left "priority" in various places where the clarity suffered
when it was removed.
2014-11-01 14:39:47 -04:00
Zbigniew Jędrzejewski-Szmek ee7122c0ec libudev: do not accept invalid log levels
Invalid log levels lead to a assert failure later on.

https://bugs.freedesktop.org/show_bug.cgi?id=85657
2014-11-01 14:39:47 -04:00
Zbigniew Jędrzejewski-Szmek fe756ed9ec libudev: modernization
This brings udev logging style a bit closer to normal systemd convention.
2014-11-01 14:39:47 -04:00
Lennart Poettering 955d98c9c1 everywhere: make use of new0() and macro() macros, and stop using perror() 2014-02-13 14:45:51 +01:00
Thomas Hindoe Paaboel Andersen 9091e686f4 Add more _printf_'s for format-nonliterals
Clang is a bit more strict wrt format-nonliterals:
http://clang.llvm.org/docs/LanguageExtensions.html#format-string-checking

Adding these extra printf attributes also makes gcc able to find more
problems. E.g. this patch uncovers a format issue in udev-builtin-path_id.c

Some parts looked intetional about breaking the format-nonliteral check.
I added some supression for warnings there.
2013-12-14 13:32:22 +01:00
Tom Gundersen 2004d23a0f libudev: default log_priority to INFO
This brings it in sync with the default config file.
2013-10-30 15:36:04 +01:00
Thomas Hindoe Paaboel Andersen 090be86534 use streq instead of strcmp 2013-02-13 18:14:20 +01:00
Kay Sievers 88a6477ef3 libudev: update copyright headers 2012-11-12 17:50:33 +01:00
Kay Sievers ff944daa01 udev: get rid of SYSCONFDIR 2012-10-28 04:04:22 +01:00
Zbigniew Jędrzejewski-Szmek 4db17f291c build-sys: __secure_getenv lost dunder in libc 2.17 2012-09-17 00:21:25 +02:00
Lennart Poettering 88fae6e044 shared: in code that might get called from suid programs use __secure_getenv() rather than getenv()
It's better to be safe than sorry.
2012-09-03 18:59:04 -07:00
Kay Sievers c195956988 udev: update docs, NEWS 2012-05-15 23:44:28 +02:00
Kay Sievers 20bbd54f60 udev: libudev - bump soname, remove deprecated functions, introduce symbol versions 2012-05-15 23:06:26 +02:00
Kay Sievers c8f8394a93 libudev: prefix log macros with 'udev_' 2012-04-26 17:43:48 +02:00
Kay Sievers 6ada823a9a udev: remove configuration options for /dev, /sys, /run directories 2012-04-16 19:20:57 +02:00