chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] allow to match against empty key values
[elogind.git]
/
udev.c
diff --git
a/udev.c
b/udev.c
index bf2eb373f82765b6ec77c10f0c43f68c5b465d07..6d1d679d9a0ccd446f988cb605c407dd545c123f 100644
(file)
--- a/
udev.c
+++ b/
udev.c
@@
-37,20
+37,19
@@
#include "udev_utils.h"
#include "udev_sysfs.h"
#include "udev_version.h"
#include "udev_utils.h"
#include "udev_sysfs.h"
#include "udev_version.h"
-#include "
namedev
.h"
+#include "
udev_rules
.h"
#include "logging.h"
#include "logging.h"
-
#ifdef USE_LOG
#ifdef USE_LOG
-void log_message(int
level
, const char *format, ...)
+void log_message(int
priority
, const char *format, ...)
{
va_list args;
{
va_list args;
- if (
!udev_log
)
+ if (
priority > udev_log_priority
)
return;
va_start(args, format);
return;
va_start(args, format);
- vsyslog(
level
, format, args);
+ vsyslog(
priority
, format, args);
va_end(args);
}
#endif
va_end(args);
}
#endif
@@
-115,13
+114,12
@@
int main(int argc, char *argv[], char *envp[])
}
logging_init("udev");
}
logging_init("udev");
- dbg("version %s", UDEV_VERSION);
-
udev_init_config();
udev_init_config();
+ dbg("version %s", UDEV_VERSION);
/* set signal handlers */
memset(&act, 0x00, sizeof(act));
/* set signal handlers */
memset(&act, 0x00, sizeof(act));
- act.sa_handler = (void (*)
(int))
sig_handler;
+ act.sa_handler = (void (*)
(int))
sig_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
sigaction(SIGALRM, &act, NULL);
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
sigaction(SIGALRM, &act, NULL);
@@
-146,21
+144,25
@@
int main(int argc, char *argv[], char *envp[])
udev_init_device(&udev, devpath, subsystem);
if (!action || !subsystem || !devpath) {
udev_init_device(&udev, devpath, subsystem);
if (!action || !subsystem || !devpath) {
-
dbg
("action, subsystem or devpath missing");
+
err
("action, subsystem or devpath missing");
goto hotplug;
}
/* export logging flag, as called scripts may want to do the same as udev */
goto hotplug;
}
/* export logging flag, as called scripts may want to do the same as udev */
- if (udev_log)
- setenv("UDEV_LOG", "1", 1);
+ if (udev_log_priority) {
+ char priority[32];
+
+ sprintf(priority, "%i", udev_log_priority);
+ setenv("UDEV_LOG", priority, 1);
+ }
- if (udev.type ==
BLOCK || udev.type == CLASS || udev.type ==
NET) {
+ if (udev.type ==
DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_
NET) {
if (strcmp(action, "add") == 0) {
/* wait for sysfs and possibly add node */
dbg("udev add");
/* skip subsystems without "dev", but handle net devices */
if (strcmp(action, "add") == 0) {
/* wait for sysfs and possibly add node */
dbg("udev add");
/* skip subsystems without "dev", but handle net devices */
- if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) {
+ if (udev.type !=
DEV_
NET && subsystem_expect_no_dev(udev.subsystem)) {
dbg("don't care about '%s' devices", udev.subsystem);
goto hotplug;
}
dbg("don't care about '%s' devices", udev.subsystem);
goto hotplug;
}
@@
-169,7
+171,7
@@
int main(int argc, char *argv[], char *envp[])
path[sizeof(path)-1] = '\0';
class_dev = wait_class_device_open(path);
if (class_dev == NULL) {
path[sizeof(path)-1] = '\0';
class_dev = wait_class_device_open(path);
if (class_dev == NULL) {
- dbg
("open class device failed");
+ dbg("open class device failed");
goto hotplug;
}
dbg("opened class_dev->name='%s'", class_dev->name);
goto hotplug;
}
dbg("opened class_dev->name='%s'", class_dev->name);
@@
-177,7
+179,7
@@
int main(int argc, char *argv[], char *envp[])
wait_for_class_device(class_dev, &error);
/* init rules */
wait_for_class_device(class_dev, &error);
/* init rules */
-
namedev
_init();
+
udev_rules
_init();
/* name, create node, store in db */
retval = udev_add_device(&udev, class_dev);
/* name, create node, store in db */
retval = udev_add_device(&udev, class_dev);
@@
-203,7
+205,7
@@
int main(int argc, char *argv[], char *envp[])
if (udev_dev_d)
udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
}
if (udev_dev_d)
udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX);
}
- } else if (udev.type ==
PHYSDEV
) {
+ } else if (udev.type ==
DEV_DEVICE
) {
if (strcmp(action, "add") == 0) {
/* wait for sysfs */
dbg("devices add");
if (strcmp(action, "add") == 0) {
/* wait for sysfs */
dbg("devices add");