From nobody Fri Nov 20 14:21:22 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 4jWHZY6RL7z71rYm; Fri, 20 Nov 2026 14:21:25 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from omta004.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jWHZY0hFSz4b55; Fri, 20 Nov 2026 14:21:25 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=permerror reason="p tag has invalid value: quarantine rua=mailto:p[ostmaster@cschubert.com" header.from=cschubert.com (policy=permerror); spf=pass (mx1.freebsd.org: domain of cy.schubert@cschubert.com designates 3.97.99.33 as permitted sender) smtp.mailfrom=cy.schubert@cschubert.com Received: from shw-obgw-4003b.ext.cloudfilter.net ([10.228.9.157]) by cmsmtp with ESMTPS id UOOXxY3PESrfpUPUSxLir1; Fri, 20 Nov 2026 14:21:24 +0000 Received: from spqr.komquats.com ([70.66.136.217]) by cmsmtp with ESMTPSA id UPUQx8bEeETL2UPURxi47F; Fri, 20 Nov 2026 14:21:24 +0000 X-Auth-User: cschuber X-Authority-Analysis: v=2.4 cv=KLVXzVFo c=1 sm=1 tr=0 ts=6b005764 a=h7br+8Ma+Xn9xscxy5znUg==:117 a=h7br+8Ma+Xn9xscxy5znUg==:17 a=b8+xJRgcbepLoiPQPEzLjyvsYN4=:19 a=kj9zAlcOel0A:10 a=zJRp6_cAMcgA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=m5QXn6DzAAAA:8 a=VjhGrrbqhzJQqeekZOQA:9 a=lqcHg5cX4UMA:10 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 a=MVGw0nVQe49WX2woHWDl:22 Received: from slippy.cwsent.com (slippy.cwsent.com [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTP id 8D6C859D; Fri, 20 Nov 2026 07:21:22 -0700 (MST) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (Postfix) with ESMTP id 4E469406; Fri, 20 Nov 2026 07:21:22 -0700 (MST) Date: Fri, 20 Nov 2026 07:21:22 -0700 From: Cy Schubert To: Zhenlei Huang Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , Elliott Mitchell Subject: Re: git: bf362c1b41c8 - main - kobj: convert KOBJOPLOOKUP() to returning pointer to function Message-ID: <20261120072122.679034c4@slippy.cwsent.com> In-Reply-To: <2E303DF5-FFE0-4BEF-8915-DC26E1CF09DB@FreeBSD.org> References: <6b001ca8.17a65.140055b6@gitrepo.freebsd.org> <20261120133642.ED99E1D0@slippy.cwsent.com> <2E303DF5-FFE0-4BEF-8915-DC26E1CF09DB@FreeBSD.org> Organization: KOMQUATS X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; amd64-portbld-freebsd16.0) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfIVarnJp1WCJgnYgljB11tqRZjWNxWxYcuWt2QvbtNPDaG1VGt3n+3Xu0bSZBL7g1Sfe4WMzwz8hBzgFuwPdCnbEHwHMrwKt0NyO32FJr5n1rX298i3y r7QmbR1ewzhR3aY0tONUqXV24O1yMMuC2sOJeAR4QaLw6HK28s+LbYFsI9L6DfRcP+oh1sNQT+KMs5ahtikdcazmIsC86BZH0lyfaccE71gxBjCM/Y5rpNok 5oceUtPBHOsXQo3BNKrhId98BCpkt1NK2TDYWMJkYHymkakP2VDxgHBVhuGTTRnJrw5YOB8yOm3Yw2DVcQ/n3bxKRjjH7g73UmpO4nqaA7QNsOBevDOSFWFT gzUhH1o9 X-Rspamd-Queue-Id: 4jWHZY0hFSz4b55 X-Spamd-Bar: / X-Spamd-Result: default: False [-0.40 / 15.00]; R_SPF_ALLOW(-0.20)[+ip4:3.97.99.32/31]; RCVD_IN_DNSWL_LOW(-0.10)[3.97.99.33:from]; MIME_GOOD(-0.10)[text/plain]; TO_DN_EQ_ADDR_SOME(0.00)[]; HAS_ORG_HEADER(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; TAGGED_RCPT(0.00)[freebsd]; R_DKIM_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DMARC_BAD_POLICY(0.00)[cschubert.com : p tag has invalid value: quarantine rua=mailto:p[ostmaster@cschubert.com]; RCVD_TLS_LAST(0.00)[]; ALIAS_RESOLVED(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; RCPT_COUNT_FIVE(0.00)[5] On Fri, 20 Nov 2026 21:48:37 +0800 Zhenlei Huang wrote: > > On Nov 20, 2026, at 9:36 PM, Cy Schubert 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=bf362c1b41c803c7320147b89915bd65 > >> 88dd6071 > >> > >> commit bf362c1b41c803c7320147b89915bd6588dd6071 > >> Author: Elliott Mitchell > >> AuthorDate: 2025-01-10 00:45:05 +0000 > >> Commit: Zhenlei Huang > >> 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 = &OP##_##desc; \ > >> kobj_method_t **_cep = \ > >> - &OPS->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 ? This resolved it. Thanks. > > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > /opt/src/git-src/sys/sys/kobj.h:267:14: note: expanded from macro > > 'KOBJOPLOOKUP' > > 267 | &(OBJ)->ops->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\ > > | ~~~~~ ^ > > > > > >> kobj_method_t *_ce = *_cep; \ > >> if (_ce->desc != _desc) { \ > >> - _ce = kobj_lookup_method(OPS->cls, \ > >> + _ce = kobj_lookup_method((OBJ)->ops->cls, \ > >> _cep, _desc); \ > >> kobj_lookup_misses++; \ > >> } else \ > >> kobj_lookup_hits++; \ > >> - _m = _ce->func; \ > >> -} while (0) > >> + (OP##_t *)(_ce->func); \ > >> +}) > >> #else > >> -#define KOBJOPLOOKUP(OPS,OP) do { \ > >> +#define KOBJOPLOOKUP(OBJ, OP) __extension__ ({ \ > >> kobjop_desc_t _desc = &OP##_##desc; \ > >> kobj_method_t **_cep = \ > >> - &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \ > >> + &(OBJ)->ops->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\ > >> kobj_method_t *_ce = *_cep; \ > >> if (_ce->desc != _desc) \ > >> - _ce = kobj_lookup_method(OPS->cls, \ > >> + _ce = kobj_lookup_method((OBJ)->ops->cls, \ > >> _cep, _desc); \ > >> - _m = _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 != "void") > >> printh("\t" ret " rc;"); > >> if (!static) > >> firstvar = "((kobj_t)" firstvar ")"; > >> if (prolog != "") > >> printh(prolog); > >> - printh("\tKOBJOPLOOKUP(" firstvar "->ops, " mname ");"); > >> + printh("\t_m = KOBJOPLOOKUP(" firstvar ", " mname ");"); > >> rceq = (ret != "void") ? "rc = " : ""; > >> - printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");"); > >> + printh("\t" rceq "(*_m)(" varname_list ");"); > >> if (epilog != "") > >> printh(epilog); > >> if (ret != "void") > >> > > > > > > -- > > Cheers, > > Cy Schubert > > > FreeBSD UNIX: > Web: https://FreeBSD.org > > NTP: > Web: https://nwtime.org > > > > e**(i*pi)+1=0 > > > -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org e**(i*pi)+1=0