get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/112655/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 112655,
    "url": "http://patches.dpdk.org/api/patches/112655/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220610142406.580943-2-bruce.richardson@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20220610142406.580943-2-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220610142406.580943-2-bruce.richardson@intel.com",
    "date": "2022-06-10T14:24:05",
    "name": "[v3,1/2] cmdline: add function to verify valid commands",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8507a86c9f951ddbec6bf364743fbbf38814cfc4",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220610142406.580943-2-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 23469,
            "url": "http://patches.dpdk.org/api/series/23469/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23469",
            "date": "2022-06-10T14:24:04",
            "name": "fix uncallable unit tests (Bugzilla 1002)",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/23469/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/112655/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/112655/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 25AFDA0553;\n\tFri, 10 Jun 2022 16:24:22 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E55AC42802;\n\tFri, 10 Jun 2022 16:24:18 +0200 (CEST)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id 7237B427F6\n for <dev@dpdk.org>; Fri, 10 Jun 2022 16:24:17 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 10 Jun 2022 07:24:16 -0700",
            "from silpixa00401385.ir.intel.com (HELO\n silpixa00401385.ger.corp.intel.com.) ([10.237.223.181])\n by fmsmga002.fm.intel.com with ESMTP; 10 Jun 2022 07:24:15 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1654871057; x=1686407057;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=vpgMxOVhel/h+DKQfVmpc33FcAVgmiobLizOcNMS7A0=;\n b=VKL4l+fNZW1HcQOM5m1xhhebbSYvkm8UWphxjbsFdcJURtjyqBA5NYWA\n 0vCVGGqv5Aq0lB9SndOxPeMUbvAZu2g1hH3Bxni2uY1WV7ERdeKUbNlvi\n H+8eGhaHvYN9DcQf9FH2717HQssgfYMBsUzbZ80BxJfuE9Xwwx81Z22uw\n lkwet4DAqKH/NbN5CstcIrCkc3WgRg/rRBRxkwvGCvYZ94rG1VNE1wf9T\n ugeDJz+JdDSZdHXnP4V1HorEGDUDGEoxA+D8+sLTFSGn0ZCOV/rDksN3p\n kvDoDWxF3YrsVO6ZX3v2MQVRpd7s1nm2sigSY+Uu1p+9BBboI14G9fLnx w==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10373\"; a=\"258079381\"",
            "E=Sophos;i=\"5.91,290,1647327600\"; d=\"scan'208\";a=\"258079381\"",
            "E=Sophos;i=\"5.91,290,1647327600\"; d=\"scan'208\";a=\"684568702\""
        ],
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "olivier.matz@6wind.com, Bruce Richardson <bruce.richardson@intel.com>,\n Weiyuan Li <weiyuanx.li@intel.com>",
        "Subject": "[PATCH v3 1/2] cmdline: add function to verify valid commands",
        "Date": "Fri, 10 Jun 2022 15:24:05 +0100",
        "Message-Id": "<20220610142406.580943-2-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220610142406.580943-1-bruce.richardson@intel.com>",
        "References": "<20220520145631.137962-1-bruce.richardson@intel.com>\n <20220610142406.580943-1-bruce.richardson@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "The cmdline library cmdline_parse() function parses a command and\nexecutes the action automatically too. The cmdline_valid_buffer function\nalso uses this function to validate commands, meaning that there is no\nfunction to validate a command as ok without executing it.\n\nTo fix this omission, we extract the body of cmdline_parse into a new\nstatic inline function with an extra parameter to indicate whether the\naction should be performed or not. Then we create two wrappers around\nthat - a replacement for the existing cmdline_parse function where the\nextra parameter is \"true\" to execute the command, and a new function\n\"cmdline_parse_check\" which passes the parameter as \"false\" to perform\ncmdline validation only.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\nTested-by: Weiyuan Li  <weiyuanx.li@intel.com>\nAcked-by: Olivier Matz <olivier.matz@6wind.com>\n---\n lib/cmdline/cmdline_parse.c | 28 ++++++++++++++++++++--------\n lib/cmdline/cmdline_parse.h | 17 +++++++++++++++--\n lib/cmdline/version.map     |  3 +++\n 3 files changed, 38 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/lib/cmdline/cmdline_parse.c b/lib/cmdline/cmdline_parse.c\nindex 349ec87bd7..ba7f4b80cb 100644\n--- a/lib/cmdline/cmdline_parse.c\n+++ b/lib/cmdline/cmdline_parse.c\n@@ -7,6 +7,7 @@\n #include <stdio.h>\n #include <errno.h>\n #include <string.h>\n+#include <stdbool.h>\n \n #include <rte_string_fns.h>\n \n@@ -182,8 +183,8 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,\n }\n \n \n-int\n-cmdline_parse(struct cmdline *cl, const char * buf)\n+static inline int\n+__cmdline_parse(struct cmdline *cl, const char *buf, bool call_fn)\n {\n \tunsigned int inst_num=0;\n \tcmdline_parse_inst_t *inst;\n@@ -282,20 +283,31 @@ cmdline_parse(struct cmdline *cl, const char * buf)\n \t\tinst = ctx[inst_num];\n \t}\n \n-\t/* call func */\n-\tif (f) {\n-\t\tf(result.buf, cl, data);\n-\t}\n-\n \t/* no match */\n-\telse {\n+\tif (f == NULL) {\n \t\tdebug_printf(\"No match err=%d\\n\", err);\n \t\treturn err;\n \t}\n \n+\t/* call func if requested*/\n+\tif (call_fn)\n+\t\tf(result.buf, cl, data);\n+\n \treturn linelen;\n }\n \n+int\n+cmdline_parse(struct cmdline *cl, const char *buf)\n+{\n+\treturn __cmdline_parse(cl, buf, true);\n+}\n+\n+int\n+cmdline_parse_check(struct cmdline *cl, const char *buf)\n+{\n+\treturn __cmdline_parse(cl, buf, false);\n+}\n+\n int\n cmdline_complete(struct cmdline *cl, const char *buf, int *state,\n \t\t char *dst, unsigned int size)\ndiff --git a/lib/cmdline/cmdline_parse.h b/lib/cmdline/cmdline_parse.h\nindex e4d802fff7..f4241a68fe 100644\n--- a/lib/cmdline/cmdline_parse.h\n+++ b/lib/cmdline/cmdline_parse.h\n@@ -7,6 +7,8 @@\n #ifndef _CMDLINE_PARSE_H_\n #define _CMDLINE_PARSE_H_\n \n+#include <rte_compat.h>\n+\n #ifdef __cplusplus\n extern \"C\" {\n #endif\n@@ -149,11 +151,22 @@ typedef cmdline_parse_inst_t *cmdline_parse_ctx_t;\n  * argument buf must ends with \"\\n\\0\". The function returns\n  * CMDLINE_PARSE_AMBIGUOUS, CMDLINE_PARSE_NOMATCH or\n  * CMDLINE_PARSE_BAD_ARGS on error. Else it calls the associated\n- * function (defined in the context) and returns 0\n- * (CMDLINE_PARSE_SUCCESS).\n+ * function (defined in the context) and returns the parsed line length (>= 0).\n  */\n int cmdline_parse(struct cmdline *cl, const char *buf);\n \n+/**\n+ * Try to parse a buffer according to the specified context, but do not\n+ * perform any function calls if parse is successful.\n+ *\n+ * The argument buf must ends with \"\\n\\0\".\n+ * The function returns CMDLINE_PARSE_AMBIGUOUS, CMDLINE_PARSE_NOMATCH or\n+ * CMDLINE_PARSE_BAD_ARGS on error and returns the parsed line length (>=0)\n+ * on successful parse.\n+ */\n+__rte_experimental\n+int cmdline_parse_check(struct cmdline *cl, const char *buf);\n+\n /**\n  * complete() must be called with *state==0 (try to complete) or\n  * with *state==-1 (just display choices), then called without\ndiff --git a/lib/cmdline/version.map b/lib/cmdline/version.map\nindex b9bbb87510..fc7fdd6ea4 100644\n--- a/lib/cmdline/version.map\n+++ b/lib/cmdline/version.map\n@@ -81,5 +81,8 @@ EXPERIMENTAL {\n \trdline_get_history_buffer_size;\n \trdline_get_opaque;\n \n+\t# added in 22.07\n+\tcmdline_parse_check;\n+\n \tlocal: *;\n };\n",
    "prefixes": [
        "v3",
        "1/2"
    ]
}