From 60865f33a1fee5bddc8add3963f44691996d2ceb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Sep 2008 10:34:48 +0200 Subject: udevadm: move init from commands to udevadm --- udev/udevadm-info.c | 6 ------ udev/udevadm-settle.c | 5 ----- udev/udevadm-test.c | 3 --- udev/udevadm-trigger.c | 5 ----- udev/udevadm.c | 6 ++++++ 5 files changed, 6 insertions(+), 19 deletions(-) (limited to 'udev') diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 1f47b89952..fdf53d2ab5 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -279,10 +279,6 @@ int udevadm_info(int argc, char *argv[]) struct name_entry *name_loop; int rc = 0; - logging_init("udevinfo"); - udev_config_init(); - sysfs_init(); - while (1) { option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); if (option == -1) @@ -501,7 +497,5 @@ int udevadm_info(int argc, char *argv[]) exit: udev_device_cleanup(udev); - sysfs_cleanup(); - logging_close(); return rc; } diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 0cb9ece472..3a886469ad 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -87,10 +87,7 @@ int udevadm_settle(int argc, char *argv[]) int rc = 1; int seconds; - logging_init("udevsettle"); - udev_config_init(); dbg("version %s\n", VERSION); - sysfs_init(); while (1) { option = getopt_long(argc, argv, "t:h", options, NULL); @@ -172,7 +169,5 @@ int udevadm_settle(int argc, char *argv[]) } exit: - sysfs_cleanup(); - logging_close(); return rc; } diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 291f7e934f..d06249c6c1 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -92,7 +92,6 @@ int udevadm_test(int argc, char *argv[]) }; info("version %s\n", VERSION); - udev_config_init(); if (udev_log_priority < LOG_INFO) { char priority[32]; @@ -143,7 +142,6 @@ int udevadm_test(int argc, char *argv[]) "some values may be different, or not available at a simulation run.\n" "\n"); - sysfs_init(); udev_rules_init(&rules, 0); /* remove /sys if given */ @@ -202,6 +200,5 @@ int udevadm_test(int argc, char *argv[]) exit: udev_rules_cleanup(&rules); - sysfs_cleanup(); return rc; } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 322040582e..04d8f79ba1 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -584,10 +584,7 @@ int udevadm_trigger(int argc, char *argv[]) {} }; - logging_init("udevtrigger"); - udev_config_init(); dbg("version %s\n", VERSION); - sysfs_init(); while (1) { option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); @@ -710,7 +707,5 @@ exit: if (sock >= 0) close(sock); - sysfs_cleanup(); - logging_close(); return 0; } diff --git a/udev/udevadm.c b/udev/udevadm.c index aa0befed3b..047365d973 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -125,6 +125,10 @@ int main(int argc, char *argv[]) const char *pos; int rc; + logging_init("udevadm"); + udev_config_init(); + sysfs_init(); + /* find command */ if (command != NULL) for (i = 0; cmds[i].cmd != NULL; i++) { @@ -169,5 +173,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "unknown command, try help\n\n"); rc = 2; out: + sysfs_cleanup(); + logging_close(); return rc; } -- cgit v1.2.3-54-g00ecf