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] rename LOG to USE_LOG in all places
[elogind.git]
/
udev.c
diff --git
a/udev.c
b/udev.c
index 7854bc74d0a2f4a8e7f98c3881bf4946c13de409..76de8181d17e6c1fcba9095674477da03ab93988 100644
(file)
--- a/
udev.c
+++ b/
udev.c
@@
-40,7
+40,7
@@
#include "logging.h"
#include "logging.h"
-#ifdef LOG
+#ifdef
USE_
LOG
void log_message(int level, const char *format, ...)
{
va_list args;
void log_message(int level, const char *format, ...)
{
va_list args;
@@
-96,7
+96,6
@@
static void asmlinkage sig_handler(int signum)
int main(int argc, char *argv[], char *envp[])
{
int main(int argc, char *argv[], char *envp[])
{
- struct sigaction act;
struct sysfs_class_device *class_dev;
struct sysfs_device *devices_dev;
struct udevice udev;
struct sysfs_class_device *class_dev;
struct sysfs_device *devices_dev;
struct udevice udev;
@@
-106,6
+105,7
@@
int main(int argc, char *argv[], char *envp[])
const char *devpath;
const char *subsystem;
int managed_event;
const char *devpath;
const char *subsystem;
int managed_event;
+ struct sigaction act;
int retval = -EINVAL;
if (argc == 2 && strcmp(argv[1], "-V") == 0) {
int retval = -EINVAL;
if (argc == 2 && strcmp(argv[1], "-V") == 0) {
@@
-153,16
+153,10
@@
int main(int argc, char *argv[], char *envp[])
if (!subsystem && argc == 2)
subsystem = argv[1];
if (!subsystem && argc == 2)
subsystem = argv[1];
- if (!action) {
- dbg("no action");
- goto hotplug;
- }
- if (!subsystem) {
- dbg("no subsystem");
- goto hotplug;
- }
- if (!devpath) {
- dbg("no devpath");
+ udev_init_device(&udev, devpath, subsystem);
+
+ if (!action || !subsystem || !devpath) {
+ dbg("action, subsystem or devpath missing");
goto hotplug;
}
goto hotplug;
}
@@
-170,8
+164,6
@@
int main(int argc, char *argv[], char *envp[])
if (udev_log)
setenv("UDEV_LOG", "1", 1);
if (udev_log)
setenv("UDEV_LOG", "1", 1);
- udev_init_device(&udev, devpath, subsystem);
-
if (udev.type == BLOCK || udev.type == CLASS || udev.type == NET) {
if (strcmp(action, "add") == 0) {
/* wait for sysfs and possibly add node */
if (udev.type == BLOCK || udev.type == CLASS || udev.type == NET) {
if (strcmp(action, "add") == 0) {
/* wait for sysfs and possibly add node */
@@
-244,6
+236,7
@@
int main(int argc, char *argv[], char *envp[])
}
hotplug:
}
hotplug:
+ udev_cleanup_device(&udev);
if (udev_hotplug_d && managed_event)
udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX);
if (udev_hotplug_d && managed_event)
udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX);