Page MenuHomeFreeBSD

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

Authored by dumbbell on Jun 14 2026, 9:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jul 12, 10:12 AM
Unknown Object (File)
Sat, Jul 4, 11:18 AM
Unknown Object (File)
Thu, Jul 2, 3:51 AM
Unknown Object (File)
Thu, Jul 2, 3:35 AM
Unknown Object (File)
Wed, Jul 1, 1:28 PM
Unknown Object (File)
Sun, Jun 28, 3:30 AM
Unknown Object (File)
Wed, Jun 24, 3:57 AM
Unknown Object (File)
Tue, Jun 23, 10:53 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