Add extern "C" wrapper to all public headers

Also consistently place the extern "C" before any includes or other
declarations in files that already had it.

Change-Id: Ia316d5be3e509ec76c4a98cfa90ed516073351e0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-02-12 07:52:35 -07:00
parent bfd92d4719
commit 04adec22bc
14 changed files with 103 additions and 5 deletions

View File

@ -34,6 +34,10 @@
#ifndef SPDK_ASSERT_H #ifndef SPDK_ASSERT_H
#define SPDK_ASSERT_H #define SPDK_ASSERT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <assert.h> #include <assert.h>
#define SPDK_CONCAT_(x, y) x##y #define SPDK_CONCAT_(x, y) x##y
@ -52,4 +56,8 @@
typedef char SPDK_CONCAT(SPDK_STATIC_ASSERT_, __LINE__)[!!(cond) - 1] typedef char SPDK_CONCAT(SPDK_STATIC_ASSERT_, __LINE__)[!!(cond) - 1]
#endif #endif
#ifdef __cplusplus
}
#endif
#endif /* SPDK_ASSERT_H */ #endif /* SPDK_ASSERT_H */

View File

@ -34,7 +34,15 @@
#ifndef SPDK_BARRIER_H #ifndef SPDK_BARRIER_H
#define SPDK_BARRIER_H #define SPDK_BARRIER_H
#ifdef __cplusplus
extern "C" {
#endif
#define spdk_wmb() __asm volatile("sfence" ::: "memory") #define spdk_wmb() __asm volatile("sfence" ::: "memory")
#define spdk_mb() __asm volatile("mfence" ::: "memory") #define spdk_mb() __asm volatile("mfence" ::: "memory")
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,9 +34,17 @@
#ifndef SPDK_FILE_H #ifndef SPDK_FILE_H
#define SPDK_FILE_H #define SPDK_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
uint64_t spdk_file_get_size(int fd); uint64_t spdk_file_get_size(int fd);
uint32_t spdk_dev_get_blocklen(int fd); uint32_t spdk_dev_get_blocklen(int fd);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -38,6 +38,10 @@
#ifndef SPDK_IOAT_H #ifndef SPDK_IOAT_H
#define SPDK_IOAT_H #define SPDK_IOAT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h> #include <inttypes.h>
#include <stdbool.h> #include <stdbool.h>
#include "spdk/pci.h" #include "spdk/pci.h"
@ -149,4 +153,8 @@ enum spdk_ioat_dma_capability_flags {
*/ */
uint32_t spdk_ioat_get_dma_capabilities(void); uint32_t spdk_ioat_get_dma_capabilities(void);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,6 +34,10 @@
#ifndef SPDK_IOAT_SPEC_H #ifndef SPDK_IOAT_SPEC_H
#define SPDK_IOAT_SPEC_H #define SPDK_IOAT_SPEC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h> #include <inttypes.h>
#include "spdk/assert.h" #include "spdk/assert.h"
@ -312,4 +316,8 @@ union spdk_ioat_hw_desc {
}; };
SPDK_STATIC_ASSERT(sizeof(union spdk_ioat_hw_desc) == 64, "incorrect spdk_ioat_hw_desc layout"); SPDK_STATIC_ASSERT(sizeof(union spdk_ioat_hw_desc) == 64, "incorrect spdk_ioat_hw_desc layout");
#ifdef __cplusplus
}
#endif
#endif /* SPDK_IOAT_SPEC_H */ #endif /* SPDK_IOAT_SPEC_H */

View File

