From 9ed4c9e8c86ec04cbae067db18e1d31dd5f2ca79 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 23 Mar 2021 15:30:25 +0000 Subject: add -Wmissing-declarations (#399) This is used by SPDK, and it's generally useful. This also uncovered some issues in the test mocking. Signed-off-by: John Levon Reviewed-by: Swapnil Ingle --- samples/gpio-pci-idio-16.c | 2 +- samples/server.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'samples') diff --git a/samples/gpio-pci-idio-16.c b/samples/gpio-pci-idio-16.c index b52eafb..26ac62a 100644 --- a/samples/gpio-pci-idio-16.c +++ b/samples/gpio-pci-idio-16.c @@ -55,7 +55,7 @@ _log(vfu_ctx_t *vfu_ctx UNUSED, UNUSED int level, char const *msg) static int pin; bool dirty = true; -ssize_t +static ssize_t bar2_access(vfu_ctx_t *vfu_ctx UNUSED, char * const buf, size_t count, loff_t offset, const bool is_write) { diff --git a/samples/server.c b/samples/server.c index cb966f5..ecf5c49 100644 --- a/samples/server.c +++ b/samples/server.c @@ -86,7 +86,7 @@ arm_timer(vfu_ctx_t *vfu_ctx, time_t t) return 0; } -ssize_t +static ssize_t bar0_access(vfu_ctx_t *vfu_ctx, char * const buf, size_t count, loff_t offset, const bool is_write) { @@ -115,7 +115,7 @@ bar0_access(vfu_ctx_t *vfu_ctx, char * const buf, size_t count, loff_t offset, return count; } -ssize_t +static ssize_t bar1_access(vfu_ctx_t *vfu_ctx, char * const buf, size_t count, loff_t offset, const bool is_write) @@ -190,7 +190,8 @@ unmap_dma(vfu_ctx_t *vfu_ctx, uint64_t iova, uint64_t len) return -EINVAL; } -void get_md5sum(unsigned char *buf, int len, unsigned char *md5sum) +static void +get_md5sum(unsigned char *buf, int len, unsigned char *md5sum) { MD5_CTX ctx; @@ -401,14 +402,16 @@ migration_data_written(UNUSED vfu_ctx_t *vfu_ctx, UNUSED __u64 count) return 0; } -size_t +static size_t nr_pages(size_t size) { - return (size / sysconf(_SC_PAGE_SIZE) + (size % sysconf(_SC_PAGE_SIZE) > 1)); + return (size / sysconf(_SC_PAGE_SIZE) + + (size % sysconf(_SC_PAGE_SIZE) > 1)); } -size_t -page_align(size_t size) { +static size_t +page_align(size_t size) +{ return nr_pages(size) * sysconf(_SC_PAGE_SIZE); } -- cgit v1.1