log: split internal TRACELOG macro into new header
The SPDK_TRACELOG macro depends on a CONFIG setting (DEBUG), so it should not be part of the public API. Create a new include/spdk_internal directory for headers that should only be used within SPDK, not exported for public use. Change-Id: I39b90ce57da3270e735ba32210c4b3a3468c460b Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
ac99f2fbc5
commit
d27b24c94b
@ -57,37 +57,6 @@ extern unsigned int spdk_g_notice_stderr_flag;
|
||||
#define SPDK_ERRLOG(...) \
|
||||
spdk_errlog(__FILE__, __LINE__, __func__, __VA_ARGS__)
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SPDK_LOG_REGISTER_TRACE_FLAG(str, flag) \
|
||||
bool flag = false; \
|
||||
__attribute__((constructor)) static void register_trace_flag_##flag(void) \
|
||||
{ \
|
||||
spdk_log_register_trace_flag(str, &flag); \
|
||||
}
|
||||
|
||||
#define SPDK_TRACELOG(FLAG, ...) \
|
||||
do { \
|
||||
extern bool FLAG; \
|
||||
if (FLAG) { \
|
||||
spdk_tracelog(__FILE__, __LINE__, __func__, __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SPDK_TRACEDUMP(FLAG, LABEL, BUF, LEN) \
|
||||
do { \
|
||||
extern bool FLAG; \
|
||||
if ((FLAG) && (LEN)) { \
|
||||
spdk_trace_dump((LABEL), (BUF), (LEN)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define SPDK_LOG_REGISTER_TRACE_FLAG(str, flag)
|
||||
#define SPDK_TRACELOG(...) do { } while (0)
|
||||
#define SPDK_TRACEDUMP(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
int spdk_set_log_facility(const char *facility);
|
||||
int spdk_set_log_priority(const char *priority);
|
||||
void spdk_noticelog(const char *file, const int line, const char *func,
|
||||
|
74
include/spdk_internal/log.h
Normal file
74
include/spdk_internal/log.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*-
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Intel Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Logging interfaces
|
||||
*/
|
||||
|
||||
#ifndef SPDK_INTERNAL_LOG_H
|
||||
#define SPDK_INTERNAL_LOG_H
|
||||
|
||||
#include "spdk/log.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define SPDK_LOG_REGISTER_TRACE_FLAG(str, flag) \
|
||||
bool flag = false; \
|
||||
__attribute__((constructor)) static void register_trace_flag_##flag(void) \
|
||||
{ \
|
||||
spdk_log_register_trace_flag(str, &flag); \
|
||||
}
|
||||
|
||||
#define SPDK_TRACELOG(FLAG, ...) \
|
||||
do { \
|
||||
extern bool FLAG; \
|
||||
if (FLAG) { \
|
||||
spdk_tracelog(__FILE__, __LINE__, __func__, __VA_ARGS__); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define SPDK_TRACEDUMP(FLAG, LABEL, BUF, LEN) \
|
||||
do { \
|
||||
extern bool FLAG; \
|
||||
if ((FLAG) && (LEN)) { \
|
||||
spdk_trace_dump((LABEL), (BUF), (LEN)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define SPDK_LOG_REGISTER_TRACE_FLAG(str, flag)
|
||||
#define SPDK_TRACELOG(...) do { } while (0)
|
||||
#define SPDK_TRACEDUMP(...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif /* SPDK_INTERNAL_LOG_H */
|
@ -44,9 +44,10 @@
|
||||
#include "spdk/bdev.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/fd.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/io_channel.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
static int g_blockdev_count = 0;
|
||||
|
||||
static int blockdev_aio_initialize(void);
|
||||
|
@ -32,9 +32,10 @@
|
||||
*/
|
||||
|
||||
#include "blockdev_aio.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_construct_aio {
|
||||
char *fname;
|
||||
};
|
||||
|
@ -44,9 +44,10 @@
|
||||
#include <rte_version.h>
|
||||
|
||||
#include "spdk/event.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/queue.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "bdev_module.h"
|
||||
|
||||
#define SPDK_BDEV_IO_POOL_SIZE (64 * 1024)
|
||||
|
@ -40,10 +40,11 @@
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/endian.h"
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/copy_engine.h"
|
||||
#include "spdk/io_channel.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "bdev_module.h"
|
||||
|
||||
#define MALLOC_MAX_UNMAP_BDESC 1
|
||||
|
@ -32,9 +32,10 @@
|
||||
*/
|
||||
|
||||
#include "blockdev_malloc.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_construct_malloc {
|
||||
uint32_t num_blocks;
|
||||
uint32_t block_size;
|
||||
|
@ -44,11 +44,12 @@
|
||||
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/endian.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/bdev.h"
|
||||
#include "spdk/nvme.h"
|
||||
#include "spdk/io_channel.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "bdev_module.h"
|
||||
|
||||
static void blockdev_nvme_get_spdk_running_config(FILE *fp);
|
||||
|
@ -32,9 +32,10 @@
|
||||
*/
|
||||
|
||||
#include "blockdev_nvme.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_construct_nvme {
|
||||
char *pci_address;
|
||||
};
|
||||
|
@ -32,9 +32,10 @@
|
||||
*/
|
||||
|
||||
#include "blockdev_rbd.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_construct_rbd {
|
||||
char *pool_name;
|
||||
char *rbd_name;
|
||||
|
@ -38,9 +38,10 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_kill_instance {
|
||||
char *sig_name;
|
||||
};
|
||||
|
@ -33,9 +33,10 @@
|
||||
|
||||
#include "ioat_internal.h"
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/env.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
struct ioat_driver {
|
||||
|
@ -51,8 +51,10 @@
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/event.h"
|
||||
#include "spdk/trace.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/net.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "iscsi/task.h"
|
||||
#include "iscsi/conn.h"
|
||||
#include "iscsi/tgt_node.h"
|
||||
|
@ -47,9 +47,11 @@
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/net.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "iscsi/iscsi.h"
|
||||
#include "iscsi/tgt_node.h"
|
||||
#include "iscsi/conn.h"
|
||||
|
@ -58,7 +58,6 @@
|
||||
#include "spdk/trace.h"
|
||||
#include "spdk/string.h"
|
||||
#include "spdk/queue.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/net.h"
|
||||
#include "iscsi/crc32c.h"
|
||||
@ -73,6 +72,8 @@
|
||||
#include "iscsi/portal_grp.h"
|
||||
#include "iscsi/acceptor.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#define MAX_TMPBUF 1024
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
|
@ -38,9 +38,10 @@
|
||||
#include "iscsi/portal_grp.h"
|
||||
#include "iscsi/init_grp.h"
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
extern struct spdk_iscsi_conn *g_conns_array; // TODO: move this to an internal iSCSI header
|
||||
|
||||
static void
|
||||
|
@ -49,7 +49,8 @@
|
||||
|
||||
#include "spdk/event.h"
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/log.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#define ISCSI_CONFIG_TMPL \
|
||||
"[iSCSI]\n" \
|
||||
|
@ -40,13 +40,14 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/string.h"
|
||||
#include "iscsi/iscsi.h"
|
||||
#include "iscsi/param.h"
|
||||
#include "iscsi/conn.h"
|
||||
#include "spdk/string.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#define MAX_TMPBUF 1024
|
||||
|
||||
/* whose value may be bigger than 255 */
|
||||
|
@ -48,9 +48,11 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/net.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "iscsi/iscsi.h"
|
||||
#include "iscsi/tgt_node.h"
|
||||
#include "iscsi/conn.h"
|
||||
|
@ -55,9 +55,11 @@
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "spdk/event.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/net.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "iscsi/iscsi.h"
|
||||
#include "iscsi/conn.h"
|
||||
#include "iscsi/tgt_node.h"
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#define SPDK_JSONRPC_RECV_BUF_SIZE (32 * 1024)
|
||||
#define SPDK_JSONRPC_SEND_BUF_SIZE (32 * 1024)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -31,10 +31,10 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "spdk/log.h"
|
||||
|
||||
#include "spdk/rpc.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_trace_flag {
|
||||
char *flag;
|
||||
};
|
||||
|
@ -36,10 +36,11 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/rpc.h"
|
||||
#include "spdk/net.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
struct rpc_ip_address {
|
||||
int32_t ifc_index;
|
||||
char *ip_address;
|
||||
|
@ -53,11 +53,12 @@
|
||||
#include "spdk/queue.h"
|
||||
#include "spdk/barrier.h"
|
||||
#include "spdk/bit_array.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/mmio.h"
|
||||
#include "spdk/pci_ids.h"
|
||||
#include "spdk/nvme_intel.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
/*
|
||||
* Some Intel devices support vendor-unique read latency log page even
|
||||
* though the log page directory says otherwise.
|
||||
|
@ -34,11 +34,13 @@
|
||||
#include "subsystem.h"
|
||||
#include "session.h"
|
||||
#include "request.h"
|
||||
#include "spdk/log.h"
|
||||
|
||||
#include "spdk/nvme.h"
|
||||
#include "spdk/nvmf_spec.h"
|
||||
#include "spdk/trace.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
static void
|
||||
nvmf_direct_ctrlr_get_data(struct spdk_nvmf_session *session)
|
||||
{
|
||||
|
@ -33,11 +33,12 @@
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/nvmf.h"
|
||||
#include "spdk/trace.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#include "subsystem.h"
|
||||
#include "transport.h"
|
||||
|
||||
|
@ -46,13 +46,15 @@
|
||||
#include "session.h"
|
||||
#include "subsystem.h"
|
||||
#include "transport.h"
|
||||
|
||||
#include "spdk/assert.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/nvmf.h"
|
||||
#include "spdk/nvmf_spec.h"
|
||||
#include "spdk/string.h"
|
||||
#include "spdk/trace.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
/*
|
||||
RDMA Connection Resouce Defaults
|
||||
*/
|
||||
|
@ -39,11 +39,12 @@
|
||||
#include "subsystem.h"
|
||||
#include "transport.h"
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/nvme.h"
|
||||
#include "spdk/nvmf_spec.h"
|
||||
#include "spdk/trace.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
int
|
||||
spdk_nvmf_request_complete(struct spdk_nvmf_request *req)
|
||||
{
|
||||
|
@ -39,10 +39,12 @@
|
||||
#include "request.h"
|
||||
#include "subsystem.h"
|
||||
#include "transport.h"
|
||||
#include "spdk/log.h"
|
||||
|
||||
#include "spdk/trace.h"
|
||||
#include "spdk/nvme_spec.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
static void
|
||||
nvmf_init_discovery_session_properties(struct spdk_nvmf_session *session)
|
||||
{
|
||||
|
@ -39,11 +39,12 @@
|
||||
#include "subsystem.h"
|
||||
#include "transport.h"
|
||||
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/string.h"
|
||||
#include "spdk/trace.h"
|
||||
#include "spdk/nvmf_spec.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
static TAILQ_HEAD(, spdk_nvmf_subsystem) g_subsystems = TAILQ_HEAD_INITIALIZER(g_subsystems);
|
||||
|
||||
struct spdk_nvmf_subsystem *
|
||||
|
@ -40,13 +40,14 @@
|
||||
|
||||
#include "spdk/bdev.h"
|
||||
#include "spdk/endian.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/nvme.h"
|
||||
#include "spdk/nvmf_spec.h"
|
||||
#include "spdk/trace.h"
|
||||
#include "spdk/scsi_spec.h"
|
||||
#include "spdk/string.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
#define MIN_KEEP_ALIVE_TIMEOUT 10000
|
||||
#define MODEL_NUMBER "SPDK Virtual Controller"
|
||||
#define FW_VERSION "FFFFFFFF"
|
||||
|
@ -50,11 +50,12 @@
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include "spdk/bdev.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/scsi.h"
|
||||
#include "spdk/scsi_spec.h"
|
||||
#include "spdk/trace.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
enum {
|
||||
SPDK_SCSI_TASK_UNKNOWN = -1,
|
||||
SPDK_SCSI_TASK_COMPLETE,
|
||||
|
@ -1,9 +1,11 @@
|
||||
#include "iscsi/task.h"
|
||||
#include "iscsi/iscsi.h"
|
||||
#include "iscsi/conn.h"
|
||||
#include "spdk/log.h"
|
||||
|
||||
#include "spdk/event.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
|
||||
SPDK_LOG_REGISTER_TRACE_FLAG("iscsi", SPDK_TRACE_ISCSI)
|
||||
|
||||
struct spdk_iscsi_globals g_spdk_iscsi;
|
||||
|
Loading…
Reference in New Issue
Block a user