chiark / gitweb /
[PATCH] trivial clenaup of namedev code
[elogind.git] / udevinfo.c
index a4c17da3f09069bded7b65c3d3b97a86c6f6ce9b..045395256d2b75d2b254ef562299872fbaf9faa2 100644 (file)
@@ -178,9 +178,14 @@ exit:
        return retval;
 }
 
+static int print_dump(struct udevice *udev) {
+       printf("%s:%s/%s\n", udev->devpath, udev_root, udev->name);
+       return 0;
+}
+
 static int process_options(int argc, char *argv[])
 {
-       static const char short_options[] = "an:p:q:rVh";
+       static const char short_options[] = "adn:p:q:rVh";
        int option;
        int retval = 1;
        struct udevice udev;
@@ -245,6 +250,10 @@ static int process_options(int argc, char *argv[])
                        attributes = 1;
                        break;
 
+               case 'd':
+                       udev_db_call_foreach(print_dump);
+                       exit(0);
+
                case 'V':
                        printf("udevinfo, version %s\n", UDEV_VERSION);
                        exit(0);
@@ -293,7 +302,7 @@ static int process_options(int argc, char *argv[])
 
                        memset(&udev, 0x00, sizeof(struct udevice));
                        strfieldcpy(udev.name, pos);
-                       retval = udev_db_get_device_byname(&udev, pos);
+                       retval = udev_db_get_device_by_name(&udev, pos);
                        if (retval != 0) {
                                printf("device not found in database\n");
                                goto exit;
@@ -384,7 +393,8 @@ help:
               "\n"
               "  -r       print udev root\n"
               "  -a       print all SYSFS_attributes along the device chain\n"
-              "  -s       print all sysfs devices with major/minor, physical device and bus\n"
+              "  -d       print the relationship of devpath and the node name for all\n"
+              "           devices available in the database\n"
               "  -V       print udev version\n"
               "  -h       print this help text\n"
               "\n");