@ -34,6 +34,10 @@
#ifndef SPDK_MMIO_H #ifndef SPDK_MMIO_H
#define SPDK_MMIO_H #define SPDK_MMIO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h> #include <inttypes.h>
#ifdef __x86_64__ #ifdef __x86_64__
@ -88,4 +92,8 @@ spdk_mmio_write_8(volatile uint64_t *addr, uint64_t val)
} }
} }
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,6 +34,10 @@
#ifndef SPDK_NVME_H #ifndef SPDK_NVME_H
#define SPDK_NVME_H #define SPDK_NVME_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> #include <stddef.h>
#include "spdk/pci.h" #include "spdk/pci.h"
#include "nvme_spec.h" #include "nvme_spec.h"
@ -45,9 +49,7 @@
#define SPDK_NVME_DEFAULT_RETRY_COUNT (4) #define SPDK_NVME_DEFAULT_RETRY_COUNT (4)
extern int32_t spdk_nvme_retry_count; extern int32_t spdk_nvme_retry_count;
#ifdef __cplusplus
extern "C" {
#endif
/** \brief Opaque handle to a controller. Returned by \ref spdk_nvme_probe()'s attach_cb. */ /** \brief Opaque handle to a controller. Returned by \ref spdk_nvme_probe()'s attach_cb. */
struct spdk_nvme_ctrlr; struct spdk_nvme_ctrlr;

View File

@ -34,6 +34,10 @@
#ifndef SPDK_NVME_INTEL_H #ifndef SPDK_NVME_INTEL_H
#define SPDK_NVME_INTEL_H #define SPDK_NVME_INTEL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
@ -193,4 +197,8 @@ union spdk_nvme_intel_feat_latency_tracking {
}; };
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_intel_feat_latency_tracking) == 4, "Incorrect size"); SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_intel_feat_latency_tracking) == 4, "Incorrect size");
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,6 +34,10 @@
#ifndef SPDK_NVME_SPEC_H #ifndef SPDK_NVME_SPEC_H
#define SPDK_NVME_SPEC_H #define SPDK_NVME_SPEC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
@ -1149,4 +1153,8 @@ enum spdk_nvme_ns_management_type {
#define SPDK_NVME_IO_FLAGS_FORCE_UNIT_ACCESS (1U << 30) #define SPDK_NVME_IO_FLAGS_FORCE_UNIT_ACCESS (1U << 30)
#define SPDK_NVME_IO_FLAGS_LIMITED_RETRY (1U << 31) #define SPDK_NVME_IO_FLAGS_LIMITED_RETRY (1U << 31)
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,6 +34,10 @@
#ifndef SPDK_PCI_H #ifndef SPDK_PCI_H
#define SPDK_PCI_H #define SPDK_PCI_H
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h> #include <inttypes.h>
#include <stddef.h> #include <stddef.h>
@ -63,4 +67,8 @@ int spdk_pci_device_bind_uio_driver(struct spdk_pci_device *dev);
int spdk_pci_device_switch_to_uio_driver(struct spdk_pci_device *pci_dev); int spdk_pci_device_switch_to_uio_driver(struct spdk_pci_device *pci_dev);
int spdk_pci_device_claim(struct spdk_pci_device *dev); int spdk_pci_device_claim(struct spdk_pci_device *dev);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,6 +34,10 @@
#ifndef SPDK_PCI_IDS #ifndef SPDK_PCI_IDS
#define SPDK_PCI_IDS #define SPDK_PCI_IDS
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#define SPDK_PCI_VID_INTEL 0x8086 #define SPDK_PCI_VID_INTEL 0x8086
@ -47,4 +51,8 @@
*/ */
#define SPDK_PCI_CLASS_NVME 0x010802 #define SPDK_PCI_CLASS_NVME 0x010802
#ifdef __cplusplus
}
#endif
#endif /* SPDK_PCI_IDS */ #endif /* SPDK_PCI_IDS */

View File

@ -34,6 +34,10 @@
#ifndef SPDK_QUEUE_H #ifndef SPDK_QUEUE_H
#define SPDK_QUEUE_H #define SPDK_QUEUE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/queue.h> #include <sys/queue.h>
@ -46,4 +50,8 @@
#include <spdk/queue_extras.h> #include <spdk/queue_extras.h>
#endif #endif
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,6 +34,10 @@
#ifndef SPDK_STRING_H #ifndef SPDK_STRING_H
#define SPDK_STRING_H #define SPDK_STRING_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* sprintf with automatic buffer allocation. * sprintf with automatic buffer allocation.
* *
@ -43,4 +47,8 @@
*/ */
char *spdk_sprintf_alloc(const char *format, ...) __attribute__((format(printf, 1, 2))); char *spdk_sprintf_alloc(const char *format, ...) __attribute__((format(printf, 1, 2)));
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -34,12 +34,12 @@
#ifndef SPDK_VTOPHYS_H #ifndef SPDK_VTOPHYS_H
#define SPDK_VTOPHYS_H #define SPDK_VTOPHYS_H
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdint.h>
#define SPDK_VTOPHYS_ERROR (0xFFFFFFFFFFFFFFFFULL) #define SPDK_VTOPHYS_ERROR (0xFFFFFFFFFFFFFFFFULL)
uint64_t spdk_vtophys(void *buf); uint64_t spdk_vtophys(void *buf);