diff options
author | John Baldwin <jhb@FreeBSD.org> | 2016-04-27 16:29:03 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2016-04-27 16:29:03 +0000 |
commit | a907c6914c5879870b2597a63253cea0a5b7bdb8 (patch) | |
tree | 57198594e0baf051edc63655c2d1254c1a033442 /sys/kern/subr_bus.c | |
parent | 167e63e3948c9ee374152b5ce2a270e805d22801 (diff) | |
download | src-a907c6914c5879870b2597a63253cea0a5b7bdb8.tar.gz src-a907c6914c5879870b2597a63253cea0a5b7bdb8.zip |
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
Notes
Notes:
svn path=/head/; revision=298707
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r-- | sys/kern/subr_bus.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 81be36894079..d9c2ac1b6e24 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -5203,6 +5203,7 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, case DEV_SUSPEND: case DEV_RESUME: case DEV_SET_DRIVER: + case DEV_RESCAN: error = priv_check(td, PRIV_DRIVER); if (error == 0) error = find_device(req, &dev); @@ -5366,6 +5367,13 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, error = device_probe_and_attach(dev); break; } + case DEV_RESCAN: + if (!device_is_attached(dev)) { + error = ENXIO; + break; + } + error = BUS_RESCAN(dev); + break; } mtx_unlock(&Giant); return (error); |