Page MenuHomeFreeBSD

linuxkpi: Define `DEFINE_CLASS()` and `CLASS()`
Needs ReviewPublic

Authored by dumbbell on Jun 14 2026, 9:22 AM.
Referenced Files
F168095389: D57583.diff
Wed, Aug 26, 8:59 AM
Unknown Object (File)
Mon, Aug 24, 9:09 AM
Unknown Object (File)
Sat, Aug 22, 9:15 AM
Unknown Object (File)
Thu, Aug 20, 6:14 AM
Unknown Object (File)
Mon, Aug 17, 9:05 PM
Unknown Object (File)
Thu, Aug 13, 12:26 AM
Unknown Object (File)
Wed, Aug 12, 1:21 AM
Unknown Object (File)
Tue, Aug 11, 8:55 AM
Subscribers

Details

Reviewers
None
Group Reviewers
linuxkpi
Summary

DEFINE_CLASS() is in fact named LINUXKPI_DEFINE_CLASS() because it conflicts with DEFINE_CLASS() defined in <sys/kobj.h>.

This macro defines a type and a pair of constructor/destructor functions.

They are to be used by CLASS(): this one declares a variable, initialise it with the constructor and set the __cleanup() attribute to call the destructor once the variable goes out of scope.

The DRM drivers generic code started to use CLASS() in Linux 6.13. It requires the fd class to be defined in <linux/file.h>.

This is part of the update of DRM drivers to Linux 6.13.

Sponsored by: The FreeBSD Foundation

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped