Re: git: bf362c1b41c8 - main - kobj: convert KOBJOPLOOKUP() to returning pointer to function
- Reply: Ed Maste : "Re: git: bf362c1b41c8 - main - kobj: convert KOBJOPLOOKUP() to returning pointer to function"
- Reply: Zhenlei Huang : "Re: git: bf362c1b41c8 - main - kobj: convert KOBJOPLOOKUP() to returning pointer to function"
- In reply to: John Baldwin : "Re: git: bf362c1b41c8 - main - kobj: convert KOBJOPLOOKUP() to returning pointer to function"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Nov 2026 15:32:29 UTC
On 20 Nov 2026, at 15:14, John Baldwin <jhb@freebsd.org> wrote:
> On 11/20/26 09:25, Jessica Clarke wrote:
>> On 20 Nov 2026, at 14:21, Cy Schubert <Cy.Schubert@cschubert.com> wrote:
>>> On Fri, 20 Nov 2026 21:48:37 +0800
>>> Zhenlei Huang <zlei@FreeBSD.org> wrote:
>>>
>>>>> On Nov 20, 2026, at 9:36 PM, Cy Schubert <Cy.Schubert@cschubert.com> wrote:
>>>>>
>>>>> In message <6b001ca8.17a65.140055b6@gitrepo.freebsd.org <mailto: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 <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 = &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.
>> Hi Zhenlei,
>> Please figure out an appropriate depend-cleanup.sh patch or revert this
>> ASAP. WITHOUT_CLEAN is a supported configuration, and even our default,
>> so we cannot break it.
>
> Probably all the foo_if.[ch] need to depend not just on foo_if.m, but also on
> sys/tools/makeobjops.awk
It seems we already do for the suffix transformation rules in kmod.mk,
but not for the MFILES rules in kern.post.mk, nor for the uses of
NORMAL_M in sys/conf/files*. SomeoneTM should test and commit such a
fix.
Jessica