Index: head/sys/powerpc/aim/moea64_if.m =================================================================== --- head/sys/powerpc/aim/moea64_if.m +++ head/sys/powerpc/aim/moea64_if.m @@ -43,6 +43,7 @@ */ INTERFACE moea64; +SINGLETON; CODE { static moea64_pte_replace_t moea64_pte_replace_default; Index: head/sys/powerpc/powerpc/mmu_if.m =================================================================== --- head/sys/powerpc/powerpc/mmu_if.m +++ head/sys/powerpc/powerpc/mmu_if.m @@ -46,6 +46,7 @@ */ INTERFACE mmu; +SINGLETON; # # Default implementations of some methods Index: head/sys/tools/makeobjops.awk =================================================================== --- head/sys/tools/makeobjops.awk +++ head/sys/tools/makeobjops.awk @@ -325,13 +325,18 @@ line_width, length(prototype))); } printh("{"); - printh("\tkobjop_t _m;"); + if (singleton) + printh("\tstatic kobjop_t _m;"); + else + printh("\tkobjop_t _m;"); if (ret != "void") printh("\t" ret " rc;"); if (!static) firstvar = "((kobj_t)" firstvar ")"; if (prolog != "") printh(prolog); + if (singleton) + printh("\tif (_m == NULL)"); printh("\tKOBJOPLOOKUP(" firstvar "->ops," mname ");"); rceq = (ret != "void") ? "rc = " : ""; printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");"); @@ -453,6 +458,7 @@ lastdoc = ""; prolog = ""; epilog = ""; + singleton = 0; while (!error && (getline < src) > 0) { lineno++; @@ -497,6 +503,8 @@ prolog = handle_code(); else if (/^EPILOG[ ]*{$/) epilog = handle_code(); + else if (/^SINGLETON/) + singleton = 1; else { debug($0); warnsrc("Invalid line encountered");