From nobody Fri Nov 20 13:48:37 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jWGry1T2Yz71mJh; Fri, 20 Nov 2026 13:48:50 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jWGry18JTz4SK4; Fri, 20 Nov 2026 13:48:50 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795182530; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7Bp4PNR2wuLlzoFL95xlWeABjuMIg3EYaK/omDV/a1I=; b=DyTNxjoRA+9X+3JetPmo6UFMHSDH0qUWXfkhMChJUOByrMWdygeKgaPqAUbBkTQ7Hjj3IZ EVqpOVm/TRd3WI8X6BzUNJ4H7oc6GIK+qC+zo3EUqQzB0KOCwF8qxSWHS48Sw6yjpFHE6P iw1YOuPMnS+1qlWWRfYZ8/hj89oF44/fZuHADmeKPxA5uWEvnYwcSNyr7pWGU/ihio8xzX Sb5a7e+C3quAvtgFwPuB9nZEW6RPUFusyu0veeMD0E2uBsGtupNL4g/O4ACTgoOdu19Uvn at/uxeBuHh24sck3UA0Iuj4iaJsJEgnKLUYVHfPynCD+I3Htr60Tiv4bf1sWiw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795182530; b=XbPx/EkelWcVVpPr5fKsymFa0gWNOf3OpWfKDcuqwPrm9y2IfgnW6LlheDyGqKR9DbnbeI tTCcCxcHTrPlM4/lTixTgWVdxS4xpNtbOd006OPWuloC//NbLJ7m45xZVWja8y3ToLgbIp BACUNWFWSOJCAAfra8UuXDy2ULpd9e6nPMC8+ohYfs4O/UkioS0+p9W+WolZUjyaiPuaSD /rezMB2KeTIn2Ku/O1tKAurI+50wihyEJ33ja07IKQ5rxkR53BcgEDwZKu/34l7fzTUPSx dbFjsP0YRxjwnlbVvIC1b6O+29jgzQfsIsgwm5qrjz5PBuSlbwV3BuVA7HCYsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795182530; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7Bp4PNR2wuLlzoFL95xlWeABjuMIg3EYaK/omDV/a1I=; b=KRrI95Gq7f3NRRmHO6JWp6pryfyvuh86nps71dUSeoZBKymoyZJkaIEdgDQjHIZL7s//Rt 315tkAQlAYVS6ilUCu5VUuwhNjwGYWqvRNKeUsuBivQL2X3i0j65v/ciizbsJkGApzllt1 vitQnJvxOy6EPWr5oFiMdOlvl6wTx6TBeWAcgmdqViXZNydCU5nkPQnay4GHCdToK0NI1S 0udcF5jnCMyAkI6Ncm8js1z2L0dzF9syRQPKL30LhGjxNTwlrzHou3RnOG26MnSZpwBsb+ J4SRhSXDxZwUgNkhY0jCAXamaC6fRjNpp017DlVXU4bxwOWyjT5wvebMaiI39A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from smtpclient.apple (ns1.oxydns.net [45.32.91.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4jWGrr5nbJz128b; Fri, 20 Nov 2026 13:48:44 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: <2E303DF5-FFE0-4BEF-8915-DC26E1CF09DB@FreeBSD.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_E0D08900-E0D2-41FD-A4FA-F969C6D4BA03" List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: git: bf362c1b41c8 - main - kobj: convert KOBJOPLOOKUP() to returning pointer to function Date: Fri, 20 Nov 2026 21:48:37 +0800 In-Reply-To: <20261120133642.ED99E1D0@slippy.cwsent.com> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , Elliott Mitchell To: Cy Schubert References: <6b001ca8.17a65.140055b6@gitrepo.freebsd.org> <20261120133642.ED99E1D0@slippy.cwsent.com> X-Mailer: Apple Mail (2.3696.120.41.1.10) --Apple-Mail=_E0D08900-E0D2-41FD-A4FA-F969C6D4BA03 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Nov 20, 2026, at 9:36 PM, Cy Schubert = wrote: >=20 > In message <6b001ca8.17a65.140055b6@gitrepo.freebsd.org = >, Zhenlei Huang=20 > writes: >> The branch main has been updated by zlei: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dbf362c1b41c803c7320147b89915bd65= >> 88dd6071 >>=20 >> commit bf362c1b41c803c7320147b89915bd6588dd6071 >> Author: Elliott Mitchell >> AuthorDate: 2025-01-10 00:45:05 +0000 >> Commit: Zhenlei Huang >> CommitDate: 2026-11-20 10:09:02 +0000 >>=20 >> kobj: convert KOBJOPLOOKUP() to returning pointer to function >>=20 >> This makes KOBJOPLOOKUP() rather more suitable for purposes = outside the >> macros generated by makeobjops.awk. Of note other callers can = lookup >> the function on their parent class and call that explicitly. >>=20 >> Reviewed by: zlei >> MFC after: 2 weeks >> Differential Revision: https://reviews.freebsd.org/D48408 >> --- >> sys/sys/kobj.h | 20 ++++++++++---------- >> sys/tools/makeobjops.awk | 6 +++--- >> 2 files changed, 13 insertions(+), 13 deletions(-) >>=20 >> diff --git a/sys/sys/kobj.h b/sys/sys/kobj.h >> index 890ad1d39a13..3cdbf14d124c 100644 >> --- a/sys/sys/kobj.h >> +++ b/sys/sys/kobj.h >> @@ -247,30 +247,30 @@ extern u_int kobj_lookup_misses; >> * slow way. >> */ >> #ifdef KOBJ_STATS >> -#define KOBJOPLOOKUP(OPS,OP) do { \ >> +#define KOBJOPLOOKUP(OBJ, OP) __extension__ ({ = \ >> kobjop_desc_t _desc =3D &OP##_##desc; \ >> kobj_method_t **_cep =3D = \ >> - &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \ >> + &(OBJ)->ops->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\ >=20 > This has caused a number of errors as below as an example. >=20 > --- aq_media.o --- > In file included from /opt/src/git-src/sys/dev/aq/aq_media.c:43: > In file included from /opt/src/git-src/sys/net/iflib.h:31: > In file included from /opt/src/git-src/sys/sys/bus.h:893: > ./device_if.h:115:2: error: no member named 'ops' in 'struct kobj_ops' > 115 | KOBJOPLOOKUP(((kobj_t)dev)->ops, device_probe); It appears that the generated file `device_if.h` is not re-generated = after `sys/tools/makeobjops.awk`=20 been updated. Can you please try this first, ``` make cleankernel ```=20 and then rebuild ? > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /opt/src/git-src/sys/sys/kobj.h:267:14: note: expanded from macro=20 > 'KOBJOPLOOKUP' > 267 | &(OBJ)->ops->cache[_desc->id & = (KOBJ_CACHE_SIZE-1)];\ > | ~~~~~ ^ >=20 >=20 >> kobj_method_t *_ce =3D *_cep; \ >> if (_ce->desc !=3D _desc) { \ >> - _ce =3D kobj_lookup_method(OPS->cls, \ >> + _ce =3D kobj_lookup_method((OBJ)->ops->cls, \ >> _cep, _desc); \ >> kobj_lookup_misses++; \ >> } else \ >> kobj_lookup_hits++; \ >> - _m =3D _ce->func; = \ >> -} while (0) >> + (OP##_t *)(_ce->func); \ >> +}) >> #else >> -#define KOBJOPLOOKUP(OPS,OP) do { \ >> +#define KOBJOPLOOKUP(OBJ, OP) __extension__ ({ = \ >> kobjop_desc_t _desc =3D &OP##_##desc; \ >> kobj_method_t **_cep =3D = \ >> - &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \ >> + &(OBJ)->ops->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\ >> kobj_method_t *_ce =3D *_cep; \ >> if (_ce->desc !=3D _desc) = \ >> - _ce =3D kobj_lookup_method(OPS->cls, \ >> + _ce =3D kobj_lookup_method((OBJ)->ops->cls, \ >> _cep, _desc); \ >> - _m =3D _ce->func; = \ >> -} while (0) >> + (OP##_t *)(_ce->func); \ >> +}) >> #endif >>=20 >> kobj_method_t* kobj_lookup_method(kobj_class_t cls, >> diff --git a/sys/tools/makeobjops.awk b/sys/tools/makeobjops.awk >> index 522fb04ec4d1..f36a9166efbd 100644 >> --- a/sys/tools/makeobjops.awk >> +++ b/sys/tools/makeobjops.awk >> @@ -320,16 +320,16 @@ function handle_method (static, doc) >> line_width, length(prototype))); >> } >> printh("{"); >> - printh("\tkobjop_t _m;"); >> + printh("\t" mname "_t *_m;"); >> if (ret !=3D "void") >> printh("\t" ret " rc;"); >> if (!static) >> firstvar =3D "((kobj_t)" firstvar ")"; >> if (prolog !=3D "") >> printh(prolog); >> - printh("\tKOBJOPLOOKUP(" firstvar "->ops, " mname ");"); >> + printh("\t_m =3D KOBJOPLOOKUP(" firstvar ", " mname ");"); >> rceq =3D (ret !=3D "void") ? "rc =3D " : ""; >> - printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");"); >> + printh("\t" rceq "(*_m)(" varname_list ");"); >> if (epilog !=3D "") >> printh(epilog); >> if (ret !=3D "void") >>=20 >=20 >=20 > --=20 > Cheers, > Cy Schubert > > FreeBSD UNIX: > Web: = https://FreeBSD.org > NTP: > Web: = https://nwtime.org >=20 > e**(i*pi)+1=3D0 --Apple-Mail=_E0D08900-E0D2-41FD-A4FA-F969C6D4BA03 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Nov 20, 2026, at 9:36 PM, Cy Schubert <Cy.Schubert@cschubert.com> wrote:

