Page MenuHomeFreeBSD

sys: make callout.h self-contained
ClosedPublic

Authored by kp on Dec 16 2021, 9:29 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 11:42 PM
Unknown Object (File)
Sun, Nov 24, 2:49 PM
Unknown Object (File)
Sat, Nov 23, 11:53 AM
Unknown Object (File)
Sat, Nov 23, 11:52 AM
Unknown Object (File)
Thu, Nov 21, 6:05 PM
Unknown Object (File)
Thu, Nov 21, 5:33 PM
Unknown Object (File)
Mon, Nov 11, 11:19 PM
Unknown Object (File)
Fri, Nov 8, 2:09 AM
Subscribers
None

Details

Summary

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kp requested review of this revision.Dec 16 2021, 9:29 AM
kp created this revision.

You'll need to remove these from badfiles.inc too...
also we don't test the _*.h files.

sys/sys/_callout.h
43

Does _types.h suffice?

In D33500#757091, @imp wrote:

You'll need to remove these from badfiles.inc too...

That's in D33506

also we don't test the _*.h files.

Not directly, but this breaks callout.h (and a few headers that include callout.h). It seems appropriate to add the include to the header that actually uses the type directly, rather than to say callout.h, which includes this header.

sys/sys/_callout.h
43

Unfortunately not. _callout.h uses sbintime_t, which is typedef'd in sys/types.h itself.

sys/sys/_callout.h
43

OK. I'll have to take a closer look at where this is used to see what to do here. Most of the _xxx.h are supposed to, in theory, avoid including the non _ version where both exist (eg here with types.h and _types.h). types.h may be a special case, though and I need to look at it more closely.

I'd be tempted to make all of sys/callout.h #ifdef _KERNEL rather than the subset it is today. It's a kernel only interface that none of the kernel memory groveling programs reference.
I'd be tempted to do similar to sys/taskqueue.h for the same reason.

However, having said all that, sys/callout.h is included in sys/proc.h to get struct callout which lives inside of struct thread, so we can't do the above at least for sys/callout.h. So it's more than just the #defines that need to be visible (though maybe they don't need to be).
Based on that, I'd be tempted to add a typedef int64_t sbintime_t; to _types.h, change the typedef in types.h to be typedef sbintime_t sbintime_t and then change _callout.h to use sbintime_t. It might also be possible to change sys/callout.h to sys/_callout.h in sys/proc.h, but that likely would have more ripple effect potential based on the current namespace pollution in the kernel so it may not be worth making that change.
I suspect that will have less fallout than this change with less namespace pollution which pops up in weird places...

So I'd prefer that things be fixed that way. I suspect we'll need __sbintime_t before this is all over more urgently than for this example and it would make this work with no additional namespace pollution (though one could legitimately have a debate over this specific case).

Include _types.h from _callout.h, introduce __sbintime_t to allow for this.

This revision is now accepted and ready to land.Dec 16 2021, 2:08 PM
This revision was automatically updated to reflect the committed changes.