Module Name: src
Committed By: riastradh
Date: Wed Jun 16 00:19:46 UTC 2021
Modified Files:
src/sys/kern: kern_drvctl.c
Log Message:
drvctl(4): If no ifattr is specified on rescan, rescan all of them.
No longer must you remember the magic `-a ata_hl' incantation when
you deign to `drvctl -r atabusN'. It didn't actually do anything
anyway: atabus_rescan always rescans all ifattrs; same with
uhub_rescan and many others.
To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/kern/kern_drvctl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_drvctl.c
diff -u src/sys/kern/kern_drvctl.c:1.48 src/sys/kern/kern_drvctl.c:1.49
--- src/sys/kern/kern_drvctl.c:1.48 Sat Jun 12 12:14:03 2021
+++ src/sys/kern/kern_drvctl.c Wed Jun 16 00:19:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_drvctl.c,v 1.48 2021/06/12 12:14:03 riastradh Exp $ */
+/* $NetBSD: kern_drvctl.c,v 1.49 2021/06/16 00:19:46 riastradh Exp $ */
/*
* Copyright (c) 2004
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.48 2021/06/12 12:14:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_drvctl.c,v 1.49 2021/06/16 00:19:46 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -318,11 +318,15 @@ rescanbus(const char *busname, const cha
!d->dv_cfdriver->cd_attrs)
return ENODEV;
- /* allow to omit attribute if there is exactly one */
+ /* rescan all ifattrs if none is specified */
if (!ifattr) {
- if (d->dv_cfdriver->cd_attrs[1])
- return EINVAL;
- ifattr = d->dv_cfdriver->cd_attrs[0]->ci_name;
+ rc = 0;
+ for (ap = d->dv_cfdriver->cd_attrs; *ap; ap++) {
+ rc = (*d->dv_cfattach->ca_rescan)(d, (*ap)->ci_name,
+ locs);
+ if (rc)
+ break;
+ }
} else {
/* check for valid attribute passed */
for (ap = d->dv_cfdriver->cd_attrs; *ap; ap++)
@@ -330,9 +334,9 @@ rescanbus(const char *busname, const cha
break;
if (!*ap)
return EINVAL;
+ rc = (*d->dv_cfattach->ca_rescan)(d, ifattr, locs);
}
- rc = (*d->dv_cfattach->ca_rescan)(d, ifattr, locs);
config_deferred(NULL);
return rc;
}