linux/drivers/scsi/scsi_logging.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _SCSI_LOGGING_H
#define _SCSI_LOGGING_H


/*
 * This defines the scsi logging feature.  It is a means by which the user can
 * select how much information they get about various goings on, and it can be
 * really useful for fault tracing.  The logging word is divided into 10 3-bit
 * bitfields, each of which describes a loglevel.  The division of things is
 * somewhat arbitrary, and the division of the word could be changed if it
 * were really needed for any reason.  The numbers below are the only place
 * where these are specified.  For a first go-around, 3 bits is more than
 * enough, since this gives 8 levels of logging (really 7, since 0 is always
 * off).  Cutting to 2 bits might be wise at some point.
 */

#define SCSI_LOG_ERROR_SHIFT
#define SCSI_LOG_TIMEOUT_SHIFT
#define SCSI_LOG_SCAN_SHIFT
#define SCSI_LOG_MLQUEUE_SHIFT
#define SCSI_LOG_MLCOMPLETE_SHIFT
#define SCSI_LOG_LLQUEUE_SHIFT
#define SCSI_LOG_LLCOMPLETE_SHIFT
#define SCSI_LOG_HLQUEUE_SHIFT
#define SCSI_LOG_HLCOMPLETE_SHIFT
#define SCSI_LOG_IOCTL_SHIFT

#define SCSI_LOG_ERROR_BITS
#define SCSI_LOG_TIMEOUT_BITS
#define SCSI_LOG_SCAN_BITS
#define SCSI_LOG_MLQUEUE_BITS
#define SCSI_LOG_MLCOMPLETE_BITS
#define SCSI_LOG_LLQUEUE_BITS
#define SCSI_LOG_LLCOMPLETE_BITS
#define SCSI_LOG_HLQUEUE_BITS
#define SCSI_LOG_HLCOMPLETE_BITS
#define SCSI_LOG_IOCTL_BITS

extern unsigned int scsi_logging_level;

#ifdef CONFIG_SCSI_LOGGING

#define SCSI_LOG_LEVEL(SHIFT, BITS)

#define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD)
#else
#define SCSI_LOG_LEVEL
#define SCSI_CHECK_LOGGING
#endif /* CONFIG_SCSI_LOGGING */

/*
 * These are the macros that are actually used throughout the code to
 * log events.  If logging isn't enabled, they are no-ops and will be
 * completely absent from the user's code.
 */
#define SCSI_LOG_ERROR_RECOVERY(LEVEL,CMD)
#define SCSI_LOG_TIMEOUT(LEVEL,CMD)
#define SCSI_LOG_SCAN_BUS(LEVEL,CMD)
#define SCSI_LOG_MLQUEUE(LEVEL,CMD)
#define SCSI_LOG_MLCOMPLETE(LEVEL,CMD)
#define SCSI_LOG_LLQUEUE(LEVEL,CMD)
#define SCSI_LOG_LLCOMPLETE(LEVEL,CMD)
#define SCSI_LOG_HLQUEUE(LEVEL,CMD)
#define SCSI_LOG_HLCOMPLETE(LEVEL,CMD)
#define SCSI_LOG_IOCTL(LEVEL,CMD)

#endif /* _SCSI_LOGGING_H */