From 6dcd2b484dd859bb1d6ba0fa24ca88d84d47026c Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Mon, 23 May 2016 03:29:43 +0000 Subject: [PATCH] [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 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D6491 --- sys/sys/kobj.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/sys/kobj.h b/sys/sys/kobj.h index 0cb25fbc95a..36d8d2a76a8 100644 --- a/sys/sys/kobj.h +++ b/sys/sys/kobj.h @@ -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 \ }