summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-08-22 16:25:17 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-08-23 04:57:39 +0900
commit152d0efa2bd70ebbaa48bde734b1ba5770a07412 (patch)
treee1732fd28be05680ee0dc7abf9e12f00d91c113a
parent05becb11e8500e883147adb948f23ba55c136273 (diff)
downloadsystemd-152d0efa2bd70ebbaa48bde734b1ba5770a07412.tar.gz
udev: move udev cleanup functions from udev-util.h to udev.h
-rw-r--r--src/shared/udev-util.c2
-rw-r--r--src/shared/udev-util.h9
-rw-r--r--src/test/test-libudev.c5
-rw-r--r--src/test/test-udev.c1
-rw-r--r--src/udev/scsi_id/scsi_id.c1
-rw-r--r--src/udev/udev-builtin-hwdb.c1
-rw-r--r--src/udev/udev-builtin-net_id.c1
-rw-r--r--src/udev/udev-builtin-path_id.c1
-rw-r--r--src/udev/udev.h7
-rw-r--r--src/udev/udevadm-control.c1
-rw-r--r--src/udev/udevadm-info.c1
-rw-r--r--src/udev/udevadm-monitor.c1
-rw-r--r--src/udev/udevadm-test.c1
-rw-r--r--src/udev/udevadm-trigger.c1
14 files changed, 11 insertions, 22 deletions
diff --git a/src/shared/udev-util.c b/src/shared/udev-util.c
index 92802a49e8..a603867b16 100644
--- a/src/shared/udev-util.c
+++ b/src/shared/udev-util.c
@@ -1,7 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
+#include <errno.h>
#include <string.h>
+#include "alloc-util.h"
#include "fileio.h"
#include "log.h"
#include "string-util.h"
diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h
index e3baf8cdb0..0df2cf9eb1 100644
--- a/src/shared/udev-util.h
+++ b/src/shared/udev-util.h
@@ -1,13 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
-#include "udev.h"
-#include "util.h"
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_rules*, udev_rules_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl*, udev_ctrl_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl_connection*, udev_ctrl_connection_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl_msg*, udev_ctrl_msg_unref);
-
int udev_parse_config(void);
diff --git a/src/test/test-libudev.c b/src/test/test-libudev.c
index 68399bdb9e..8ffbab14f9 100644
--- a/src/test/test-libudev.c
+++ b/src/test/test-libudev.c
@@ -5,14 +5,11 @@
#include <sys/epoll.h>
#include <unistd.h>
-#include "libudev.h"
-
#include "fd-util.h"
+#include "libudev-private.h"
#include "log.h"
#include "stdio-util.h"
#include "string-util.h"
-#include "udev-util.h"
-#include "util.h"
static void print_device(struct udev_device *device) {
const char *str;
diff --git a/src/test/test-udev.c b/src/test/test-udev.c
index dd630b9718..93626d9b50 100644
--- a/src/test/test-udev.c
+++ b/src/test/test-udev.c
@@ -17,7 +17,6 @@
#include "selinux-util.h"
#include "signal-util.h"
#include "string-util.h"
-#include "udev-util.h"
#include "udev.h"
static int fake_filesystems(void) {
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c
index 1600666730..313ad74bf0 100644
--- a/src/udev/scsi_id/scsi_id.c
+++ b/src/udev/scsi_id/scsi_id.c
@@ -19,6 +19,7 @@
#include "libudev.h"
+#include "alloc-util.h"
#include "fd-util.h"
#include "libudev-private.h"
#include "scsi_id.h"
diff --git a/src/udev/udev-builtin-hwdb.c b/src/udev/udev-builtin-hwdb.c
index 396384f6c8..10155ad338 100644
--- a/src/udev/udev-builtin-hwdb.c
+++ b/src/udev/udev-builtin-hwdb.c
@@ -11,7 +11,6 @@
#include "hwdb-util.h"
#include "parse-util.h"
#include "string-util.h"
-#include "udev-util.h"
#include "udev.h"
static sd_hwdb *hwdb;
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 4dddc86773..21e1715306 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -102,7 +102,6 @@
#include "stdio-util.h"
#include "string-util.h"
#include "udev.h"
-#include "udev-util.h"
#define ONBOARD_INDEX_MAX (16*1024-1)
diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index 1688cae238..462729f5c8 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -21,7 +21,6 @@
#include "string-util.h"
#include "sysexits.h"
#include "udev.h"
-#include "udev-util.h"
_printf_(2,3)
static void path_prepend(char **path, const char *fmt, ...) {
diff --git a/src/udev/udev.h b/src/udev/udev.h
index 778d5c4174..e79b8ed0d9 100644
--- a/src/udev/udev.h
+++ b/src/udev/udev.h
@@ -188,6 +188,13 @@ int udev_builtin_add_property(struct udev_device *dev, bool test, const char *ke
int udev_builtin_hwdb_lookup(struct udev_device *dev, const char *prefix, const char *modalias,
const char *filter, bool test);
+/* Cleanup functions */
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_event*, udev_event_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_rules*, udev_rules_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl*, udev_ctrl_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl_connection*, udev_ctrl_connection_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct udev_ctrl_msg*, udev_ctrl_msg_unref);
+
/* udevadm commands */
struct udevadm_cmd {
const char *name;
diff --git a/src/udev/udevadm-control.c b/src/udev/udevadm-control.c
index 7f89d4f536..fb8ebdd485 100644
--- a/src/udev/udevadm-control.c
+++ b/src/udev/udevadm-control.c
@@ -21,7 +21,6 @@
#include "process-util.h"
#include "time-util.h"
-#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index e0c110135a..a7530e02e7 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -13,7 +13,6 @@
#include "dirent-util.h"
#include "fd-util.h"
#include "string-util.h"
-#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c
index d44b1fe521..aa6600f6a5 100644
--- a/src/udev/udevadm-monitor.c
+++ b/src/udev/udevadm-monitor.c
@@ -12,7 +12,6 @@
#include "fd-util.h"
#include "format-util.h"
-#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c
index 73bb2124fc..cad462e281 100644
--- a/src/udev/udevadm-test.c
+++ b/src/udev/udevadm-test.c
@@ -13,7 +13,6 @@
#include <unistd.h>
#include "string-util.h"
-#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
index 21c43af18a..5d90911894 100644
--- a/src/udev/udevadm-trigger.c
+++ b/src/udev/udevadm-trigger.c
@@ -11,7 +11,6 @@
#include "fd-util.h"
#include "set.h"
#include "string-util.h"
-#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
#include "util.h"