mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
udevadm: move init from commands to udevadm
This commit is contained in:
parent
8a3c06af21
commit
60865f33a1
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user