include: move standard includes into spdk/stdinc.h
This is the first step toward isolating standard C and POSIX headers into a single replaceable header file. Change-Id: I527297f5e7260b01103018ad3429922962ee9add Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
578c0d550d
commit
45cab335bc
@ -38,12 +38,12 @@
|
||||
#ifndef SPDK_ASSERT_H
|
||||
#define SPDK_ASSERT_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef static_assert
|
||||
#define SPDK_STATIC_ASSERT(cond, msg) static_assert(cond, msg)
|
||||
#else
|
||||
|
@ -38,6 +38,8 @@
|
||||
#ifndef SPDK_BARRIER_H
|
||||
#define SPDK_BARRIER_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -39,11 +39,7 @@
|
||||
#ifndef SPDK_BDEV_H_
|
||||
#define SPDK_BDEV_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h> /* for offsetof */
|
||||
#include <sys/uio.h> /* for struct iovec */
|
||||
#include <stdbool.h>
|
||||
#include <pthread.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/event.h"
|
||||
#include "spdk/queue.h"
|
||||
|
@ -38,14 +38,12 @@
|
||||
#ifndef SPDK_BIT_ARRAY_H
|
||||
#define SPDK_BIT_ARRAY_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Variable-length bit array.
|
||||
*/
|
||||
|
@ -66,8 +66,7 @@
|
||||
#ifndef SPDK_BLOB_H
|
||||
#define SPDK_BLOB_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
typedef uint64_t spdk_blob_id;
|
||||
#define SPDK_BLOBID_INVALID (uint64_t)-1
|
||||
|
@ -38,6 +38,8 @@
|
||||
#ifndef SPDK_BLOB_BDEV_H
|
||||
#define SPDK_BLOB_BDEV_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -38,9 +38,7 @@
|
||||
#ifndef SPDK_FS_H
|
||||
#define SPDK_FS_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <semaphore.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/blob.h"
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#ifndef SPDK_CONF_H
|
||||
#define SPDK_CONF_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
struct spdk_conf_value;
|
||||
struct spdk_conf_item;
|
||||
|
@ -38,8 +38,7 @@
|
||||
#ifndef SPDK_COPY_ENGINE_H
|
||||
#define SPDK_COPY_ENGINE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
typedef void (*spdk_copy_completion_cb)(void *ref, int status);
|
||||
|
||||
|
@ -39,12 +39,12 @@
|
||||
#ifndef SPDK_ENDIAN_H
|
||||
#define SPDK_ENDIAN_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static inline uint16_t
|
||||
from_be16(const void *ptr)
|
||||
{
|
||||
|
@ -38,15 +38,12 @@
|
||||
#ifndef SPDK_ENV_H
|
||||
#define SPDK_ENV_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define SPDK_ENV_SOCKET_ID_ANY (-1)
|
||||
|
||||
struct spdk_pci_device;
|
||||
|
@ -41,10 +41,7 @@
|
||||
#ifndef SPDK_EVENT_H
|
||||
#define SPDK_EVENT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/queue.h"
|
||||
|
||||
|
@ -38,12 +38,12 @@
|
||||
#ifndef SPDK_FD_H
|
||||
#define SPDK_FD_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint64_t spdk_fd_get_size(int fd);
|
||||
uint32_t spdk_fd_get_blocklen(int fd);
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#ifndef SPDK_GPT_SPEC_H
|
||||
#define SPDK_GPT_SPEC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/assert.h"
|
||||
|
||||
|
@ -38,8 +38,7 @@
|
||||
#ifndef SPDK_IO_CHANNEL_H_
|
||||
#define SPDK_IO_CHANNEL_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/queue.h"
|
||||
|
||||
|
@ -38,13 +38,12 @@
|
||||
#ifndef SPDK_IOAT_H
|
||||
#define SPDK_IOAT_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "spdk/env.h"
|
||||
|
||||
/**
|
||||
|
@ -39,12 +39,12 @@
|
||||
#ifndef SPDK_IOAT_SPEC_H
|
||||
#define SPDK_IOAT_SPEC_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "spdk/assert.h"
|
||||
|
||||
#define SPDK_IOAT_INTRCTRL_MASTER_INT_EN 0x01
|
||||
|
@ -40,7 +40,7 @@
|
||||
#ifndef SPDK_ISCSI_SPEC_H
|
||||
#define SPDK_ISCSI_SPEC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/assert.h"
|
||||
|
||||
|
@ -39,11 +39,7 @@
|
||||
#ifndef SPDK_JSON_H_
|
||||
#define SPDK_JSON_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
enum spdk_json_val_type {
|
||||
SPDK_JSON_VAL_INVALID,
|
||||
|
@ -39,17 +39,10 @@
|
||||
#ifndef SPDK_JSONRPC_H_
|
||||
#define SPDK_JSONRPC_H_
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/json.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define SPDK_JSONRPC_ERROR_PARSE_ERROR -32700
|
||||
#define SPDK_JSONRPC_ERROR_INVALID_REQUEST -32600
|
||||
#define SPDK_JSONRPC_ERROR_METHOD_NOT_FOUND -32601
|
||||
|
@ -38,6 +38,8 @@
|
||||
#ifndef SPDK_LIKELY_H
|
||||
#define SPDK_LIKELY_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#define spdk_unlikely(cond) __builtin_expect((cond), 0)
|
||||
#define spdk_likely(cond) __builtin_expect(!!(cond), 1)
|
||||
|
||||
|
@ -39,10 +39,7 @@
|
||||
#ifndef SPDK_LOG_H
|
||||
#define SPDK_LOG_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
/*
|
||||
* Default: 1 - noticelog messages will print to stderr and syslog.
|
||||
|
@ -38,12 +38,12 @@
|
||||
#ifndef SPDK_MMIO_H
|
||||
#define SPDK_MMIO_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "spdk/barrier.h"
|
||||
|
||||
#ifdef __x86_64__
|
||||
|
@ -38,11 +38,7 @@
|
||||
#ifndef SPDK_NET_H
|
||||
#define SPDK_NET_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/uio.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/queue.h"
|
||||
|
||||
|
@ -38,14 +38,12 @@
|
||||
#ifndef SPDK_NVME_H
|
||||
#define SPDK_NVME_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/nvme_spec.h"
|
||||
#include "spdk/nvmf_spec.h"
|
||||
|
@ -42,13 +42,12 @@
|
||||
#ifndef SPDK_NVME_INTEL_H
|
||||
#define SPDK_NVME_INTEL_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "spdk/assert.h"
|
||||
|
||||
enum spdk_nvme_intel_feat {
|
||||
|
@ -39,13 +39,12 @@
|
||||
#ifndef SPDK_NVME_SPEC_H
|
||||
#define SPDK_NVME_SPEC_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "spdk/assert.h"
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@
|
||||
#ifndef SPDK_NVMF_H
|
||||
#define SPDK_NVMF_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/nvmf_spec.h"
|
||||
|
@ -34,7 +34,7 @@
|
||||
#ifndef SPDK_NVMF_SPEC_H
|
||||
#define SPDK_NVMF_SPEC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/assert.h"
|
||||
#include "spdk/nvme_spec.h"
|
||||
|
@ -38,12 +38,12 @@
|
||||
#ifndef SPDK_PCI_IDS
|
||||
#define SPDK_PCI_IDS
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define SPDK_PCI_ANY_ID 0xffff
|
||||
#define SPDK_PCI_VID_INTEL 0x8086
|
||||
#define SPDK_PCI_VID_MEMBLAZE 0x1c5f
|
||||
|
@ -34,7 +34,7 @@
|
||||
#ifndef SPDK_RPC_CONFIG_H_
|
||||
#define SPDK_RPC_CONFIG_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/jsonrpc.h"
|
||||
|
||||
|
@ -39,10 +39,7 @@
|
||||
#ifndef SPDK_SCSI_H
|
||||
#define SPDK_SCSI_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/uio.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/queue.h"
|
||||
#include "spdk/event.h"
|
||||
|
@ -39,7 +39,7 @@
|
||||
#ifndef SPDK_SCSI_SPEC_H
|
||||
#define SPDK_SCSI_SPEC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/assert.h"
|
||||
|
||||
|
73
include/spdk/stdinc.h
Normal file
73
include/spdk/stdinc.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*-
|
||||
* 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
|
||||
* Standard C headers
|
||||
*
|
||||
* This file is intended to be included first by all other SPDK files.
|
||||
*/
|
||||
|
||||
#ifndef SPDK_STDINC_H
|
||||
#define SPDK_STDINC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Standard C */
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* POSIX */
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPDK_STDINC_H */
|
@ -38,13 +38,12 @@
|
||||
#ifndef SPDK_STRING_H
|
||||
#define SPDK_STRING_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* sprintf with automatic buffer allocation.
|
||||
*
|
||||
|
@ -39,8 +39,7 @@
|
||||
#ifndef _SPDK_TRACE_H_
|
||||
#define _SPDK_TRACE_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -38,13 +38,12 @@
|
||||
#ifndef SPDK_UTIL_H
|
||||
#define SPDK_UTIL_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define spdk_min(a,b) (((a)<(b))?(a):(b))
|
||||
#define spdk_max(a,b) (((a)>(b))?(a):(b))
|
||||
|
||||
|
@ -39,6 +39,8 @@
|
||||
#ifndef SPDK_VHOST_H
|
||||
#define SPDK_VHOST_H
|
||||
|
||||
#include "spdk/stdinc.h"
|
||||
|
||||
#include "spdk/event.h"
|
||||
|
||||
#define SPDK_VHOST_SCSI_CTRLR_MAX_DEVS 8
|
||||
|
Loading…
Reference in New Issue
Block a user