diff --git a/sys/kern/device_if.m b/sys/kern/device_if.m --- a/sys/kern/device_if.m +++ b/sys/kern/device_if.m @@ -69,7 +69,7 @@ static void * null_register(device_t dev) { - return NULL; + return NULL; } }; diff --git a/sys/tools/makeobjops.awk b/sys/tools/makeobjops.awk --- a/sys/tools/makeobjops.awk +++ b/sys/tools/makeobjops.awk @@ -45,6 +45,7 @@ print " -p use the path component in the source file for destination dir"; print " -l set line width for output files [80]"; print " -d switch on debugging"; + print " -s generate default function with correct signature when DEFAULT is missed"; exit 1; } @@ -291,9 +292,17 @@ firstvar = varnames[1]; - if (default_function == "") + if (default_function == "") { default_function = "kobj_error_method"; + if (opt_s) { + default_function=mname "_error_method"; + # Generate correct default function for KCFI use + # kobj_error_method return ENXIO + printc("static " ret " " default_function "(" argument_list ")\n{\n " "return (" ret ") ENXIO;\n}\n"); + } + } + # the method description printh("/** @brief Unique descriptor for the " umname "() method */"); printh("extern struct kobjop_desc " mname "_desc;"); @@ -364,6 +373,7 @@ else if (o == "h") opt_h = 1; else if (o == "p") opt_p = 1; else if (o == "d") opt_d = 1; + else if (o == "s") opt_s = 1; else if (o == "l") { if (length(ARGV[i]) > j) { opt_l = substr(ARGV[i], j + 1);