chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix makefile to allow 'make release' to work with git
[elogind.git]
/
udevstart.c
diff --git
a/udevstart.c
b/udevstart.c
index 7564c3de03d5d9e98924bc9abe22e515b0b9cd37..60e63c5ad8a69c8c9b512ff764e97c4d310895b2 100644
(file)
--- a/
udevstart.c
+++ b/
udevstart.c
@@
-38,14
+38,23
@@
#include "libsysfs/sysfs/libsysfs.h"
#include "udev_libc_wrapper.h"
#include "udev.h"
#include "libsysfs/sysfs/libsysfs.h"
#include "udev_libc_wrapper.h"
#include "udev.h"
+#include "udev_version.h"
#include "logging.h"
#include "logging.h"
-#include "
namedev
.h"
+#include "
udev_rules
.h"
#include "udev_utils.h"
#include "list.h"
#ifdef USE_LOG
#include "udev_utils.h"
#include "list.h"
#ifdef USE_LOG
-void log_message(int
level
, const char *format, ...)
+void log_message(int
priority
, const char *format, ...)
{
{
+ va_list args;
+
+ if (priority > udev_log_priority)
+ return;
+
+ va_start(args, format);
+ vsyslog(priority, format, args);
+ va_end(args);
}
#endif
}
#endif
@@
-114,15
+123,24
@@
static int add_device(const char *path, const char *subsystem)
return -ENODEV;
}
return -ENODEV;
}
- udev_init_device(&udev, devpath, subsystem);
+ udev_init_device(&udev, devpath, subsystem
, "add"
);
udev_add_device(&udev, class_dev);
udev_add_device(&udev, class_dev);
- /* run dev.d/ scripts if we created a node or changed a netif name */
- if (udev_dev_d && udev.devname[0] != '\0') {
+ if (udev.devname[0] != '\0')
setenv("DEVNAME", udev.devname, 1);
setenv("DEVNAME", udev.devname, 1);
- udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
+
+ if (udev_run && !list_empty(&udev.run_list)) {
+ struct name_entry *name_loop;
+
+ dbg("executing run list");
+ list_for_each_entry(name_loop, &udev.run_list, node)
+ execute_command(name_loop->name, udev.subsystem);
}
}
+ /* run dev.d/ scripts if we created a node or changed a netif name */
+ if (udev_dev_d && udev.devname[0] != '\0')
+ udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
+
sysfs_close_class_device(class_dev);
udev_cleanup_device(&udev);
sysfs_close_class_device(class_dev);
udev_cleanup_device(&udev);
@@
-299,7
+317,12
@@
int main(int argc, char *argv[], char *envp[])
{
struct sigaction act;
{
struct sigaction act;
+ logging_init("udev");
udev_init_config();
udev_init_config();
+ /* disable all logging if not explicitely requested */
+ if (getenv("UDEV_LOG") == NULL)
+ udev_log_priority = 0;
+ dbg("version %s", UDEV_VERSION);
/* set signal handlers */
memset(&act, 0x00, sizeof(act));
/* set signal handlers */
memset(&act, 0x00, sizeof(act));
@@
-317,10
+340,11
@@
int main(int argc, char *argv[], char *envp[])
setenv("ACTION", "add", 1);
setenv("UDEV_START", "1", 1);
setenv("ACTION", "add", 1);
setenv("UDEV_START", "1", 1);
-
namedev
_init();
+
udev_rules
_init();
udev_scan_block();
udev_scan_class();
udev_scan_block();
udev_scan_class();
+ logging_close();
return 0;
}
return 0;
}