udev: Clean up includes

Split out of #37344.
This commit is contained in:
Daan De Meyer
2025-05-21 23:57:31 +09:00
committed by Yu Watanabe
parent 5cf0b3b5bc
commit dc59a1517d
84 changed files with 153 additions and 316 deletions
-10
View File
@@ -5,30 +5,20 @@
* Copyright © 2009-2010 David Zeuthen <zeuthen@gmail.com>
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/bsg.h>
#include <linux/hdreg.h>
#include <scsi/scsi.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/sg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "build.h"
#include "device-nodes.h"
#include "fd-util.h"
#include "log.h"
#include "main-func.h"
#include "memory-util.h"
#include "udev-util.h"
#include "unaligned.h"
+1 -2
View File
@@ -8,17 +8,16 @@
#include <linux/cdrom.h>
#include <scsi/sg.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include "alloc-util.h"
#include "build.h"
#include "fd-util.h"
#include "main-func.h"
#include "memory-util.h"
#include "random-util.h"
#include "sort-util.h"
#include "string-table.h"
#include "string-util.h"
#include "time-util.h"
#include "udev-util.h"
#include "unaligned.h"
+1
View File
@@ -43,6 +43,7 @@
*/
#include <getopt.h>
#include <stdio.h>
#include "alloc-util.h"
#include "build.h"
-5
View File
@@ -6,13 +6,10 @@
* Inspired by Andrew Lutomirski's 'u2f-hidraw-policy.c'
*/
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/hid.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
@@ -22,10 +19,8 @@
#include "fd-util.h"
#include "fido_id_desc.h"
#include "log.h"
#include "macro.h"
#include "main-func.h"
#include "path-util.h"
#include "string-util.h"
#include "udev-util.h"
static const char *arg_device = NULL;
-5
View File
@@ -1,11 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* Inspired by Andrew Lutomirski's 'u2f-hidraw-policy.c' */
#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "fido_id_desc.h"
#define HID_RPTDESC_FIRST_BYTE_LONG_ITEM 0xfeu
+1 -2
View File
@@ -2,7 +2,6 @@
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "forward.h"
int is_fido_security_token_desc(const uint8_t *desc, size_t desc_len);
-4
View File
@@ -1,13 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/hid.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "fido_id_desc.h"
#include "fuzz.h"
#include "log.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
fuzz_setup_logging();
-5
View File
@@ -1,11 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdint.h>
#include <stdlib.h>
#include "fido_id_desc.h"
#include "log.h"
#include "macro.h"
#include "tests.h"
TEST(is_fido_security_token_desc__fido) {
-2
View File
@@ -3,9 +3,7 @@
#include <stdio.h>
#include "fd-util.h"
#include "fs-util.h"
#include "fuzz.h"
#include "tests.h"
#include "tmpfile-util.h"
#include "udev-rules.h"
-4
View File
@@ -1,9 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include <unistd.h>
#include "sd-device.h"
@@ -14,8 +12,6 @@
#include "device-util.h"
#include "devnum-util.h"
#include "main-func.h"
#include "path-util.h"
#include "pretty-print.h"
#include "string-util.h"
#include "strv.h"
#include "udev-util.h"
-6
View File
@@ -18,18 +18,12 @@
* Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <mtd/mtd-user.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
#include "build.h"
#include "fd-util.h"
#include "log.h"
+1 -1
View File
@@ -22,7 +22,7 @@
#include <mtd/mtd-user.h>
#include "macro.h"
#include "forward.h"
/* Full oob structure as written on the flash */
struct sm_oob {
-6
View File
@@ -18,15 +18,9 @@
* Boston, MA 02110-1301 USA
*/
#include <errno.h>
#include <fcntl.h>
#include <mtd/mtd-user.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "alloc-util.h"
-1
View File
@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "fd-util.h"
#include "fs-util.h"
#include "fuzz.h"
#include "link-config.h"
#include "tmpfile-util.h"
+1
View File
@@ -5,6 +5,7 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
#endif
#include <stddef.h>
#include "condition.h"
#include "conf-parser.h"
#include "ethtool-util.h"
#include "link-config.h"
+8 -3
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/netdevice.h>
#include <netinet/ether.h>
#include <net/if_arp.h>
#include <unistd.h>
#include "sd-device.h"
@@ -9,29 +9,34 @@
#include "alloc-util.h"
#include "arphrd-util.h"
#include "condition.h"
#include "conf-files.h"
#include "conf-parser.h"
#include "constants.h"
#include "cpu-set-util.h"
#include "creds-util.h"
#include "device-private.h"
#include "device-util.h"
#include "escape.h"
#include "ether-addr-util.h"
#include "ethtool-util.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "hashmap.h"
#include "link-config.h"
#include "log-link.h"
#include "memory-util.h"
#include "net-condition.h"
#include "netif-naming-scheme.h"
#include "netif-sriov.h"
#include "netif-util.h"
#include "netlink-util.h"
#include "network-util.h"
#include "parse-util.h"
#include "path-lookup.h"
#include "path-util.h"
#include "proc-cmdline.h"
#include "random-util.h"
#include "socket-util.h"
#include "specifier.h"
#include "stat-util.h"
#include "string-table.h"
+2 -6
View File
@@ -2,16 +2,12 @@
#pragma once
#include "sd-device.h"
#include "sd-netlink.h"
#include "condition.h"
#include "conf-parser.h"
#include "cpu-set-util.h"
#include "ether-addr-util.h"
#include "ethtool-util.h"
#include "hashmap.h"
#include "forward.h"
#include "list.h"
#include "net-condition.h"
#include "netif-naming-scheme.h"
typedef struct LinkConfigContext LinkConfigContext;
typedef struct LinkConfig LinkConfig;
-1
View File
@@ -4,7 +4,6 @@
/* Copyright (C) IBM Corp. 2003 */
#include <scsi/scsi.h>
#include <sys/types.h>
struct scsi_ioctl_command {
unsigned inlen; /* excluding scsi command length */
+1 -8
View File
@@ -5,15 +5,9 @@
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "build.h"
@@ -21,7 +15,6 @@
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "parse-util.h"
#include "scsi_id.h"
#include "string-util.h"
#include "strv.h"
-7
View File
@@ -5,24 +5,17 @@
* Author: Patrick Mansfield<patmans@us.ibm.com>
*/
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <linux/bsg.h>
#include <linux/types.h>
#include <scsi/scsi.h>
#include <scsi/sg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include "devnum-util.h"
#include "log.h"
#include "memory-util.h"
#include "random-util.h"
#include "scsi.h"
#include "scsi_id.h"
-1
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "log.h"
#include "tests.h"
#include "udev-builtin.h"
+1 -5
View File
@@ -3,12 +3,7 @@
Copyright © 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
***/
#include <errno.h>
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/signalfd.h>
#include <unistd.h>
#include "device-private.h"
@@ -24,6 +19,7 @@
#include "signal-util.h"
#include "string-util.h"
#include "tests.h"
#include "time-util.h"
#include "udev-event.h"
#include "udev-rules.h"
#include "udev-spawn.h"
+6
View File
@@ -1,8 +1,14 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdlib.h>
#include "sd-device.h"
#include "alloc-util.h"
#include "mountpoint-util.h"
#include "path-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "tests.h"
#include "udev-event.h"
+1 -6
View File
@@ -9,17 +9,12 @@
#include <valgrind/memcheck.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/loop.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include "sd-id128.h"
#include "alloc-util.h"
#include "blkid-util.h"
#include "blockdev-util.h"
@@ -28,8 +23,8 @@
#include "efi-loader.h"
#include "errno-util.h"
#include "fd-util.h"
#include "gpt.h"
#include "initrd-util.h"
#include "gpt.h"
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
-3
View File
@@ -2,15 +2,12 @@
#include <fcntl.h>
#include <linux/btrfs.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include "device-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "missing_fs.h"
#include "string-util.h"
#include "strxcpyx.h"
#include "udev-builtin.h"
static int builtin_btrfs(UdevEvent *event, int argc, char *argv[]) {
+5 -1
View File
@@ -1,15 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <sys/file.h>
#include "alloc-util.h"
#include "blockdev-util.h"
#include "device-util.h"
#include "dissect-image.h"
#include "fd-util.h"
#include "errno-util.h"
#include "hexdecoct.h"
#include "image-policy.h"
#include "initrd-util.h"
#include "loop-util.h"
#include "proc-cmdline.h"
#include "string-util.h"
#include "strv.h"
#include "udev-builtin.h"
static ImagePolicy *arg_image_policy = NULL;
+1
View File
@@ -2,6 +2,7 @@
#include "device-util.h"
#include "factory-reset.h"
#include "string-util.h"
#include "udev-builtin.h"
/* Sometimes it is relevant in udev rules to know whether factory reset is currently in effect or not. Report
-2
View File
@@ -1,10 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fnmatch.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include "sd-hwdb.h"
-4
View File
@@ -6,12 +6,8 @@
* Copyright © 2014 Carlos Garnacho <carlosg@gnome.org>
*/
#include <errno.h>
#include <fcntl.h>
#include <linux/input.h>
#include <linux/limits.h>
#include <stdarg.h>
#include <unistd.h>
#include "device-util.h"
#include "fd-util.h"
-1
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <linux/input.h>
#include <stdlib.h>
-5
View File
@@ -5,11 +5,6 @@
* Copyright © 2011 ProFUSION embedded systems
*/
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "device-util.h"
#include "module-util.h"
#include "string-util.h"
-2
View File
@@ -6,8 +6,6 @@
#include "errno-util.h"
#include "ethtool-util.h"
#include "fd-util.h"
#include "log.h"
#include "string-util.h"
#include "udev-builtin.h"
static int builtin_net_driver_set_driver(UdevEvent *event, int argc, char **argv) {
-8
View File
@@ -12,18 +12,13 @@
* When the code here is changed, man/systemd.net-naming-scheme.xml must be updated too.
*/
#include <errno.h>
#include <fcntl.h>
#include <linux/if.h>
#include <linux/if_arp.h>
#include <linux/netdevice.h>
#include <linux/pci_regs.h>
#include <net/if.h>
#include <stdarg.h>
#include <unistd.h>
#include "alloc-util.h"
#include "chase.h"
#include "device-private.h"
#include "device-util.h"
#include "dirent-util.h"
@@ -33,11 +28,8 @@
#include "glyph-util.h"
#include "netif-naming-scheme.h"
#include "parse-util.h"
#include "proc-cmdline.h"
#include "stdio-util.h"
#include "string-util.h"
#include "strv.h"
#include "strxcpyx.h"
#include "udev-builtin.h"
#define ONBOARD_14BIT_INDEX_MAX ((1U << 14) - 1)
+1 -4
View File
@@ -1,13 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "alloc-util.h"
#include "device-private.h"
#include "device-util.h"
#include "errno-util.h"
#include "link-config.h"
#include "log.h"
#include "string-util.h"
#include "strv.h"
#include "netif-naming-scheme.h"
#include "udev-builtin.h"
static LinkConfigContext *ctx = NULL;
+1 -7
View File
@@ -5,14 +5,10 @@
* Logic based on Hannes Reinecke's shell script.
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/usb/ch11.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "alloc-util.h"
#include "device-private.h"
@@ -21,10 +17,8 @@
#include "fd-util.h"
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "sysexits.h"
#include "udev-builtin.h"
#include "udev-util.h"
_printf_(2,3)
static void path_prepend(char **path, const char *fmt, ...) {
-4
View File
@@ -6,14 +6,10 @@
* Author: Hannes Reinecke <hare@suse.de>
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
#include "alloc-util.h"
#include "device-nodes.h"
#include "device-util.h"
#include "fd-util.h"
+1 -7
View File
@@ -1,13 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdbool.h>
#include "sd-device.h"
#include "sd-netlink.h"
#include "macro.h"
#include "udev-def.h"
#include "forward.h"
#include "udev-event.h"
typedef struct UdevBuiltin {
+5 -1
View File
@@ -1,20 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <getopt.h>
#include <unistd.h>
#include <stdlib.h>
#include "conf-parser.h"
#include "cpu-set-util.h"
#include "daemon-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "hashmap.h"
#include "limits-util.h"
#include "parse-util.h"
#include "pretty-print.h"
#include "proc-cmdline.h"
#include "serialize.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "syslog-util.h"
#include "time-util.h"
#include "udev-config.h"
#include "udev-manager.h"
#include "udev-rules.h"
+1 -5
View File
@@ -1,15 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdbool.h>
#include "time-util.h"
#include "udev-def.h"
#include "udev-forward.h"
extern bool arg_daemonize;
typedef struct Manager Manager;
typedef struct UdevConfig {
int log_level;
ResolveNameTiming resolve_name_timing;
-4
View File
@@ -1,10 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <poll.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/un.h>
#include <unistd.h>
+1 -7
View File
@@ -1,13 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "sd-event.h"
#include "macro.h"
#include "memory-util.h"
#include "time-util.h"
typedef struct UdevCtrl UdevCtrl;
#include "udev-forward.h"
typedef enum UdevCtrlMessageType {
_UDEV_CTRL_END_MESSAGES,
+1 -2
View File
@@ -1,9 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <errno.h>
#include "env-util.h"
#include "udev-forward.h"
#define UDEV_NAME_SIZE 512
#define UDEV_PATH_SIZE 1024
+2 -2
View File
@@ -6,9 +6,9 @@
#include "device-util.h"
#include "devnum-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "json-util.h"
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "udev-builtin.h"
#include "udev-dump.h"
+1 -5
View File
@@ -1,11 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdio.h>
#include "sd-json.h"
typedef struct UdevEvent UdevEvent;
#include "udev-forward.h"
void event_cache_written_sysattr(UdevEvent *event, const char *attr, const char *value);
void event_cache_written_sysctl(UdevEvent *event, const char *attr, const char *value);
+1 -1
View File
@@ -16,7 +16,7 @@ int device_add_errno(sd_device *dev, int error) {
if (error == 0)
return 0;
error = abs(error);
error = ABS(error);
r = device_add_property(dev, "UDEV_WORKER_FAILED", "1");
RET_GATHER(r, device_add_propertyf(dev, "UDEV_WORKER_ERRNO", "%i", error));
+1 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "sd-device.h"
#include "forward.h"
int device_add_errno(sd_device *dev, int error);
int device_add_exit_status(sd_device *dev, int status);
+5 -1
View File
@@ -1,15 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "sd-netlink.h"
#include "alloc-util.h"
#include "device-internal.h"
#include "device-private.h"
#include "device-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "netif-naming-scheme.h"
#include "netlink-util.h"
#include "path-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "udev-event.h"
#include "udev-node.h"
#include "udev-rules.h"
+1 -13
View File
@@ -5,20 +5,8 @@
* Copyright © 2003 Greg Kroah-Hartman <greg@kroah.com>
*/
#include <stdbool.h>
#include <stddef.h>
#include "sd-device.h"
#include "sd-netlink.h"
#include "hashmap.h"
#include "macro.h"
#include "time-util.h"
#include "udev-def.h"
#include "user-util.h"
typedef struct UdevRules UdevRules;
typedef struct UdevWorker UdevWorker;
#include "udev-forward.h"
typedef struct UdevEvent {
unsigned n_ref;
+2
View File
@@ -1,5 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <sys/sysmacros.h>
#include "alloc-util.h"
#include "device-util.h"
#include "errno-util.h"
+1 -4
View File
@@ -1,10 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdbool.h>
#include <stddef.h>
typedef struct UdevEvent UdevEvent;
#include "udev-forward.h"
#define UDEV_ALLOWED_CHARS_INPUT "/ $%?,"
+13
View File
@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "forward.h" /* IWYU pragma: export */
typedef struct UdevCtrl UdevCtrl;
typedef struct UdevEvent UdevEvent;
typedef struct Manager Manager;
typedef struct Event Event;
typedef struct UdevRules UdevRules;
typedef struct Worker Worker;
typedef struct UdevWorker UdevWorker;
typedef struct UdevRuleFile UdevRuleFile;
+1 -1
View File
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
typedef struct Manager Manager;
#include "udev-forward.h"
int manager_init_ctrl(Manager *manager, int fd);
int manager_start_ctrl(Manager *manager);
+11 -6
View File
@@ -1,36 +1,41 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <poll.h>
#include <stdlib.h>
#include "sd-varlink.h"
#include "cgroup-util.h"
#include "common-signal.h"
#include "daemon-util.h"
#include "device-monitor-private.h"
#include "device-private.h"
#include "device-util.h"
#include "errno-list.h"
#include "errno-util.h"
#include "event-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "io-util.h"
#include "iovec-util.h"
#include "list.h"
#include "mkdir.h"
#include "notify-recv.h"
#include "pidref.h"
#include "prioq.h"
#include "process-util.h"
#include "selinux-util.h"
#include "set.h"
#include "signal-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "strv.h"
#include "syslog-util.h"
#include "time-util.h"
#include "udev-builtin.h"
#include "udev-config.h"
#include "udev-ctrl.h"
#include "udev-error.h"
#include "udev-event.h"
#include "udev-manager.h"
#include "udev-manager-ctrl.h"
#include "udev-node.h"
#include "udev-rules.h"
#include "udev-spawn.h"
#include "udev-trace.h"
+2 -14
View File
@@ -1,20 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdbool.h>
#include "sd-device.h"
#include "sd-event.h"
#include "sd-varlink.h"
#include "hashmap.h"
#include "forward.h"
#include "list.h"
#include "macro.h"
#include "prioq.h"
#include "time-util.h"
#include "udev-config.h"
#include "udev-ctrl.h"
#include "udev-def.h"
#include "udev-forward.h"
/* This should have a higher priority than the device monitor and inotify watch, to make device monitor and
* inotify event source stopped as soon as possible when the signal is received. Otherwise, we may continue
@@ -43,10 +35,6 @@
/* The event is intended to trigger the post-event source, hence can be the lowest priority. */
#define EVENT_PRIORITY_REQUEUE_EVENT (SD_EVENT_PRIORITY_NORMAL + 3)
typedef struct Event Event;
typedef struct UdevRules UdevRules;
typedef struct Worker Worker;
typedef struct Manager {
sd_event *event;
Hashmap *workers;
+4 -1
View File
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <sys/file.h>
#include <sys/stat.h>
#include <unistd.h>
#include "sd-id128.h"
@@ -15,14 +17,15 @@
#include "fileio.h"
#include "format-util.h"
#include "fs-util.h"
#include "hashmap.h"
#include "hexdecoct.h"
#include "label-util.h"
#include "mkdir-label.h"
#include "parse-util.h"
#include "path-util.h"
#include "selinux-util.h"
#include "siphash24.h"
#include "smack-util.h"
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
#include "udev-node.h"
+1 -6
View File
@@ -1,12 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdbool.h>
#include <sys/types.h>
#include "sd-device.h"
#include "hashmap.h"
#include "forward.h"
int udev_node_apply_permissions(
sd_device *dev,
+7 -1
View File
@@ -2,9 +2,11 @@
#include <ctype.h>
#include <fnmatch.h>
#include <unistd.h>
#include "alloc-util.h"
#include "architecture.h"
#include "chase.h"
#include "conf-files.h"
#include "conf-parser.h"
#include "confidential-virt.h"
@@ -12,6 +14,7 @@
#include "device-private.h"
#include "device-util.h"
#include "dirent-util.h"
#include "errno-util.h"
#include "escape.h"
#include "extract-word.h"
#include "fd-util.h"
@@ -19,9 +22,9 @@
#include "format-util.h"
#include "fs-util.h"
#include "glob-util.h"
#include "hashmap.h"
#include "list.h"
#include "memstream-util.h"
#include "mkdir.h"
#include "netif-naming-scheme.h"
#include "nulstr-util.h"
#include "parse-util.h"
@@ -30,6 +33,7 @@
#include "socket-util.h"
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "strxcpyx.h"
#include "sysctl-util.h"
@@ -44,6 +48,8 @@
#include "udev-trace.h"
#include "udev-util.h"
#include "udev-worker.h"
#include "user-record.h"
#include "user-util.h"
#include "userdb.h"
#include "virt.h"
+1 -7
View File
@@ -1,14 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "alloc-util.h"
#include "hashmap.h"
#include "time-util.h"
#include "udev-def.h"
typedef struct UdevRuleFile UdevRuleFile;
typedef struct UdevRules UdevRules;
typedef struct UdevEvent UdevEvent;
#include "udev-forward.h"
int udev_rule_parse_value(char *str, char **ret_value, char **ret_endpos, bool *ret_is_case_insensitive);
int udev_rules_parse_file(UdevRules *rules, const char *filename, bool extra_checks, UdevRuleFile **ret);
+4
View File
@@ -9,11 +9,15 @@
#include "exec-util.h"
#include "extract-word.h"
#include "fd-util.h"
#include "format-util.h"
#include "hashmap.h"
#include "path-util.h"
#include "pidref.h"
#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "udev-builtin.h"
#include "udev-event.h"
#include "udev-spawn.h"
+1 -7
View File
@@ -1,17 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include "macro.h"
#include "time-util.h"
#include "udev-forward.h"
#define READ_END 0
#define WRITE_END 1
typedef struct UdevEvent UdevEvent;
int udev_event_spawn(
UdevEvent *event,
bool accept_failure,
+1
View File
@@ -8,6 +8,7 @@
#include "device-private.h"
#include "device-util.h"
#include "errno-util.h"
#include "forward.h"
/* Each trace point can have different number of additional arguments. Note that when the macro is used only
* additional arguments are listed in the macro invocation!
+1
View File
@@ -2,6 +2,7 @@
#include "json-util.h"
#include "log.h"
#include "string-util.h"
#include "strv.h"
#include "udev-manager.h"
#include "udev-varlink.h"
+1 -5
View File
@@ -1,11 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sd-varlink.h"
#include "time-util.h"
typedef struct Manager Manager;
#include "udev-forward.h"
int manager_start_varlink_server(Manager *manager);
int udev_varlink_connect(sd_varlink **ret, usec_t timeout);
+5 -1
View File
@@ -4,6 +4,9 @@
* Copyright © 2009 Scott James Remnant <scott@netsplit.com>
*/
#include <sys/signalfd.h>
#include <sys/wait.h>
#include "alloc-util.h"
#include "blockdev-util.h"
#include "daemon-util.h"
@@ -12,10 +15,11 @@
#include "errno-util.h"
#include "event-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
#include "inotify-util.h"
#include "mkdir.h"
#include "parse-util.h"
#include "pidref.h"
#include "process-util.h"
#include "rm-rf.h"
#include "set.h"
+1 -4
View File
@@ -1,10 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "sd-device.h"
typedef struct Manager Manager;
typedef struct UdevWorker UdevWorker;
#include "udev-forward.h"
void udev_watch_dump(void);
+5 -7
View File
@@ -1,24 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <linux/fs.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include "sd-daemon.h"
#include "sd-event.h"
#include "sd-netlink.h"
#include "alloc-util.h"
#include "blockdev-util.h"
#include "common-signal.h"
#include "device-monitor-private.h"
#include "device-private.h"
#include "device-util.h"
#include "errno-list.h"
#include "errno-util.h"
#include "fd-util.h"
#include "path-util.h"
#include "hashmap.h"
#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "strv.h"
#include "udev-error.h"
#include "udev-event.h"
#include "udev-rules.h"
+1 -11
View File
@@ -1,22 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdbool.h>
#include "sd-device.h"
#include "sd-event.h"
#include "sd-netlink.h"
#include "errno-list.h"
#include "hashmap.h"
#include "time-util.h"
#include "udev-config.h"
#include "udev-forward.h"
#define DEFAULT_WORKER_TIMEOUT_USEC (3 * USEC_PER_MINUTE)
#define MIN_WORKER_TIMEOUT_USEC (1 * USEC_PER_MSEC)
typedef struct UdevRules UdevRules;
typedef struct UdevWorker {
sd_event *event;
sd_netlink *rtnl;
-5
View File
@@ -1,19 +1,14 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <getopt.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "creds-util.h"
#include "errno-util.h"
#include "log.h"
#include "parse-argument.h"
#include "parse-util.h"
#include "process-util.h"
#include "static-destruct.h"
#include "strv.h"
#include "syslog-util.h"
+1 -1
View File
@@ -1,8 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
#include <stdio.h>
#include "assert-util.h"
#include "hwdb-util.h"
#include "log.h"
#include "udevadm.h"
+2 -5
View File
@@ -1,12 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <stddef.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <unistd.h>
#include "sd-device.h"
@@ -17,10 +16,8 @@
#include "device-enumerator-private.h"
#include "device-private.h"
#include "device-util.h"
#include "devnum-util.h"
#include "dirent-util.h"
#include "errno-util.h"
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "glyph-util.h"
@@ -31,7 +28,7 @@
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "time-util.h"
#include "udev-util.h"
#include "udevadm.h"
#include "udevadm-util.h"
+4 -4
View File
@@ -1,23 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <getopt.h>
#include <stdlib.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <unistd.h>
#include "blockdev-util.h"
#include "btrfs-util.h"
#include "device-util.h"
#include "fd-util.h"
#include "fdset.h"
#include "hash-funcs.h"
#include "lock-util.h"
#include "main-func.h"
#include "parse-util.h"
#include "path-util.h"
#include "pidref.h"
#include "pretty-print.h"
#include "process-util.h"
#include "signal-util.h"
#include "sort-util.h"
#include "static-destruct.h"
#include "strv.h"
#include "time-util.h"
#include "udevadm.h"
-3
View File
@@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <getopt.h>
#include "sd-device.h"
@@ -10,11 +9,9 @@
#include "device-monitor-private.h"
#include "device-private.h"
#include "device-util.h"
#include "fd-util.h"
#include "format-util.h"
#include "hashmap.h"
#include "set.h"
#include "signal-util.h"
#include "static-destruct.h"
#include "string-util.h"
#include "time-util.h"
+1
View File
@@ -15,6 +15,7 @@
#include "alloc-util.h"
#include "bus-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "udev-util.h"
-3
View File
@@ -1,10 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <getopt.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include "device-private.h"
#include "device-util.h"
+2
View File
@@ -8,7 +8,9 @@
#include <stdio.h>
#include "sd-device.h"
#include "sd-json.h"
#include "alloc-util.h"
#include "device-private.h"
#include "log.h"
#include "parse-argument.h"
+3 -7
View File
@@ -1,25 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include "sd-device.h"
#include "sd-event.h"
#include "alloc-util.h"
#include "device-enumerator-private.h"
#include "device-private.h"
#include "device-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "id128-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "set.h"
#include "static-destruct.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "udevadm.h"
#include "udevadm-util.h"
#include "virt.h"
+8 -1
View File
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <getopt.h>
#include "sd-bus.h"
#include "alloc-util.h"
#include "bus-error.h"
@@ -9,14 +11,19 @@
#include "conf-files.h"
#include "constants.h"
#include "device-private.h"
#include "errno-util.h"
#include "extract-word.h"
#include "log.h"
#include "path-util.h"
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "udev-ctrl.h"
#include "udev-rules.h"
#include "udev-varlink.h"
#include "udevadm-util.h"
#include "unit-def.h"
#include "unit-name.h"
#include "varlink-util.h"
+1 -1
View File
@@ -3,7 +3,7 @@
#include "sd-device.h"
#include "time-util.h"
#include "forward.h"
#include "udev-def.h"
int find_device(const char *id, const char *prefix, sd_device **ret);
+1 -4
View File
@@ -1,12 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <getopt.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "alloc-util.h"
#include "errno-util.h"
#include "log.h"
#include "parse-argument.h"
+4 -5
View File
@@ -1,24 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <getopt.h>
#include <stdio.h>
#include <sys/inotify.h>
#include <unistd.h>
#include "sd-event.h"
#include "alloc-util.h"
#include "chase.h"
#include "device-monitor-private.h"
#include "device-util.h"
#include "errno-util.h"
#include "event-util.h"
#include "fd-util.h"
#include "fs-util.h"
#include "inotify-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "static-destruct.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "time-util.h"
#include "udev-util.h"
#include "udevadm.h"
+7 -5
View File
@@ -1,17 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <errno.h>
#include <getopt.h>
#include <stddef.h>
#include <stdio.h>
#include "alloc-util.h"
#include "argv-util.h"
#include "label-util.h"
#include "main-func.h"
#include "pretty-print.h"
#include "process-util.h"
#include "selinux-util.h"
#include "string-util.h"
#include "udev-util.h"
#include "udevadm.h"
#include "udevd.h"
@@ -89,6 +85,12 @@ static int parse_argv(int argc, char *argv[]) {
return 1; /* work to do */
}
int print_version(void) {
/* Dracut relies on the version being a single integer */
puts(PROJECT_VERSION_STR);
return 0;
}
static int version_main(int argc, char *argv[], void *userdata) {
return print_version();
}
+2 -8
View File
@@ -1,9 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include <stdio.h>
#include "macro.h"
#include "forward.h"
int cat_main(int argc, char *argv[], void *userdata);
int info_main(int argc, char *argv[], void *userdata);
@@ -18,8 +16,4 @@ int verify_main(int argc, char *argv[], void *userdata);
int wait_main(int argc, char *argv[], void *userdata);
int lock_main(int argc, char *argv[], void *userdata);
static inline int print_version(void) {
/* Dracut relies on the version being a single integer */
puts(PROJECT_VERSION_STR);
return 0;
}
int print_version(void);
+2 -2
View File
@@ -5,15 +5,15 @@
* Copyright © 2009 Scott James Remnant <scott@netsplit.com>
*/
#include <sys/stat.h>
#include <unistd.h>
#include "errno-util.h"
#include "fd-util.h"
#include "label-util.h"
#include "log.h"
#include "mkdir.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "selinux-util.h"
#include "terminal-util.h"
#include "udev-config.h"
#include "udev-manager.h"
-7
View File
@@ -3,18 +3,11 @@
* Copyright (c) 2009 Filippo Argiolas <filippo.argiolas@gmail.com>
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <linux/videodev2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include "build.h"
#include "fd-util.h"