svn commit: r362343 - in head/sys: kern sys
Pawel Biernacki
kaktus at FreeBSD.org
Thu Jun 18 21:42:55 UTC 2020
Author: kaktus
Date: Thu Jun 18 21:42:54 2020
New Revision: 362343
URL: https://svnweb.freebsd.org/changeset/base/362343
Log:
hw.bus.info: rework handler
hw.bus.info was added in r68522 as a node, but there was never anything
connected "behind" it. Its only purpose is to return a struct u_businfo.
The only in-base consumer are devinfo(3)/devinfo(8).
Rewrite the handler as SYSCTL_PROC and mark it as MPSAFE and read-only
as there never was a writable path.
Reviewed by: kib
Approved by: kib (mentor)
Sponsored by: Mysterious Code Ltd.
Differential Revision: https://reviews.freebsd.org/D25321
Modified:
head/sys/kern/subr_bus.c
head/sys/sys/sysctl.h
Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c Thu Jun 18 20:49:56 2020 (r362342)
+++ head/sys/kern/subr_bus.c Thu Jun 18 21:42:54 2020 (r362343)
@@ -5454,7 +5454,7 @@ print_devclass_list(void)
*/
static int
-sysctl_bus(SYSCTL_HANDLER_ARGS)
+sysctl_bus_info(SYSCTL_HANDLER_ARGS)
{
struct u_businfo ubus;
@@ -5463,7 +5463,8 @@ sysctl_bus(SYSCTL_HANDLER_ARGS)
return (SYSCTL_OUT(req, &ubus, sizeof(ubus)));
}
-SYSCTL_NODE(_hw_bus, OID_AUTO, info, CTLFLAG_RW | CTLFLAG_NEEDGIANT, sysctl_bus,
+SYSCTL_PROC(_hw_bus, OID_AUTO, info, CTLTYPE_STRUCT | CTLFLAG_RD |
+ CTLFLAG_MPSAFE, NULL, 0, sysctl_bus_info, "S,u_businfo",
"bus-related data");
static int
@@ -5555,7 +5556,8 @@ bus_data_generation_check(int generation)
void
bus_data_generation_update(void)
{
- bus_data_generation++;
+
+ atomic_add_int(&bus_data_generation, 1);
}
int
Modified: head/sys/sys/sysctl.h
==============================================================================
--- head/sys/sys/sysctl.h Thu Jun 18 20:49:56 2020 (r362342)
+++ head/sys/sys/sysctl.h Thu Jun 18 21:42:54 2020 (r362343)
@@ -1122,7 +1122,6 @@ SYSCTL_DECL(_dev);
SYSCTL_DECL(_hw);
SYSCTL_DECL(_hw_bus);
SYSCTL_DECL(_hw_bus_devices);
-SYSCTL_DECL(_hw_bus_info);
SYSCTL_DECL(_machdep);
SYSCTL_DECL(_machdep_mitigations);
SYSCTL_DECL(_user);
More information about the svn-src-all
mailing list