summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-11-16 11:44:17 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-20 14:38:35 +0900
commit5ea78a39e5894297d59ea75b30e250d24bbfc6aa (patch)
tree585f73773786df0c3cbd13fd62d3516bee26a674
parent170e4380b60cd7911fe72d62ca78445c917967cb (diff)
downloadsystemd-5ea78a39e5894297d59ea75b30e250d24bbfc6aa.tar.gz
systemd-5ea78a39e5894297d59ea75b30e250d24bbfc6aa.tar.bz2
systemd-5ea78a39e5894297d59ea75b30e250d24bbfc6aa.zip
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
-rw-r--r--src/libudev/libudev-device-internal.h2
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev-hwdb.c4
-rw-r--r--src/libudev/libudev-list-internal.h24
-rw-r--r--src/libudev/libudev-list.c67
-rw-r--r--src/libudev/libudev-monitor.c5
-rw-r--r--src/libudev/libudev-private.h67
-rw-r--r--src/libudev/libudev-queue.c3
-rw-r--r--src/libudev/libudev-util.c6
-rw-r--r--src/libudev/libudev-util.h24
-rw-r--r--src/libudev/libudev.c1
-rw-r--r--src/libudev/meson.build11
-rw-r--r--src/test/test-libudev.c3
-rw-r--r--src/test/test-udev.c1
-rw-r--r--src/udev/ata_id/ata_id.c3
-rw-r--r--src/udev/scsi_id/scsi_id.c3
-rw-r--r--src/udev/udev-builtin-path_id.c2
-rw-r--r--src/udev/udev-builtin-usb_id.c3
-rw-r--r--src/udev/udev-event.c4
-rw-r--r--src/udev/udev-node.c4
-rw-r--r--src/udev/udev-rules.c4
-rw-r--r--src/udev/udev.h7
-rw-r--r--src/udev/udevadm-settle.c2
-rw-r--r--src/udev/udevadm-test.c2
-rw-r--r--src/udev/udevd.c2
25 files changed, 114 insertions, 142 deletions
diff --git a/src/libudev/libudev-device-internal.h b/src/libudev/libudev-device-internal.h
index 73db709e93..8a6e5a48f6 100644
--- a/src/libudev/libudev-device-internal.h
+++ b/src/libudev/libudev-device-internal.h
@@ -4,7 +4,7 @@
#include "libudev.h"
#include "sd-device.h"
-#include "libudev-private.h"
+#include "libudev-list-internal.h"
/**
* udev_device:
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index b6ccef7d8e..37828b2f09 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -23,8 +23,8 @@
#include "device-private.h"
#include "device-util.h"
#include "libudev-device-internal.h"
-#include "libudev-private.h"
#include "parse-util.h"
+#include "time-util.h"
/**
* SECTION:libudev-device
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index efb76a3f02..33c042c02b 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -1,10 +1,12 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
+#include <errno.h>
+
#include "sd-hwdb.h"
#include "alloc-util.h"
#include "hwdb-util.h"
-#include "libudev-private.h"
+#include "libudev-list-internal.h"
/**
* SECTION:libudev-hwdb
diff --git a/src/libudev/libudev-list-internal.h b/src/libudev/libudev-list-internal.h
new file mode 100644
index 0000000000..1f75c37cb2
--- /dev/null
+++ b/src/libudev/libudev-list-internal.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include "libudev.h"
+
+struct udev_list_node {
+ struct udev_list_node *next, *prev;
+};
+
+struct udev_list {
+ struct udev *udev;
+ struct udev_list_node node;
+ struct udev_list_entry **entries;
+ unsigned entries_cur;
+ unsigned entries_max;
+ bool unique;
+};
+
+void udev_list_init(struct udev *udev, struct udev_list *list, bool unique);
+void udev_list_cleanup(struct udev_list *list);
+struct udev_list_entry *udev_list_get_entry(struct udev_list *list);
+struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value);
+int udev_list_entry_get_num(struct udev_list_entry *list_entry);
+void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num);
diff --git a/src/libudev/libudev-list.c b/src/libudev/libudev-list.c
index 03dcd43372..32b4127f99 100644
--- a/src/libudev/libudev-list.c
+++ b/src/libudev/libudev-list.c
@@ -6,7 +6,8 @@
#include <string.h>
#include "alloc-util.h"
-#include "libudev-private.h"
+#include "libudev-list-internal.h"
+#include "util.h"
/**
* SECTION:libudev-list
@@ -30,34 +31,25 @@ struct udev_list_entry {
};
/* the list's head points to itself if empty */
-void udev_list_node_init(struct udev_list_node *list)
-{
+static void udev_list_node_init(struct udev_list_node *list) {
list->next = list;
list->prev = list;
}
-int udev_list_node_is_empty(struct udev_list_node *list)
-{
+static int udev_list_node_is_empty(struct udev_list_node *list) {
return list->next == list;
}
static void udev_list_node_insert_between(struct udev_list_node *new,
struct udev_list_node *prev,
- struct udev_list_node *next)
-{
+ struct udev_list_node *next) {
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
-void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list)
-{
- udev_list_node_insert_between(new, list->prev, list);
-}
-
-void udev_list_node_remove(struct udev_list_node *entry)
-{
+static void udev_list_node_remove(struct udev_list_node *entry) {
struct udev_list_node *prev = entry->prev;
struct udev_list_node *next = entry->next;
@@ -69,13 +61,11 @@ void udev_list_node_remove(struct udev_list_node *entry)
}
/* return list entry which embeds this node */
-static inline struct udev_list_entry *list_node_to_entry(struct udev_list_node *node)
-{
+static inline struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) {
return container_of(node, struct udev_list_entry, node);
}
-void udev_list_init(struct udev *udev, struct udev_list *list, bool unique)
-{
+void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) {
memzero(list, sizeof(struct udev_list));
list->udev = udev;
list->unique = unique;
@@ -83,23 +73,20 @@ void udev_list_init(struct udev *udev, struct udev_list *list, bool unique)
}
/* insert entry into a list as the last element */
-static void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list)
-{
+static void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) {
/* inserting before the list head make the node the last node in the list */
udev_list_node_insert_between(&new->node, list->node.prev, &list->node);
new->list = list;
}
/* insert entry into a list, before a given existing entry */
-static void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry)
-{
+static void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) {
udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node);
new->list = entry->list;
}
/* binary search in sorted array */
-static int list_search(struct udev_list *list, const char *name)
-{
+static int list_search(struct udev_list *list, const char *name) {
unsigned first, last;
first = 0;
@@ -200,8 +187,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
return entry;
}
-void udev_list_entry_delete(struct udev_list_entry *entry)
-{
+static void udev_list_entry_delete(struct udev_list_entry *entry) {
if (entry->list->entries != NULL) {
int i;
struct udev_list *list = entry->list;
@@ -221,8 +207,12 @@ void udev_list_entry_delete(struct udev_list_entry *entry)
free(entry);
}
-void udev_list_cleanup(struct udev_list *list)
-{
+#define udev_list_entry_foreach_safe(entry, tmp, first) \
+ for (entry = first, tmp = udev_list_entry_get_next(entry); \
+ entry; \
+ entry = tmp, tmp = udev_list_entry_get_next(tmp))
+
+void udev_list_cleanup(struct udev_list *list) {
struct udev_list_entry *entry_loop;
struct udev_list_entry *entry_tmp;
@@ -233,8 +223,7 @@ void udev_list_cleanup(struct udev_list *list)
udev_list_entry_delete(entry_loop);
}
-struct udev_list_entry *udev_list_get_entry(struct udev_list *list)
-{
+struct udev_list_entry *udev_list_get_entry(struct udev_list *list) {
if (udev_list_node_is_empty(&list->node))
return NULL;
return list_node_to_entry(list->node.next);
@@ -248,8 +237,7 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list *list)
*
* Returns: udev_list_entry, #NULL if no more entries are available.
*/
-_public_ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry)
-{
+_public_ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) {
struct udev_list_node *next;
if (list_entry == NULL)
@@ -270,8 +258,7 @@ _public_ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry
*
* Returns: udev_list_entry, #NULL if no matching entry is found.
*/
-_public_ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name)
-{
+_public_ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) {
int i;
if (list_entry == NULL)
@@ -294,8 +281,7 @@ _public_ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_en
*
* Returns: the name string of this entry.
*/
-_public_ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry)
-{
+_public_ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) {
if (list_entry == NULL)
return NULL;
return list_entry->name;
@@ -309,22 +295,19 @@ _public_ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry
*
* Returns: the value string of this entry.
*/
-_public_ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry)
-{
+_public_ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) {
if (list_entry == NULL)
return NULL;
return list_entry->value;
}
-int udev_list_entry_get_num(struct udev_list_entry *list_entry)
-{
+int udev_list_entry_get_num(struct udev_list_entry *list_entry) {
if (list_entry == NULL)
return -EINVAL;
return list_entry->num;
}
-void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num)
-{
+void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num) {
if (list_entry == NULL)
return;
list_entry->num = num;
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 5d64dab193..364ec09617 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -10,7 +10,6 @@
#include "device-private.h"
#include "device-util.h"
#include "libudev-device-internal.h"
-#include "libudev-private.h"
#include "string-util.h"
/**
@@ -65,7 +64,7 @@ static MonitorNetlinkGroup monitor_netlink_group_from_string(const char *name) {
**/
_public_ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) {
_cleanup_(sd_device_monitor_unrefp) sd_device_monitor *m = NULL;
- _cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor = NULL;
+ struct udev_monitor *udev_monitor;
MonitorNetlinkGroup g;
int r;
@@ -93,7 +92,7 @@ _public_ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, c
.monitor = TAKE_PTR(m),
};
- return TAKE_PTR(udev_monitor);
+ return udev_monitor;
}
/**
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
deleted file mode 100644
index c79290dfe3..0000000000
--- a/src/libudev/libudev-private.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-#pragma once
-
-#include <signal.h>
-#include <stdbool.h>
-#include <stdint.h>
-
-#include "libudev.h"
-
-#include "macro.h"
-#include "mkdir.h"
-#include "strxcpyx.h"
-#include "util.h"
-
-/* libudev-list.c */
-struct udev_list_node {
- struct udev_list_node *next, *prev;
-};
-struct udev_list {
- struct udev *udev;
- struct udev_list_node node;
- struct udev_list_entry **entries;
- unsigned entries_cur;
- unsigned entries_max;
- bool unique;
-};
-void udev_list_node_init(struct udev_list_node *list);
-int udev_list_node_is_empty(struct udev_list_node *list);
-void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list);
-void udev_list_node_remove(struct udev_list_node *entry);
-#define udev_list_node_foreach(node, list) \
- for (node = (list)->next; \
- node != list; \
- node = (node)->next)
-#define udev_list_node_foreach_safe(node, tmp, list) \
- for (node = (list)->next, tmp = (node)->next; \
- node != list; \
- node = tmp, tmp = (tmp)->next)
-void udev_list_init(struct udev *udev, struct udev_list *list, bool unique);
-void udev_list_cleanup(struct udev_list *list);
-struct udev_list_entry *udev_list_get_entry(struct udev_list *list);
-struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value);
-void udev_list_entry_delete(struct udev_list_entry *entry);
-int udev_list_entry_get_num(struct udev_list_entry *list_entry);
-void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num);
-#define udev_list_entry_foreach_safe(entry, tmp, first) \
- for (entry = first, tmp = udev_list_entry_get_next(entry); \
- entry != NULL; \
- entry = tmp, tmp = udev_list_entry_get_next(tmp))
-
-/* libudev-util.c */
-#define UTIL_PATH_SIZE 1024
-#define UTIL_NAME_SIZE 512
-#define UTIL_LINE_SIZE 16384
-#define UDEV_ALLOWED_CHARS_INPUT "/ $%?,"
-size_t util_path_encode(const char *src, char *dest, size_t size);
-int util_replace_whitespace(const char *str, char *to, size_t len);
-int util_replace_chars(char *str, const char *white);
-int util_resolve_subsys_kernel(const char *string, char *result, size_t maxsize, int read_value);
-
-/* Cleanup functions */
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev*, udev_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_device*, udev_device_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_enumerate*, udev_enumerate_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_monitor*, udev_monitor_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_hwdb*, udev_hwdb_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_queue*, udev_queue_unref);
diff --git a/src/libudev/libudev-queue.c b/src/libudev/libudev-queue.c
index 832f3b3da5..4ccb3f8736 100644
--- a/src/libudev/libudev-queue.c
+++ b/src/libudev/libudev-queue.c
@@ -9,10 +9,11 @@
#include <sys/inotify.h>
#include <unistd.h>
+#include "libudev.h"
+
#include "alloc-util.h"
#include "fd-util.h"
#include "io-util.h"
-#include "libudev-private.h"
/**
* SECTION:libudev-queue
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index df5223e5a9..8007463581 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -7,11 +7,9 @@
#include <string.h>
#include <unistd.h>
-#include "libudev.h"
-
-#include "MurmurHash2.h"
#include "device-nodes.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
+#include "strxcpyx.h"
#include "utf8.h"
/**
diff --git a/src/libudev/libudev-util.h b/src/libudev/libudev-util.h
new file mode 100644
index 0000000000..fb5558da88
--- /dev/null
+++ b/src/libudev/libudev-util.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include "libudev.h"
+
+#include "macro.h"
+
+/* libudev-util.c */
+#define UTIL_PATH_SIZE 1024
+#define UTIL_NAME_SIZE 512
+#define UTIL_LINE_SIZE 16384
+#define UDEV_ALLOWED_CHARS_INPUT "/ $%?,"
+size_t util_path_encode(const char *src, char *dest, size_t size);
+int util_replace_whitespace(const char *str, char *to, size_t len);
+int util_replace_chars(char *str, const char *white);
+int util_resolve_subsys_kernel(const char *string, char *result, size_t maxsize, int read_value);
+
+/* Cleanup functions */
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev*, udev_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_device*, udev_device_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_enumerate*, udev_enumerate_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_monitor*, udev_monitor_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_hwdb*, udev_hwdb_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_queue*, udev_queue_unref);
diff --git a/src/libudev/libudev.c b/src/libudev/libudev.c
index 4554b922e3..4c26231f86 100644
--- a/src/libudev/libudev.c
+++ b/src/libudev/libudev.c
@@ -11,7 +11,6 @@
#include "alloc-util.h"
#include "fd-util.h"
-#include "libudev-private.h"
#include "missing.h"
#include "string-util.h"
diff --git a/src/libudev/meson.build b/src/libudev/meson.build
index bd0d5389c9..8d86c34189 100644
--- a/src/libudev/meson.build
+++ b/src/libudev/meson.build
@@ -1,16 +1,17 @@
# SPDX-License-Identifier: LGPL-2.1+
libudev_sources = files('''
- libudev-private.h
- libudev-device-internal.h
libudev.c
- libudev-list.c
- libudev-util.c
libudev-device.c
+ libudev-device-internal.h
libudev-enumerate.c
+ libudev-hwdb.c
+ libudev-list.c
+ libudev-list-internal.h
libudev-monitor.c
libudev-queue.c
- libudev-hwdb.c
+ libudev-util.c
+ libudev-util.h
'''.split())
############################################################
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 8ffbab14f9..abf79874bd 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -1,12 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
+#include <errno.h>
#include <getopt.h>
#include <stdio.h>
#include <sys/epoll.h>
#include <unistd.h>
#include "fd-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
#include "log.h"
#include "stdio-util.h"
#include "string-util.h"
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index b93876d26f..49198f8633 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -15,6 +15,7 @@
#include "fs-util.h"
#include "log.h"
#include "missing.h"
+#include "mkdir.h"
#include "selinux-util.h"
#include "signal-util.h"
#include "string-util.h"
diff --git a/src/udev/ata_id/ata_id.c b/src/udev/ata_id/ata_id.c
index e98425841f..6c2233e430 100644
--- a/src/udev/ata_id/ata_id.c
+++ b/src/udev/ata_id/ata_id.c
@@ -24,9 +24,10 @@
#include <unistd.h>
#include "fd-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
#include "log.h"
#include "udev-util.h"
+#include "util.h"
#define COMMAND_TIMEOUT_MSEC (30 * 1000)
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 2cace552f2..e50edb20b3 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -19,9 +19,10 @@
#include "alloc-util.h"
#include "fd-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
#include "scsi_id.h"
#include "string-util.h"
+#include "strxcpyx.h"
#include "udev-util.h"
static const struct option options[] = {
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index e8581a4869..94f2740592 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -18,7 +18,7 @@
#include "alloc-util.h"
#include "dirent-util.h"
#include "fd-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
#include "string-util.h"
#include "strv.h"
#include "sysexits.h"
diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c
index 73f53b31a4..3525d25048 100644
--- a/src/udev/udev-builtin-usb_id.c
+++ b/src/udev/udev-builtin-usb_id.c
@@ -18,8 +18,9 @@
#include "alloc-util.h"
#include "device-util.h"
#include "fd-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
#include "string-util.h"
+#include "strxcpyx.h"
#include "udev-builtin.h"
static void set_usb_iftype(char *to, int if_class_num, size_t len) {
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 40f4dac05e..cc7efbb81e 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -16,13 +16,15 @@
#include "device-util.h"
#include "fd-util.h"
#include "format-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
#include "netlink-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"
#include "stdio-util.h"
#include "string-util.h"
+#include "strv.h"
+#include "strxcpyx.h"
#include "udev-builtin.h"
#include "udev-node.h"
#include "udev-watch.h"
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 94bebd69c7..648a102265 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -17,12 +17,14 @@
#include "fd-util.h"
#include "format-util.h"
#include "fs-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
+#include "mkdir.h"
#include "path-util.h"
#include "selinux-util.h"
#include "smack-util.h"
#include "stdio-util.h"
#include "string-util.h"
+#include "strxcpyx.h"
#include "udev-node.h"
static int node_symlink(sd_device *dev, const char *node, const char *slink) {
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index c52f93af1c..c470338807 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -23,7 +23,8 @@
#include "fileio.h"
#include "fs-util.h"
#include "glob-util.h"
-#include "libudev-private.h"
+#include "libudev-util.h"
+#include "mkdir.h"
#include "path-util.h"
#include "proc-cmdline.h"
#include "stat-util.h"
@@ -31,6 +32,7 @@
#include "strbuf.h"
#include "string-util.h"
#include "strv.h"
+#include "strxcpyx.h"
#include "sysctl-util.h"
#include "udev-builtin.h"
#include "udev.h"
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 9de5280ffa..320f9a1534 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -5,18 +5,11 @@
* Copyright © 2003 Greg Kroah-Hartman <greg@kroah.com>
*/
-#include <sys/param.h>
-#include <sys/sysmacros.h>
-#include <sys/types.h>
-
#include "sd-device.h"
#include "sd-netlink.h"
#include "hashmap.h"
-#include "label.h"
-#include "libudev-private.h"
#include "macro.h"
-#include "strv.h"
#include "udev-util.h"
#include "util.h"
diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
index 6960324516..a2a8893870 100644
--- a/src/udev/udevadm-settle.c
+++ b/src/udev/udevadm-settle.c
@@ -13,7 +13,7 @@
#include <string.h>
#include <unistd.h>
-#include "libudev-private.h"
+#include "libudev-util.h"
#include "time-util.h"
#include "udevadm.h"
#include "udev-ctrl.h"
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 6f3b6099a9..2ee78da51b 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -16,7 +16,9 @@
#include "device-private.h"
#include "device-util.h"
+#include "libudev-util.h"
#include "string-util.h"
+#include "strxcpyx.h"
#include "udev-builtin.h"
#include "udev.h"
#include "udevadm.h"
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index a6d6bbf5fd..516453877f 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -46,6 +46,7 @@
#include "io-util.h"
#include "libudev-device-internal.h"
#include "list.h"
+#include "mkdir.h"
#include "netlink-util.h"
#include "parse-util.h"
#include "proc-cmdline.h"
@@ -54,6 +55,7 @@
#include "signal-util.h"
#include "socket-util.h"
#include "string-util.h"
+#include "strxcpyx.h"
#include "syslog-util.h"
#include "terminal-util.h"
#include "udev-builtin.h"