In message <6b001ca8.17a65.140055b6@gitrepo.freebsd.org>, Zhenlei = Huang 
writes:
The branch main has been updated by = zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=3Dbf362c1b41c803c732014= 7b89915bd65
88dd6071

commit= bf362c1b41c803c7320147b89915bd6588dd6071
Author: =     Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: = 2025-01-10 00:45:05 +0000
Commit: =     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2026-11-20 10:09:02 +0000

   kobj: convert KOBJOPLOOKUP() to returning = pointer to function

   This = makes KOBJOPLOOKUP() rather more suitable for purposes outside the
   macros generated by makeobjops.awk. Of note = other callers can lookup
   the function on = their parent class and call that explicitly.

   Reviewed by:    zlei
   MFC after:      2 = weeks
   Differential Revision:  https://reviews.freebsd.org/D48408
---
sys/sys/kobj.h =           | 20 = ++++++++++----------
sys/tools/makeobjops.awk |  6 = +++---
2 files changed, 13 insertions(+), 13 = deletions(-)

diff --git a/sys/sys/kobj.h = b/sys/sys/kobj.h
index 890ad1d39a13..3cdbf14d124c = 100644
--- a/sys/sys/kobj.h
+++ = b/sys/sys/kobj.h
@@ -247,30 +247,30 @@ extern u_int = kobj_lookup_misses;
 * slow way.
 */
