get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7742,
    "url": "https://patches.dpdk.org/api/patches/7742/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445260390-78613-1-git-send-email-btw@mail.ustc.edu.cn/",
    "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": "<1445260390-78613-1-git-send-email-btw@mail.ustc.edu.cn>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1445260390-78613-1-git-send-email-btw@mail.ustc.edu.cn",
    "date": "2015-10-19T13:13:10",
    "name": "[dpdk-dev,v2] eal: don't reset getopt lib",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3cc41d5119aa67234a03bc8040260b5072221518",
    "submitter": {
        "id": 350,
        "url": "https://patches.dpdk.org/api/people/350/?format=api",
        "name": "Tiwei Bie",
        "email": "btw@mail.ustc.edu.cn"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445260390-78613-1-git-send-email-btw@mail.ustc.edu.cn/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7742/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7742/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 AF8968E6E;\n\tMon, 19 Oct 2015 15:11:29 +0200 (CEST)",
            "from ustc.edu.cn (smtp2.ustc.edu.cn [202.38.64.46])\n\tby dpdk.org (Postfix) with ESMTP id 356FB5961\n\tfor <dev@dpdk.org>; Mon, 19 Oct 2015 15:11:26 +0200 (CEST)",
            "from freebsd.my.domain (unknown [58.211.218.74])\n\tby newmailweb.ustc.edu.cn (Coremail) with SMTP id\n\tLkAmygDn7cH46yRWqa3bAQ--.62769S2; \n\tMon, 19 Oct 2015 21:11:24 +0800 (CST)"
        ],
        "From": "Tiwei Bie <btw@mail.ustc.edu.cn>",
        "To": "dev@dpdk.org",
        "Date": "Mon, 19 Oct 2015 21:13:10 +0800",
        "Message-Id": "<1445260390-78613-1-git-send-email-btw@mail.ustc.edu.cn>",
        "X-Mailer": "git-send-email 2.1.2",
        "In-Reply-To": "<1444909564-53691-1-git-send-email-btw@mail.ustc.edu.cn>",
        "References": "<1444909564-53691-1-git-send-email-btw@mail.ustc.edu.cn>",
        "X-CM-TRANSID": "LkAmygDn7cH46yRWqa3bAQ--.62769S2",
        "X-Coremail-Antispam": "1UD129KBjvJXoW3Wr4fAF1UXw1furW7Xw45Awb_yoWxZr1UpF\n\tZ8Ca4jgr1xtFW8Zr43ta1kCFWYkrn3JF1UCa97u3sYyw4ay34Fka1jkF4rWF13WrsrJrWU\n\tZF4FvFyY9FyUG3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDU0xBIdaVrnRJUUUkIb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2\n\t0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw\n\tA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xII\n\tjxv20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I\n\t8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI\n\t64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWxJVW8Jr\n\t1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxkIecxEwVAFwVW5GwCF04k2\n\t0xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI\n\t8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jrv_JF1lIxkGc2Ij64vIr41l\n\tIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIx\n\tAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvE\n\tx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU5JUU5UUUUU==",
        "X-CM-SenderInfo": "xewzqzxdloh3xvwfhvlgxou0/1tbiAQcHAVQhmEobywAMs7",
        "Cc": "dprovan@bivio.net",
        "Subject": "[dpdk-dev] [PATCH v2] eal: don't reset getopt lib",
        "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": "Someone may need to call rte_eal_init() with a fake argc/argv array\nin the middle of using getopt() to parse its own unrelated argc/argv\nparameters. So getopt lib shouldn't be reset by rte_eal_init().\n\nNow eal will always save optind, optarg and optopt (and optreset on\nFreeBSD) at the beginning, initialize optind (and optreset on FreeBSD)\nto 1 before calling getopt_long(), then restore all values after.\n\nSuggested-by: Don Provan <dprovan@bivio.net>\nSuggested-by: Bruce Richardson <bruce.richardson@intel.com>\nSigned-off-by: Tiwei Bie <btw@mail.ustc.edu.cn>\nReviewed-by: Don Provan <dprovan@bivio.net>\nReviewed-by: Bruce Richardson <bruce.richardson@intel.com>\n---\nv2:\n - constify some variables\n\n lib/librte_eal/bsdapp/eal/eal.c   | 47 ++++++++++++++++++++++++-------\n lib/librte_eal/linuxapp/eal/eal.c | 59 ++++++++++++++++++++++++++++-----------\n 2 files changed, 80 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 1b6f705..b356517 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -312,8 +312,14 @@ eal_log_level_parse(int argc, char **argv)\n \tint opt;\n \tchar **argvopt;\n \tint option_index;\n+\tconst int old_optind = optind;\n+\tconst int old_optopt = optopt;\n+\tconst int old_optreset = optreset;\n+\tchar * const old_optarg = optarg;\n \n \targvopt = argv;\n+\toptind = 1;\n+\toptreset = 1;\n \n \teal_reset_internal_config(&internal_config);\n \n@@ -334,7 +340,11 @@ eal_log_level_parse(int argc, char **argv)\n \t\t\tbreak;\n \t}\n \n-\toptind = 0; /* reset getopt lib */\n+\t/* restore getopt lib */\n+\toptind = old_optind;\n+\toptopt = old_optopt;\n+\toptreset = old_optreset;\n+\toptarg = old_optarg;\n }\n \n /* Parse the argument given in the command line of the application */\n@@ -345,25 +355,31 @@ eal_parse_args(int argc, char **argv)\n \tchar **argvopt;\n \tint option_index;\n \tchar *prgname = argv[0];\n+\tconst int old_optind = optind;\n+\tconst int old_optopt = optopt;\n+\tconst int old_optreset = optreset;\n+\tchar * const old_optarg = optarg;\n \n \targvopt = argv;\n+\toptind = 1;\n+\toptreset = 1;\n \n \twhile ((opt = getopt_long(argc, argvopt, eal_short_options,\n \t\t\t\t  eal_long_options, &option_index)) != EOF) {\n \n-\t\tint ret;\n-\n \t\t/* getopt is not happy, stop right now */\n \t\tif (opt == '?') {\n \t\t\teal_usage(prgname);\n-\t\t\treturn -1;\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n \t\t}\n \n \t\tret = eal_parse_common_option(opt, optarg, &internal_config);\n \t\t/* common parser is not happy */\n \t\tif (ret < 0) {\n \t\t\teal_usage(prgname);\n-\t\t\treturn -1;\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n \t\t}\n \t\t/* common parser handled this option */\n \t\tif (ret == 0)\n@@ -387,23 +403,34 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\t\t\"on FreeBSD\\n\", opt);\n \t\t\t}\n \t\t\teal_usage(prgname);\n-\t\t\treturn -1;\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n \t\t}\n \t}\n \n-\tif (eal_adjust_config(&internal_config) != 0)\n-\t\treturn -1;\n+\tif (eal_adjust_config(&internal_config) != 0) {\n+\t\tret = -1;\n+\t\tgoto out;\n+\t}\n \n \t/* sanity checks */\n \tif (eal_check_common_options(&internal_config) != 0) {\n \t\teal_usage(prgname);\n-\t\treturn -1;\n+\t\tret = -1;\n+\t\tgoto out;\n \t}\n \n \tif (optind >= 0)\n \t\targv[optind-1] = prgname;\n \tret = optind-1;\n-\toptind = 0; /* reset getopt lib */\n+\n+out:\n+\t/* restore getopt lib */\n+\toptind = old_optind;\n+\toptopt = old_optopt;\n+\toptreset = old_optreset;\n+\toptarg = old_optarg;\n+\n \treturn ret;\n }\n \ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 33e1067..89a81bd 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -505,8 +505,12 @@ eal_log_level_parse(int argc, char **argv)\n \tint opt;\n \tchar **argvopt;\n \tint option_index;\n+\tconst int old_optind = optind;\n+\tconst int old_optopt = optopt;\n+\tchar * const old_optarg = optarg;\n \n \targvopt = argv;\n+\toptind = 1;\n \n \teal_reset_internal_config(&internal_config);\n \n@@ -527,7 +531,10 @@ eal_log_level_parse(int argc, char **argv)\n \t\t\tbreak;\n \t}\n \n-\toptind = 0; /* reset getopt lib */\n+\t/* restore getopt lib */\n+\toptind = old_optind;\n+\toptopt = old_optopt;\n+\toptarg = old_optarg;\n }\n \n /* Parse the argument given in the command line of the application */\n@@ -539,25 +546,29 @@ eal_parse_args(int argc, char **argv)\n \tint option_index;\n \tchar *prgname = argv[0];\n \tstruct shared_driver *solib;\n+\tconst int old_optind = optind;\n+\tconst int old_optopt = optopt;\n+\tchar * const old_optarg = optarg;\n \n \targvopt = argv;\n+\toptind = 1;\n \n \twhile ((opt = getopt_long(argc, argvopt, eal_short_options,\n \t\t\t\t  eal_long_options, &option_index)) != EOF) {\n \n-\t\tint ret;\n-\n \t\t/* getopt is not happy, stop right now */\n \t\tif (opt == '?') {\n \t\t\teal_usage(prgname);\n-\t\t\treturn -1;\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n \t\t}\n \n \t\tret = eal_parse_common_option(opt, optarg, &internal_config);\n \t\t/* common parser is not happy */\n \t\tif (ret < 0) {\n \t\t\teal_usage(prgname);\n-\t\t\treturn -1;\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n \t\t}\n \t\t/* common parser handled this option */\n \t\tif (ret == 0)\n@@ -573,7 +584,8 @@ eal_parse_args(int argc, char **argv)\n \t\t\tsolib = malloc(sizeof(*solib));\n \t\t\tif (solib == NULL) {\n \t\t\t\tRTE_LOG(ERR, EAL, \"malloc(solib) failed\\n\");\n-\t\t\t\treturn -1;\n+\t\t\t\tret = -1;\n+\t\t\t\tgoto out;\n \t\t\t}\n \t\t\tmemset(solib, 0, sizeof(*solib));\n \t\t\tstrncpy(solib->name, optarg, PATH_MAX-1);\n@@ -589,7 +601,8 @@ eal_parse_args(int argc, char **argv)\n \t\t\tRTE_LOG(ERR, EAL, \"Can't support DPDK app \"\n \t\t\t\t\"running on Dom0, please configure\"\n \t\t\t\t\" RTE_LIBRTE_XEN_DOM0=y\\n\");\n-\t\t\treturn -1;\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n #endif\n \t\t\tbreak;\n \n@@ -606,7 +619,8 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n \t\t\t\t\t\tOPT_SOCKET_MEM \"\\n\");\n \t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n+\t\t\t\tret = -1;\n+\t\t\t\tgoto out;\n \t\t\t}\n \t\t\tbreak;\n \n@@ -615,7 +629,8 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameter for --\"\n \t\t\t\t\t\tOPT_BASE_VIRTADDR \"\\n\");\n \t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n+\t\t\t\tret = -1;\n+\t\t\t\tgoto out;\n \t\t\t}\n \t\t\tbreak;\n \n@@ -624,7 +639,8 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\tRTE_LOG(ERR, EAL, \"invalid parameters for --\"\n \t\t\t\t\t\tOPT_VFIO_INTR \"\\n\");\n \t\t\t\teal_usage(prgname);\n-\t\t\t\treturn -1;\n+\t\t\t\tret = -1;\n+\t\t\t\tgoto out;\n \t\t\t}\n \t\t\tbreak;\n \n@@ -646,17 +662,21 @@ eal_parse_args(int argc, char **argv)\n \t\t\t\t\t\"on Linux\\n\", opt);\n \t\t\t}\n \t\t\teal_usage(prgname);\n-\t\t\treturn -1;\n+\t\t\tret = -1;\n+\t\t\tgoto out;\n \t\t}\n \t}\n \n-\tif (eal_adjust_config(&internal_config) != 0)\n-\t\treturn -1;\n+\tif (eal_adjust_config(&internal_config) != 0) {\n+\t\tret = -1;\n+\t\tgoto out;\n+\t}\n \n \t/* sanity checks */\n \tif (eal_check_common_options(&internal_config) != 0) {\n \t\teal_usage(prgname);\n-\t\treturn -1;\n+\t\tret = -1;\n+\t\tgoto out;\n \t}\n \n \t/* --xen-dom0 doesn't make sense with --socket-mem */\n@@ -664,13 +684,20 @@ eal_parse_args(int argc, char **argv)\n \t\tRTE_LOG(ERR, EAL, \"Options --\"OPT_SOCKET_MEM\" cannot be specified \"\n \t\t\t\"together with --\"OPT_XEN_DOM0\"\\n\");\n \t\teal_usage(prgname);\n-\t\treturn -1;\n+\t\tret = -1;\n+\t\tgoto out;\n \t}\n \n \tif (optind >= 0)\n \t\targv[optind-1] = prgname;\n \tret = optind-1;\n-\toptind = 0; /* reset getopt lib */\n+\n+out:\n+\t/* restore getopt lib */\n+\toptind = old_optind;\n+\toptopt = old_optopt;\n+\toptarg = old_optarg;\n+\n \treturn ret;\n }\n \n",
    "prefixes": [
        "dpdk-dev",
        "v2"
    ]
}