get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 22655,
    "url": "https://patches.dpdk.org/api/patches/22655/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20170329004737.44249-4-allain.legacy@windriver.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": "<20170329004737.44249-4-allain.legacy@windriver.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170329004737.44249-4-allain.legacy@windriver.com",
    "date": "2017-03-29T00:47:34",
    "name": "[dpdk-dev,v3,3/6] cfgfile: add support for configurable comment character",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "402c76aaed81eb52e55dac53cb0f422ad88f5d42",
    "submitter": {
        "id": 679,
        "url": "https://patches.dpdk.org/api/people/679/?format=api",
        "name": "Allain Legacy",
        "email": "allain.legacy@windriver.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20170329004737.44249-4-allain.legacy@windriver.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/22655/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/22655/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 B8C8E5424;\n\tWed, 29 Mar 2017 02:48:24 +0200 (CEST)",
            "from mail1.windriver.com (mail1.windriver.com [147.11.146.13])\n\tby dpdk.org (Postfix) with ESMTP id 17AB037B4\n\tfor <dev@dpdk.org>; Wed, 29 Mar 2017 02:47:50 +0200 (CEST)",
            "from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com\n\t[147.11.189.40])\n\tby mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id v2T0lnYl026761\n\t(version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL);\n\tTue, 28 Mar 2017 17:47:49 -0700 (PDT)",
            "from yow-cgts4-lx.wrs.com (128.224.145.137) by\n\tALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server\n\t(TLS) id 14.3.294.0; Tue, 28 Mar 2017 17:47:48 -0700"
        ],
        "From": "Allain Legacy <allain.legacy@windriver.com>",
        "To": "<cristian.dumitrescu@intel.com>, <bruce.richardson@intel.com>",
        "CC": "<dev@dpdk.org>, <yuanhan.liu@linux.intel.com>,\n\t<thomas.monjalon@6wind.com>",
        "Date": "Tue, 28 Mar 2017 20:47:34 -0400",
        "Message-ID": "<20170329004737.44249-4-allain.legacy@windriver.com>",
        "X-Mailer": "git-send-email 2.12.1",
        "In-Reply-To": "<20170329004737.44249-1-allain.legacy@windriver.com>",
        "References": "<1489065060-98370-1-git-send-email-allain.legacy@windriver.com>\n\t<20170329004737.44249-1-allain.legacy@windriver.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[128.224.145.137]",
        "Subject": "[dpdk-dev] [PATCH v3 3/6] cfgfile: add support for configurable\n\tcomment character",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <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": "The current cfgfile comment character is hardcoded to ';'.  This commit a\nnew API to allow the user to specify which comment character to use while\nparsing the file.\n\nThis is to ease adoption by applications that have an existing\nconfiguration file which may use a different comment character.  For\ninstance, an application may already have a configuration file that uses\nthe '#' as the comment character.\n\nThe approach of using a new API with an extensible parameters structure was\nused rather than simply adding a new argument to the existing API to allow\nfor additional arguments to be introduced in the future.\n\nSigned-off-by: Allain Legacy <allain.legacy@windriver.com>\n---\n lib/librte_cfgfile/rte_cfgfile.c        | 61 ++++++++++++++++++++++++++++++++-\n lib/librte_cfgfile/rte_cfgfile.h        | 29 ++++++++++++++++\n test/test/test_cfgfile.c                | 47 +++++++++++++++++++++++++\n test/test/test_cfgfiles/etc/sample2.ini | 12 +++++++\n 4 files changed, 148 insertions(+), 1 deletion(-)\n create mode 100644 test/test/test_cfgfiles/etc/sample2.ini",
    "diff": "diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c\nindex 832fea829..63e34bbb0 100644\n--- a/lib/librte_cfgfile/rte_cfgfile.c\n+++ b/lib/librte_cfgfile/rte_cfgfile.c\n@@ -35,6 +35,7 @@\n #include <stdlib.h>\n #include <string.h>\n #include <ctype.h>\n+#include <rte_common.h>\n #include <rte_string_fns.h>\n \n #include \"rte_cfgfile.h\"\n@@ -58,6 +59,25 @@ struct rte_cfgfile {\n  * for new entries do we add in */\n #define CFG_ALLOC_ENTRY_BATCH 16\n \n+/**\n+ * Default cfgfile load parameters.\n+ */\n+static const struct rte_cfgfile_parameters default_cfgfile_params = {\n+\t.comment_character = CFG_DEFAULT_COMMENT_CHARACTER,\n+};\n+\n+/**\n+ * Defines the list of acceptable comment characters supported by this\n+ * library.\n+ */\n+static const char valid_comment_chars[] = {\n+\t'!',\n+\t'#',\n+\t'%',\n+\t';',\n+\t'@'\n+};\n+\n static unsigned\n _strip(char *str, unsigned len)\n {\n@@ -85,9 +105,45 @@ _strip(char *str, unsigned len)\n \treturn newlen;\n }\n \n+static int\n+rte_cfgfile_check_params(const struct rte_cfgfile_parameters *params)\n+{\n+\tunsigned int valid_comment;\n+\tunsigned int i;\n+\n+\tif (!params) {\n+\t\tprintf(\"Error - missing cfgfile parameters\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tvalid_comment = 0;\n+\tfor (i = 0; i < RTE_DIM(valid_comment_chars); i++) {\n+\t\tif (params->comment_character == valid_comment_chars[i]) {\n+\t\t\tvalid_comment = 1;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tif (valid_comment == 0)\t{\n+\t\tprintf(\"Error - invalid comment characters %c\\n\",\n+\t\t       params->comment_character);\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\treturn 0;\n+}\n+\n struct rte_cfgfile *\n rte_cfgfile_load(const char *filename, int flags)\n {\n+\treturn rte_cfgfile_load_with_params(filename, flags,\n+\t\t\t\t\t    &default_cfgfile_params);\n+}\n+\n+struct rte_cfgfile *\n+rte_cfgfile_load_with_params(const char *filename, int flags,\n+\t\t\t     const struct rte_cfgfile_parameters *params)\n+{\n \tint allocated_sections = CFG_ALLOC_SECTION_BATCH;\n \tint allocated_entries = 0;\n \tint curr_section = -1;\n@@ -96,6 +152,9 @@ rte_cfgfile_load(const char *filename, int flags)\n \tint lineno = 0;\n \tstruct rte_cfgfile *cfg = NULL;\n \n+\tif (rte_cfgfile_check_params(params))\n+\t\treturn NULL;\n+\n \tFILE *f = fopen(filename, \"r\");\n \tif (f == NULL)\n \t\treturn NULL;\n@@ -132,7 +191,7 @@ rte_cfgfile_load(const char *filename, int flags)\n \t\t\t\t\t\"Check if line too long\\n\", lineno);\n \t\t\tgoto error1;\n \t\t}\n-\t\tpos = memchr(buffer, ';', sizeof(buffer));\n+\t\tpos = memchr(buffer, params->comment_character, sizeof(buffer));\n \t\tif (pos != NULL) {\n \t\t\t*pos = '\\0';\n \t\t\tlen = pos -  buffer;\ndiff --git a/lib/librte_cfgfile/rte_cfgfile.h b/lib/librte_cfgfile/rte_cfgfile.h\nindex 0e805c268..a7cd3944e 100644\n--- a/lib/librte_cfgfile/rte_cfgfile.h\n+++ b/lib/librte_cfgfile/rte_cfgfile.h\n@@ -66,6 +66,12 @@ struct rte_cfgfile_entry {\n \tchar value[CFG_VALUE_LEN]; /**< Value */\n };\n \n+/** Configuration file operation optional arguments */\n+struct rte_cfgfile_parameters {\n+\tchar comment_character;\n+\t/**< Config file comment character; one of '!', '#', '%', ';', '@' */\n+};\n+\n /**@{ cfgfile load operation flags */\n /**\n  * Indicates that the file supports key value entries before the first defined\n@@ -74,6 +80,9 @@ struct rte_cfgfile_entry {\n #define CFG_FLAG_GLOBAL_SECTION (1 << 0)\n /**@} */\n \n+/** Defines the default comment character used for parsing config files. */\n+#define CFG_DEFAULT_COMMENT_CHARACTER ';'\n+\n /**\n * Open config file\n *\n@@ -87,6 +96,26 @@ struct rte_cfgfile_entry {\n struct rte_cfgfile *rte_cfgfile_load(const char *filename, int flags);\n \n /**\n+ * Open config file with specified optional parameters.  Use @see\n+ * rte_cfgfile_init_parameters to setup the default parameters.\n+ *\n+ * @param filename\n+ *   Config file name\n+ * @param flags\n+ *   Config file flags\n+ * @param params\n+ *   Additional configuration attributes.  Must be configured with default\n+ *   values prior to invoking this API.\n+ * @return\n+ *   Handle to configuration file on success, NULL otherwise\n+ * @param\n+ *\n+ */\n+struct rte_cfgfile *rte_cfgfile_load_with_params(const char *filename,\n+\tint flags, const struct rte_cfgfile_parameters *params);\n+\n+\n+/**\n * Get number of sections in config file\n *\n * @param cfg\ndiff --git a/test/test/test_cfgfile.c b/test/test/test_cfgfile.c\nindex ad293cc89..0478de59e 100644\n--- a/test/test/test_cfgfile.c\n+++ b/test/test/test_cfgfile.c\n@@ -130,6 +130,30 @@ test_cfgfile_sample1(void)\n }\n \n static int\n+test_cfgfile_sample2(void)\n+{\n+\tstruct rte_cfgfile_parameters params;\n+\tstruct rte_cfgfile *cfgfile;\n+\tint ret;\n+\n+\t/* override comment character */\n+\tmemset(&params, 0, sizeof(params));\n+\tparams.comment_character = '#';\n+\n+\tcfgfile = rte_cfgfile_load_with_params(CFG_FILES_ETC \"/sample2.ini\", 0,\n+\t\t\t\t\t       &params);\n+\tTEST_ASSERT_NOT_NULL(cfgfile, \"Failed to parse sample2.ini\");\n+\n+\tret = _test_cfgfile_sample(cfgfile);\n+\tTEST_ASSERT_SUCCESS(ret, \"Failed to validate sample file: %d\", ret);\n+\n+\tret = rte_cfgfile_close(cfgfile);\n+\tTEST_ASSERT_SUCCESS(ret, \"Failed to close cfgfile\");\n+\n+\treturn 0;\n+}\n+\n+static int\n test_cfgfile_invalid_section_header(void)\n {\n \tstruct rte_cfgfile *cfgfile;\n@@ -141,6 +165,23 @@ test_cfgfile_invalid_section_header(void)\n }\n \n static int\n+test_cfgfile_invalid_comment(void)\n+{\n+\tstruct rte_cfgfile_parameters params;\n+\tstruct rte_cfgfile *cfgfile;\n+\n+\t/* override comment character with an invalid one */\n+\tmemset(&params, 0, sizeof(params));\n+\tparams.comment_character = '$';\n+\n+\tcfgfile = rte_cfgfile_load_with_params(CFG_FILES_ETC \"/sample2.ini\", 0,\n+\t\t\t\t\t       &params);\n+\tTEST_ASSERT_NULL(cfgfile, \"Expected failured did not occur\");\n+\n+\treturn 0;\n+}\n+\n+static int\n test_cfgfile_invalid_key_value_pair(void)\n {\n \tstruct rte_cfgfile *cfgfile;\n@@ -219,9 +260,15 @@ test_cfgfile(void)\n \tif (test_cfgfile_sample1())\n \t\treturn -1;\n \n+\tif (test_cfgfile_sample2())\n+\t\treturn -1;\n+\n \tif (test_cfgfile_invalid_section_header())\n \t\treturn -1;\n \n+\tif (test_cfgfile_invalid_comment())\n+\t\treturn -1;\n+\n \tif (test_cfgfile_invalid_key_value_pair())\n \t\treturn -1;\n \ndiff --git a/test/test/test_cfgfiles/etc/sample2.ini b/test/test/test_cfgfiles/etc/sample2.ini\nnew file mode 100644\nindex 000000000..21075e976\n--- /dev/null\n+++ b/test/test/test_cfgfiles/etc/sample2.ini\n@@ -0,0 +1,12 @@\n+# this is a global comment\n+\n+[section1]\n+# this is section 1\n+key1=value1\n+\n+[section2]\n+# this is section 2\n+#key1=value1\n+key2=value2\n+key3=value3 # this is key3\n+ignore-missing-separator\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "3/6"
    ]
}