build: replace USE_PCIACCESS with config.h define

Drop the special-case preprocessor definition for PCI access library now
that config.h is available with an equivalent SPDK_CONFIG_PCIACCESS
define.

Change-Id: I4891d0f2fd7d3eea51b767df9e594555b36265ea
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-06-23 09:55:04 -07:00
parent cd258ce089
commit 336ba0d09c
4 changed files with 13 additions and 15 deletions

View File

@ -16,7 +16,7 @@
#include "ioat_pci.h" #include "ioat_pci.h"
#ifdef USE_PCIACCESS #ifdef SPDK_CONFIG_PCIACCESS
#include <pciaccess.h> #include <pciaccess.h>
#else #else
#include <rte_pci.h> #include <rte_pci.h>
@ -81,7 +81,7 @@ struct ioat_pci_enum_ctx {
void *user_enum_ctx; void *user_enum_ctx;
}; };
#ifdef USE_PCIACCESS #ifdef SPDK_CONFIG_PCIACCESS
static inline bool static inline bool
ioat_pci_device_match_id(uint16_t vendor_id, uint16_t device_id) ioat_pci_device_match_id(uint16_t vendor_id, uint16_t device_id)
@ -182,7 +182,7 @@ ioat_pcicfg_unmap_bar(void *devhandle, uint32_t bar, void *addr)
return pci_device_unmap_range(dev, addr, dev->regions[bar].size); return pci_device_unmap_range(dev, addr, dev->regions[bar].size);
} }
#else /* !USE_PCIACCESS */ #else /* !SPDK_CONFIG_PCIACCESS */
static inline int static inline int
ioat_pcicfg_map_bar(void *devhandle, uint32_t bar, uint32_t read_only, void **mapped_addr) ioat_pcicfg_map_bar(void *devhandle, uint32_t bar, uint32_t read_only, void **mapped_addr)
@ -294,7 +294,7 @@ ioat_pci_enumerate(int (*enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_de
return rc; return rc;
} }
#endif /* !USE_PCIACCESS */ #endif /* !SPDK_CONFIG_PCIACCESS */
typedef pthread_mutex_t ioat_mutex_t; typedef pthread_mutex_t ioat_mutex_t;

View File

@ -55,7 +55,7 @@
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_mempool.h> #include <rte_mempool.h>
#ifdef USE_PCIACCESS #ifdef SPDK_CONFIG_PCIACCESS
#include <pciaccess.h> #include <pciaccess.h>
#else #else
#include <rte_pci.h> #include <rte_pci.h>
@ -146,7 +146,7 @@ struct nvme_pci_enum_ctx {
void *user_enum_ctx; void *user_enum_ctx;
}; };
#ifdef USE_PCIACCESS #ifdef SPDK_CONFIG_PCIACCESS
static int static int
nvme_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev) nvme_pci_enum_cb(void *enum_ctx, struct spdk_pci_device *pci_dev)
@ -208,7 +208,7 @@ nvme_pcicfg_get_bar_addr_len(void *devhandle, uint32_t bar, uint64_t *addr, uint
*size = (uint64_t)dev->regions[bar].size; *size = (uint64_t)dev->regions[bar].size;
} }
#else /* !USE_PCIACCESS */ #else /* !SPDK_CONFIG_PCIACCESS */
static inline int static inline int
nvme_pcicfg_map_bar(void *devhandle, uint32_t bar, uint32_t read_only, void **mapped_addr) nvme_pcicfg_map_bar(void *devhandle, uint32_t bar, uint32_t read_only, void **mapped_addr)
@ -297,7 +297,7 @@ nvme_pci_enumerate(int (*enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_de
return rc; return rc;
} }
#endif /* !USE_PCIACCESS */ #endif /* !SPDK_CONFIG_PCIACCESS */
typedef pthread_mutex_t nvme_mutex_t; typedef pthread_mutex_t nvme_mutex_t;

View File

@ -43,7 +43,7 @@
#include <pthread.h> #include <pthread.h>
#include <stdbool.h> #include <stdbool.h>
#ifdef USE_PCIACCESS #ifdef SPDK_CONFIG_PCIACCESS
#include <pciaccess.h> #include <pciaccess.h>
/* When using libpciaccess, struct spdk_pci_device * is actually struct pci_device * internally. */ /* When using libpciaccess, struct spdk_pci_device * is actually struct pci_device * internally. */
#define spdk_pci_device pci_device #define spdk_pci_device pci_device
@ -62,7 +62,7 @@
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices" #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
#define SYSFS_PCI_DRIVERS "/sys/bus/pci/drivers" #define SYSFS_PCI_DRIVERS "/sys/bus/pci/drivers"
#ifndef PCI_PRI_FMT /* This is defined by rte_pci.h when USE_PCIACCESS is not set */ #ifndef PCI_PRI_FMT /* This is defined by rte_pci.h when SPDK_CONFIG_PCIACCESS is not set */
#define PCI_PRI_FMT "%04x:%02x:%02x.%1u" #define PCI_PRI_FMT "%04x:%02x:%02x.%1u"
#endif #endif
@ -71,7 +71,7 @@
#define PCI_EXT_CAP_ID_SN 0x03 #define PCI_EXT_CAP_ID_SN 0x03
#define PCI_UIO_DRIVER "uio_pci_generic" #define PCI_UIO_DRIVER "uio_pci_generic"
#ifdef USE_PCIACCESS #ifdef SPDK_CONFIG_PCIACCESS
/* /*
* libpciaccess wrapper functions * libpciaccess wrapper functions
@ -231,7 +231,7 @@ spdk_pci_enumerate(int (*enum_cb)(void *enum_ctx, struct spdk_pci_device *pci_de
return rc; return rc;
} }
#else /* !USE_PCIACCESS */ #else /* !SPDK_CONFIG_PCIACCESS */
/* /*
* DPDK PCI wrapper functions * DPDK PCI wrapper functions
@ -374,7 +374,7 @@ spdk_pci_device_cfg_write32(struct spdk_pci_device *dev, uint32_t value, uint32_
return rte_eal_pci_write_config(dev, &value, 4, offset) == 4 ? 0 : -1; return rte_eal_pci_write_config(dev, &value, 4, offset) == 4 ? 0 : -1;
} }
#endif /* !USE_PCIACCESS */ #endif /* !SPDK_CONFIG_PCIACCESS */
int int

View File

@ -92,8 +92,6 @@ endif
ifeq ($(CONFIG_PCIACCESS), y) ifeq ($(CONFIG_PCIACCESS), y)
PCIACCESS_LIB=-lpciaccess PCIACCESS_LIB=-lpciaccess
SPDK_PCIACCESS_CFLAGS=-DUSE_PCIACCESS
COMMON_CFLAGS += $(SPDK_PCIACCESS_CFLAGS)
endif endif
CFLAGS += $(COMMON_CFLAGS) -Wno-pointer-sign -Wstrict-prototypes -std=gnu99 CFLAGS += $(COMMON_CFLAGS) -Wno-pointer-sign -Wstrict-prototypes -std=gnu99