summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/Makefile.am18
-rw-r--r--src/udev/dev-setup.c84
-rw-r--r--src/udev/dev-setup.h24
-rw-r--r--src/udev/label.c247
-rw-r--r--src/udev/label.h38
-rw-r--r--src/udev/mkdir.c157
-rw-r--r--src/udev/mkdir.h29
-rw-r--r--src/udev/smack-util.c89
-rw-r--r--src/udev/smack-util.h28
-rw-r--r--src/udev/udev-util.h42
10 files changed, 3 insertions, 753 deletions
diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am
index 8722524e67..638e2d5678 100644
--- a/src/udev/Makefile.am
+++ b/src/udev/Makefile.am
@@ -10,6 +10,7 @@ AM_CPPFLAGS = \
-DUDEV_RULES_DIR=\"$(udevrulesdir)\" \
-DUDEV_LIBEXEC_DIR=\"$(udevlibexecdir)\" \
-DUDEV_VERSION=\"$(UDEV_VERSION)\" \
+ -I $(top_srcdir)/src/shared \
-I $(top_srcdir)/src/libudev
bin_PROGRAMS = \
@@ -54,24 +55,13 @@ libudev_core_la_SOURCES = \
udev-builtin-input_id.c \
udev-builtin-net_id.c \
udev-builtin-path_id.c \
- udev-builtin-usb_id.c \
- dev-setup.c \
- label.c \
- mkdir.c \
- smack-util.c
+ udev-builtin-usb_id.c
if ENABLE_FIRMWARE
libudev_core_la_SOURCES += \
udev-builtin-firmware.c
endif
-noinst_HEADERS = \
- dev-setup.h \
- label.h \
- mkdir.h \
- smack-util.h \
- udev-util.h
-
include_HEADERS = \
udev.h
@@ -80,6 +70,7 @@ libudev_core_la_CFLAGS = \
$(BLKID_CFLAGS)
libudev_core_la_LIBADD = \
+ $(top_builddir)/src/shared/libudev_shared.la \
$(top_builddir)/src/libudev/libudev-private.la \
$(BLKID_LIBS) \
$(SELINUX_LIBS)
@@ -92,15 +83,12 @@ endif
if HAVE_MODULES
libudev_core_la_SOURCES += \
udev-builtin-kmod.c
-
if HAVE_LIBKMOD
libudev_core_la_CFLAGS += $(KMOD_CFLAGS)
libudev_core_la_LIBADD += $(KMOD_LIBS)
endif
endif
-
-
libudev_core_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-DFIRMWARE_PATH="$(FIRMWARE_PATH)"
diff --git a/src/udev/dev-setup.c b/src/udev/dev-setup.c
deleted file mode 100644
index 1a565d5470..0000000000
--- a/src/udev/dev-setup.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010-2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <errno.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <unistd.h>
-
-#include "dev-setup.h"
-#include "log.h"
-#include "macro.h"
-#include "util.h"
-#include "label.h"
-
-static int symlink_and_label(const char *old_path, const char *new_path) {
- int r;
-
- assert(old_path);
- assert(new_path);
-
- r = label_context_set(new_path, S_IFLNK);
- if (r < 0)
- return r;
-
- if (symlink(old_path, new_path) < 0)
- r = -errno;
-
- label_context_clear();
-
- return r;
-}
-
-int dev_setup(const char *prefix) {
- const char *j, *k;
-
- static const char symlinks[] =
- "-/proc/kcore\0" "/dev/core\0"
- "/proc/self/fd\0" "/dev/fd\0"
- "/proc/self/fd/0\0" "/dev/stdin\0"
- "/proc/self/fd/1\0" "/dev/stdout\0"
- "/proc/self/fd/2\0" "/dev/stderr\0";
-
- NULSTR_FOREACH_PAIR(j, k, symlinks) {
- if (j[0] == '-') {
- j++;
-
- if (access(j, F_OK) < 0)
- continue;
- }
-
- if (prefix) {
- _cleanup_free_ char *link_name = NULL;
-
- link_name = strjoin(prefix, "/", k, NULL);
- if (!link_name)
- return -ENOMEM;
-
- symlink_and_label(j, link_name);
- } else
- symlink_and_label(j, k);
- }
-
- return 0;
-}
diff --git a/src/udev/dev-setup.h b/src/udev/dev-setup.h
deleted file mode 100644
index d41b6eefba..0000000000
--- a/src/udev/dev-setup.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#pragma once
-
-/***
- This file is part of systemd.
-
- Copyright 2010-2012 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-int dev_setup(const char *pathprefix);
diff --git a/src/udev/label.c b/src/udev/label.c
deleted file mode 100644
index dca2a21228..0000000000
--- a/src/udev/label.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <errno.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include "label.h"
-#include "util.h"
-#include "path-util.h"
-
-#ifdef HAVE_SELINUX
-#include <stdbool.h>
-#include <selinux/selinux.h>
-#include <selinux/label.h>
-
-static struct selabel_handle *label_hnd = NULL;
-static int use_selinux_cached = -1;
-
-bool use_selinux(void) {
- if (use_selinux_cached < 0)
- use_selinux_cached = is_selinux_enabled() > 0;
-
- return use_selinux_cached;
-}
-#endif
-
-int label_init(const char *prefix) {
- int r = 0;
-
-#ifdef HAVE_SELINUX
- usec_t before_timestamp, after_timestamp;
- struct mallinfo before_mallinfo, after_mallinfo;
-
- if (!use_selinux())
- return 0;
-
- if (label_hnd)
- return 0;
-
- before_mallinfo = mallinfo();
- before_timestamp = now(CLOCK_MONOTONIC);
-
- if (prefix) {
- struct selinux_opt options[] = {
- { .type = SELABEL_OPT_SUBSET, .value = prefix },
- };
-
- label_hnd = selabel_open(SELABEL_CTX_FILE, options, ELEMENTSOF(options));
- } else
- label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
-
- if (!label_hnd) {
- log_full(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG,
- "Failed to initialize SELinux context: %m");
- r = security_getenforce() == 1 ? -errno : 0;
- } else {
- char timespan[FORMAT_TIMESPAN_MAX];
- int l;
-
- after_timestamp = now(CLOCK_MONOTONIC);
- after_mallinfo = mallinfo();
-
- l = after_mallinfo.uordblks > before_mallinfo.uordblks ? after_mallinfo.uordblks - before_mallinfo.uordblks : 0;
-
- log_debug("Successfully loaded SELinux database in %s, size on heap is %iK.",
- format_timespan(timespan, sizeof(timespan), after_timestamp - before_timestamp, 0),
- (l+1023)/1024);
- }
-#endif
-
- return r;
-}
-
-int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
- int r = 0;
-
-#ifdef HAVE_SELINUX
- struct stat st;
- security_context_t fcon;
-
- if (!use_selinux() || !label_hnd)
- return 0;
-
- r = lstat(path, &st);
- if (r == 0) {
- r = selabel_lookup_raw(label_hnd, &fcon, path, st.st_mode);
-
- /* If there's no label to set, then exit without warning */
- if (r < 0 && errno == ENOENT)
- return 0;
-
- if (r == 0) {
- r = lsetfilecon(path, fcon);
- freecon(fcon);
-
- /* If the FS doesn't support labels, then exit without warning */
- if (r < 0 && errno == ENOTSUP)
- return 0;
- }
- }
-
- if (r < 0) {
- /* Ignore ENOENT in some cases */
- if (ignore_enoent && errno == ENOENT)
- return 0;
-
- if (ignore_erofs && errno == EROFS)
- return 0;
-
- log_full(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG,
- "Unable to fix label of %s: %m", path);
- r = security_getenforce() == 1 ? -errno : 0;
- }
-#endif
-
- return r;
-}
-
-void label_finish(void) {
-
-#ifdef HAVE_SELINUX
- if (use_selinux() && label_hnd)
- selabel_close(label_hnd);
-#endif
-}
-
-int label_context_set(const char *path, mode_t mode) {
- int r = 0;
-
-#ifdef HAVE_SELINUX
- security_context_t filecon = NULL;
-
- if (!use_selinux() || !label_hnd)
- return 0;
-
- r = selabel_lookup_raw(label_hnd, &filecon, path, mode);
- if (r < 0 && errno != ENOENT)
- r = -errno;
- else if (r == 0) {
- r = setfscreatecon(filecon);
- if (r < 0) {
- log_error("Failed to set SELinux file context on %s: %m", path);
- r = -errno;
- }
-
- freecon(filecon);
- }
-
- if (r < 0 && security_getenforce() == 0)
- r = 0;
-#endif
-
- return r;
-}
-
-void label_context_clear(void) {
-
-#ifdef HAVE_SELINUX
- if (!use_selinux())
- return;
-
- setfscreatecon(NULL);
-#endif
-}
-
-int label_mkdir(const char *path, mode_t mode, bool apply) {
-
- /* Creates a directory and labels it according to the SELinux policy */
-#ifdef HAVE_SELINUX
- int r;
- security_context_t fcon = NULL;
-
- if (!apply || !use_selinux() || !label_hnd)
- goto skipped;
-
- if (path_is_absolute(path))
- r = selabel_lookup_raw(label_hnd, &fcon, path, S_IFDIR);
- else {
- char *newpath;
-
- newpath = path_make_absolute_cwd(path);
- if (!newpath)
- return -ENOMEM;
-
- r = selabel_lookup_raw(label_hnd, &fcon, newpath, S_IFDIR);
- free(newpath);
- }
-
- if (r == 0)
- r = setfscreatecon(fcon);
-
- if (r < 0 && errno != ENOENT) {
- log_error("Failed to set security context %s for %s: %m", fcon, path);
-
- if (security_getenforce() == 1) {
- r = -errno;
- goto finish;
- }
- }
-
- r = mkdir(path, mode);
- if (r < 0)
- r = -errno;
-
-finish:
- setfscreatecon(NULL);
- freecon(fcon);
-
- return r;
-
-skipped:
-#endif
- return mkdir(path, mode) < 0 ? -errno : 0;
-}
-
-int label_apply(const char *path, const char *label) {
- int r = 0;
-
-#ifdef HAVE_SELINUX
- if (!use_selinux())
- return 0;
-
- r = setfilecon(path, (char *)label);
-#endif
- return r;
-}
diff --git a/src/udev/label.h b/src/udev/label.h
deleted file mode 100644
index a8dbcdc8b7..0000000000
--- a/src/udev/label.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#pragma once
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <sys/types.h>
-#include <stdbool.h>
-#include <sys/socket.h>
-
-int label_init(const char *prefix);
-void label_finish(void);
-
-int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
-
-int label_context_set(const char *path, mode_t mode);
-void label_context_clear(void);
-
-int label_mkdir(const char *path, mode_t mode, bool apply);
-
-int label_apply(const char *path, const char *label);
diff --git a/src/udev/mkdir.c b/src/udev/mkdir.c
deleted file mode 100644
index 770ee994c4..0000000000
--- a/src/udev/mkdir.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <assert.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-
-#include "label.h"
-#include "util.h"
-#include "mkdir.h"
-
-static int is_dir(const char* path) {
- struct stat st;
-
- if (stat(path, &st) < 0)
- return -errno;
-
- return S_ISDIR(st.st_mode);
-}
-
-
-char* path_startswith(const char *path, const char *prefix) {
- assert(path);
- assert(prefix);
-
- if ((path[0] == '/') != (prefix[0] == '/'))
- return NULL;
-
- for (;;) {
- size_t a, b;
-
- path += strspn(path, "/");
- prefix += strspn(prefix, "/");
-
- if (*prefix == 0)
- return (char*) path;
-
- if (*path == 0)
- return NULL;
-
- a = strcspn(path, "/");
- b = strcspn(prefix, "/");
-
- if (a != b)
- return NULL;
-
- if (memcmp(path, prefix, a) != 0)
- return NULL;
-
- path += a;
- prefix += b;
- }
-}
-
-static int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, bool apply) {
- const char *p, *e;
- int r;
-
- assert(path);
-
- if (prefix && !path_startswith(path, prefix))
- return -ENOTDIR;
-
- /* return immediately if directory exists */
- e = strrchr(path, '/');
- if (!e)
- return -EINVAL;
-
- if (e == path)
- return 0;
-
- char buf[PATH_MAX + 1];
- p = buf;
- assert(e-path < sizeof(buf));
- memcpy(buf, path, e-path);
- buf[e-path] = 0;
-
- r = is_dir(p);
- if (r > 0)
- return 0;
- if (r == 0)
- return -ENOTDIR;
-
- /* create every parent directory in the path, except the last component */
- p = path + strspn(path, "/");
- for (;;) {
- char t[strlen(path) + 1];
-
- e = p + strcspn(p, "/");
- p = e + strspn(e, "/");
-
- /* Is this the last component? If so, then we're
- * done */
- if (*p == 0)
- return 0;
-
- memcpy(t, path, e - path);
- t[e-path] = 0;
-
- if (prefix && path_startswith(prefix, t))
- continue;
-
- r = label_mkdir(t, mode, apply);
- if (r < 0 && errno != EEXIST)
- return -errno;
- }
-}
-
-int mkdir_parents(const char *path, mode_t mode) {
- return mkdir_parents_internal(NULL, path, mode, false);
-}
-
-int mkdir_parents_label(const char *path, mode_t mode) {
- return mkdir_parents_internal(NULL, path, mode, true);
-}
-
-static int mkdir_p_internal(const char *prefix, const char *path, mode_t mode, bool apply) {
- int r;
-
- /* Like mkdir -p */
-
- r = mkdir_parents_internal(prefix, path, mode, apply);
- if (r < 0)
- return r;
-
- r = label_mkdir(path, mode, apply);
- if (r < 0 && (errno != EEXIST || is_dir(path) <= 0))
- return -errno;
-
- return 0;
-}
-
-int mkdir_p(const char *path, mode_t mode) {
- return mkdir_p_internal(NULL, path, mode, false);
-}
diff --git a/src/udev/mkdir.h b/src/udev/mkdir.h
deleted file mode 100644
index 24ffa6364c..0000000000
--- a/src/udev/mkdir.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#ifndef foomkdirhfoo
-#define foomkdirhfoo
-
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-char* path_startswith(const char *path, const char *prefix) _pure_;
-int mkdir_parents(const char *path, mode_t mode);
-int mkdir_parents_label(const char *path, mode_t mode);
-int mkdir_p(const char *path, mode_t mode);
-#endif
diff --git a/src/udev/smack-util.c b/src/udev/smack-util.c
deleted file mode 100644
index 2711041c7e..0000000000
--- a/src/udev/smack-util.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/***
- This file is part of eudev, forked from systemd.
-
- Copyright 2013 Intel Corporation
-
- Author: Auke Kok <auke-jan.h.kok@intel.com>
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <unistd.h>
-#include <string.h>
-#ifdef HAVE_XATTR
-#include <attr/xattr.h>
-#endif
-
-#include "smack-util.h"
-
-bool use_smack(void) {
-#ifdef HAVE_SMACK
- static int use_smack_cached = -1;
-
- if (use_smack_cached < 0)
- use_smack_cached = access("/sys/fs/smackfs/", F_OK) >= 0;
-
- return use_smack_cached;
-#else
- return false;
-#endif
-
-}
-
-int smack_label_path(const char *path, const char *label) {
-#ifdef HAVE_SMACK
- if (!use_smack())
- return 0;
-
- if (label)
- return setxattr(path, "security.SMACK64", label, strlen(label), 0);
- else
- return lremovexattr(path, "security.SMACK64");
-#else
- return 0;
-#endif
-}
-
-int smack_label_fd(int fd, const char *label) {
-#ifdef HAVE_SMACK
- if (!use_smack())
- return 0;
-
- return fsetxattr(fd, "security.SMACK64", label, strlen(label), 0);
-#else
- return 0;
-#endif
-}
-
-int smack_label_ip_out_fd(int fd, const char *label) {
-#ifdef HAVE_SMACK
- if (!use_smack())
- return 0;
-
- return fsetxattr(fd, "security.SMACK64IPOUT", label, strlen(label), 0);
-#else
- return 0;
-#endif
-}
-
-int smack_label_ip_in_fd(int fd, const char *label) {
-#ifdef HAVE_SMACK
- if (!use_smack())
- return 0;
-
- return fsetxattr(fd, "security.SMACK64IPIN", label, strlen(label), 0);
-#else
- return 0;
-#endif
-}
diff --git a/src/udev/smack-util.h b/src/udev/smack-util.h
deleted file mode 100644
index 88704894e7..0000000000
--- a/src/udev/smack-util.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/***
- This file is part of eudev, forked from systemd.
-
- Copyright 2013 Intel Corporation
-
- Author: Auke Kok <auke-jan.h.kok@intel.com>
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include <stdbool.h>
-
-bool use_smack(void);
-int smack_label_path(const char *path, const char *label);
-int smack_label_fd(int fd, const char *label);
-int smack_label_ip_in_fd(int fd, const char *label);
-int smack_label_ip_out_fd(int fd, const char *label);
diff --git a/src/udev/udev-util.h b/src/udev/udev-util.h
deleted file mode 100644
index 5f09ce181f..0000000000
--- a/src/udev/udev-util.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#pragma once
-
-/***
- This file is part of systemd.
-
- Copyright 2013 Zbigniew Jędrzejewski-Szmek
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
-
-#include "udev.h"
-#include "util.h"
-
-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_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_monitor*, udev_monitor_unref);
-
-#define _cleanup_udev_unref_ _cleanup_(udev_unrefp)
-#define _cleanup_udev_device_unref_ _cleanup_(udev_device_unrefp)
-#define _cleanup_udev_enumerate_unref_ _cleanup_(udev_enumerate_unrefp)
-#define _cleanup_udev_event_unref_ _cleanup_(udev_event_unrefp)
-#define _cleanup_udev_rules_unref_ _cleanup_(udev_rules_unrefp)
-#define _cleanup_udev_ctrl_unref_ _cleanup_(udev_ctrl_unrefp)
-#define _cleanup_udev_monitor_unref_ _cleanup_(udev_monitor_unrefp)
-#define _cleanup_udev_list_cleanup_ _cleanup_(udev_list_cleanup)