diff options
author | jhb <jhb@FreeBSD.org> | 2016-04-27 16:29:03 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2016-04-27 16:29:03 +0000 |
commit | e05c6840a1464552cb7462d76fbae2a9e3bc86d0 (patch) | |
tree | 57198594e0baf051edc63655c2d1254c1a033442 /lib/libdevctl | |
parent | fe28ec8024a7da09961b3b7d4dc1e205b1b35bb1 (diff) | |
download | FreeBSD-src-e05c6840a1464552cb7462d76fbae2a9e3bc86d0.zip FreeBSD-src-e05c6840a1464552cb7462d76fbae2a9e3bc86d0.tar.gz |
Add a new rescan method to the bus interface.
The BUS_RESCAN() method rescans a single bus device checking for devices
that have been added or removed from the bus. A new 'rescan' command is
added to devctl(8) to trigger a rescan.
Differential Revision: https://reviews.freebsd.org/D6016
Diffstat (limited to 'lib/libdevctl')
-rw-r--r-- | lib/libdevctl/devctl.3 | 22 | ||||
-rw-r--r-- | lib/libdevctl/devctl.c | 7 | ||||
-rw-r--r-- | lib/libdevctl/devctl.h | 1 |
3 files changed, 28 insertions, 2 deletions
diff --git a/lib/libdevctl/devctl.3 b/lib/libdevctl/devctl.3 index b2734cf..7d8ddba 100644 --- a/lib/libdevctl/devctl.3 +++ b/lib/libdevctl/devctl.3 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2016 +.Dd April 27, 2016 .Dt DEVCTL 3 .Os .Sh NAME @@ -34,6 +34,7 @@ .Nm devctl_detach , .Nm devctl_disable , .Nm devctl_enable , +.Nm devctl_rescan , .Nm devctl_resume , .Nm devctl_set_driver , .Nm devctl_suspend @@ -51,6 +52,8 @@ .Ft int .Fn devctl_enable "const char *device" .Ft int +.Fn devctl_rescan "const char *device" +.Ft int .Fn devctl_resume "const char *device" .Ft int .Fn devctl_set_driver "const char *device" "const char *driver" "bool force" @@ -149,9 +152,14 @@ If the device is already attached and is true, the device will be detached from its current device driver before it is attached to the new device driver. +.Pp +The +.Fn devctl_rescan +function rescans a bus device checking for devices that have been added or +removed. .Sh RETURN VALUES .Rv -std devctl_attach devctl_detach devctl_disable devctl_enable \ -devctl_suspend devctl_resume devctl_set_driver +devctl_suspend devctl_rescan devctl_resume devctl_set_driver .Sh ERRORS In addition to specific errors noted below, all of the @@ -280,6 +288,16 @@ The device is disabled. .It Bq Er ENXIO The new device driver failed to attach. .El +.Pp +The +.Fn devctl_rescan +function may fail if: +.Bl -tag -width Er +.It Bq Er ENXIO +The device is not attached to a driver. +.It Bq Er ENXIO +The bus driver does not support rescanning. +.El .Sh SEE ALSO .Xr devinfo 3 , .Xr devstat 3 , diff --git a/lib/libdevctl/devctl.c b/lib/libdevctl/devctl.c index 7be431e..33c891b 100644 --- a/lib/libdevctl/devctl.c +++ b/lib/libdevctl/devctl.c @@ -122,3 +122,10 @@ devctl_set_driver(const char *device, const char *driver, bool force) req.dr_flags |= DEVF_SET_DRIVER_DETACH; return (devctl_request(DEV_SET_DRIVER, &req)); } + +int +devctl_rescan(const char *device) +{ + + return (devctl_simple_request(DEV_RESCAN, device, 0)); +} diff --git a/lib/libdevctl/devctl.h b/lib/libdevctl/devctl.h index f773b11..40c64c1 100644 --- a/lib/libdevctl/devctl.h +++ b/lib/libdevctl/devctl.h @@ -38,5 +38,6 @@ int devctl_disable(const char *device, bool force_detach); int devctl_suspend(const char *device); int devctl_resume(const char *device); int devctl_set_driver(const char *device, const char *driver, bool force); +int devctl_rescan(const char *device); #endif /* !__DEVCTL_H__ */ |