cleanup duplicate includes
Subsystems (2)
cover cleanup duplicate includes
Using a simple script (in first patch), discovered that there was lots of #include file sloppiness in DPDK. This patch series fixes everything but base drivers and examples.
Stephen Hemminger (19):
devtools: add simple script to find duplicate includes
eal: remove duplicate includes
cmdline: remove duplicate include of errno.h
distributor: remove duplicate include of rte_compat.h
lpm: remove duplicate include of errno.h
cuckoo_hash: remove duplicate include of rte_log.h
timer: remove duplicate include of rte_per_lcore.h
bnxt: remove duplicate include of unistd.h
ixgbe: remove duplicate include of rte_atomic.h
i40e: remove duplicate include of rte_atomic.h
virtio: remove duplicated includes
cxgbe: remove duplicated includes
vmxnet3: remove duplicated include of rte_atomic.h
dpaa2: remove duplicated includes
fsmlc: remove duplicated includes
app/proc-info: remove duplicate include
app/test-pmd: remove duplicate includes test/test-pipeline: remove duplicate include of rte_per_lcore.h test/test: remove duplicate includes
app/proc_info/main.c | 1 - app/test-pmd/cmdline.c | 1 - app/test-pmd/config.c | 1 - app/test-pmd/csumonly.c | 2 - app/test-pmd/flowgen.c | 1 - app/test-pmd/iofwd.c | 1 - app/test-pmd/macfwd.c | 1 - app/test-pmd/macswap.c | 1 - app/test-pmd/parameters.c | 1 - app/test-pmd/rxonly.c | 1 - app/test-pmd/txonly.c | 2 - devtools/dup_include.pl | 64 ++++++++++++++++++++++++ drivers/bus/fslmc/fslmc_vfio.c | 2 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/event/dpaa2/dpaa2_eventdev.c | 1 - drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 1 - drivers/net/bnxt/bnxt_hwrm.c | 2 - drivers/net/cxgbe/cxgbe_ethdev.c | 1 - drivers/net/cxgbe/cxgbe_main.c | 1 - drivers/net/cxgbe/sge.c | 1 - drivers/net/dpaa2/dpaa2_ethdev.c | 1 - drivers/net/dpaa2/dpaa2_rxtx.c | 1 - drivers/net/i40e/i40e_ethdev_vf.c | 1 - drivers/net/ixgbe/ixgbe_ethdev.c | 1 - drivers/net/ixgbe/ixgbe_flow.c | 1 - drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 - lib/librte_cmdline/cmdline_parse_etheraddr.c | 1 - lib/librte_distributor/rte_distributor.c | 1 - lib/librte_eal/bsdapp/eal/eal.c | 2 - lib/librte_eal/bsdapp/eal/eal_pci.c | 2 - lib/librte_eal/bsdapp/eal/eal_thread.c | 1 - lib/librte_eal/common/eal_common_dev.c | 1 - lib/librte_eal/common/eal_common_tailqs.c | 1 - lib/librte_eal/common/rte_keepalive.c | 1 - lib/librte_eal/linuxapp/eal/eal.c | 2 - lib/librte_eal/linuxapp/eal/eal_memory.c | 2 - lib/librte_eal/linuxapp/eal/eal_thread.c | 1 - lib/librte_eal/linuxapp/eal/eal_xen_memory.c | 2 - lib/librte_hash/rte_cuckoo_hash.c | 1 - lib/librte_lpm/rte_lpm.c | 1 - lib/librte_lpm/rte_lpm6.c | 1 - lib/librte_timer/rte_timer.c | 1 - test/test-pipeline/config.c | 1 - test/test-pipeline/init.c | 1 - test/test-pipeline/main.c | 1 - test/test-pipeline/runtime.c | 2 - test/test/test_alarm.c | 1 - test/test/test_atomic.c | 1 - test/test/test_eal_flags.c | 1 - test/test/test_malloc.c | 1 - test/test/test_mbuf.c | 1 - test/test/test_mp_secondary.c | 4 -- test/test/test_per_lcore.c | 1 - test/test/test_ring.c | 1 - test/test/test_rwlock.c | 1 - test/test/test_spinlock.c | 1 - 58 files changed, 64 insertions(+), 70 deletions(-) create mode 100755 devtools/dup_include.pl
Signature · 1 line
2.11.0
PATCH 1/19 devtools: add simple script to find duplicate includes
This is just a simple check script to find obvious duplications.
--- devtools/dup_include.pl | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 devtools/dup_include.pl
devtools/dup_include.pl new file +64 -0
@@ -0,0 +1,64 @@ +#! /usr/bin/env perl + +# BSD LICENSE +# +# Copyright 2016 Stephen Hemminger <[email protected]> +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND S.A. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Examine files looking for duplicate references to the +# same include file. +# +# Usage: dup_include.pl foo.c bar.c +# + +use strict; +use warnings; + +die "no input files'n" + if ($#ARGV < 0); + +foreach my $filename (@ARGV) { + open my $f, '<', $filename + or die "$filename: $!\n"; + + my %included; + my $lineno = 0; + + while (<$f>) { + ++$lineno; + next unless /^#include\s+<(.+)>$/; + + my $h = $1; + warn "$filename:$lineno duplicate include $h\n" + if $included{$h}; + + $included{$h} = 1; + } + + close $f; +}
Signature · 1 line
2.11.0
PATCH 2/19 eal: remove duplicate includes
In reply to Stephen HemmingerInclude files only need to be refrenced once per file.
--- lib/librte_eal/bsdapp/eal/eal.c | 2 -- lib/librte_eal/bsdapp/eal/eal_pci.c | 2 -- lib/librte_eal/bsdapp/eal/eal_thread.c | 1 - lib/librte_eal/common/eal_common_dev.c | 1 - lib/librte_eal/common/eal_common_tailqs.c | 1 - lib/librte_eal/common/rte_keepalive.c | 1 - lib/librte_eal/linuxapp/eal/eal.c | 2 -- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 -- lib/librte_eal/linuxapp/eal/eal_thread.c | 1 - lib/librte_eal/linuxapp/eal/eal_xen_memory.c | 2 -- 10 files changed, 15 deletions(-)
lib/librte_eal/bsdapp/eal/eal.c +0 -2
@@ -45,7 +45,6 @@#include <stddef.h> #include <errno.h> #include <limits.h> -#include <errno.h> #include <sys/mman.h> #include <sys/queue.h>
@@ -69,7 +68,6 @@#include <rte_pci.h> #include <rte_dev.h> #include <rte_devargs.h> -#include <rte_common.h> #include <rte_version.h> #include <rte_atomic.h> #include <malloc_heap.h>
lib/librte_eal/bsdapp/eal/eal_pci.c +0 -2
@@ -41,7 +41,6 @@#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <stdarg.h> #include <errno.h> #include <dirent.h> #include <limits.h>
@@ -52,7 +51,6 @@#include <dev/pci/pcireg.h> #if defined(RTE_ARCH_X86 ) -#include <sys/types.h> #include <machine/cpufunc.h> #endif
lib/librte_eal/bsdapp/eal/eal_thread.c +0 -1
@@ -49,7 +49,6 @@#include <rte_memzone.h> #include <rte_per_lcore.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include "eal_private.h"
lib/librte_eal/common/eal_common_dev.c +0 -1
@@ -41,7 +41,6 @@#include <rte_dev.h> #include <rte_devargs.h> #include <rte_debug.h> -#include <rte_devargs.h> #include <rte_log.h> #include "eal_private.h"
lib/librte_eal/common/eal_common_tailqs.c +0 -1
@@ -46,7 +46,6 @@#include <rte_eal_memconfig.h> #include <rte_per_lcore.h> #include <rte_lcore.h> -#include <rte_memory.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> #include <rte_log.h>
lib/librte_eal/common/rte_keepalive.c +0 -1
@@ -38,7 +38,6 @@#include <rte_log.h> #include <rte_keepalive.h> #include <rte_malloc.h> -#include <rte_cycles.h> struct rte_keepalive {/** Core Liveness. */
lib/librte_eal/linuxapp/eal/eal.c +0 -2
@@ -46,7 +46,6 @@#include <stddef.h> #include <errno.h> #include <limits.h> -#include <errno.h> #include <sys/mman.h> #include <sys/queue.h> #include <sys/stat.h>
@@ -74,7 +73,6 @@#include <rte_pci.h> #include <rte_dev.h> #include <rte_devargs.h> -#include <rte_common.h> #include <rte_version.h> #include <rte_atomic.h> #include <malloc_heap.h>
lib/librte_eal/linuxapp/eal/eal_memory.c +0 -2
@@ -41,7 +41,6 @@#include <stdint.h> #include <inttypes.h> #include <string.h> -#include <stdarg.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h>
@@ -49,7 +48,6 @@#include <sys/file.h> #include <unistd.h> #include <limits.h> -#include <errno.h> #include <sys/ioctl.h> #include <sys/time.h> #include <signal.h>
lib/librte_eal/linuxapp/eal/eal_thread.c +0 -1
@@ -49,7 +49,6 @@#include <rte_memzone.h> #include <rte_per_lcore.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include "eal_private.h"
lib/librte_eal/linuxapp/eal/eal_xen_memory.c +0 -2
@@ -38,7 +38,6 @@#include <stdint.h> #include <inttypes.h> #include <string.h> -#include <stdarg.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h>
@@ -46,7 +45,6 @@#include <sys/file.h> #include <unistd.h> #include <limits.h> -#include <errno.h> #include <sys/ioctl.h> #include <sys/time.h>
Signature · 1 line
2.11.0
PATCH 3/19 cmdline: remove duplicate include of errno.h
In reply to Stephen Hemminger--- lib/librte_cmdline/cmdline_parse_etheraddr.c | 1 - 1 file changed, 1 deletion(-)
lib/librte_cmdline/cmdline_parse_etheraddr.c +0 -1
@@ -65,7 +65,6 @@#include <inttypes.h> #include <ctype.h> #include <string.h> -#include <errno.h> #include <sys/types.h> #include <net/ethernet.h>
Signature · 1 line
2.11.0
PATCH 4/19 distributor: remove duplicate include of rte_compat.h
In reply to Stephen Hemminger--- lib/librte_distributor/rte_distributor.c | 1 - 1 file changed, 1 deletion(-)
lib/librte_distributor/rte_distributor.c +0 -1
@@ -41,7 +41,6 @@#include <rte_errno.h> #include <rte_string_fns.h> #include <rte_eal_memconfig.h> -#include <rte_compat.h> #include <rte_pause.h> #include "rte_distributor_private.h"
Signature · 1 line
2.11.0
PATCH 5/19 lpm: remove duplicate include of errno.h
In reply to Stephen Hemminger--- lib/librte_lpm/rte_lpm.c | 1 - lib/librte_lpm/rte_lpm6.c | 1 - 2 files changed, 2 deletions(-)
lib/librte_lpm/rte_lpm.c +0 -1
@@ -36,7 +36,6 @@#include <errno.h> #include <stdarg.h> #include <stdio.h> -#include <errno.h> #include <sys/queue.h> #include <rte_log.h>
lib/librte_lpm/rte_lpm6.c +0 -1
@@ -35,7 +35,6 @@#include <errno.h> #include <stdarg.h> #include <stdio.h> -#include <errno.h> #include <sys/queue.h> #include <rte_log.h>
Signature · 1 line
2.11.0
PATCH 6/19 cuckoo_hash: remove duplicate include of rte_log.h
In reply to Stephen Hemminger--- lib/librte_hash/rte_cuckoo_hash.c | 1 - 1 file changed, 1 deletion(-)
lib/librte_hash/rte_cuckoo_hash.c +0 -1
@@ -52,7 +52,6 @@#include <rte_errno.h> #include <rte_string_fns.h> #include <rte_cpuflags.h> -#include <rte_log.h> #include <rte_rwlock.h> #include <rte_spinlock.h> #include <rte_ring.h>
Signature · 1 line
2.11.0
PATCH 7/19 timer: remove duplicate include of rte_per_lcore.h
In reply to Stephen Hemminger--- lib/librte_timer/rte_timer.c | 1 - 1 file changed, 1 deletion(-)
lib/librte_timer/rte_timer.c +0 -1
@@ -46,7 +46,6 @@#include <rte_memzone.h> #include <rte_launch.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_branch_prediction.h> #include <rte_spinlock.h>
Signature · 1 line
2.11.0
PATCH 8/19 bnxt: remove duplicate include of unistd.h
In reply to Stephen Hemminger--- drivers/net/bnxt/bnxt_hwrm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/bnxt/bnxt_hwrm.c +0 -2
@@ -33,8 +33,6 @@#include <unistd.h> -#include <unistd.h> -#include <rte_byteorder.h> #include <rte_common.h> #include <rte_cycles.h>
Signature · 1 line
2.11.0
PATCH 9/19 ixgbe: remove duplicate include of rte_atomic.h
In reply to Stephen Hemminger--- drivers/net/ixgbe/ixgbe_ethdev.c | 1 - drivers/net/ixgbe/ixgbe_flow.c | 1 - 2 files changed, 2 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -1
@@ -57,7 +57,6 @@#include <rte_ether.h> #include <rte_ethdev.h> #include <rte_ethdev_pci.h> -#include <rte_atomic.h> #include <rte_malloc.h> #include <rte_random.h> #include <rte_dev.h>
drivers/net/ixgbe/ixgbe_flow.c +0 -1
@@ -56,7 +56,6 @@#include <rte_alarm.h> #include <rte_ether.h> #include <rte_ethdev.h> -#include <rte_atomic.h> #include <rte_malloc.h> #include <rte_random.h> #include <rte_dev.h>
Signature · 1 line
2.11.0
PATCH 10/19 i40e: remove duplicate include of rte_atomic.h
In reply to Stephen Hemminger--- drivers/net/i40e/i40e_ethdev_vf.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/i40e/i40e_ethdev_vf.c +0 -1
@@ -56,7 +56,6 @@#include <rte_ether.h> #include <rte_ethdev.h> #include <rte_ethdev_pci.h> -#include <rte_atomic.h> #include <rte_malloc.h> #include <rte_dev.h>
Signature · 1 line
2.11.0
PATCH 11/19 virtio: remove duplicated includes
In reply to Stephen Hemminger--- drivers/net/virtio/virtio_user/virtio_user_dev.c | 1 - drivers/net/virtio/virtio_user_ethdev.c | 1 - 2 files changed, 2 deletions(-)
drivers/net/virtio/virtio_user/virtio_user_dev.c +0 -1
@@ -41,7 +41,6 @@#include <sys/eventfd.h> #include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> #include "vhost.h" #include "virtio_user_dev.h"
drivers/net/virtio/virtio_user_ethdev.c +0 -1
@@ -35,7 +35,6 @@#include <sys/types.h> #include <unistd.h> #include <fcntl.h> -#include <sys/types.h> #include <sys/socket.h> #include <rte_malloc.h>
Signature · 1 line
2.11.0
PATCH 12/19 cxgbe: remove duplicated includes
In reply to Stephen Hemminger--- drivers/net/cxgbe/cxgbe_ethdev.c | 1 - drivers/net/cxgbe/cxgbe_main.c | 1 - drivers/net/cxgbe/sge.c | 1 - 3 files changed, 3 deletions(-)
drivers/net/cxgbe/cxgbe_ethdev.c +0 -1
@@ -58,7 +58,6 @@#include <rte_ether.h> #include <rte_ethdev.h> #include <rte_ethdev_pci.h> -#include <rte_atomic.h> #include <rte_malloc.h> #include <rte_random.h> #include <rte_dev.h>
drivers/net/cxgbe/cxgbe_main.c +0 -1
@@ -58,7 +58,6 @@#include <rte_ether.h> #include <rte_ethdev.h> #include <rte_ethdev_pci.h> -#include <rte_atomic.h> #include <rte_malloc.h> #include <rte_random.h> #include <rte_dev.h>
drivers/net/cxgbe/sge.c +0 -1
@@ -57,7 +57,6 @@#include <rte_alarm.h> #include <rte_ether.h> #include <rte_ethdev.h> -#include <rte_atomic.h> #include <rte_malloc.h> #include <rte_random.h> #include <rte_dev.h>
Signature · 1 line
2.11.0
PATCH 13/19 vmxnet3: remove duplicated include of rte_atomic.h
In reply to Stephen Hemminger--- drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/vmxnet3/vmxnet3_ethdev.c +0 -1
@@ -57,7 +57,6 @@#include <rte_ether.h> #include <rte_ethdev.h> #include <rte_ethdev_pci.h> -#include <rte_atomic.h> #include <rte_string_fns.h> #include <rte_malloc.h> #include <rte_dev.h>
Signature · 1 line
2.11.0
PATCH 14/19 dpaa2: remove duplicated includes
In reply to Stephen Hemminger--- drivers/event/dpaa2/dpaa2_eventdev.c | 1 - drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 1 - drivers/net/dpaa2/dpaa2_ethdev.c | 1 - drivers/net/dpaa2/dpaa2_rxtx.c | 1 - 4 files changed, 4 deletions(-)
drivers/event/dpaa2/dpaa2_eventdev.c +0 -1
@@ -36,7 +36,6 @@#include <errno.h> #include <stdint.h> #include <string.h> -#include <stdint.h> #include <sys/epoll.h> #include <rte_atomic.h>
drivers/mempool/dpaa2/dpaa2_hw_mempool.c +0 -1
@@ -47,7 +47,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <fslmc_logs.h> #include <mc/fsl_dpbp.h>
drivers/net/dpaa2/dpaa2_ethdev.c +0 -1
@@ -42,7 +42,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <rte_fslmc.h> #include <fslmc_logs.h>
drivers/net/dpaa2/dpaa2_rxtx.c +0 -1
@@ -40,7 +40,6 @@#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <fslmc_logs.h> #include <fslmc_vfio.h>
Signature · 1 line
2.11.0
PATCH 15/19 fsmlc: remove duplicated includes
In reply to Stephen Hemminger--- drivers/bus/fslmc/fslmc_vfio.c | 2 -- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - 2 files changed, 3 deletions(-)
drivers/bus/fslmc/fslmc_vfio.c +0 -2
@@ -40,7 +40,6 @@#include <errno.h> #include <sys/ioctl.h> #include <sys/stat.h> -#include <sys/types.h> #include <sys/mman.h> #include <sys/vfs.h> #include <libgen.h>
@@ -55,7 +54,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <rte_bus.h> #include "rte_fslmc.h"
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +0 -1
@@ -57,7 +57,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <fslmc_logs.h> #include <fslmc_vfio.h>
Signature · 1 line
2.11.0
PATCH 16/19 app/proc-info: remove duplicate include
In reply to Stephen Hemminger--- app/proc_info/main.c | 1 - 1 file changed, 1 deletion(-)
app/proc_info/main.c +0 -1
@@ -53,7 +53,6 @@#include <rte_tailq.h> #include <rte_per_lcore.h> #include <rte_lcore.h> -#include <rte_debug.h> #include <rte_log.h> #include <rte_atomic.h> #include <rte_branch_prediction.h>
Signature · 1 line
2.11.0
PATCH 17/19 app/test-pmd: remove duplicate includes
In reply to Stephen Hemminger--- app/test-pmd/cmdline.c | 1 - app/test-pmd/config.c | 1 - app/test-pmd/csumonly.c | 2 -- app/test-pmd/flowgen.c | 1 - app/test-pmd/iofwd.c | 1 - app/test-pmd/macfwd.c | 1 - app/test-pmd/macswap.c | 1 - app/test-pmd/parameters.c | 1 - app/test-pmd/rxonly.c | 1 - app/test-pmd/txonly.c | 2 -- 10 files changed, 12 deletions(-)
app/test-pmd/cmdline.c +0 -1
@@ -36,7 +36,6 @@#include <errno.h> #include <stdio.h> #include <stdint.h> -#include <stdarg.h> #include <string.h> #include <termios.h> #include <unistd.h>
app/test-pmd/config.c +0 -1
@@ -36,7 +36,6 @@#include <errno.h> #include <stdio.h> #include <string.h> -#include <stdarg.h> #include <stdint.h> #include <inttypes.h>
app/test-pmd/csumonly.c +0 -2
@@ -56,10 +56,8 @@#include <rte_lcore.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> -#include <rte_memory.h> #include <rte_mempool.h> #include <rte_mbuf.h> -#include <rte_memcpy.h> #include <rte_interrupts.h> #include <rte_pci.h> #include <rte_ether.h>
app/test-pmd/flowgen.c +0 -1
@@ -57,7 +57,6 @@#include <rte_lcore.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> -#include <rte_memory.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_interrupts.h>
app/test-pmd/iofwd.c +0 -1
@@ -55,7 +55,6 @@#include <rte_lcore.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> -#include <rte_memory.h> #include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h>
app/test-pmd/macfwd.c +0 -1
@@ -56,7 +56,6 @@#include <rte_lcore.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> -#include <rte_memory.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_interrupts.h>
app/test-pmd/macswap.c +0 -1
@@ -56,7 +56,6 @@#include <rte_lcore.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> -#include <rte_memory.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_interrupts.h>
app/test-pmd/parameters.c +0 -1
@@ -41,7 +41,6 @@#include <time.h> #include <fcntl.h> #include <sys/types.h> -#include <errno.h> #include <sys/queue.h> #include <sys/stat.h>
app/test-pmd/rxonly.c +0 -1
@@ -56,7 +56,6 @@#include <rte_lcore.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> -#include <rte_memory.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_interrupts.h>
app/test-pmd/txonly.c +0 -2
@@ -56,10 +56,8 @@#include <rte_lcore.h> #include <rte_atomic.h> #include <rte_branch_prediction.h> -#include <rte_memory.h> #include <rte_mempool.h> #include <rte_mbuf.h> -#include <rte_memcpy.h> #include <rte_interrupts.h> #include <rte_pci.h> #include <rte_ether.h>
Signature · 1 line
2.11.0
PATCH 18/19 test/test-pipeline: remove duplicate include of rte_per_lcore.h
In reply to Stephen Hemminger--- test/test-pipeline/config.c | 1 - test/test-pipeline/init.c | 1 - test/test-pipeline/main.c | 1 - test/test-pipeline/runtime.c | 2 -- 4 files changed, 5 deletions(-)
test/test-pipeline/config.c +0 -1
@@ -55,7 +55,6 @@#include <rte_cycles.h> #include <rte_prefetch.h> #include <rte_lcore.h> -#include <rte_per_lcore.h> #include <rte_branch_prediction.h> #include <rte_interrupts.h> #include <rte_pci.h>
test/test-pipeline/init.c +0 -1
@@ -55,7 +55,6 @@#include <rte_cycles.h> #include <rte_prefetch.h> #include <rte_lcore.h> -#include <rte_per_lcore.h> #include <rte_branch_prediction.h> #include <rte_interrupts.h> #include <rte_pci.h>
test/test-pipeline/main.c +0 -1
@@ -56,7 +56,6 @@#include <rte_cycles.h> #include <rte_prefetch.h> #include <rte_lcore.h> -#include <rte_per_lcore.h> #include <rte_branch_prediction.h> #include <rte_interrupts.h> #include <rte_pci.h>
test/test-pipeline/runtime.c +0 -2
@@ -54,8 +54,6 @@#include <rte_atomic.h> #include <rte_cycles.h> #include <rte_prefetch.h> -#include <rte_lcore.h> -#include <rte_per_lcore.h> #include <rte_branch_prediction.h> #include <rte_interrupts.h> #include <rte_pci.h>
Signature · 1 line
2.11.0
PATCH 19/19 test/test: remove duplicate includes
In reply to Stephen Hemminger--- test/test/test_alarm.c | 1 - test/test/test_atomic.c | 1 - test/test/test_eal_flags.c | 1 - test/test/test_malloc.c | 1 - test/test/test_mbuf.c | 1 - test/test/test_mp_secondary.c | 4 ---- test/test/test_per_lcore.c | 1 - test/test/test_ring.c | 1 - test/test/test_rwlock.c | 1 - test/test/test_spinlock.c | 1 - 10 files changed, 13 deletions(-)
test/test/test_alarm.c +0 -1
@@ -37,7 +37,6 @@#include <rte_common.h> #include <rte_cycles.h> #include <rte_interrupts.h> -#include <rte_common.h> #include <rte_atomic.h> #include <rte_alarm.h>
test/test/test_atomic.c +0 -1
@@ -42,7 +42,6 @@#include <rte_launch.h> #include <rte_atomic.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include "test.h"
test/test/test_eal_flags.c +0 -1
@@ -38,7 +38,6 @@#include <string.h> #include <stdarg.h> #include <libgen.h> -#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h>
test/test/test_malloc.c +0 -1
@@ -45,7 +45,6 @@#include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_malloc.h> #include <rte_cycles.h>
test/test/test_mbuf.c +0 -1
@@ -43,7 +43,6 @@#include <rte_common.h> #include <rte_debug.h> #include <rte_log.h> -#include <rte_common.h> #include <rte_memory.h> #include <rte_memcpy.h> #include <rte_memzone.h>
test/test/test_mp_secondary.c +0 -4
@@ -41,11 +41,7 @@#include <inttypes.h> #include <sys/queue.h> #include <errno.h> -#include <stdarg.h> -#include <inttypes.h> #include <string.h> -#include <stdlib.h> -#include <stdarg.h> #include <unistd.h> #include <sys/wait.h> #include <libgen.h>
test/test/test_per_lcore.c +0 -1
@@ -41,7 +41,6 @@#include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_cycles.h>
test/test/test_ring.c +0 -1
@@ -54,7 +54,6 @@#include <rte_malloc.h> #include <rte_ring.h> #include <rte_random.h> -#include <rte_common.h> #include <rte_errno.h> #include <rte_hexdump.h>
test/test/test_rwlock.c +0 -1
@@ -44,7 +44,6 @@#include <rte_atomic.h> #include <rte_rwlock.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_cycles.h>
test/test/test_spinlock.c +0 -1
@@ -44,7 +44,6 @@#include <rte_per_lcore.h> #include <rte_launch.h> #include <rte_eal.h> -#include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_cycles.h> #include <rte_spinlock.h>
Signature · 1 line
2.11.0
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
In reply to Stephen HemmingerHi Stephen,
11/07/2017 20:55, Stephen Hemminger:
Quoted 7 lines
This is just a simple check script to find obvious duplications.
Signed-off-by Stephen Hemminger <[email protected]>--- devtools/dup_include.pl | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 devtools/dup_include.pl
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)
I would like to propose this shell script:
dirs='app buildtools drivers examples lib test' pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'
for file in $(git ls $dirs) ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d)
[ -n "$dups" ] || continue
echo "$file"
echo "$dups" | sed 's,^,\t,'done
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
Quoted 21 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Hi Stephen,
11/07/2017 20:55, Stephen Hemminger:
Quoted 7 lines
This is just a simple check script to find obvious duplications.
Signed-off-by Stephen Hemminger <[email protected]>--- devtools/dup_include.pl | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 devtools/dup_include.plThank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
dirs='app buildtools drivers examples lib test' pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'
Quoted 6 lines
for file in $(git ls $dirs) ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -n "$dups" ] || continue echo "$file" echo "$dups" | sed 's,^,\t,'done
Sorry, it is quick and easy. After all it is optional, just like coccinelle and not part of the build. Plus checkpatch is in Perl.
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
12/07/2017 01:05, Stephen Hemminger:
Quoted 31 lines
Quoted 21 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Hi Stephen,
11/07/2017 20:55, Stephen Hemminger:
Quoted 7 lines
This is just a simple check script to find obvious duplications.
Signed-off-by Stephen Hemminger <[email protected]>--- devtools/dup_include.pl | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 devtools/dup_include.plThank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
dirs='app buildtools drivers examples lib test' pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'
Quoted 6 lines
for file in $(git ls $dirs) ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -n "$dups" ] || continue echo "$file" echo "$dups" | sed 's,^,\t,'done
Quoted 2 lines
Sorry, it is quick and easy. After all it is optional, just like coccinelle and not part of the build. Plus checkpatch is in Perl.
checkpatch is not in the repository ;)
I prefer my shell script because
- I am able to maintain it
- the regexp is more tolerant with #include line
- it checks the whole repository
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
In reply to Thomas MonjalonQuoted 10 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
dirs='app buildtools drivers examples lib test' pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'
Quoted 6 lines
for file in $(git ls $dirs) ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -n "$dups" ] || continue echo "$file" echo "$dups" | sed 's,^,\t,'done
There is no "git ls" command in current version,
Using find instead works.
plus shell is 7x slower.
$ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" real 0m0.765s user 0m1.220s sys 0m0.155s $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" real 0m0.131s user 0m0.118s sys 0m0.014s
How about some python code.
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
12/07/2017 23:59, Stephen Hemminger:
Quoted 20 lines
Quoted 10 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
dirs='app buildtools drivers examples lib test' pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'
Quoted 6 lines
for file in $(git ls $dirs) ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -n "$dups" ] || continue echo "$file" echo "$dups" | sed 's,^,\t,'done
Quoted 3 lines
There is no "git ls" command in current version,
Using find instead works.
Yes, both work if specifying source code directories as above.
Quoted 10 lines
plus shell is 7x slower.
$ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" real 0m0.765s user 0m1.220s sys 0m0.155s $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" real 0m0.131s user 0m0.118s sys 0m0.014s
I don't think speed is really relevant here :)
Quoted 1 line
How about some python code.
I don't really care between shell or python.
I thought a shell script would be really concise
and without Python 2/3 compat issues.
Re: [PATCH 14/19] dpaa2: remove duplicated includes
In reply to Stephen HemmingerQuoted 50 lines · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>--- drivers/event/dpaa2/dpaa2_eventdev.c | 1 - drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 1 - drivers/net/dpaa2/dpaa2_ethdev.c | 1 - drivers/net/dpaa2/dpaa2_rxtx.c | 1 - 4 files changed, 4 deletions(-)drivers/event/dpaa2/dpaa2_eventdev.c +0
-1@@ -36,7 +36,6 @@#include <errno.h> #include <stdint.h> #include <string.h> -#include <stdint.h> #include <sys/epoll.h> #include <rte_atomic.h> drivers/mempool/dpaa2/dpaa2_hw_mempool.c +0
-1@@ -47,7 +47,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <fslmc_logs.h> #include <mc/fsl_dpbp.h> drivers/net/dpaa2/dpaa2_ethdev.c +0
-1@@ -42,7 +42,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <rte_fslmc.h> #include <fslmc_logs.h> drivers/net/dpaa2/dpaa2_rxtx.c +0
-0
drivers/net/dpaa2/dpaa2_rxtx.c line 45
Quoted 7 lines
drivers/net/dpaa2/dpaa2_rxtx.c +0
-1@@ -40,7 +40,6 @@#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <fslmc_logs.h> #include <fslmc_vfio.h>
Re: [PATCH 15/19] fsmlc: remove duplicated includes
In reply to Stephen HemmingerQuoted 32 lines · Stephen Hemminger
Signed-off-by Stephen Hemminger <[email protected]>--- drivers/bus/fslmc/fslmc_vfio.c | 2 -- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - 2 files changed, 3 deletions(-)drivers/bus/fslmc/fslmc_vfio.c +0
-2@@ -40,7 +40,6 @@#include <errno.h> #include <sys/ioctl.h> #include <sys/stat.h> -#include <sys/types.h> #include <sys/mman.h> #include <sys/vfs.h> #include <libgen.h> @@ -55,7 +54,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <rte_bus.h> #include "rte_fslmc.h" drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +0
-0
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c line 62
Quoted 7 lines
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +0
-1@@ -57,7 +57,6 @@#include <rte_cycles.h> #include <rte_kvargs.h> #include <rte_dev.h> -#include <rte_ethdev.h> #include <fslmc_logs.h> #include <fslmc_vfio.h>
minor typo in patch header %s/fsmlc/fslmc/g
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
In reply to Thomas MonjalonQuoted 24 lines · Thomas Monjalon
12/07/2017 23:59, Stephen Hemminger:
Quoted 20 lines
Quoted 16 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
dirs='app buildtools drivers examples lib test' pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'
for file in $(git ls $dirs) ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -n "$dups" ] || continue
echo "$file"
echo "$dups" | sed 's,^,\t,'
done
Quoted 5 lines
Quoted 3 lines
There is no "git ls" command in current version,
Using find instead works.
Yes, both work if specifying source code directories as above.
‘git ls’ I had to change it to ‘git ls-files’ to make it work. I think you have a git alias setup for ls-files.
Can this be added to the patch testing?
Quoted 12 lines
Quoted 11 lines
plus shell is 7x slower.
$ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" real 0m0.765s user 0m1.220s sys 0m0.155s $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" real 0m0.131s user 0m0.118s sys 0m0.014s
Quoted 7 lines
I don't think speed is really relevant here :)
Quoted 1 line
How about some python code.
I don't really care between shell or python.
I thought a shell script would be really concise
and without Python 2/3 compat issues.
Regards,
Keith
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
13/07/2017 14:19, Wiles, Keith:
Quoted 24 lines
Quoted 24 lines · Thomas Monjalon
12/07/2017 23:59, Stephen Hemminger:
Quoted 20 lines
Quoted 16 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
dirs='app buildtools drivers examples lib test' pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'
for file in $(git ls $dirs) ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -n "$dups" ] || continue
echo "$file"
echo "$dups" | sed 's,^,\t,'
done
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
There is no "git ls" command in current version,
Using find instead works.
Yes, both work if specifying source code directories as above.
‘git ls’ I had to change it to ‘git ls-files’ to make it work. I think you have a git alias setup for ls-files.
Ah yes, you're right!
Thanks, I has not well understood the original comment :)
Quoted 1 line
Can this be added to the patch testing?
Yes sure, I will do.
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
In reply to Thomas Monjalon13/07/2017 08:56, Thomas Monjalon:
Quoted 10 lines
12/07/2017 23:59, Stephen Hemminger:
Quoted 9 lines
Quoted 6 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
[...]
Quoted 12 lines
Quoted 11 lines
plus shell is 7x slower.
$ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" real 0m0.765s user 0m1.220s sys 0m0.155s $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" real 0m0.131s user 0m0.118s sys 0m0.014s
Quoted 1 line
I don't think speed is really relevant here :)
I did my own benchmark (recreation time):
# time sh -c 'for file in $(git ls-files app buildtools drivers examples lib test) ; do devtools/dup_include.pl $file ; done' 4,41s user 1,32s system 101% cpu 5,667 total # time devtools/check-duplicate-includes.sh 5,48s user 1,00s system 153% cpu 4,222 total
The shell version is reported as faster on my computer!
It is faster when filtering only .c and .h files:
for file in $(git ls-files '*.[ch]') ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d)
[ -z "$dups" ] || echo "$dups" | sed "s,^,$file: duplicated include: ,"done
# time sh -c 'for file in $(git ls-files "*.[ch]") ; do devtools/dup_include.pl $file ; done' 3,65s user 1,05s system 100% cpu 4,668 total # time devtools/check-duplicate-includes.sh 4,72s user 0,80s system 153% cpu 3,603 total
I prefer this version using only pipes, which is well parallelized:
for file in $(git ls-files '*.[ch]') ; do
sed -rn "s,$pattern,\1,p" $file | sort | uniq -d | sed "s,^,$file: duplicated include: ,"
done
7,40s user 1,49s system 231% cpu 3,847 total
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
14/07/2017 17:39, Thomas Monjalon:
Quoted 47 lines
13/07/2017 08:56, Thomas Monjalon:
Quoted 10 lines
12/07/2017 23:59, Stephen Hemminger:
Quoted 9 lines
Quoted 6 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
[...]
Quoted 12 lines
Quoted 11 lines
plus shell is 7x slower.
$ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" real 0m0.765s user 0m1.220s sys 0m0.155s $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" real 0m0.131s user 0m0.118s sys 0m0.014sQuoted 1 line
I don't think speed is really relevant here :)
I did my own benchmark (recreation time):
# time sh -c 'for file in $(git ls-files app buildtools drivers examples lib test) ; do devtools/dup_include.pl $file ; done' 4,41s user 1,32s system 101% cpu 5,667 total # time devtools/check-duplicate-includes.sh 5,48s user 1,00s system 153% cpu 4,222 totalThe shell version is reported as faster on my computer!
It is faster when filtering only .c and .h files:
for file in $(git ls-files '*.[ch]') ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d) [ -z "$dups" ] || echo "$dups" | sed "s,^,$file: duplicated include: ,"done
# time sh -c 'for file in $(git ls-files "*.[ch]") ; do devtools/dup_include.pl $file ; done' 3,65s user 1,05s system 100% cpu 4,668 total # time devtools/check-duplicate-includes.sh 4,72s user 0,80s system 153% cpu 3,603 total
Quoted 8 lines
I prefer this version using only pipes, which is well parallelized:
for file in $(git ls-files '*.[ch]') ; do
sed -rn "s,$pattern,\1,p" $file | sort | uniq -d | sed "s,^,$file: duplicated include: ,"
done7,40s user 1,49s system 231% cpu 3,847 total
And now, the big shell optimization:
export LC_ALL=C
Result is impressive:
2,99s user 0,72s system 258% cpu 1,436 total
I'm sure you will agree to integrate my version now :)
Re: [PATCH 01/19] devtools: add simple script to find duplicate includes
Quoted 58 lines · Thomas Monjalon
14/07/2017 17:39, Thomas Monjalon:
Quoted 54 lines
13/07/2017 08:56, Thomas Monjalon:
Quoted 10 lines
12/07/2017 23:59, Stephen Hemminger:
Quoted 9 lines
Quoted 6 lines · On Tue, 11 Jul 2017 22:33:55 +0200 Thomas Monjalon <[email protected]> wrote:
Thank you for this script, but... it is written in Perl! I don't think it is a good idea to add yet another language to DPDK. We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)I would like to propose this shell script:
[...]
Quoted 12 lines
Quoted 11 lines
plus shell is 7x slower.
$ time bash -c "find . -name '*.c' | xargs /tmp/dupinc.sh" real 0m0.765s user 0m1.220s sys 0m0.155s $time bash -c "find . -name '*.c' | xargs ~/bin/dup_inc.pl" real 0m0.131s user 0m0.118s sys 0m0.014sQuoted 1 line
I don't think speed is really relevant here :)
I did my own benchmark (recreation time):
# time sh -c 'for file in $(git ls-files app buildtools drivers examples lib test) ; do devtools/dup_include.pl $file ; done' 4,41s user 1,32s system 101% cpu 5,667 total # time devtools/check-duplicate-includes.sh 5,48s user 1,00s system 153% cpu 4,222 totalThe shell version is reported as faster on my computer!
It is faster when filtering only .c and .h files:
for file in $(git ls-files '*.[ch]') ; do
dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d)
[ -z "$dups" ] || echo "$dups" | sed "s,^,$file: duplicated include: ,"
done# time sh -c 'for file in $(git ls-files "*.[ch]") ; do devtools/dup_include.pl $file ; done' 3,65s user 1,05s system 100% cpu 4,668 total # time devtools/check-duplicate-includes.sh 4,72s user 0,80s system 153% cpu 3,603 totalI prefer this version using only pipes, which is well parallelized:
for file in $(git ls-files '*.[ch]') ; do
sed -rn "s,$pattern,\1,p" $file | sort | uniq -d | sed "s,^,$file: duplicated include: ,"
done
Quoted 9 lines
Quoted 1 line
7,40s user 1,49s system 231% cpu 3,847 total
And now, the big shell optimization:
export LC_ALL=C
Result is impressive:2,99s user 0,72s system 258% cpu 1,436 totalI'm sure you will agree to integrate my version now :)
hands down winner, where is the patch? :-)
Quoted 1 line
Regards,
Keith
PATCH 1/1 devtools: add script to find duplicated includes
In reply to Stephen HemmingerBased on Stephen's idea (originally implemented in a Perl script), this is a shell script to find duplicated includes in a file. It looks for all the .c and .h files of the git repository.
It is fast enough because automatically well parallelized.
--- devtools/check-dup-includes.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 devtools/check-dup-includes.sh
devtools/check-dup-includes.sh new file +35 -0
@@ -0,0 +1,35 @@ +#! /bin/sh -e + +# Copyright 2017 Mellanox Technologies, Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Check C files in the git repository for duplicated includes. + +cd $(dirname $(readlink -m $0))/.. + +# speed up by ignoring Unicode details +export LC_ALL=C + +for file in $(git ls-files '*.[ch]') ; do + sed -rn 's,^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*,\1,p' $file | + sort | uniq -d | + sed "s,^,$file: duplicated include: ," +done
Signature · 1 line
2.13.2
Re: [PATCH] devtools: add script to find duplicated includes
Quoted 38 lines · Thomas Monjalon
Based on Stephen's idea (originally implemented in a Perl script), this is a shell script to find duplicated includes in a file. It looks for all the .c and .h files of the git repository.
It is fast enough because automatically well parallelized.
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
devtools/check-dup-includes.sh| 35 +++++++++++++++++++++++++++++++++++1 file changed, 35 insertions(+)create mode 100755
devtools/check-dup-includes.shdevtools/check-dup-includes.sh new file +16
-0@@ -0,0 +1,35 @@ +#! /bin/sh -e + +# Copyright 2017 Mellanox Technologies, Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
devtools/check-dup-includes.sh line 26
Quoted 10 lines
devtools/check-dup-includes.sh new file +10
-0+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Check C files in the git repository for duplicated includes. + +cd $(dirname $(readlink -m $0))/..
I tried the script it works, but I am concerned about the ‘cd’ above as it does all of the the repo. I would like to see it do just the directory and sub-directories if a path is given. If I am testing a specific PMD or library then I would not want to do all of the repo.
Quoted 12 lines
devtools/check-dup-includes.sh new file +9
-0+ +# speed up by ignoring Unicode details +export LC_ALL=C + +for file in $(git ls-files '*.[ch]') ; do + sed -rn 's,^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*,\1,p' $file | + sort | uniq -d | + sed "s,^,$file: duplicated include: ," +doneSignature · 1 line
2.13.2
Regards,
Keith
Re: [PATCH] devtools: add script to find duplicated includes
Quoted 45 lines · Keith
Quoted 43 lines · Thomas Monjalon
Based on Stephen's idea (originally implemented in a Perl script), this is a shell script to find duplicated includes in a file. It looks for all the .c and .h files of the git repository.
It is fast enough because automatically well parallelized.
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>---
devtools/check-dup-includes.sh| 35 +++++++++++++++++++++++++++++++++++1 file changed, 35 insertions(+)create mode 100755
devtools/check-dup-includes.shdevtools/check-dup-includes.sh new file +20
-0@@ -0,0 +1,35 @@ +#! /bin/sh -e + +# Copyright 2017 Mellanox Technologies, Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
Quoted 9 lines
devtools/check-dup-includes.sh line 26
Quoted 6 lines
devtools/check-dup-includes.sh new file +6
-0+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Check C files in the git repository for duplicated includes. + +cd $(dirname $(readlink -m $0))/..I tried the script it works, but I am concerned about the ‘cd’ above as it does all of the the repo. I would like to see it do just the directory and sub-directories if a path is given. If I am testing a specific PMD or library then I would not want to do all of the repo.
I was thinking about something like the following:
if [ "$1x" = "x" ]; then
cd $(dirname $(readlink -m $0))/..
fi
Quoted 7 lines
Quoted 7 lines
devtools/check-dup-includes.sh new file +7
-0+ +# speed up by ignoring Unicode details +export LC_ALL=C + +for file in $(git ls-files '*.[ch]') ; do + sed -rn 's,^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*,\1,p' $file | + sort | uniq -d |
Quoted 9 lines
Quoted 5 lines
devtools/check-dup-includes.sh new file +2
-0+ sed "s,^,$file: duplicated include: ," +doneSignature · 1 line
2.13.2Regards,
Keith
Regards,
Keith
Re: [PATCH] devtools: add script to find duplicated includes
14/07/2017 20:43, Wiles, Keith:
Quoted 4 lines
Quoted 4 lines · Keith
Quoted 2 lines · Thomas Monjalon
+cd $(dirname $(readlink -m $0))/..
Quoted 8 lines
Quoted 2 lines
I tried the script it works, but I am concerned about the ‘cd’ above as it does all of the the repo. I would like to see it do just the directory and sub-directories if a path is given. If I am testing a specific PMD or library then I would not want to do all of the repo.
I was thinking about something like the following:
if [ "$1x" = "x" ]; then
cd $(dirname $(readlink -m $0))/..fi
Yes we can add a parameter to the script.
The parameter would be the path to check, and the default value is the whole repo.
So the script could be used also for another repo - like pktgen ;)
I'll send a v2
PATCH v2 1/1 devtools: add script to find duplicated includes
In reply to Thomas MonjalonBased on Stephen's idea (originally implemented in a Perl script), this is a shell script to find duplicated includes in a file. It looks for all the .c and .h files of the git repository.
It is fast enough because automatically well parallelized.
---
v2: add optional parameter for directory as suggested by Keith
--- devtools/check-dup-includes.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 devtools/check-dup-includes.sh
devtools/check-dup-includes.sh new file +37 -0
@@ -0,0 +1,37 @@ +#! /bin/sh -e + +# Copyright 2017 Mellanox Technologies, Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Check C files in git repository for duplicated includes. +# Usage: devtools/check-dup-includes.sh [directory] + +dir=${1:-$(dirname $(readlink -m $0))/..} +cd $dir + +# speed up by ignoring Unicode details +export LC_ALL=C + +for file in $(git ls-files '*.[ch]') ; do + sed -rn 's,^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*,\1,p' $file | + sort | uniq -d | + sed "s,^,$file: duplicated include: ," +done
Signature · 1 line
2.13.2
11/07/2017 20:55, Stephen Hemminger:
Quoted 16 lines
Using a simple script (in first patch), discovered that there was lots of #include file sloppiness in DPDK. This patch series fixes everything but base drivers and examples.
Stephen Hemminger (19):
devtools: add simple script to find duplicate includes
eal: remove duplicate includes
cmdline: remove duplicate include oferrno.h
distributor: remove duplicate include ofrte_compat.h
lpm: remove duplicate include oferrno.h
cuckoo_hash: remove duplicate include ofrte_log.h
timer: remove duplicate include ofrte_per_lcore.h
bnxt: remove duplicate include ofunistd.h
ixgbe: remove duplicate include ofrte_atomic.h
i40e: remove duplicate include ofrte_atomic.h
virtio: remove duplicated includes
Quoted 8 lines
cxgbe: remove duplicated includes
vmxnet3: remove duplicated include ofrte_atomic.h
dpaa2: remove duplicated includes
fsmlc: remove duplicated includes
app/proc-info: remove duplicate include
app/test-pmd: remove duplicate includes test/test-pipeline: remove duplicate include ofrte_per_lcore.htest/test: remove duplicate includes
Squashed a bit and applied with an additional patch for examples, some more duplicates in .h files removed, and without the perl script.
Note: my shell script is pending for approval :)
Thanks
Re: [PATCH] devtools: add script to find duplicated includes
In reply to Thomas MonjalonQuoted 4 lines · Thomas Monjalon
Based on Stephen's idea (originally implemented in a Perl script), this is a shell script to find duplicated includes in a file. It looks for all the .c and .h files of the git repository.
Quoted 9 lines
It is fast enough because automatically well parallelized.
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- devtools/check-dup-includes.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 devtools/check-dup-includes.sh
How many times has this been a problem? Find the same file included twice in any single file seems like a pretty rudimentary thing to catch by visual inspection during development. At the very least I recall coverity having a header file analyer which would indicate that a header file was unused, and I think that offered detection of duplicate includes.
Neil
Re: [PATCH] devtools: add script to find duplicated includes
17/07/2017 14:50, Neil Horman:
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
Based on Stephen's idea (originally implemented in a Perl script), this is a shell script to find duplicated includes in a file. It looks for all the .c and .h files of the git repository.
It is fast enough because automatically well parallelized.
Quoted 8 lines
Quoted 7 lines
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- devtools/check-dup-includes.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 devtools/check-dup-includes.shHow many times has this been a problem?
It is not a problem, just a trivial clean-up.
Quoted 5 lines
Find the same file included twice in
any single file seems like a pretty rudimentary thing to catch by visual inspection during development. At the very least I recall coverity having a header file analyer which would indicate that a header file was unused, and I think that offered detection of duplicate includes.
Good for Coverity. This simple script is Open Source ;)
Thomas Monjalon
AppliedRe: [PATCH v2] devtools: add script to find duplicated includes
In reply to Thomas Monjalon15/07/2017 12:00, Thomas Monjalon:
Quoted 4 lines
Based on Stephen's idea (originally implemented in a Perl script), this is a shell script to find duplicated includes in a file. It looks for all the .c and .h files of the git repository.
Quoted 8 lines
It is fast enough because automatically well parallelized.
Suggested-by Stephen Hemminger <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>Tested-by Keith Wiles <[email protected]>---
v2: add optional parameter for directory as suggested by Keith
---
Applied