X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev%2Fudevd.c;h=22d261fccb215424209dbdbabcb11f23e0f88f20;hp=0827a5ceb32551b41520caa4414c82b774b1483f;hb=8ef5af2db83cea4b7d2d02f1fed71fca82f9e20d;hpb=726687ad48bdececed1e7e44387c50e009e28208 diff --git a/udev/udevd.c b/udev/udevd.c index 0827a5ceb..22d261fcc 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -17,6 +17,8 @@ * */ +#include "config.h" + #include #include #include @@ -39,6 +41,9 @@ #include #include #include +#ifdef HAVE_INOTIFY +#include +#endif #include "udev.h" #include "udev_rules.h" @@ -156,12 +161,12 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st size_t start; /* location of queue file */ - snprintf(filename, sizeof(filename), "%s/"EVENT_QUEUE_DIR"/%llu", udev_root, msg->seqnum); + snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_root, msg->seqnum); /* location of failed file */ strlcpy(filename_failed, udev_root, sizeof(filename_failed)); strlcat(filename_failed, "/", sizeof(filename_failed)); - start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed)); + start = strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); path_encode(&filename_failed[start], sizeof(filename_failed) - start); @@ -182,7 +187,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st strlcpy(filename_failed_old, udev_root, sizeof(filename_failed_old)); strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); - start = strlcat(filename_failed_old, EVENT_FAILED_DIR"/", sizeof(filename_failed_old)); + start = strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); path_encode(&filename_failed_old[start], sizeof(filename) - start); @@ -273,7 +278,7 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { char str[32]; @@ -939,7 +944,7 @@ static void export_initial_seqnum(void) len = 3; } strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); create_path(filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { @@ -971,7 +976,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevd"); udev_config_init(); selinux_init(); - dbg("version %s\n", UDEV_VERSION); + dbg("version %s\n", VERSION); while (1) { option = getopt_long(argc, argv, "dDthV", options, NULL); @@ -994,7 +999,7 @@ int main(int argc, char *argv[], char *envp[]) printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); goto exit; case 'V': - printf("%s\n", UDEV_VERSION); + printf("%s\n", VERSION); goto exit; default: goto exit; @@ -1123,7 +1128,7 @@ int main(int argc, char *argv[], char *envp[]) fd = open("/dev/kmsg", O_WRONLY); if (fd > 0) { - const char *str = "<6>udevd version " UDEV_VERSION " started\n"; + const char *str = "<6>udevd version " VERSION " started\n"; write(fd, str, strlen(str)); close(fd); @@ -1148,14 +1153,14 @@ int main(int argc, char *argv[], char *envp[]) } else { char filename[PATH_MAX]; - inotify_add_watch(inotify_fd, RULES_LIB_DIR, + inotify_add_watch(inotify_fd, UDEV_PREFIX "/lib/udev/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - inotify_add_watch(inotify_fd, RULES_ETC_DIR, + inotify_add_watch(inotify_fd, SYSCONFDIR "/udev/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + strlcat(filename, "/.udev/rules.d", sizeof(filename)); inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); }