get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 129614,
    "url": "http://patches.dpdk.org/api/patches/129614/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230718131117.684986-1-shiyangx.he@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": "<20230718131117.684986-1-shiyangx.he@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230718131117.684986-1-shiyangx.he@intel.com",
    "date": "2023-07-18T13:11:17",
    "name": "app/dma-perf: parse the cmdline with getopt_long",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3d4c6330a0d33102737e44f0746ef2b40fffd2b5",
    "submitter": {
        "id": 2927,
        "url": "http://patches.dpdk.org/api/people/2927/?format=api",
        "name": "Shiyang He",
        "email": "shiyangx.he@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230718131117.684986-1-shiyangx.he@intel.com/mbox/",
    "series": [
        {
            "id": 28962,
            "url": "http://patches.dpdk.org/api/series/28962/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28962",
            "date": "2023-07-18T13:11:17",
            "name": "app/dma-perf: parse the cmdline with getopt_long",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/28962/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/129614/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/129614/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 E04AD42EA2;\n\tTue, 18 Jul 2023 07:47:55 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7883A410D3;\n\tTue, 18 Jul 2023 07:47:55 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n by mails.dpdk.org (Postfix) with ESMTP id E6BCA40A84;\n Tue, 18 Jul 2023 07:47:53 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Jul 2023 22:43:19 -0700",
            "from unknown (HELO root..) ([10.239.252.115])\n by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Jul 2023 22:43:16 -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=1689659274; x=1721195274;\n h=from:to:cc:subject:date:message-id:mime-version:\n content-transfer-encoding;\n bh=dphi9lkjcXAJsGnvcLl71rUi2nx+2a3HjjSvJLEDD9k=;\n b=YT79JiNGioLKtXbtuqoSSws+WW9UVSLVGQjVdsBlYycBkaHKgn+STZOv\n bruHrIXvOqFblAy7OmbE03e9DeVSGGYMMnW+4wyf4iaq6sbMENUDxWcZJ\n 3h2ODlJUyfKQZdGgFmDt8G73LN+ZMZ0Rl6PKIFcCIpGOiMuoXKAwcg0Zo\n nTmveSd3JQV9/3kK8lMIbNON3FoNySOR8ssUWp8KP6u651rfVWhOoJgUE\n pwdjJCKr1fmgq3UIDDR4yIbKOWIiOtXbCkJfZMM8fv0lJ6orOH5Oa5szq\n 7JWq2g3S/HyRM3Scxtzum6Va8V1bFT7sEQLT+mi01Og2pqIJTj4MR5MgW Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10774\"; a=\"432297739\"",
            "E=Sophos;i=\"6.01,213,1684825200\"; d=\"scan'208\";a=\"432297739\"",
            "E=McAfee;i=\"6600,9927,10774\"; a=\"970106923\"",
            "E=Sophos;i=\"6.01,213,1684825200\"; d=\"scan'208\";a=\"970106923\""
        ],
        "X-ExtLoop1": "1",
        "From": "Shiyang He <shiyangx.he@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "yidingx.zhou@intel.com, Shiyang He <shiyangx.he@intel.com>,\n stable@dpdk.org, Cheng Jiang <cheng1.jiang@intel.com>,\n Chengwen Feng <fengchengwen@huawei.com>, Yuan Wang <yuanx.wang@intel.com>,\n Jiayu Hu <jiayu.hu@intel.com>, Anoob Joseph <anoobj@marvell.com>",
        "Subject": "[PATCH] app/dma-perf: parse the cmdline with getopt_long",
        "Date": "Tue, 18 Jul 2023 13:11:17 +0000",
        "Message-Id": "<20230718131117.684986-1-shiyangx.he@intel.com>",
        "X-Mailer": "git-send-email 2.37.2",
        "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": "Use getopt_long to parse the command line for ease of extension and\nimproved code readability.\n\nFixes: 623dc9364dc6 (\"app/dma-perf: introduce DMA performance test\")\nCc: stable@dpdk.org\n\nSigned-off-by: Shiyang He <shiyangx.he@intel.com>\n---\n app/test-dma-perf/main.c     | 60 ++++++++++++++++++++++++++----------\n app/test-dma-perf/main.h     |  4 +++\n doc/guides/tools/dmaperf.rst |  2 +-\n 3 files changed, 48 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/app/test-dma-perf/main.c b/app/test-dma-perf/main.c\nindex e5bccc27da..a7e00998e6 100644\n--- a/app/test-dma-perf/main.c\n+++ b/app/test-dma-perf/main.c\n@@ -472,6 +472,36 @@ append_eal_args(int argc, char **argv, const char *eal_args, char **new_argv)\n \treturn new_argc;\n }\n \n+/*\n+ * Parse command line options.\n+ */\n+static void\n+parse_opts(struct test_options *options, int argc, char **argv)\n+{\n+\tstatic const struct option long_options[] = {\n+\t\t{ \"config\", required_argument, NULL, 0},\n+\t\t{ \"result\", required_argument, NULL, 1},\n+\t\t{ NULL },\n+\t};\n+\n+\tint opt_idx;\n+\tint opt;\n+\n+\twhile ((opt = getopt_long(argc, argv, \"\", long_options, &opt_idx))\n+\t\t\t!= EOF) {\n+\t\tswitch (opt) {\n+\t\tcase 0:\n+\t\t\toptions->cfg_path_ptr = optarg;\n+\t\t\tbreak;\n+\t\tcase 1:\n+\t\t\toptions->rst_path_ptr = optarg;\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+}\n+\n int\n main(int argc, char *argv[])\n {\n@@ -482,39 +512,35 @@ main(int argc, char *argv[])\n \tint wstatus;\n \tchar args[MAX_EAL_PARAM_NB][MAX_EAL_PARAM_LEN];\n \tchar *pargs[MAX_EAL_PARAM_NB];\n-\tchar *cfg_path_ptr = NULL;\n-\tchar *rst_path_ptr = NULL;\n \tchar rst_path[PATH_MAX];\n \tint new_argc;\n+\tstruct test_options opt;\n \n \tmemset(args, 0, sizeof(args));\n+\tmemset(&opt, 0, sizeof(opt));\n \n \tfor (i = 0; i < RTE_DIM(pargs); i++)\n \t\tpargs[i] = args[i];\n \n-\tfor (i = 0; i < (uint32_t)argc; i++) {\n-\t\tif (strncmp(argv[i], CMDLINE_CONFIG_ARG, MAX_LONG_OPT_SZ) == 0)\n-\t\t\tcfg_path_ptr = argv[i + 1];\n-\t\tif (strncmp(argv[i], CMDLINE_RESULT_ARG, MAX_LONG_OPT_SZ) == 0)\n-\t\t\trst_path_ptr = argv[i + 1];\n-\t}\n-\tif (cfg_path_ptr == NULL) {\n+\tparse_opts(&opt, argc, argv);\n+\n+\tif (opt.cfg_path_ptr == NULL) {\n \t\tprintf(\"Config file not assigned.\\n\");\n \t\treturn -1;\n \t}\n-\tif (rst_path_ptr == NULL) {\n-\t\tstrlcpy(rst_path, cfg_path_ptr, PATH_MAX);\n+\tif (opt.rst_path_ptr == NULL) {\n+\t\tstrlcpy(rst_path, opt.cfg_path_ptr, PATH_MAX);\n \t\tchar *token = strtok(basename(rst_path), \".\");\n \t\tif (token == NULL) {\n \t\t\tprintf(\"Config file error.\\n\");\n \t\t\treturn -1;\n \t\t}\n \t\tstrcat(token, \"_result.csv\");\n-\t\trst_path_ptr = rst_path;\n+\t\topt.rst_path_ptr = rst_path;\n \t}\n \n-\tcase_nb = load_configs(cfg_path_ptr);\n-\tfd = fopen(rst_path_ptr, \"w\");\n+\tcase_nb = load_configs(opt.cfg_path_ptr);\n+\tfd = fopen(opt.rst_path_ptr, \"w\");\n \tif (fd == NULL) {\n \t\tprintf(\"Open output CSV file error.\\n\");\n \t\treturn -1;\n@@ -527,7 +553,7 @@ main(int argc, char *argv[])\n \t\t\tprintf(\"Invalid test case %d.\\n\\n\", i + 1);\n \t\t\tsnprintf(output_str[0], MAX_OUTPUT_STR_LEN, \"Invalid case %d\\n\", i + 1);\n \n-\t\t\tfd = fopen(rst_path_ptr, \"a\");\n+\t\t\tfd = fopen(opt.rst_path_ptr, \"a\");\n \t\t\tif (!fd) {\n \t\t\t\tprintf(\"Open output CSV file error.\\n\");\n \t\t\t\treturn 0;\n@@ -541,7 +567,7 @@ main(int argc, char *argv[])\n \t\t\tprintf(\"No valid test type in test case %d.\\n\\n\", i + 1);\n \t\t\tsnprintf(output_str[0], MAX_OUTPUT_STR_LEN, \"Invalid case %d\\n\", i + 1);\n \n-\t\t\tfd = fopen(rst_path_ptr, \"a\");\n+\t\t\tfd = fopen(opt.rst_path_ptr, \"a\");\n \t\t\tif (!fd) {\n \t\t\t\tprintf(\"Open output CSV file error.\\n\");\n \t\t\t\treturn 0;\n@@ -569,7 +595,7 @@ main(int argc, char *argv[])\n \t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\"There should be at least 2 worker lcores.\\n\");\n \n-\t\t\tfd = fopen(rst_path_ptr, \"a\");\n+\t\t\tfd = fopen(opt.rst_path_ptr, \"a\");\n \t\t\tif (!fd) {\n \t\t\t\tprintf(\"Open output CSV file error.\\n\");\n \t\t\t\treturn 0;\ndiff --git a/app/test-dma-perf/main.h b/app/test-dma-perf/main.h\nindex f65e264378..b2f870a4e0 100644\n--- a/app/test-dma-perf/main.h\n+++ b/app/test-dma-perf/main.h\n@@ -18,6 +18,10 @@\n \n extern char output_str[MAX_WORKER_NB + 1][MAX_OUTPUT_STR_LEN];\n \n+struct test_options {\n+\tchar *cfg_path_ptr;\n+\tchar *rst_path_ptr;\n+};\n typedef enum {\n \tOP_NONE = 0,\n \tOP_ADD,\ndiff --git a/doc/guides/tools/dmaperf.rst b/doc/guides/tools/dmaperf.rst\nindex 9e3e78a6b7..9fc77ca943 100644\n--- a/doc/guides/tools/dmaperf.rst\n+++ b/doc/guides/tools/dmaperf.rst\n@@ -119,7 +119,7 @@ Typical command-line invocation to execute the application:\n \n .. code-block:: console\n \n-   dpdk-test-dma-perf --config=./config_dma.ini --result=./res_dma.csv\n+   dpdk-test-dma-perf --config ./config_dma.ini --result ./res_dma.csv\n \n Where ``config_dma.ini`` is the configuration file,\n and ``res_dma.csv`` will be the generated result file.\n",
    "prefixes": []
}