Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern drvctl(4): If no ifattr is specified on rescan, res...
details: https://anonhg.NetBSD.org/src/rev/550ea8a967da
branches: trunk
changeset: 379716:550ea8a967da
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Jun 16 00:19:46 2021 +0000
description:
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.
diffstat:
sys/kern/kern_drvctl.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diffs (49 lines):
diff -r f89efccae135 -r 550ea8a967da sys/kern/kern_drvctl.c
--- a/sys/kern/kern_drvctl.c Tue Jun 15 23:39:43 2021 +0000
+++ b/sys/kern/kern_drvctl.c Wed Jun 16 00:19:46 2021 +0000
@@ -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;
}
Home |
Main Index |
Thread Index |
Old Index