From 7953f98e235666fa9d085d042fa9579bc662b65b Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Mon, 26 Mar 2018 19:53:02 +0000 Subject: vmci(4): Fix GCC build and rationalize vmci_kernel_defs.h To fix the GCC build, remove multiple redundant declarations of vmci_send_datagram() (the copy in vmci.h as well as the extern definition in vmci_queue_pair.c were wholly redundant). Also to fix the GCC build, include a non-empty format string in the vmci(4) definition of ASSERT(). It seems harmless either way, but adding the stringified invariant is easier than masking the warning. The other vmci_kernel_defs.h changes are cosmetic and simply match macros to existing definitions. Reported by: GCC 6.4.0 Sponsored by: Dell EMC Isilon --- sys/dev/vmware/vmci/vmci.h | 1 - sys/dev/vmware/vmci/vmci_kernel_defs.h | 14 +++++++------- sys/dev/vmware/vmci/vmci_queue_pair.c | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'sys/dev/vmware') diff --git a/sys/dev/vmware/vmci/vmci.h b/sys/dev/vmware/vmci/vmci.h index ba4a99cd90c8..4177bd474c90 100644 --- a/sys/dev/vmware/vmci/vmci.h +++ b/sys/dev/vmware/vmci/vmci.h @@ -73,7 +73,6 @@ struct vmci_softc { int vmci_dma_malloc(bus_size_t size, bus_size_t align, struct vmci_dma_alloc *dma); void vmci_dma_free(struct vmci_dma_alloc *); -int vmci_send_datagram(struct vmci_datagram *dg); int vmci_schedule_delayed_work_fn(vmci_work_fn *work_fn, void *data); #endif /* !_VMCI_H_ */ diff --git a/sys/dev/vmware/vmci/vmci_kernel_defs.h b/sys/dev/vmware/vmci/vmci_kernel_defs.h index 68f716057392..46eefd99289e 100644 --- a/sys/dev/vmware/vmci/vmci_kernel_defs.h +++ b/sys/dev/vmware/vmci/vmci_kernel_defs.h @@ -16,17 +16,17 @@ typedef uint32_t PPN; -#define ASSERT(cond) KASSERT(cond, ("")) +#define ASSERT(cond) KASSERT(cond, ("%s", #cond)) #define ASSERT_ON_COMPILE(e) _Static_assert(e, #e); -#define LIKELY(_exp) __builtin_expect(!!(_exp), 1) -#define UNLIKELY(_exp) __builtin_expect((_exp), 0) +#define LIKELY(_exp) __predict_true(_exp) +#define UNLIKELY(_exp) __predict_false(_exp) -#define CONST64U(c) c##uL +#define CONST64U(c) UINT64_C(c) -#define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a))) +#define ARRAYSIZE(a) nitems(a) -#define ROUNDUP(x, y) (((x) + (y) - 1) / (y) * (y)) -#define CEILING(x, y) (((x) + (y) - 1) / (y)) +#define ROUNDUP(x, y) roundup(x, y) +#define CEILING(x, y) howmany(x, y) #endif /* !_VMCI_KERNEL_DEFS_H_ */ diff --git a/sys/dev/vmware/vmci/vmci_queue_pair.c b/sys/dev/vmware/vmci/vmci_queue_pair.c index 3c6dfecccae1..851008904e80 100644 --- a/sys/dev/vmware/vmci/vmci_queue_pair.c +++ b/sys/dev/vmware/vmci/vmci_queue_pair.c @@ -74,8 +74,6 @@ static int vmci_queue_pair_alloc_guest_work(struct vmci_handle *handle, static int vmci_queue_pair_detach_guest_work(struct vmci_handle handle); static int vmci_queue_pair_detach_hypercall(struct vmci_handle handle); -extern int vmci_send_datagram(struct vmci_datagram *); - /* *------------------------------------------------------------------------------ * -- cgit v1.3