#ifdef KOBJ_STATS
-#define= KOBJOPLOOKUP(OPS,OP) do { \
+#define = KOBJOPLOOKUP(OBJ, OP) __extension__ ({ \
= kobjop_desc_t _desc =3D &OP##_##desc; \
= kobj_method_t **_cep =3D \
-     &OPS-&g= t;cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \
+ =     &(OBJ)-= >ops->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\

This has caused a number of errors as below as an = example.

--- = aq_media.o ---
In file included from = /opt/src/git-src/sys/dev/aq/aq_media.c:43:
In file included from = /opt/src/git-src/sys/net/iflib.h:31:
In file included from = /opt/src/git-src/sys/sys/bus.h:893:
./device_if.h:115:2: error: no member named 'ops' in 'struct = kobj_ops'
 115 | =         KOBJOPLOOKUP(((kobj_t)dev)= ->ops, device_probe);

It appears that the generated file `device_if.h` = is not re-generated after = `sys/tools/makeobjops.awk` 
been updated.

Can you please try this first,

```
make = cleankernel
``` 

and = then rebuild ?

     | =         ^~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~~~~~~~~~~
/opt/src/git-src/sys/sys/kobj.h:267:14: note: expanded from = macro 
'KOBJOPLOOKUP'
 267 | =             &a= mp;(OBJ)->ops->cache[_desc->id & = (KOBJ_CACHE_SIZE-1)];\
     | =             &n= bsp;~~~~~  ^


