Index: head/sys/conf/NOTES =================================================================== --- head/sys/conf/NOTES (revision 221756) +++ head/sys/conf/NOTES (working copy) @@ -173,6 +173,9 @@ options GEOM_VIRSTOR # Virtual storage. options GEOM_VOL # Volume names from UFS superblock options GEOM_ZERO # Performance testing helper. +# GEOM_NODEBUG disables most of GEOM debug messages +#options GEOM_NODEBUG + # # The root device and filesystem type can be compiled in; # this provides a fallback option if the root device cannot Index: head/sys/conf/options =================================================================== --- head/sys/conf/options (revision 221756) +++ head/sys/conf/options (working copy) @@ -92,6 +92,7 @@ GEOM_LINUX_LVM opt_geom.h GEOM_MBR opt_geom.h GEOM_MIRROR opt_geom.h GEOM_MULTIPATH opt_geom.h +GEOM_NODEBUG opt_geom.h GEOM_NOP opt_geom.h GEOM_PART_APM opt_geom.h GEOM_PART_BSD opt_geom.h Index: head/sys/geom/geom.h =================================================================== --- head/sys/geom/geom.h (revision 221756) +++ head/sys/geom/geom.h (working copy) @@ -371,6 +371,41 @@ g_free(void *ptr) }; \ DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); +#define G_MSG(class, ...) do { \ + printf("GEOM_%s: ", (class)); \ + printf(__VA_ARGS__); \ + printf("\n"); \ +} while (0) + +#ifdef GEOM_NODEBUG +#define G_DEBUG(...) +#define G_LOGREQ(...) +#define G_TRACE(...) +#else +#define G_DEBUG(class, debugctl, lvl, ...) do { \ + if ((debugctl) >= (lvl)) { \ + printf("GEOM_%s[%u]: ", (class), (lvl)); \ + printf(__VA_ARGS__); \ + printf("\n"); \ + } \ +} while (0) +#define G_LOGREQ(class, debugctl, lvl, bp, ...) do { \ + if ((debugctl) >= (lvl)) { \ + printf("GEOM_%s[%u]: ", (class), (lvl)); \ + printf(__VA_ARGS__); \ + printf(" "); \ + g_print_bio(bp); \ + printf("\n"); \ + } \ +} while (0) +#define G_TRACE(class, lvl, ...) do { \ + if ((g_debugflags & (lvl)) != 0) { \ + printf("GEOM_%s: ", (class)); \ + g_trace((lvl), __VA_ARGS__); \ + } \ +} while (0) +#endif /* GEOM_NODEBUG */ + #endif /* _KERNEL */ /* geom_ctl.c */