From 3d017846c9b9a3681c2b59f1d5e29e7a9fb720bd Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 9 Nov 2011 11:00:29 +0000 Subject: Simplify the code emitted by makeobjops.awk slightly. Just place the default kobj_method inside the kobjop_desc structure. There's no need to give these kobj_methods their own symbol. This shaves off 10 KB of a GENERIC kernel binary. --- sys/kern/subr_kobj.c | 2 +- sys/sys/kobj.h | 2 +- sys/tools/makeobjops.awk | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/kern/subr_kobj.c b/sys/kern/subr_kobj.c index 23ad29f..821a712 100644 --- a/sys/kern/subr_kobj.c +++ b/sys/kern/subr_kobj.c @@ -251,7 +251,7 @@ kobj_lookup_method(kobj_class_t cls, ce = kobj_lookup_method_mi(cls, desc); if (!ce) - ce = desc->deflt; + ce = &desc->deflt; *cep = ce; return ce; } diff --git a/sys/sys/kobj.h b/sys/sys/kobj.h index 31d308a..dec90d0 100644 --- a/sys/sys/kobj.h +++ b/sys/sys/kobj.h @@ -86,7 +86,7 @@ struct kobj_ops { struct kobjop_desc { unsigned int id; /* unique ID */ - kobj_method_t *deflt; /* default implementation */ + kobj_method_t deflt; /* default implementation */ }; /* diff --git a/sys/tools/makeobjops.awk b/sys/tools/makeobjops.awk index 4e3bd04..34f2b09 100644 --- a/sys/tools/makeobjops.awk +++ b/sys/tools/makeobjops.awk @@ -306,13 +306,8 @@ function handle_method (static, doc) printh(format_line(prototype argument_list ");", line_width, length(prototype))); - # Print out the method desc - printc("static const struct kobj_method " mname "_method_default = {"); - printc("\t&" mname "_desc, (kobjop_t) " default_function); - printc("};\n"); - printc("struct kobjop_desc " mname "_desc = {"); - printc("\t0, &" mname "_method_default"); + printc("\t0, { &" mname "_desc, (kobjop_t)" default_function " }"); printc("};\n"); # Print out the method itself -- cgit v1.1