ata_id_SOURCES = \
ata_id.c \
- ../../udev/udev.h \
+ ../../libudev/libudev.h \
+ ../../libudev/libudev-private.h \
../../libudev/libudev.c \
../../libudev/libudev-list.c \
../../libudev/libudev-util.c
#include <linux/types.h>
#include <linux/hdreg.h>
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
if (udev == NULL)
goto exit;
- logging_init("ata_id");
+ udev_log_init("ata_id");
udev_set_log_fn(udev, log_fn);
while (1) {
close(fd);
exit:
udev_unref(udev);
- logging_close();
+ udev_log_close();
return rc;
}
cdrom_id_SOURCES = \
cdrom_id.c \
../../libudev/libudev.h \
+ ../../libudev/libudev-private.h \
../../libudev/libudev.c \
../../libudev/libudev-list.c \
../../libudev/libudev-util.c
#include <sys/ioctl.h>
#include <linux/cdrom.h>
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
static int debug;
if (udev == NULL)
goto exit;
- logging_init("cdrom_id");
+ udev_log_init("cdrom_id");
udev_set_log_fn(udev, log_fn);
while (1) {
if (fd >= 0)
close(fd);
udev_unref(udev);
- logging_close();
+ udev_log_close();
return rc;
}
#include <dirent.h>
#include <stdint.h>
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
static void log_fn(struct udev *udev, int priority,
const char *file, int line, const char *fn,
if (udev == NULL)
goto exit;
- logging_init("edd_id");
+ udev_log_init("edd_id");
udev_set_log_fn(udev, log_fn);
for (i = 1 ; i < argc; i++) {
closedir(dir);
exit:
udev_unref(udev);
- logging_close();
+ udev_log_close();
return rc;
}
../../libudev/libudev-util.c \
../../libudev/libudev-device.c \
../../libudev/libudev-enumerate.c \
+ ../../udev/udev.h \
../../udev/udev-util.c
if USE_SELINUX
#include <pwd.h>
#include <grp.h>
+#include "libudev.h"
+#include "libudev-private.h"
#include "../../udev/udev.h"
static char *table[] = {
if (udev == NULL)
goto exit;
- logging_init("create_floppy_devices");
+ udev_log_init("create_floppy_devices");
udev_set_log_fn(udev, log_fn);
udev_selinux_init(udev);
udev_selinux_exit(udev);
udev_unref(udev);
+ udev_log_close();
exit:
return 0;
}
#include <mntent.h>
#include <sys/stat.h>
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
static int debug;
if (udev == NULL)
goto exit;
- logging_init("fstab_id");
+ udev_log_init("fstab_id");
udev_set_log_fn(udev, log_fn);
while (1) {
exit:
udev_unref(udev);
- logging_close();
+ udev_log_close();
return rc;
}
#include <getopt.h>
#include "libudev.h"
-#include "../../udev/udev.h"
+#include "libudev-private.h"
int debug;
if (udev == NULL)
goto exit;
- logging_init("path_id");
+ udev_log_init("path_id");
udev_set_log_fn(udev, log_fn);
while (1) {
udev_device_unref(dev);
exit:
udev_unref(udev);
- logging_close();
+ udev_log_close();
return rc;
}
#include <getopt.h>
#include <sys/stat.h>
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
#include "scsi_id.h"
static const struct option options[] = {
if (udev == NULL)
goto exit;
- logging_init("scsi_id");
+ udev_log_init("scsi_id");
udev_set_log_fn(udev, log_fn);
/*
exit:
udev_unref(udev);
- logging_close();
+ udev_log_close();
return retval;
}
/* #include <linux/bsg.h> */
#include "bsg.h"
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
#include "scsi.h"
#include "scsi_id.h"
#include <errno.h>
#include <getopt.h>
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
int debug;
if (udev == NULL)
goto exit;
- logging_init("usb_id");
+ udev_log_init("usb_id");
udev_set_log_fn(udev, log_fn);
while (1) {
exit:
udev_device_unref(dev);
udev_unref(udev);
- logging_close();
+ udev_log_close();
return retval;
}
# define err(udev, arg...) udev_log_null(udev, ## arg)
#endif
-/* libudev */
+static inline void udev_log_init(const char *program_name)
+{
+ openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON);
+}
+
+static inline void udev_log_close(void)
+{
+ closelog();
+}
+
+/* libudev.c */
void udev_log(struct udev *udev,
int priority, const char *file, int line, const char *fn,
const char *format, ...)
struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value);
struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev);
-/* libudev-device */
+/* libudev-device.c */
struct udev_device *udev_device_new(struct udev *udev);
int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
int udev_device_delete_db(struct udev_device *udev_device);
int udev_device_rename_db(struct udev_device *udev_device, const char *devpath);
-/* libudev-monitor - netlink/unix socket communication */
+/* libudev-monitor.c - netlink/unix socket communication */
int udev_monitor_disconnect(struct udev_monitor *udev_monitor);
int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender);
int udev_monitor_send_device(struct udev_monitor *udev_monitor,
struct udev_monitor *destination, struct udev_device *udev_device);
int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size);
-/* libudev-ctrl - daemon runtime setup */
+/* libudev-ctrl.c - daemon runtime setup */
struct udev_ctrl;
struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path);
int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl);
const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg);
int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg);
-/* libudev-list */
+/* libudev-list.c */
struct udev_list_node {
struct udev_list_node *next, *prev;
};
entry != NULL; \
entry = tmp, tmp = udev_list_entry_get_next(tmp))
-/* libudev-queue */
+/* libudev-queue.c */
unsigned long long int udev_get_kernel_seqnum(struct udev *udev);
int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum);
ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size);
ssize_t udev_queue_skip_devpath(FILE *queue_file);
-/* libudev-queue-export */
+/* libudev-queue-export.c */
struct udev_queue_export *udev_queue_export_new(struct udev *udev);
void udev_queue_export_unref(struct udev_queue_export *udev_queue_export);
void udev_queue_export_cleanup(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 */
+/* libudev-utils.c */
#define UTIL_PATH_SIZE 1024
#define UTIL_LINE_SIZE 2048
#define UTIL_NAME_SIZE 512
#define READ_END 0
#define WRITE_END 1
-static inline void logging_init(const char *program_name)
-{
- openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON);
-}
-
-static inline void logging_msg(struct udev *udev, int priority,
- const char *file, int line, const char *fn,
- const char *format, va_list args)
-{
- vsyslog(priority, format, args);
-}
-
-static inline void logging_close(void)
-{
- closelog();
-}
-
struct udev_event {
struct udev *udev;
struct udev_device *dev;
if (udev == NULL)
goto out;
- logging_init("udevadm");
+ udev_log_init("udevadm");
udev_set_log_fn(udev, log_fn);
udev_selinux_init(udev);
out:
udev_selinux_exit(udev);
udev_unref(udev);
- logging_close();
+ udev_log_close();
return rc;
}
udev_ctrl_unref(udev_ctrl);
close(pfd[FD_SIGNAL].fd);
close(worker_watch[READ_END]);
- logging_close();
- logging_init("udevd-work");
+ udev_log_close();
+ udev_log_init("udevd-work");
setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY);
/* set signal handlers */
}
udev_monitor_unref(worker_monitor);
- logging_close();
+ udev_log_close();
exit(0);
}
case -1:
if (udev == NULL)
goto exit;
- logging_init("udevd");
+ udev_log_init("udevd");
udev_set_log_fn(udev, log_fn);
info(udev, "version %s\n", VERSION);
udev_selinux_init(udev);
udev_monitor_unref(monitor);
udev_selinux_exit(udev);
udev_unref(udev);
- logging_close();
+ udev_log_close();
return rc;
}