kobj_method_t *_ce =3D = *_cep; = = = = \
if (_ce->desc !=3D _desc) = { = = = = \
- _ce =3D = kobj_lookup_method(OPS->cls, \
+ _ce =3D = kobj_lookup_method((OBJ)->ops->cls, \
 _cep, _desc); \
= = kobj_lookup_misses++; \
} = else = = = = = = = \
kobj_lookup_hits++; \
- = _m =3D _ce->func; \
-} while (0)
+ = (OP##_t *)(_ce->func); \
+})
#else
-#define KOBJOPLOOKUP(OPS,OP) do { \
+#define KOBJOPLOOKUP(OBJ, OP) __extension__ ({ \
= kobjop_desc_t _desc =3D &OP##_##desc; \
= kobj_method_t **_cep =3D \
-     &OPS-&g= t;cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \
+ =     &(OBJ)-= >ops->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\
= kobj_method_t *_ce =3D *_cep; \
if = (_ce->desc !=3D _desc) \
- _ce =3D = kobj_lookup_method(OPS->cls, \
+ _ce =3D = kobj_lookup_method((OBJ)->ops->cls, \
 _cep, _desc); \
- = _m =3D _ce->func; \
-} while (0)
+ = (OP##_t *)(_ce->func); \
+})
#endif

kobj_method_t* = kobj_lookup_method(kobj_class_t cls,
diff --git = a/sys/tools/makeobjops.awk b/sys/tools/makeobjops.awk
index = 522fb04ec4d1..f36a9166efbd 100644
--- = a/sys/tools/makeobjops.awk
+++ = b/sys/tools/makeobjops.awk
@@ -320,16 +320,16 @@ function = handle_method (static, doc)
    line_width,= length(prototype)));
}
= printh("{");
- printh("\tkobjop_t _m;");
+ = printh("\t" mname "_t *_m;");
if (ret = !=3D "void")
printh("\t" ret " rc;");
= if (!static)
firstvar =3D "((kobj_t)" firstvar = ")";
if (prolog !=3D "")
= printh(prolog);
- printh("\tKOBJOPLOOKUP(" firstvar = "->ops, " mname ");");
+ printh("\t_m =3D KOBJOPLOOKUP(" = firstvar ", " mname ");");
rceq =3D (ret !=3D "void") ? "rc = =3D " : "";
- printh("\t" rceq "((" mname "_t = *) _m)(" varname_list ");");
+ printh("\t" rceq "(*_m)(" = varname_list ");");
if (epilog !=3D "")
= = printh(epilog);
if (ret !=3D "void")



-- Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org> =   Web:  https://FreeBSD.org
NTP: =           <cy@nwtime.org> =    Web:  https://nwtime.org

= e**(i*pi)+1=3D0



= --Apple-Mail=_E0D08900-E0D2-41FD-A4FA-F969C6D4BA03--