diff --git a/sys/geom/geom.h b/sys/geom/geom.h index b8e0c11b2e10..2c2b25faa909 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ -void g_trace(int level, const char *, ...); +void (g_trace)(int level, const char *, ...) __printflike(2, 3); # define G_T_TOPOLOGY 1 # define G_T_BIO 2 # define G_T_ACCESS 4 - +extern int g_debugflags; +#define g_trace(level, fmt, ...) do { \ + if (__predict_false(g_debugflags & (level))) \ + (g_trace)(level, fmt, ## __VA_ARGS__); \ +} while (0) /* geom_event.c */ typedef void g_event_t(void *, int flag); diff --git a/sys/geom/geom_dump.c b/sys/geom/geom_dump.c index 21a6e14b4960..dd23f97038ea 100644 --- a/sys/geom/geom_dump.c +++ b/sys/geom/geom_dump.c @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) } void -g_trace(int level, const char *fmt, ...) +(g_trace)(int level, const char *fmt, ...) { va_list ap;