tools perf: Move from sane_ctype.h obtained from git to the Linux's original
Subsystems (2)
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 3052ba56bcb589046eca6a931bd897742653d2cb Gitweb: https://git.kernel.org/tip/3052ba56bcb589046eca6a931bd897742653d2cb Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Tue, 25 Jun 2019 17:27:31 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 25 Jun 2019 21:02:47 -0300
tools perf: Move from sane_ctype.h obtained from git to the Linux's original
We got the sane_ctype.h headers from git and kept using it so far, but since that code originally came from the kernel sources to the git sources, perhaps its better to just use the one in the kernel, so that we can leverage tools/perf/check_headers.sh to be notified when our copy gets out of sync, i.e. when fixes or goodies are added to the code we've copied.
This will help with things like tools/lib/string.c where we want to have more things in common with the kernel, such as strim(), skip_spaces(), etc so as to go on removing the things that we have in tools/perf/util/ and instead using the code in the kernel, indirectly and removing things like EXPORT_SYMBOL(), etc, getting notified when fixes and improvements are made to the original code.
Hopefully this also should help with reducing the difference of code hosted in tools/ to the one in the kernel proper.
---
{include => tools/include}/linux/ctype.h | 3 +-
{lib => tools/lib}/ctype.c | 3 --
tools/lib/symbol/kallsyms.c | 1 -
tools/lib/symbol/kallsyms.h | 1 +
tools/perf/MANIFEST | 1 +
tools/perf/arch/x86/util/machine.c | 2 +-
tools/perf/builtin-kmem.c | 2 +-
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-sched.c | 2 +-
tools/perf/builtin-script.c | 2 +-
tools/perf/builtin-stat.c | 2 +-
tools/perf/builtin-top.c | 2 +-
tools/perf/builtin-trace.c | 2 +-
tools/perf/check-headers.sh | 2 ++
tools/perf/tests/code-reading.c | 2 +-
tools/perf/ui/browser.c | 2 +-
tools/perf/ui/browsers/hists.c | 2 +-
tools/perf/ui/browsers/map.c | 2 +-
tools/perf/ui/stdio/hist.c | 2 +-
tools/perf/util/Build | 4 +++
tools/perf/util/annotate.c | 2 +-
tools/perf/util/auxtrace.c | 2 +-
tools/perf/util/build-id.c | 2 +-
tools/perf/util/config.c | 2 +-
tools/perf/util/cpumap.c | 2 +-
tools/perf/util/ctype.c | 32 ----------------------
tools/perf/util/data-convert-bt.c | 2 +-
tools/perf/util/debug.c | 2 +-
tools/perf/util/demangle-java.c | 2 +-
tools/perf/util/env.c | 2 +-
tools/perf/util/event.c | 2 +-
tools/perf/util/evsel.c | 2 +-
tools/perf/util/header.c | 2 +-
tools/perf/util/jitdump.c | 2 +-
tools/perf/util/machine.c | 2 +-
tools/perf/util/print_binary.c | 2 +-
tools/perf/util/probe-event.c | 2 +-
tools/perf/util/probe-finder.h | 2 +-
tools/perf/util/python-ext-sources | 2 +-
tools/perf/util/sane_ctype.h | 47 --------------------------------
tools/perf/util/stat-display.c | 2 +-
tools/perf/util/strfilter.c | 2 +-
tools/perf/util/string.c | 2 +-
tools/perf/util/symbol-elf.c | 2 +-
tools/perf/util/symbol.c | 2 +-
tools/perf/util/trace-event-parse.c | 2 +-
46 files changed, 47 insertions(+), 121 deletions(-)tools/include/linux/ctype.h renamed from include/linux/ctype.h +2 -1
@@ -23,10 +23,11 @@ extern const unsigned char _ctype[];#define isalnum (c) ((__ismask(c)&(_U|_L|_D)) != 0)#define isalpha (c) ((__ismask(c)&(_U|_L)) != 0)#define iscntrl (c) ((__ismask(c)&(_C)) != 0) -static inline int isdigit (int c) +static inline int __isdigit (int c) {return '0' <= c && c <='9' ; } +#define isdigit (c) __isdigit(c)#define isgraph (c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)#define islower (c) ((__ismask(c)&(_L)) != 0)#define isprint (c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
tools/lib/ctype.c renamed from lib/ctype.c +0 -3
@@ -7,7 +7,6 @@#include <linux/ctype.h> #include <linux/compiler.h> -#include <linux/export.h> const unsigned char _ctype[] = { _C,_C,_C,_C,_C,_C,_C,_C,/* 0-7 */
@@ -34,5 +33,3 @@ _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ _U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,/* 208-223 */ _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,/* 224-239 */ _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ - -EXPORT_SYMBOL (_ctype);
tools/lib/symbol/kallsyms.c +0 -1
@@ -1,5 +1,4 @@// SPDX-License-Identifier: GPL-2.0 -#include <ctype.h> #include "symbol/kallsyms.h" #include <stdio.h> #include <stdlib.h>
tools/lib/symbol/kallsyms.h +1 -0
@@ -3,6 +3,7 @@#define __TOOLS_KALLSYMS_H_ 1#include <elf.h> +#include <linux/ctype.h> #include <linux/types.h> #ifndef KSYM_NAME_LEN
tools/perf/MANIFEST +1 -0
@@ -7,6 +7,7 @@ tools/lib/traceevent tools/lib/api tools/lib/bpf tools/lib/subcmd +tools/lib/ctype.c tools/lib/hweight.c tools/lib/rbtree.c tools/lib/string.c
tools/perf/arch/x86/util/machine.c +1 -1
@@ -7,7 +7,7 @@#include "../../util/machine.h" #include "../../util/map.h" #include "../../util/symbol.h" -#include "../../util/sane_ctype.h" +#include <linux/ctype.h> #include <symbol/kallsyms.h>
tools/perf/builtin-kmem.c +1 -1
@@ -31,7 +31,7 @@#include <locale.h> #include <regex.h> -#include "sane_ctype.h" +#include <linux/ctype.h> static int kmem_slab;static int kmem_page;
tools/perf/builtin-report.c +1 -1
@@ -47,7 +47,7 @@#include <errno.h> #include <inttypes.h> #include <regex.h> -#include "sane_ctype.h" +#include <linux/ctype.h> #include <signal.h> #include <linux/bitmap.h> #include <linux/stringify.h>
tools/perf/builtin-sched.c +1 -1
@@ -37,7 +37,7 @@#include <api/fs/fs.h> #include <linux/time64.h> -#include "sane_ctype.h" +#include <linux/ctype.h> #define PR_SET_NAME 15/* Set process name */ #define MAX_CPUS 4096
tools/perf/builtin-script.c +1 -1
@@ -49,7 +49,7 @@#include <unistd.h> #include <subcmd/pager.h> -#include "sane_ctype.h" +#include <linux/ctype.h> static char const *script_name;static char const *generate_script_lang;
tools/perf/builtin-stat.c +1 -1
@@ -82,7 +82,7 @@#include <sys/time.h> #include <sys/resource.h> -#include "sane_ctype.h" +#include <linux/ctype.h> #define DEFAULT_SEPARATOR " "#define FREEZE_ON_SMI_PATH "devices/cpu/freeze_on_smi"
tools/perf/builtin-top.c +1 -1
@@ -76,7 +76,7 @@#include <linux/time64.h> #include <linux/types.h> -#include "sane_ctype.h" +#include <linux/ctype.h> static volatile int done;static volatile int resize;
tools/perf/builtin-trace.c +1 -1
@@ -64,7 +64,7 @@#include <fcntl.h> #include <sys/sysmacros.h> -#include "sane_ctype.h" +#include <linux/ctype.h> #ifndef O_CLOEXEC # define O_CLOEXEC 02000000
tools/perf/check-headers.sh +2 -0
@@ -105,6 +105,8 @@ check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"' check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"' check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"' +check include/linux/ctype.h '-I "isdigit("' +check lib/ctype.c '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B' # diff non-symmetric files check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
tools/perf/tests/code-reading.c +1 -1
@@ -22,7 +22,7 @@#include "tests.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #define BUFSZ 1024#define READLEN 128
tools/perf/ui/browser.c +1 -1
@@ -16,7 +16,7 @@#include "helpline.h" #include "keysyms.h" #include "../color.h" -#include "sane_ctype.h" +#include <linux/ctype.h> static int ui_browser__percent_color (struct ui_browser *browser,double percent,bool current)
tools/perf/ui/browsers/hists.c +1 -1
@@ -33,7 +33,7 @@#include "units.h" #include "time-utils.h" -#include "sane_ctype.h" +#include <linux/ctype.h> extern void hist_browser__init_hpp (void );
tools/perf/ui/browsers/map.c +1 -1
@@ -13,7 +13,7 @@#include "../keysyms.h" #include "map.h" -#include "sane_ctype.h" +#include <linux/ctype.h> struct map_browser {struct ui_browser b;
tools/perf/ui/stdio/hist.c +1 -1
@@ -13,7 +13,7 @@#include "../../util/srcline.h" #include "../../util/string2.h" #include "../../util/thread.h" -#include "../../util/sane_ctype.h" +#include <linux/ctype.h> static size_t callchain__fprintf_left_margin (FILE *fp,int left_margin) {
tools/perf/util/Build +4 -0
@@ -213,6 +213,10 @@ $(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE $(call rule_mkdir) $(call if_changed_dep,cc_o_c) +$(OUTPUT)util/ctype.o: ../lib/ctype.c FORCE + $(call rule_mkdir) + $(call if_changed_dep,cc_o_c) + $(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE $(call rule_mkdir) $(call if_changed_dep,cc_o_c)
tools/perf/util/annotate.c +1 -1
@@ -49,7 +49,7 @@#define DARROW_CHAR ((unsigned char)'.')#define UARROW_CHAR ((unsigned char)'-') -#include "sane_ctype.h" +#include <linux/ctype.h> struct annotation_options annotation__default_options = { .use_offset = true,
tools/perf/util/auxtrace.c +1 -1
@@ -51,7 +51,7 @@#include "arm-spe.h" #include "s390-cpumsf.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #include "symbol/kallsyms.h" static bool auxtrace__dont_decode (struct perf_session *session)
tools/perf/util/build-id.c +1 -1
@@ -29,7 +29,7 @@#include "probe-file.h" #include "strlist.h" -#include "sane_ctype.h" +#include <linux/ctype.h> static bool no_buildid_cache;
tools/perf/util/config.c +1 -1
@@ -24,7 +24,7 @@#include <unistd.h> #include <linux/string.h> -#include "sane_ctype.h" +#include <linux/ctype.h> #define MAXNAME (256)
tools/perf/util/cpumap.c +1 -1
@@ -10,7 +10,7 @@#include <linux/bitmap.h> #include "asm/bug.h" -#include "sane_ctype.h" +#include <linux/ctype.h> static int max_cpu_num;static int max_present_cpu_num;
tools/perf/util/ctype.c deleted +0 -32
@@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* -* Sane locale-independent, ASCII ctype. -* -* No surprises, and works with signed and unsigned chars. -*/ -#include "sane_ctype.h" - -enum { -S =GIT_SPACE , -A =GIT_ALPHA , -D =GIT_DIGIT , -G =GIT_GLOB_SPECIAL ,/* *, ?, [, \\ */ -R =GIT_REGEX_SPECIAL ,/* $, (, ), +, ., ^, {, | * */ -P =GIT_PRINT_EXTRA ,/* printable - alpha - digit - glob - regex */ - -PS =GIT_SPACE |GIT_PRINT_EXTRA , -}; - -unsigned char sane_ctype[256 ] = { -/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,S ,S ,0 ,0 ,S ,0 ,0 ,/* 0.. 15 */ -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,/* 16.. 31 */ -PS ,P ,P ,P ,R ,P ,P ,P ,R ,R ,G ,R ,P ,P ,R ,P ,/* 32.. 47 */ -D ,D ,D ,D ,D ,D ,D ,D ,D ,D ,P ,P ,P ,P ,P ,G ,/* 48.. 63 */ -P ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,/* 64.. 79 */ -A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,G ,G ,P ,R ,P ,/* 80.. 95 */ -P ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,/* 96..111 */ -A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,R ,R ,P ,P ,0 ,/* 112..127 */ -/* Nothing in the 128.. range */ -};
tools/perf/util/data-convert-bt.c +1 -1
@@ -29,7 +29,7 @@#include "evsel.h" #include "machine.h" #include "config.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #define pr_N (n, fmt, ...) \ eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)
tools/perf/util/debug.c +1 -1
@@ -21,7 +21,7 @@#include "util.h" #include "target.h" -#include "sane_ctype.h" +#include <linux/ctype.h> int verbose;bool dump_trace = false, quiet = false;
tools/perf/util/demangle-java.c +1 -1
@@ -8,7 +8,7 @@#include "demangle-java.h" -#include "sane_ctype.h" +#include <linux/ctype.h> enum {MODE_PREFIX =0 ,
tools/perf/util/env.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include "cpumap.h" #include "env.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #include "util.h" #include "bpf-event.h" #include <errno.h>
tools/perf/util/event.c +1 -1
@@ -20,7 +20,7 @@#include "strlist.h" #include "thread.h" #include "thread_map.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #include "map.h" #include "symbol.h" #include "symbol/kallsyms.h"
tools/perf/util/evsel.c +1 -1
@@ -39,7 +39,7 @@#include "memswap.h" #include "util/parse-branch-options.h" -#include "sane_ctype.h" +#include <linux/ctype.h> struct perf_missing_features perf_missing_features;
tools/perf/util/header.c +1 -1
@@ -43,7 +43,7 @@#include "cputopo.h" #include "bpf-event.h" -#include "sane_ctype.h" +#include <linux/ctype.h> /* * magic2 = "PERFILE2"
tools/perf/util/jitdump.c +1 -1
@@ -28,7 +28,7 @@#include "genelf.h" #include "../builtin.h" -#include "sane_ctype.h" +#include <linux/ctype.h> struct jit_buf_desc {struct perf_data *output;
tools/perf/util/machine.c +1 -1
@@ -25,7 +25,7 @@#include "asm/bug.h" #include "bpf-event.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #include <symbol/kallsyms.h> #include <linux/mman.h>
tools/perf/util/print_binary.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include "print_binary.h" #include <linux/log2.h> -#include "sane_ctype.h" +#include <linux/ctype.h> int binary__fprintf(unsigned char *data, size_t len, size_t bytes_per_line, binary__fprintf_t printer,
tools/perf/util/probe-event.c +1 -1
@@ -39,7 +39,7 @@#include "session.h" #include "string2.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #define PERFPROBE_GROUP "probe"
tools/perf/util/probe-finder.h +1 -1
@@ -5,7 +5,7 @@#include <stdbool.h> #include "intlist.h" #include "probe-event.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #define MAX_PROBE_BUFFER 1024#define MAX_PROBES 128
tools/perf/util/python-ext-sources +1 -1
@@ -6,7 +6,7 @@ # util/python.c -util/ctype.c +../lib/ctype.c util/evlist.c util/evsel.c util/cpumap.c
tools/perf/util/sane_ctype.h deleted +0 -47
47 lines not on this page · raw message
tools/perf/util/stat-display.c +1 -1
@@ -10,7 +10,7 @@#include "thread_map.h" #include "cpumap.h" #include "string2.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #include "cgroup.h" #include <math.h> #include <api/fs/fs.h>
tools/perf/util/strfilter.c +1 -1
@@ -4,7 +4,7 @@#include "strfilter.h" #include <errno.h> -#include "sane_ctype.h" +#include <linux/ctype.h> /* Operators */ static const char *OP_and ="&" ;/* Logical AND */
tools/perf/util/string.c +1 -1
@@ -4,7 +4,7 @@#include <linux/string.h> #include <stdlib.h> -#include "sane_ctype.h" +#include <linux/ctype.h> const char *graph_dotted_line ="---------------------------------------------------------------------"
tools/perf/util/symbol-elf.c +1 -1
@@ -15,7 +15,7 @@#include "vdso.h" #include "debug.h" #include "util.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #include <symbol/kallsyms.h> #ifndef EM_AARCH64
tools/perf/util/symbol.c +1 -1
@@ -25,7 +25,7 @@#include "namespaces.h" #include "header.h" #include "path.h" -#include "sane_ctype.h" +#include <linux/ctype.h> #include <elf.h> #include <limits.h>
tools/perf/util/trace-event-parse.c +1 -1
@@ -11,7 +11,7 @@#include "debug.h" #include "trace-event.h" -#include "sane_ctype.h" +#include <linux/ctype.h> static int get_common_field (struct scripting_context *context,int *offset,int *size,const char *type)