Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern when reporting events to devmon, pass location info...



details:   https://anonhg.NetBSD.org/src/rev/628af65c5d25
branches:  trunk
changeset: 745304:628af65c5d25
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Feb 27 20:16:38 2020 +0000

description:
when reporting events to devmon, pass location info along if we find it

diffstat:

 sys/kern/subr_autoconf.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r 02a66817c4b4 -r 628af65c5d25 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Thu Feb 27 18:19:16 2020 +0000
+++ b/sys/kern/subr_autoconf.c  Thu Feb 27 20:16:38 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.268 2020/02/25 19:34:37 jdolecek Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.269 2020/02/27 20:16:38 macallan Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.268 2020/02/25 19:34:37 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.269 2020/02/27 20:16:38 macallan Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -549,9 +549,10 @@
 static void
 devmon_report_device(device_t dev, bool isattach)
 {
-       prop_dictionary_t ev;
+       prop_dictionary_t ev, dict = device_properties(dev);
        const char *parent;
        const char *what;
+       const char *where;
        device_t pdev = device_parent(dev);
 
        /* If currently no drvctl device, just return */
@@ -564,6 +565,11 @@
 
        what = (isattach ? "device-attach" : "device-detach");
        parent = (pdev == NULL ? "root" : device_xname(pdev));
+       if (prop_dictionary_get_cstring_nocopy(dict, "location", &where)) {
+               prop_dictionary_set_cstring(ev, "location", where);
+               aprint_debug("ev: %s %s at %s in [%s]\n",
+                   what, device_xname(dev), parent, where); 
+       }
        if (!prop_dictionary_set_cstring(ev, "device", device_xname(dev)) ||
            !prop_dictionary_set_cstring(ev, "parent", parent)) {
                prop_object_release(ev);



Home | Main Index | Thread Index | Old Index