[Ksummit-discuss] [CORE TOPIC] More useful types in the linux kernel

Matthew Wilcox willy6545 at gmail.com
Fri Aug 12 04:07:11 UTC 2016


On Aug 11, 2016 9:02 PM, "Josh Triplett" <josh at joshtriplett.org> wrote:
> On Thu, Aug 11, 2016 at 11:51:52PM -0400, Matthew Wilcox wrote:
> > Can we introduce types for this? We have a number of different return
type
> > conventions in the kernel:
> >
> > bool
> > errno_t (-4095 to 0 are valid)
> > count_t (-4095 to INT_MAX)
> > long_count_t (-4095 to LONG_MAX)
> > ulong_count_t (-4095 to -4096)
> > struct foo _err*
> >
> > I think this is good programmer documentation in addition to being
> > potentially useful to smatch.
>
> I'd love to see an explicit type distinct from "int" for "potentially an
> errno".  And if any code uses "potentially an errno *or* a non-errno
> non-zero return value", that should ideally use a distinct type as well.

I think the biggest problem is coming up with good names for the types. And
the churn of introducing them, particularly converting function pointers
and all occurrences.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/ksummit-discuss/attachments/20160812/f7de3d5f/attachment-0001.html>


More information about the Ksummit-discuss mailing list