mirror of
https://github.com/systemd/systemd.git
synced 2025-09-09 17:44:49 +03:00
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.
This commit is contained in:
@@ -227,6 +227,30 @@
|
|||||||
<entry><literal>P:</literal></entry>
|
<entry><literal>P:</literal></entry>
|
||||||
<entry>Device path in <filename>/sys/</filename></entry>
|
<entry>Device path in <filename>/sys/</filename></entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>M:</literal></entry>
|
||||||
|
<entry>Device name in <filename>/sys/</filename> (i.e. the last component of <literal>P:</literal>)</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>R:</literal></entry>
|
||||||
|
<entry>Device number in <filename>/sys/</filename> (i.e. the numeric suffix of the last component of <literal>P:</literal>)</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>U:</literal></entry>
|
||||||
|
<entry>Kernel subsystem</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>T:</literal></entry>
|
||||||
|
<entry>Kernel device type within subsystem</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>D:</literal></entry>
|
||||||
|
<entry>Kernel device node major/minor</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>I:</literal></entry>
|
||||||
|
<entry>Network interface index</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>N:</literal></entry>
|
<entry><literal>N:</literal></entry>
|
||||||
<entry>Kernel device node name</entry>
|
<entry>Kernel device node name</entry>
|
||||||
@@ -239,6 +263,14 @@
|
|||||||
<entry><literal>S:</literal></entry>
|
<entry><literal>S:</literal></entry>
|
||||||
<entry>Device node symlink</entry>
|
<entry>Device node symlink</entry>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>Q:</literal></entry>
|
||||||
|
<entry>Block device sequence number (DISKSEQ)</entry>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<entry><literal>V:</literal></entry>
|
||||||
|
<entry>Attached driver</entry>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<entry><literal>E:</literal></entry>
|
<entry><literal>E:</literal></entry>
|
||||||
<entry>Device property</entry>
|
<entry>Device property</entry>
|
||||||
|
@@ -171,26 +171,60 @@ static int print_device_chain(sd_device *device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int print_record(sd_device *device) {
|
static int print_record(sd_device *device) {
|
||||||
const char *str, *val;
|
const char *str, *val, *subsys;
|
||||||
int i;
|
dev_t devnum;
|
||||||
|
uint64_t q;
|
||||||
|
int i, ifi;
|
||||||
|
|
||||||
assert(device);
|
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);
|
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) {
|
if (sd_device_get_devname(device, &str) >= 0) {
|
||||||
assert_se(val = path_startswith(str, "/dev/"));
|
assert_se(val = path_startswith(str, "/dev/"));
|
||||||
printf("N: %s\n", val);
|
printf("N: %s\n", val);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_get_devlink_priority(device, &i) >= 0)
|
if (sd_device_get_diskseq(device, &q) >= 0)
|
||||||
printf("L: %i\n", i);
|
printf("Q: %" PRIu64 "\n", q);
|
||||||
|
|
||||||
FOREACH_DEVICE_DEVLINK(device, str) {
|
if (sd_device_get_driver(device, &str) >= 0)
|
||||||
assert_se(val = path_startswith(str, "/dev/"));
|
printf("V: %s\n", str);
|
||||||
printf("S: %s\n", val);
|
|
||||||
}
|
|
||||||
|
|
||||||
FOREACH_DEVICE_PROPERTY(device, str, val)
|
FOREACH_DEVICE_PROPERTY(device, str, val)
|
||||||
printf("E: %s=%s\n", str, val);
|
printf("E: %s=%s\n", str, val);
|
||||||
|
Reference in New Issue
Block a user