#include "libudev.h"
#include "libudev-private.h"
+#include "log.h"
#define COMMAND_TIMEOUT_MSEC (30 * 1000)
int is_packet_device;
/* init results */
- ret = -1;
memset(out_identify, '\0', 512);
is_packet_device = 0;
if (udev == NULL)
goto exit;
- udev_log_init("ata_id");
+ log_open();
udev_set_log_fn(udev, log_fn);
while (1) {
node = argv[optind];
if (node == NULL) {
- err(udev, "no node specified\n");
+ log_error("no node specified\n");
rc = 1;
goto exit;
}
fd = open(node, O_RDONLY|O_NONBLOCK);
if (fd < 0) {
- err(udev, "unable to open '%s'\n", node);
+ log_error("unable to open '%s'\n", node);
rc = 1;
goto exit;
}
} else {
/* If this fails, then try HDIO_GET_IDENTITY */
if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) {
- info(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node);
+ log_info("HDIO_GET_IDENTITY failed for '%s': %m\n", node);
rc = 2;
goto close;
}
close(fd);
exit:
udev_unref(udev);
- udev_log_close();
+ log_close();
return rc;
}