[bhnd] Fix DEFINE_CLASS_(2|3) multiple inheritance support.

This diff updates DEFINE_CLASS_2/_3 to support the specification of class
name separately from the class variable name, bringing them into sync
with their API documentation, as well as the behavior of DEFINE_CLASS_0/_1.

Nothing in the tree currently uses the _2/_3 variants, and I can't
find any references to the API outside of commits to the kobj.h
header itself; given the limitation that currently exists, I'd
be surprised if they've ever been used.

Submitted by:	Landon Fuller <landonf@landonf.org>
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D6491
This commit is contained in:
adrian 2016-05-23 03:29:43 +00:00
parent d142cf7cea
commit c7d4687e20

View File

@ -146,13 +146,13 @@ struct kobj_class classvar = { \
* DEFINE_CLASS_2(foo, foo_class, foo_methods, sizeof(foo_softc),
* bar, baz);
*/
#define DEFINE_CLASS_2(name, methods, size, \
#define DEFINE_CLASS_2(name, classvar, methods, size, \
base1, base2) \
\
static kobj_class_t name ## _baseclasses[] = \
{ &base1, \
&base2, NULL }; \
struct kobj_class name ## _class = { \
struct kobj_class classvar = { \
#name, methods, size, name ## _baseclasses \
}
@ -162,14 +162,14 @@ struct kobj_class name ## _class = { \
* DEFINE_CLASS_3(foo, foo_class, foo_methods, sizeof(foo_softc),
* bar, baz, foobar);
*/
#define DEFINE_CLASS_3(name, methods, size, \
#define DEFINE_CLASS_3(name, classvar, methods, size, \
base1, base2, base3) \
\
static kobj_class_t name ## _baseclasses[] = \
{ &base1, \
&base2, \
&base3, NULL }; \
struct kobj_class name ## _class = { \
struct kobj_class classvar = { \
#name, methods, size, name ## _baseclasses \
}