From 9fd924cb40e755f98d65c1e5504ed1a1a04d9ad3 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 24 Jan 2019 11:47:12 -0700 Subject: [PATCH] check_format: Verify #include syntax Change-Id: I63b877a6543293e1a5c349bcb4460b79c81ca8cd Signed-off-by: Ben Walker Reviewed-on: https://review.gerrithub.io/c/441968 Tested-by: SPDK CI Jenkins Reviewed-by: Paul Luse Reviewed-by: Shuhei Matsumoto Reviewed-by: Darek Stojaczyk Reviewed-by: Jim Harris Chandler-Test-Pool: SPDK Automated Test System --- include/spdk/ftl.h | 10 +++++----- include/spdk/queue.h | 2 +- lib/bdev/ftl/bdev_ftl.h | 8 ++++---- lib/bdev/ftl/bdev_ftl_rpc.c | 8 ++++---- lib/ftl/ftl_anm.c | 10 +++++----- lib/ftl/ftl_anm.h | 2 +- lib/ftl/ftl_init.c | 12 ++++++------ lib/ftl/ftl_reloc.c | 6 +++--- lib/ftl/ftl_reloc.h | 4 ++-- scripts/check_format.sh | 11 +++++++++++ 10 files changed, 42 insertions(+), 31 deletions(-) diff --git a/include/spdk/ftl.h b/include/spdk/ftl.h index 192431e93..0899b9e21 100644 --- a/include/spdk/ftl.h +++ b/include/spdk/ftl.h @@ -34,11 +34,11 @@ #ifndef SPDK_FTL_H #define SPDK_FTL_H -#include -#include -#include -#include -#include +#include "spdk/stdinc.h" +#include "spdk/nvme.h" +#include "spdk/nvme_ocssd.h" +#include "spdk/uuid.h" +#include "spdk/thread.h" struct spdk_ftl_dev; diff --git a/include/spdk/queue.h b/include/spdk/queue.h index d3d8615d4..a24dd0070 100644 --- a/include/spdk/queue.h +++ b/include/spdk/queue.h @@ -47,7 +47,7 @@ extern "C" { * Include a header with these additional features on Linux only. */ #ifndef __FreeBSD__ -#include +#include "spdk/queue_extras.h" #endif #ifdef __cplusplus diff --git a/lib/bdev/ftl/bdev_ftl.h b/lib/bdev/ftl/bdev_ftl.h index 8d6bdefb5..2f4a16ae9 100644 --- a/lib/bdev/ftl/bdev_ftl.h +++ b/lib/bdev/ftl/bdev_ftl.h @@ -34,10 +34,10 @@ #ifndef SPDK_BDEV_FTL_H #define SPDK_BDEV_FTL_H -#include -#include -#include -#include +#include "spdk/stdinc.h" +#include "spdk/nvme.h" +#include "spdk/bdev_module.h" +#include "spdk/ftl.h" #define FTL_MAX_CONTROLLERS 64 #define FTL_MAX_BDEVS (FTL_MAX_CONTROLLERS * 128) diff --git a/lib/bdev/ftl/bdev_ftl_rpc.c b/lib/bdev/ftl/bdev_ftl_rpc.c index e7a250531..e7a89b7e1 100644 --- a/lib/bdev/ftl/bdev_ftl_rpc.c +++ b/lib/bdev/ftl/bdev_ftl_rpc.c @@ -31,10 +31,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include +#include "spdk/rpc.h" +#include "spdk/util.h" +#include "spdk/bdev_module.h" +#include "spdk_internal/log.h" #include "bdev_ftl.h" struct rpc_construct_ftl { diff --git a/lib/ftl/ftl_anm.c b/lib/ftl/ftl_anm.c index 8f6004e9b..58b6fe745 100644 --- a/lib/ftl/ftl_anm.c +++ b/lib/ftl/ftl_anm.c @@ -31,11 +31,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include -#include +#include "spdk/stdinc.h" +#include "spdk/nvme_spec.h" +#include "spdk/nvme_ocssd_spec.h" +#include "spdk/thread.h" +#include "spdk/ftl.h" #include "ftl_anm.h" #include "ftl_core.h" diff --git a/lib/ftl/ftl_anm.h b/lib/ftl/ftl_anm.h index acf685a0a..54acc9f2d 100644 --- a/lib/ftl/ftl_anm.h +++ b/lib/ftl/ftl_anm.h @@ -34,7 +34,7 @@ #ifndef FTL_ANM_H #define FTL_ANM_H -#include +#include "spdk/thread.h" #include "ftl_ppa.h" struct ftl_nvme_ctrlr; diff --git a/lib/ftl/ftl_init.c b/lib/ftl/ftl_init.c index bec072ad8..4cb0c928c 100644 --- a/lib/ftl/ftl_init.c +++ b/lib/ftl/ftl_init.c @@ -31,12 +31,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include -#include -#include +#include "spdk/stdinc.h" +#include "spdk/nvme.h" +#include "spdk/io_channel.h" +#include "spdk/bdev_module.h" +#include "spdk_internal/log.h" +#include "spdk/ftl.h" #include "ftl_core.h" #include "ftl_anm.h" #include "ftl_io.h" diff --git a/lib/ftl/ftl_reloc.c b/lib/ftl/ftl_reloc.c index f07a92d5d..e9167ed7f 100644 --- a/lib/ftl/ftl_reloc.c +++ b/lib/ftl/ftl_reloc.c @@ -31,9 +31,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include +#include "spdk/likely.h" +#include "spdk_internal/log.h" +#include "spdk/ftl.h" #include "ftl_reloc.h" #include "ftl_core.h" #include "ftl_io.h" diff --git a/lib/ftl/ftl_reloc.h b/lib/ftl/ftl_reloc.h index b3b459b55..fa50b8e1f 100644 --- a/lib/ftl/ftl_reloc.h +++ b/lib/ftl/ftl_reloc.h @@ -34,8 +34,8 @@ #ifndef FTL_RELOC_H #define FTL_RELOC_H -#include -#include +#include "spdk/stdinc.h" +#include "spdk/ftl.h" struct ftl_reloc; struct ftl_band; diff --git a/scripts/check_format.sh b/scripts/check_format.sh index fee080384..a38579f8b 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -180,6 +180,17 @@ else fi rm -f scripts/posix.log +echo -n "Checking #include style..." +git grep -I -i --line-number "#include scripts/includes.log || true +if [ -s scripts/includes.log ]; then + echo "Incorrect #include syntax. #includes of spdk/ files should use quotes." + cat scripts/includes.log + rc=1 +else + echo " OK" +fi +rm -f scripts/includes.log + if hash pycodestyle 2>/dev/null; then PEP8=pycodestyle elif hash pep8 2>/dev/null; then