get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 17025,
    "url": "https://patches.dpdk.org/api/patches/17025/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/42d33a926c2521a5b85e55fb2b301de3c07ca07c.1479309720.git.adrien.mazarguil@6wind.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<42d33a926c2521a5b85e55fb2b301de3c07ca07c.1479309720.git.adrien.mazarguil@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/42d33a926c2521a5b85e55fb2b301de3c07ca07c.1479309720.git.adrien.mazarguil@6wind.com",
    "date": "2016-11-16T16:23:28",
    "name": "[dpdk-dev,02/22] cmdline: add support for dynamic tokens",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "113c3314da4cef876001360ee5ed33b34aa5cc8a",
    "submitter": {
        "id": 165,
        "url": "https://patches.dpdk.org/api/people/165/?format=api",
        "name": "Adrien Mazarguil",
        "email": "adrien.mazarguil@6wind.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/42d33a926c2521a5b85e55fb2b301de3c07ca07c.1479309720.git.adrien.mazarguil@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/17025/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/17025/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id C8CCE5685;\n\tWed, 16 Nov 2016 17:24:39 +0100 (CET)",
            "from mail-wm0-f51.google.com (mail-wm0-f51.google.com\n\t[74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 754C9567E\n\tfor <dev@dpdk.org>; Wed, 16 Nov 2016 17:24:04 +0100 (CET)",
            "by mail-wm0-f51.google.com with SMTP id a197so249897021wmd.0\n\tfor <dev@dpdk.org>; Wed, 16 Nov 2016 08:24:04 -0800 (PST)",
            "from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net.\n\t[82.239.227.177]) by smtp.gmail.com with ESMTPSA id\n\tba10sm41298193wjb.32.2016.11.16.08.24.02\n\t(version=TLS1_2 cipher=AES128-SHA bits=128/128);\n\tWed, 16 Nov 2016 08:24:03 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=jFimRupIZJDlMhgnq7AHcbWTcOQV3ruZe08oCeXT6NI=;\n\tb=O0b42oKWu1x4KfZH3SY/ZtFGV9VBM/2NyD7N/IjaYT3pdxsF1vCWNl+QQTUi+nu3IZ\n\tkBP1V97A8gq4/ZKp3VYgx93AQyun1bNQxRem6deF2b231teOqZBxbyiEvNU9/E7rMYbD\n\tvW4wOxd/+aaDDaT9S7Np06rD5fsOHap3mNNw4Bi/CaBArDKrnKOVoxiPURouQIrOxdsu\n\teN5NYtfx179JvA9oQHLZts3OUxUx9gY9eZGJuHvNBtaokCA2tCznXP3avZsbtWetQe9m\n\t/r/cBeB8df/6xDD7q7VJsM3ORf9H7Y+zA63T1Mg07SbqBwHa+gozcJgPPJahjzi/sM7S\n\tEXtQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=jFimRupIZJDlMhgnq7AHcbWTcOQV3ruZe08oCeXT6NI=;\n\tb=OzLRcNvFUX0gYNMGOOHEYIoM5ElEZoRTyLW+HyI7wS2xqpNTB98j/gD8eNdYBR98xK\n\teXOf5kOptqU7Ve2A4LYfwh+417Cw7B/oFqef8qDarQPEk94cQV20fVwzEgauXcwJInqv\n\to1lSOwgZLLG2PJqn+MNzwBn91Z64RuuM81+WXpie4W9tRZUloEMGoYOknq2MOdwcK5DX\n\tM11AlxbwLeYCuhlukDAM7JIJ5MK3315Ux8dpChWXGzMRE2uffo+y4AcAz3c69chrRdVj\n\t9cg4ZyjmihNDy0AMTenW1hPrwxD9pMQrZDJLvTDcAW/B2FDG5fpX3abe5NVfeic+qqG0\n\tKxhg==",
        "X-Gm-Message-State": "ABUngvc8ZR+KCUqwtvkT9EPSpKISym4Ds5Y1Yb7ye8O+ihvEMH617rSgYAdEsIfRBdTvOQzV",
        "X-Received": "by 10.28.88.18 with SMTP id m18mr10025053wmb.26.1479313443977;\n\tWed, 16 Nov 2016 08:24:03 -0800 (PST)",
        "From": "Adrien Mazarguil <adrien.mazarguil@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "Thomas Monjalon <thomas.monjalon@6wind.com>,\n\tPablo de Lara <pablo.de.lara.guarch@intel.com>,\n\tOlivier Matz <olivier.matz@6wind.com>",
        "Date": "Wed, 16 Nov 2016 17:23:28 +0100",
        "Message-Id": "<42d33a926c2521a5b85e55fb2b301de3c07ca07c.1479309720.git.adrien.mazarguil@6wind.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<cover.1479309719.git.adrien.mazarguil@6wind.com>",
        "References": "<cover.1471632644.git.adrien.mazarguil@6wind.com>\n\t<cover.1479309719.git.adrien.mazarguil@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH 02/22] cmdline: add support for dynamic tokens",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Considering tokens must be hard-coded in a list part of the instruction\nstructure, context-dependent tokens cannot be expressed.\n\nThis commit adds support for building dynamic token lists through a\nuser-provided function, which is called when the static token list is empty\n(a single NULL entry).\n\nBecause no structures are modified (existing fields are reused), this\ncommit has no impact on the current ABI.\n\nSigned-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>\n---\n lib/librte_cmdline/cmdline_parse.c | 60 +++++++++++++++++++++++++++++----\n lib/librte_cmdline/cmdline_parse.h | 21 ++++++++++++\n 2 files changed, 74 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c\nindex b496067..14f5553 100644\n--- a/lib/librte_cmdline/cmdline_parse.c\n+++ b/lib/librte_cmdline/cmdline_parse.c\n@@ -146,7 +146,9 @@ nb_common_chars(const char * s1, const char * s2)\n  */\n static int\n match_inst(cmdline_parse_inst_t *inst, const char *buf,\n-\t   unsigned int nb_match_token, void *resbuf, unsigned resbuf_size)\n+\t   unsigned int nb_match_token, void *resbuf, unsigned resbuf_size,\n+\t   cmdline_parse_token_hdr_t\n+\t\t*(*dyn_tokens)[CMDLINE_PARSE_DYNAMIC_TOKENS])\n {\n \tunsigned int token_num=0;\n \tcmdline_parse_token_hdr_t * token_p;\n@@ -155,6 +157,11 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,\n \tstruct cmdline_token_hdr token_hdr;\n \n \ttoken_p = inst->tokens[token_num];\n+\tif (!token_p && dyn_tokens && inst->f) {\n+\t\tif (!(*dyn_tokens)[0])\n+\t\t\tinst->f(&(*dyn_tokens)[0], NULL, dyn_tokens);\n+\t\ttoken_p = (*dyn_tokens)[0];\n+\t}\n \tif (token_p)\n \t\tmemcpy(&token_hdr, token_p, sizeof(token_hdr));\n \n@@ -196,7 +203,17 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,\n \t\tbuf += n;\n \n \t\ttoken_num ++;\n-\t\ttoken_p = inst->tokens[token_num];\n+\t\tif (!inst->tokens[0]) {\n+\t\t\tif (token_num < (CMDLINE_PARSE_DYNAMIC_TOKENS - 1)) {\n+\t\t\t\tif (!(*dyn_tokens)[token_num])\n+\t\t\t\t\tinst->f(&(*dyn_tokens)[token_num],\n+\t\t\t\t\t\tNULL,\n+\t\t\t\t\t\tdyn_tokens);\n+\t\t\t\ttoken_p = (*dyn_tokens)[token_num];\n+\t\t\t} else\n+\t\t\t\ttoken_p = NULL;\n+\t\t} else\n+\t\t\ttoken_p = inst->tokens[token_num];\n \t\tif (token_p)\n \t\t\tmemcpy(&token_hdr, token_p, sizeof(token_hdr));\n \t}\n@@ -239,6 +256,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)\n \tcmdline_parse_inst_t *inst;\n \tconst char *curbuf;\n \tchar result_buf[CMDLINE_PARSE_RESULT_BUFSIZE];\n+\tcmdline_parse_token_hdr_t *dyn_tokens[CMDLINE_PARSE_DYNAMIC_TOKENS];\n \tvoid (*f)(void *, struct cmdline *, void *) = NULL;\n \tvoid *data = NULL;\n \tint comment = 0;\n@@ -255,6 +273,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)\n \t\treturn CMDLINE_PARSE_BAD_ARGS;\n \n \tctx = cl->ctx;\n+\tmemset(&dyn_tokens, 0, sizeof(dyn_tokens));\n \n \t/*\n \t * - look if the buffer contains at least one line\n@@ -299,7 +318,8 @@ cmdline_parse(struct cmdline *cl, const char * buf)\n \t\tdebug_printf(\"INST %d\\n\", inst_num);\n \n \t\t/* fully parsed */\n-\t\ttok = match_inst(inst, buf, 0, result_buf, sizeof(result_buf));\n+\t\ttok = match_inst(inst, buf, 0, result_buf, sizeof(result_buf),\n+\t\t\t\t &dyn_tokens);\n \n \t\tif (tok > 0) /* we matched at least one token */\n \t\t\terr = CMDLINE_PARSE_BAD_ARGS;\n@@ -355,6 +375,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,\n \tcmdline_parse_token_hdr_t *token_p;\n \tstruct cmdline_token_hdr token_hdr;\n \tchar tmpbuf[CMDLINE_BUFFER_SIZE], comp_buf[CMDLINE_BUFFER_SIZE];\n+\tcmdline_parse_token_hdr_t *dyn_tokens[CMDLINE_PARSE_DYNAMIC_TOKENS];\n \tunsigned int partial_tok_len;\n \tint comp_len = -1;\n \tint tmp_len = -1;\n@@ -374,6 +395,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,\n \n \tdebug_printf(\"%s called\\n\", __func__);\n \tmemset(&token_hdr, 0, sizeof(token_hdr));\n+\tmemset(&dyn_tokens, 0, sizeof(dyn_tokens));\n \n \t/* count the number of complete token to parse */\n \tfor (i=0 ; buf[i] ; i++) {\n@@ -396,11 +418,24 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,\n \t\tinst = ctx[inst_num];\n \t\twhile (inst) {\n \t\t\t/* parse the first tokens of the inst */\n-\t\t\tif (nb_token && match_inst(inst, buf, nb_token, NULL, 0))\n+\t\t\tif (nb_token &&\n+\t\t\t    match_inst(inst, buf, nb_token, NULL, 0,\n+\t\t\t\t       &dyn_tokens))\n \t\t\t\tgoto next;\n \n \t\t\tdebug_printf(\"instruction match\\n\");\n-\t\t\ttoken_p = inst->tokens[nb_token];\n+\t\t\tif (!inst->tokens[0]) {\n+\t\t\t\tif (nb_token <\n+\t\t\t\t    (CMDLINE_PARSE_DYNAMIC_TOKENS - 1)) {\n+\t\t\t\t\tif (!dyn_tokens[nb_token])\n+\t\t\t\t\t\tinst->f(&dyn_tokens[nb_token],\n+\t\t\t\t\t\t\tNULL,\n+\t\t\t\t\t\t\t&dyn_tokens);\n+\t\t\t\t\ttoken_p = dyn_tokens[nb_token];\n+\t\t\t\t} else\n+\t\t\t\t\ttoken_p = NULL;\n+\t\t\t} else\n+\t\t\t\ttoken_p = inst->tokens[nb_token];\n \t\t\tif (token_p)\n \t\t\t\tmemcpy(&token_hdr, token_p, sizeof(token_hdr));\n \n@@ -490,10 +525,21 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,\n \t\t/* we need to redo it */\n \t\tinst = ctx[inst_num];\n \n-\t\tif (nb_token && match_inst(inst, buf, nb_token, NULL, 0))\n+\t\tif (nb_token &&\n+\t\t    match_inst(inst, buf, nb_token, NULL, 0, &dyn_tokens))\n \t\t\tgoto next2;\n \n-\t\ttoken_p = inst->tokens[nb_token];\n+\t\tif (!inst->tokens[0]) {\n+\t\t\tif (nb_token < (CMDLINE_PARSE_DYNAMIC_TOKENS - 1)) {\n+\t\t\t\tif (!dyn_tokens[nb_token])\n+\t\t\t\t\tinst->f(&dyn_tokens[nb_token],\n+\t\t\t\t\t\tNULL,\n+\t\t\t\t\t\t&dyn_tokens);\n+\t\t\t\ttoken_p = dyn_tokens[nb_token];\n+\t\t\t} else\n+\t\t\t\ttoken_p = NULL;\n+\t\t} else\n+\t\t\ttoken_p = inst->tokens[nb_token];\n \t\tif (token_p)\n \t\t\tmemcpy(&token_hdr, token_p, sizeof(token_hdr));\n \ndiff --git a/lib/librte_cmdline/cmdline_parse.h b/lib/librte_cmdline/cmdline_parse.h\nindex 4ac05d6..65b18d4 100644\n--- a/lib/librte_cmdline/cmdline_parse.h\n+++ b/lib/librte_cmdline/cmdline_parse.h\n@@ -83,6 +83,9 @@ extern \"C\" {\n /* maximum buffer size for parsed result */\n #define CMDLINE_PARSE_RESULT_BUFSIZE 8192\n \n+/* maximum number of dynamic tokens */\n+#define CMDLINE_PARSE_DYNAMIC_TOKENS 128\n+\n /**\n  * Stores a pointer to the ops struct, and the offset: the place to\n  * write the parsed result in the destination structure.\n@@ -130,6 +133,24 @@ struct cmdline;\n  * Store a instruction, which is a pointer to a callback function and\n  * its parameter that is called when the instruction is parsed, a help\n  * string, and a list of token composing this instruction.\n+ *\n+ * When no tokens are defined (tokens[0] == NULL), they are retrieved\n+ * dynamically by calling f() as follows:\n+ *\n+ *  f((struct cmdline_token_hdr **)&token_hdr,\n+ *    NULL,\n+ *    (struct cmdline_token_hdr *[])tokens));\n+ *\n+ * The address of the resulting token is expected at the location pointed by\n+ * the first argument. Can be set to NULL to end the list.\n+ *\n+ * The cmdline argument (struct cmdline *) is always NULL.\n+ *\n+ * The last argument points to the NULL-terminated list of dynamic tokens\n+ * defined so far. Since token_hdr points to an index of that list, the\n+ * current index can be derived as follows:\n+ *\n+ *  int index = token_hdr - &(*tokens)[0];\n  */\n struct cmdline_inst {\n \t/* f(parsed_struct, data) */\n",
    "prefixes": [
        "dpdk-dev",
        "02/22"
    ]
}