Page MenuHomeFreeBSD

D32747.diff
No OneTemporary

D32747.diff

diff --git a/usr.sbin/devctl/devctl.8 b/usr.sbin/devctl/devctl.8
--- a/usr.sbin/devctl/devctl.8
+++ b/usr.sbin/devctl/devctl.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 1, 2021
+.Dd October 31, 2021
.Dt DEVCTL 8
.Os
.Sh NAME
@@ -74,6 +74,10 @@
.Cm reset
.Op Fl d
.Ar device
+.Nm
+.Cm getpath
+.Ar locator
+.Ar device
.Sh DESCRIPTION
The
.Nm
@@ -214,6 +218,24 @@
.Pp
If you have detached or suspended a child device explicitly and then
do a reset, the child device will end up attached.
+.It Xo Cm getpath
+.Ar locator
+.Ar device
+.Xc
+Prints the full path to the
+.Ar device
+using the
+.Ar locator
+method to get the path name.
+Currently, only the
+.Dq UEFI
+and
+.Dq FreeBSD
+locators are implemented.
+The UEFI locator constructs a path to the device using the rules
+outlines for DEVICE_PATH in the UEFI standard.
+The FreeBSD locator constructs a path back to the root of the tree
+with the nodes separated by slashes.
.El
.Sh SEE ALSO
.Xr devctl 3 ,
diff --git a/usr.sbin/devctl/devctl.c b/usr.sbin/devctl/devctl.c
--- a/usr.sbin/devctl/devctl.c
+++ b/usr.sbin/devctl/devctl.c
@@ -84,6 +84,7 @@
" devctl freeze\n"
" devctl thaw\n"
" devctl reset [-d] device\n"
+ " devctl getpath locator device\n"
);
exit(1);
}
@@ -420,6 +421,21 @@
}
DEVCTL_COMMAND(top, reset, reset);
+static int
+getpath(int ac, char **av)
+{
+ char *buffer = NULL;
+
+ if (ac != 3)
+ usage();
+ if (devctl_getpath(av[2], av[1], &buffer) < 0)
+ err(1, "Failed to get path via %s to %s", av[1], av[2]);
+ printf("%s\n", buffer);
+ free(buffer);
+ return (0);
+}
+DEVCTL_COMMAND(top, getpath, getpath);
+
int
main(int ac, char *av[])
{

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 21, 8:37 AM (15 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14757799
Default Alt Text
D32747.diff (1 KB)

Event Timeline