git: b8529e7c5e5b - main - devinfo: Distinguish resources owned by unnamed devices from free resources
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Jan 2025 15:04:45 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=b8529e7c5e5b298ed2d06a60407653fce0759363
commit b8529e7c5e5b298ed2d06a60407653fce0759363
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-01-29 15:04:21 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-01-29 15:04:21 +0000
devinfo: Distinguish resources owned by unnamed devices from free resources
For resources owned by an unnamed device, list the device name as
"(unknown)" instead of using "----". In addition, if the -v flag is
given, output the pnpinfo and location info for the device if present.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D48676
---
usr.sbin/devinfo/devinfo.8 | 2 +-
usr.sbin/devinfo/devinfo.c | 14 +++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/usr.sbin/devinfo/devinfo.8 b/usr.sbin/devinfo/devinfo.8
index f2b9a5d5cbaf..714b2df81935 100644
--- a/usr.sbin/devinfo/devinfo.8
+++ b/usr.sbin/devinfo/devinfo.8
@@ -35,7 +35,7 @@
.Nm
.Op Fl rv
.Nm
-.Fl u
+.Fl u Op Fl v
.Nm
.Fl p Ar dev Op Fl v
.Sh DESCRIPTION
diff --git a/usr.sbin/devinfo/devinfo.c b/usr.sbin/devinfo/devinfo.c
index 25d5a3a36db2..e8dd74b71144 100644
--- a/usr.sbin/devinfo/devinfo.c
+++ b/usr.sbin/devinfo/devinfo.c
@@ -185,8 +185,16 @@ print_rman_resource(struct devinfo_res *res, void *arg __unused)
printf(" ");
print_resource(res);
dev = devinfo_handle_to_device(res->dr_device);
- if ((dev != NULL) && (dev->dd_name[0] != 0)) {
- printf(" (%s)", dev->dd_name);
+ if (dev != NULL) {
+ if (dev->dd_name[0] != 0) {
+ printf(" (%s)", dev->dd_name);
+ } else {
+ printf(" (unknown)");
+ if (vflag && *dev->dd_pnpinfo)
+ printf(" pnpinfo %s", dev->dd_pnpinfo);
+ if (vflag && *dev->dd_location)
+ printf(" at %s", dev->dd_location);
+ }
} else {
printf(" ----");
}
@@ -233,7 +241,7 @@ usage(void)
{
fprintf(stderr, "%s\n%s\n%s\n",
"usage: devinfo [-rv]",
- " devinfo -u",
+ " devinfo -u [-v]",
" devinfo -p dev [-v]");
exit(1);
}