summaryrefslogtreecommitdiff
path: root/udev/udevadm-control.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-09-06 15:45:31 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-09-06 15:45:31 +0200
commit7d563a17f3967890331daf08d43f2f005418139b (patch)
tree88b0c35d258a5b51fcadc1c0fc96ff80dfcaeacf /udev/udevadm-control.c
parentcf8ec631a23eae532541bfeeccce20f0d978404d (diff)
use libudev code, unify logging, pass udev context around everywhere
Diffstat (limited to 'udev/udevadm-control.c')
-rw-r--r--udev/udevadm-control.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c
index de4b658d5b..6e10316fbe 100644
--- a/udev/udevadm-control.c
+++ b/udev/udevadm-control.c
@@ -34,12 +34,9 @@
#include "udev.h"
#include "udevd.h"
-static int udev_log = 0;
-
-int udevadm_control(int argc, char *argv[])
+int udevadm_control(struct udev *udev, int argc, char *argv[])
{
struct udev_ctrl *uctrl;
- const char *env;
int rc = 1;
/* compat values with '_' will be removed in a future release */
@@ -61,19 +58,12 @@ int udevadm_control(int argc, char *argv[])
{}
};
- env = getenv("UDEV_LOG");
- if (env)
- udev_log = log_priority(env);
-
- logging_init("udevcontrol");
- dbg("version %s\n", VERSION);
-
if (getuid() != 0) {
fprintf(stderr, "root privileges required\n");
goto exit;
}
- uctrl = udev_ctrl_new_from_socket(UDEVD_CTRL_SOCK_PATH);
+ uctrl = udev_ctrl_new_from_socket(udev, UDEVD_CTRL_SOCK_PATH);
if (uctrl == NULL)
goto exit;
@@ -87,7 +77,7 @@ int udevadm_control(int argc, char *argv[])
break;
if (option > 255) {
- info("udevadm control expects commands without underscore, "
+ info(udev, "udevadm control expects commands without underscore, "
"this will stop working in a future release\n");
fprintf(stderr, "udevadm control expects commands without underscore, "
"this will stop working in a future release\n");
@@ -140,7 +130,6 @@ int udevadm_control(int argc, char *argv[])
}
udev_ctrl_set_max_childs_running(uctrl, i);
break;
- break;
case 'h':
printf("Usage: udevadm control COMMAND\n"
" --log-priority=<level> set the udev log level for the daemon\n"
@@ -163,7 +152,7 @@ int udevadm_control(int argc, char *argv[])
fprintf(stderr, "udevadm control commands requires the --<command> format, "
"this will stop working in a future release\n");
- err("udevadm control commands requires the --<command> format, "
+ err(udev, "udevadm control commands requires the --<command> format, "
"this will stop working in a future release\n");
if (!strncmp(arg, "log_priority=", strlen("log_priority="))) {
@@ -182,11 +171,10 @@ int udevadm_control(int argc, char *argv[])
udev_ctrl_set_env(uctrl, &arg[strlen("env=")]);
} else {
fprintf(stderr, "unrecognized command '%s'\n", arg);
- err("unrecognized command '%s'\n", arg);
+ err(udev, "unrecognized command '%s'\n", arg);
}
}
exit:
udev_ctrl_unref(uctrl);
- logging_close();
return rc;
}