From 6d4d657360451aa495a82edd7cc28af69ea35168 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sat, 22 Jun 2019 19:09:10 +0000 Subject: [PATCH] Decouple enc/ses verbosity from bootverbose. I don't want to be regularly notified that my enclosure violates standards until there is some real problem I want to debug. MFC after: 2 weeks --- sys/cam/scsi/scsi_enc.c | 8 ++++++++ sys/cam/scsi/scsi_enc_internal.h | 7 ++++++- sys/cam/scsi/scsi_enc_safte.c | 1 - 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/cam/scsi/scsi_enc.c b/sys/cam/scsi/scsi_enc.c index 97339206bee..e6688af2a78 100644 --- a/sys/cam/scsi/scsi_enc.c +++ b/sys/cam/scsi/scsi_enc.c @@ -81,6 +81,14 @@ static enctyp enc_type(struct ccb_getdev *); SYSCTL_NODE(_kern_cam, OID_AUTO, enc, CTLFLAG_RD, 0, "CAM Enclosure Services driver"); +#if defined(DEBUG) || defined(ENC_DEBUG) +int enc_verbose = 1; +#else +int enc_verbose = 0; +#endif +SYSCTL_INT(_kern_cam_enc, OID_AUTO, verbose, CTLFLAG_RWTUN, + &enc_verbose, 0, "Enable verbose logging"); + static struct periph_driver encdriver = { enc_init, "ses", TAILQ_HEAD_INITIALIZER(encdriver.units), /* generation */ 0 diff --git a/sys/cam/scsi/scsi_enc_internal.h b/sys/cam/scsi/scsi_enc_internal.h index 04948ad7361..29fd880ec3a 100644 --- a/sys/cam/scsi/scsi_enc_internal.h +++ b/sys/cam/scsi/scsi_enc_internal.h @@ -36,6 +36,8 @@ #ifndef __SCSI_ENC_INTERNAL_H__ #define __SCSI_ENC_INTERNAL_H__ +#include + typedef struct enc_element { uint32_t enctype : 8, /* enclosure type */ @@ -204,6 +206,9 @@ enc_softc_init_t ses_softc_init; /* SAF-TE interface */ enc_softc_init_t safte_softc_init; +SYSCTL_DECL(_kern_cam_enc); +extern int enc_verbose; + /* Helper macros */ MALLOC_DECLARE(M_SCSIENC); #define ENC_CFLAGS CAM_RETRY_SELTO @@ -216,7 +221,7 @@ MALLOC_DECLARE(M_SCSIENC); #else #define ENC_DLOG if (0) enc_log #endif -#define ENC_VLOG if (bootverbose) enc_log +#define ENC_VLOG if (enc_verbose) enc_log #define ENC_MALLOC(amt) malloc(amt, M_SCSIENC, M_NOWAIT) #define ENC_MALLOCZ(amt) malloc(amt, M_SCSIENC, M_ZERO|M_NOWAIT) /* Cast away const avoiding GCC warnings. */ diff --git a/sys/cam/scsi/scsi_enc_safte.c b/sys/cam/scsi/scsi_enc_safte.c index 8afcc323991..8d6e3fe5eeb 100644 --- a/sys/cam/scsi/scsi_enc_safte.c +++ b/sys/cam/scsi/scsi_enc_safte.c @@ -227,7 +227,6 @@ static char *safte_2little = "Too Little Data Returned (%d) at line %d\n"; } int emulate_array_devices = 1; -SYSCTL_DECL(_kern_cam_enc); SYSCTL_INT(_kern_cam_enc, OID_AUTO, emulate_array_devices, CTLFLAG_RWTUN, &emulate_array_devices, 0, "Emulate Array Devices for SAF-TE");