]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/udev-util.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright © 2017 Zbigniew Jędrzejewski-Szmek
10 #include "string-util.h"
11 #include "udev-util.h"
13 int udev_parse_config(void) {
14 _cleanup_free_
char *val
= NULL
;
19 r
= parse_env_file(NULL
, "/etc/udev/udev.conf", NEWLINE
, "udev_log", &val
, NULL
);
20 if (r
== -ENOENT
|| !val
)
28 ((val
[0] == '"' && val
[n
-1] == '"') ||
29 (val
[0] == '\'' && val
[n
-1] == '\''))) {
35 /* we set the udev log level here explicitly, this is supposed
36 * to regulate the code in libudev/ and udev/. */
37 r
= log_set_max_level_from_string_realm(LOG_REALM_UDEV
, log
);
39 log_debug_errno(r
, "/etc/udev/udev.conf: failed to set udev log level '%s', ignoring: %m", log
);
44 int udev_device_new_from_stat_rdev(struct udev
*udev
, const struct stat
*st
, struct udev_device
**ret
) {
45 struct udev_device
*nd
;
52 if (S_ISBLK(st
->st_mode
))
54 else if (S_ISCHR(st
->st_mode
))
59 nd
= udev_device_new_from_devnum(udev
, type
, st
->st_rdev
);