summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-04-04 15:25:01 +0200
committerLennart Poettering <lennart@poettering.net>2022-04-04 18:24:14 +0200
commita0e902598c9f5fbce55653f679e0ce91bc3369b7 (patch)
tree8a1cf7050f6101390aa7181f1dc580d83ca13027 /src
parent1ce0d040593c92adebceed29618f170faaee0839 (diff)
downloadsystemd-a0e902598c9f5fbce55653f679e0ce91bc3369b7.tar.gz
udevadm: show more fields of sd_device objects in "udevadm info"
Let's make things easier to debug, and show a more comprehensive set of fields, extending on the existing output syntax that starts with one marker character followed by a colon and a space.
Diffstat (limited to 'src')
-rw-r--r--src/udev/udevadm-info.c52
1 files changed, 43 insertions, 9 deletions
diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c
index a088c1727c..721c5665b3 100644
--- a/src/udev/udevadm-info.c
+++ b/src/udev/udevadm-info.c
@@ -171,27 +171,61 @@ static int print_device_chain(sd_device *device) {
}
static int print_record(sd_device *device) {
- const char *str, *val;
- int i;
+ const char *str, *val, *subsys;
+ dev_t devnum;
+ uint64_t q;
+ int i, ifi;
assert(device);
- (void) sd_device_get_devpath(device, &str);
+ /* We don't show syspath here, because it's identical to devpath (modulo the "/sys" prefix).
+ *
+ * We don't show action/seqnum here because that only makes sense for records synthesized from
+ * uevents, not for those synthesized from database entries.
+ *
+ * We don't show sysattrs here, because they can be expensive and potentially issue expensive driver
+ * IO. */
+
+ assert_se(sd_device_get_devpath(device, &str) >= 0);
printf("P: %s\n", str);
+ if (sd_device_get_sysname(device, &str) >= 0)
+ printf("M: %s\n", str);
+
+ if (sd_device_get_sysnum(device, &str) >= 0)
+ printf("R: %s\n", str);
+
+ if (sd_device_get_subsystem(device, &subsys) >= 0)
+ printf("U: %s\n", subsys);
+
+ if (sd_device_get_devtype(device, &str) >= 0)
+ printf("T: %s\n", str);
+
+ if (sd_device_get_devnum(device, &devnum) >= 0)
+ printf("D: %c %u:%u\n", streq_ptr(subsys, "block") ? 'b' : 'c', major(devnum), minor(devnum));
+
+ if (sd_device_get_ifindex(device, &ifi) >= 0)
+ printf("I: %i\n", ifi);
+
if (sd_device_get_devname(device, &str) >= 0) {
assert_se(val = path_startswith(str, "/dev/"));
printf("N: %s\n", val);
- }
- if (device_get_devlink_priority(device, &i) >= 0)
- printf("L: %i\n", i);
+ if (device_get_devlink_priority(device, &i) >= 0)
+ printf("L: %i\n", i);
- FOREACH_DEVICE_DEVLINK(device, str) {
- assert_se(val = path_startswith(str, "/dev/"));
- printf("S: %s\n", val);
+ FOREACH_DEVICE_DEVLINK(device, str) {
+ assert_se(val = path_startswith(str, "/dev/"));
+ printf("S: %s\n", val);
+ }
}
+ if (sd_device_get_diskseq(device, &q) >= 0)
+ printf("Q: %" PRIu64 "\n", q);
+
+ if (sd_device_get_driver(device, &str) >= 0)
+ printf("V: %s\n", str);
+
FOREACH_DEVICE_PROPERTY(device, str, val)
printf("E: %s=%s\n", str, val);