check_format.sh: remove "rte_vhost" exclusions

This was a remnant from ages ago when we had rte_vhost
DPDK code copied into our repo.  We actually have a file
named rte_vhost_user.c which is not DPDK code that was
getting excluded from astyle checking.

So this also includes the astyle violations that had
crept into this file.  In a couple of places, change
the enum return type to int, this reduces astyle
confusion on function and if brace style.

Same applies to POSIX include checking - we don't need
to exclude rte_vhost_user.c from this either.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If3a25011ad54c694c15a91f7be66d862c765c5db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14688
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2022-09-26 23:37:43 +00:00 committed by Tomasz Zawadzki
parent 13c7a98d33
commit 25f89bd584
2 changed files with 49 additions and 44 deletions

View File

@ -60,7 +60,8 @@ to_user_dev(struct spdk_vhost_dev *vdev)
return vdev->ctxt;
}
static void __attribute__((constructor))
static void
__attribute__((constructor))
_vhost_user_sem_init(void)
{
if (sem_init(&g_dpdk_sem, 0, 0) != 0) {
@ -69,13 +70,15 @@ _vhost_user_sem_init(void)
}
}
static void __attribute__((destructor))
static void
__attribute__((destructor))
_vhost_user_sem_destroy(void)
{
sem_destroy(&g_dpdk_sem);
}
void *vhost_gpa_to_vva(struct spdk_vhost_session *vsession, uint64_t addr, uint64_t len)
void *
vhost_gpa_to_vva(struct spdk_vhost_session *vsession, uint64_t addr, uint64_t len)
{
void *vva;
uint64_t newlen;
@ -817,24 +820,30 @@ vhost_memory_changed(struct rte_vhost_memory *new,
{
uint32_t i;
if (new->nregions != old->nregions)
if (new->nregions != old->nregions) {
return true;
}
for (i = 0; i < new->nregions; ++i) {
struct rte_vhost_mem_region *new_r = &new->regions[i];
struct rte_vhost_mem_region *old_r = &old->regions[i];
if (new_r->guest_phys_addr != old_r->guest_phys_addr)
if (new_r->guest_phys_addr != old_r->guest_phys_addr) {
return true;
if (new_r->size != old_r->size)
}
if (new_r->size != old_r->size) {
return true;
if (new_r->guest_user_addr != old_r->guest_user_addr)
}
if (new_r->guest_user_addr != old_r->guest_user_addr) {
return true;
if (new_r->mmap_addr != old_r->mmap_addr)
}
if (new_r->mmap_addr != old_r->mmap_addr) {
return true;
if (new_r->fd != old_r->fd)
}
if (new_r->fd != old_r->fd) {
return true;
}
}
return false;
}
@ -1451,7 +1460,7 @@ vhost_user_session_set_interrupt_mode(struct spdk_vhost_session *vsession, bool
}
static enum rte_vhost_msg_result
static int
extern_vhost_pre_msg_handler(int vid, void *_msg)
{
struct vhost_user_msg *msg = _msg;
@ -1559,7 +1568,7 @@ extern_vhost_pre_msg_handler(int vid, void *_msg)
return RTE_VHOST_MSG_RESULT_NOT_HANDLED;
}
static enum rte_vhost_msg_result
static int
extern_vhost_post_msg_handler(int vid, void *_msg)
{
struct vhost_user_msg *msg = _msg;
@ -1811,7 +1820,7 @@ vhost_user_dev_register(struct spdk_vhost_dev *vdev, const char *name, struct sp
if (snprintf(path, sizeof(path), "%s%s", g_vhost_user_dev_dirname, name) >= (int)sizeof(path)) {
SPDK_ERRLOG("Resulting socket path for controller %s is too long: %s%s\n",
name,g_vhost_user_dev_dirname, name);
name, g_vhost_user_dev_dirname, name);
return -EINVAL;
}

View File

@ -126,16 +126,12 @@ function check_c_style() {
else
rm -f astyle.log
touch astyle.log
# Exclude rte_vhost code imported from DPDK - we want to keep the original code
# as-is to enable ongoing work to synch with a generic upstream DPDK vhost library,
# rather than making diffs more complicated by a lot of changes to follow SPDK
# coding standards.
git ls-files '*.[ch]' \
| grep -v rte_vhost | grep -v cpp_headers \
| grep -v cpp_headers \
| xargs -P$(nproc) -n10 astyle --break-return-type --attach-return-type-decl \
--options=.astylerc >> astyle.log
git ls-files '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' \
| grep -v rte_vhost | grep -v cpp_headers \
| grep -v cpp_headers \
| xargs -P$(nproc) -n10 astyle --options=.astylerc >> astyle.log
if grep -q "^Formatted" astyle.log; then
echo " errors detected"
@ -274,7 +270,7 @@ function check_posix_includes() {
local rc=0
echo -n "Checking for POSIX includes..."
git grep -I -i -f scripts/posix.txt -- './*' ':!include/spdk/stdinc.h' ':!include/linux/**' ':!lib/rte_vhost*/**' ':!scripts/posix.txt' ':!*.patch' ':!configure' > scripts/posix.log || true
git grep -I -i -f scripts/posix.txt -- './*' ':!include/spdk/stdinc.h' ':!include/linux/**' ':!scripts/posix.txt' ':!*.patch' ':!configure' > scripts/posix.log || true
if [ -s scripts/posix.log ]; then
echo "POSIX includes detected. Please include spdk/stdinc.h instead."
cat scripts/posix.log