summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-06-09 23:05:25 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-06-09 23:05:25 +0200
commit44b49d3736bfdc94da31b5670a2c5a3477a201eb (patch)
treee4e60eec0d2aa83d8175f0bde436ee1a9c9dc38b
parent9060b066d9e7aaca9795010ac5fff61018947f87 (diff)
move common stuff from udev/ to private parts of libudev/
-rw-r--r--extras/floppy/Makefile.am8
-rw-r--r--extras/floppy/create_floppy_devices.c1
-rw-r--r--libudev/libudev-device-db-write.c3
-rw-r--r--libudev/libudev-private.h31
-rw-r--r--libudev/libudev-queue-export.c7
-rw-r--r--libudev/libudev-selinux-private.c (renamed from udev/udev-selinux.c)21
-rw-r--r--libudev/libudev-util-private.c (renamed from udev/udev-util.c)21
-rw-r--r--udev/Makefile.am4
-rw-r--r--udev/udev.h30
9 files changed, 56 insertions, 70 deletions
diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am
index 365ece9ee9..cbdcf6e8fb 100644
--- a/extras/floppy/Makefile.am
+++ b/extras/floppy/Makefile.am
@@ -7,17 +7,17 @@ udevhome_PROGRAMS = \
create_floppy_devices_SOURCES = \
create_floppy_devices.c \
../../libudev/libudev.h \
+ ../../libudev/libudev-private.h \
../../libudev/libudev.c \
../../libudev/libudev-list.c \
../../libudev/libudev-util.c \
+ ../../libudev/libudev-util-private.c \
../../libudev/libudev-device.c \
- ../../libudev/libudev-enumerate.c \
- ../../udev/udev.h \
- ../../udev/udev-util.c
+ ../../libudev/libudev-enumerate.c
if USE_SELINUX
create_floppy_devices_SOURCES += \
- ../../udev/udev-selinux.c
+ ../../libudev/libudev-selinux-private.c
create_floppy_devices_LDADD = \
$(SELINUX_LIBS)
endif
diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c
index b0d7b0bc85..2fc05cc494 100644
--- a/extras/floppy/create_floppy_devices.c
+++ b/extras/floppy/create_floppy_devices.c
@@ -26,7 +26,6 @@
#include "libudev.h"
#include "libudev-private.h"
-#include "../../udev/udev.h"
static char *table[] = {
"", "d360", "h1200", "u360", "u720", "h360", "h720",
diff --git a/libudev/libudev-device-db-write.c b/libudev/libudev-device-db-write.c
index a8e66f7884..68dc0a5b98 100644
--- a/libudev/libudev-device-db-write.c
+++ b/libudev/libudev-device-db-write.c
@@ -18,7 +18,8 @@
#include <string.h>
#include <sys/stat.h>
-#include "udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len)
{
diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h
index 21eb626dc1..9cda7bcb1e 100644
--- a/libudev/libudev-private.h
+++ b/libudev/libudev-private.h
@@ -16,6 +16,9 @@
#include "libudev.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b))
+#define READ_END 0
+#define WRITE_END 1
static inline void __attribute__((always_inline, format(printf, 2, 3)))
udev_log_null(struct udev *udev, const char *format, ...) {}
@@ -182,7 +185,7 @@ int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export,
int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
-/* libudev-utils.c */
+/* libudev-util.c */
#define UTIL_PATH_SIZE 1024
#define UTIL_LINE_SIZE 2048
#define UTIL_NAME_SIZE 512
@@ -203,4 +206,30 @@ int udev_util_replace_chars(char *str, const char *white);
int udev_util_encode_string(const char *str, char *str_enc, size_t len);
void util_set_fd_cloexec(int fd);
unsigned int util_string_hash32(const char *str);
+
+/* libudev-util-private.c */
+int util_create_path(struct udev *udev, const char *path);
+int util_delete_path(struct udev *udev, const char *path);
+int util_unlink_secure(struct udev *udev, const char *filename);
+uid_t util_lookup_user(struct udev *udev, const char *user);
+gid_t util_lookup_group(struct udev *udev, const char *group);
+int util_run_program(struct udev *udev, const char *command, char **envp,
+ char *result, size_t ressize, size_t *reslen);
+int util_resolve_subsys_kernel(struct udev *udev, const char *string,
+ char *result, size_t maxsize, int read_value);
+
+/* libudev-selinux-private.c */
+#ifndef USE_SELINUX
+static inline void udev_selinux_init(struct udev *udev) {}
+static inline void udev_selinux_exit(struct udev *udev) {}
+static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
+static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
+static inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
+#else
+void udev_selinux_init(struct udev *udev);
+void udev_selinux_exit(struct udev *udev);
+void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
+void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
+void udev_selinux_resetfscreatecon(struct udev *udev);
+#endif
#endif
diff --git a/libudev/libudev-queue-export.c b/libudev/libudev-queue-export.c
index a36ff5150a..9ae680c386 100644
--- a/libudev/libudev-queue-export.c
+++ b/libudev/libudev-queue-export.c
@@ -14,7 +14,6 @@
* DISCLAIMER - The file format mentioned here is private to udev/libudev,
* and may be changed without notice.
*
- *
* The udev event queue is exported as a binary log file.
* Each log record consists of a sequence number followed by the device path.
*
@@ -31,7 +30,6 @@
* The queue does not grow indefinitely. It is periodically re-created
* to remove finished events. Atomic rename() makes this transparent to readers.
*
- *
* The queue file starts with a single sequence number which specifies the
* minimum sequence number in the log that follows. Any events prior to this
* sequence number have already finished.
@@ -48,7 +46,8 @@
#include <sys/types.h>
#include <assert.h>
-#include "udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
static int rebuild_queue_file(struct udev_queue_export *udev_queue_export);
@@ -108,7 +107,6 @@ void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export)
unlink(filename);
}
-
static int skip_to(FILE *file, long offset)
{
long old_offset;
@@ -320,7 +318,6 @@ write_error:
return -1;
}
-
enum device_state {
DEVICE_QUEUED,
DEVICE_FINISHED,
diff --git a/udev/udev-selinux.c b/libudev/libudev-selinux-private.c
index 4f1b2bb2d1..84f8b6a63f 100644
--- a/udev/udev-selinux.c
+++ b/libudev/libudev-selinux-private.c
@@ -1,18 +1,12 @@
/*
- * Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
+ * libudev - interface to udev device information
*
- * This program 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 General Public License for more details.
+ * Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * This library 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.
*/
#include <stdio.h>
@@ -22,7 +16,8 @@
#include <unistd.h>
#include <selinux/selinux.h>
-#include "udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
static int selinux_enabled;
security_context_t selinux_prev_scontext;
diff --git a/udev/udev-util.c b/libudev/libudev-util-private.c
index 645293d389..f22c04184b 100644
--- a/udev/udev-util.c
+++ b/libudev/libudev-util-private.c
@@ -1,18 +1,12 @@
/*
- * Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
+ * libudev - interface to udev device information
*
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright (C) 2004-2009 Kay Sievers <kay.sievers@vrfy.org>
*
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * This library 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.
*/
#include <stdlib.h>
@@ -27,7 +21,8 @@
#include <grp.h>
#include <sys/wait.h>
-#include "udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
int util_create_path(struct udev *udev, const char *path)
{
diff --git a/udev/Makefile.am b/udev/Makefile.am
index ca5b4fae59..f2ceb99774 100644
--- a/udev/Makefile.am
+++ b/udev/Makefile.am
@@ -15,12 +15,12 @@ common_files = \
udev-watch.c \
udev-node.c \
udev-rules.c \
- udev-util.c \
../libudev/libudev.h \
../libudev/libudev-private.h \
../libudev/libudev.c \
../libudev/libudev-list.c \
../libudev/libudev-util.c \
+ ../libudev/libudev-util-private.c \
../libudev/libudev-device.c \
../libudev/libudev-device-db-write.c \
../libudev/libudev-monitor.c \
@@ -31,7 +31,7 @@ common_files = \
if USE_SELINUX
common_files += \
- udev-selinux.c
+ ../libudev/libudev-selinux-private.c
common_ldadd += \
$(SELINUX_LIBS)
endif
diff --git a/udev/udev.h b/udev/udev.h
index bd3686b28a..3e3ecfb1fe 100644
--- a/udev/udev.h
+++ b/udev/udev.h
@@ -30,10 +30,6 @@
#define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd"
-#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b))
-#define READ_END 0
-#define WRITE_END 1
-
struct udev_event {
struct udev *udev;
struct udev_device *dev;
@@ -89,32 +85,6 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid);
int udev_node_remove(struct udev_device *dev);
void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old);
-/* udev-util.c */
-int util_create_path(struct udev *udev, const char *path);
-int util_delete_path(struct udev *udev, const char *path);
-int util_unlink_secure(struct udev *udev, const char *filename);
-uid_t util_lookup_user(struct udev *udev, const char *user);
-gid_t util_lookup_group(struct udev *udev, const char *group);
-int util_run_program(struct udev *udev, const char *command, char **envp,
- char *result, size_t ressize, size_t *reslen);
-int util_resolve_subsys_kernel(struct udev *udev, const char *string,
- char *result, size_t maxsize, int read_value);
-
-/* udev-selinux.c */
-#ifndef USE_SELINUX
-static inline void udev_selinux_init(struct udev *udev) {}
-static inline void udev_selinux_exit(struct udev *udev) {}
-static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
-static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
-static inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
-#else
-void udev_selinux_init(struct udev *udev);
-void udev_selinux_exit(struct udev *udev);
-void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
-void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
-void udev_selinux_resetfscreatecon(struct udev *udev);
-#endif
-
/* udevadm commands */
int udevadm_monitor(struct udev *udev, int argc, char *argv[]);
int udevadm_info(struct udev *udev, int argc, char *argv[]);