lkml.org 
[lkml]   [2021]   [Oct]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5/5] dyndbg: no vpr-info on empty queries
    Date
    when `echo $cmd > control` contains multiple queries, extra query
    separators (;\n) can parse as empty statements. This is normal, and a
    vpr-info on an empty command is just noise. Also change varname.

    Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
    ---
    lib/dynamic_debug.c | 13 +++++++------
    1 file changed, 7 insertions(+), 6 deletions(-)

    diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
    index 18235de37f25..eef9ca92b05c 100644
    --- a/lib/dynamic_debug.c
    +++ b/lib/dynamic_debug.c
    @@ -520,9 +520,9 @@ static int ddebug_exec_query(char *query_string, const char *modname)
    static int ddebug_exec_queries(char *query, const char *modname)
    {
    char *split;
    - int i, errs = 0, exitcode = 0, rc, nfound = 0;
    + int qct, errs = 0, exitcode = 0, rc, nfound = 0;

    - for (i = 0; query; query = split) {
    + for (qct = 0; query; query = split) {
    split = strpbrk(query, ";\n");
    if (split)
    *split++ = '\0';
    @@ -531,7 +531,7 @@ static int ddebug_exec_queries(char *query, const char *modname)
    if (!query || !*query || *query == '#')
    continue;

    - v2pr_info("query %d: <%s> mod:<%s>\n", i, query, modname ?: "*");
    + v2pr_info("query %d: <%s> mod:<%s>\n", qct, query, modname ?: "*");

    rc = ddebug_exec_query(query, modname);
    if (rc < 0) {
    @@ -540,10 +540,11 @@ static int ddebug_exec_queries(char *query, const char *modname)
    } else {
    nfound += rc;
    }
    - i++;
    + qct++;
    }
    - v2pr_info("processed %d queries, with %d matches, %d errs\n",
    - i, nfound, errs);
    + if (qct)
    + v2pr_info("processed %d queries, with %d matches, %d errs\n",
    + qct, nfound, errs);

    if (exitcode)
    return exitcode;
    --
    2.31.1
    \
     
     \ /
      Last update: 2021-10-12 20:51    [W:3.936 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site