chiark / gitweb /
ata_id: sync ID_SERIAL(_SHORT) with other *_id tools
[elogind.git] / extras / ata_id / ata_id.c
index dd28d91f4aa78a6a23094ff1f0b4f4ec9e961656..9644a45b19482422404bc0091ac92b4d5f5a8501 100644 (file)
@@ -35,7 +35,8 @@
 #include <linux/types.h>
 #include <linux/hdreg.h>
 
-#include "../../udev/udev.h"
+#include "libudev.h"
+#include "libudev-private.h"
 
 static void log_fn(struct udev *udev, int priority,
                   const char *file, int line, const char *fn,
@@ -66,7 +67,7 @@ int main(int argc, char *argv[])
        if (udev == NULL)
                goto exit;
 
-       logging_init("ata_id");
+       udev_log_init("ata_id");
        udev_set_log_fn(udev, log_fn);
 
        while (1) {
@@ -148,11 +149,12 @@ int main(int argc, char *argv[])
                } else {
                        printf("ID_TYPE=disk\n");
                }
+               printf("ID_BUS=ata\n");
                printf("ID_MODEL=%s\n", model);
                printf("ID_MODEL_ENC=%s\n", model_enc);
-               printf("ID_SERIAL=%s\n", serial);
                printf("ID_REVISION=%s\n", revision);
-               printf("ID_BUS=ata\n");
+               printf("ID_SERIAL=%s_%s\n", model, serial);
+               printf("ID_SERIAL_SHORT=%s\n", serial);
        } else {
                if (serial[0] != '\0')
                        printf("%s_%s\n", model, serial);
@@ -164,6 +166,6 @@ close:
        close(fd);
 exit:
        udev_unref(udev);
-       logging_close();
+       udev_log_close();
        return rc;
 }