get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 88767,
    "url": "https://patches.dpdk.org/api/patches/88767/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20210309233116.1934666-8-thomas@monjalon.net/",
    "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": "<20210309233116.1934666-8-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210309233116.1934666-8-thomas@monjalon.net",
    "date": "2021-03-09T23:31:11",
    "name": "[07/11] eal: add log level help",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "bd854e4d88f5b13d00445436bd5e97cb21349cd2",
    "submitter": {
        "id": 685,
        "url": "https://patches.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "delegate": {
        "id": 24651,
        "url": "https://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20210309233116.1934666-8-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 15554,
            "url": "https://patches.dpdk.org/api/series/15554/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=15554",
            "date": "2021-03-09T23:31:04",
            "name": "improve options help",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/15554/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/88767/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/88767/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 A1247A0567;\n\tWed, 10 Mar 2021 00:32:29 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id C8CB622A579;\n\tWed, 10 Mar 2021 00:31:51 +0100 (CET)",
            "from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com\n [66.111.4.25]) by mails.dpdk.org (Postfix) with ESMTP id 57C2322A527\n for <dev@dpdk.org>; Wed, 10 Mar 2021 00:31:50 +0100 (CET)",
            "from compute4.internal (compute4.nyi.internal [10.202.2.44])\n by mailout.nyi.internal (Postfix) with ESMTP id 07F035C00ED;\n Tue,  9 Mar 2021 18:31:50 -0500 (EST)",
            "from mailfrontend1 ([10.202.2.162])\n by compute4.internal (MEProxy); Tue, 09 Mar 2021 18:31:50 -0500",
            "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n by mail.messagingengine.com (Postfix) with ESMTPA id CB38524005C;\n Tue,  9 Mar 2021 18:31:48 -0500 (EST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding; s=fm3; bh=98f9NPdLbDoj9\n UkhgWlp16HQWDs/Bgd+2JkvbojrKYU=; b=JwJlmhyb8svJb98Vp3o4B7pzUJZtC\n M0WoemsS+xi4sxeBvShvk++1cNhOVnAdA2YA5cwy7fxvIaQxUbog6umk3bYWTUJb\n rh5YB5/KfeEpQskjIBT0U2QHBS9YSMAtXB08Ghsr0tqeiPTaAk8GA/q1uoIMWdHr\n YTUd73y/yiuUoCxYrOHHzbtgaI4UJ4thG3BsGnVvrJHDj17BGFAts8uUMrByo6QC\n bMmRy2zkTlEZjxHoOZcTwQgv4FkcSiifwX0+bHZl4YJ4omDDZrrIBxQa7B+2benD\n mDczBVR1tWFOOEcpEHjOCLt3ACam+7a3yylNHGvLtekN/VsLNYPgLJHIg==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:content-transfer-encoding:date:from\n :in-reply-to:message-id:mime-version:references:subject:to\n :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=\n fm2; bh=98f9NPdLbDoj9UkhgWlp16HQWDs/Bgd+2JkvbojrKYU=; b=WzDYBq7O\n 2w/lfrdsPtr1ClLNEJoXDGvHikUJpEcHRQy51LWebyveGUkjdIPZvwNt6wmXdCgW\n UrEqMLq1zTe0tbil1ZMkhrkdt/LJRc1MYSTgtrGv567RUPTzOKtRFjSFMTikjYf5\n i4mNaRLcSipEfBsjKXsBawM+j2AcDBumtEJZ/4NdTFOIHe3XinvLbowZpcQaQPwE\n vJWA8ubdKzdIMxLAlCFB3sg9vsbKp8mBlmvwgyWX/RZOZsL8JZLRP4S1BkDVXKxq\n 6sZc6kHWlzR6BYmdMA1U8QAztWjToYmt7kkcRRnOwrLtIQ4g/mwkDIXgi4krj3RG\n IGC4N9o2tRo2qg=="
        ],
        "X-ME-Sender": "<xms:ZQVIYJi23Q8TcUKoYI122nWpslXBHPP8CRBX2Tse6wVHoAqNmhB1Vg>\n <xme:ZQVIYFqqbYtHe0X8Gigy61iFm74p-1CGg_f-zhN2pOOgsnLAK3ScDeZLnhocGPl9e\n 6r5FJWAlJtHPVwVdw>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgeduledrudduiedgudejfecutefuodetggdotefrod\n ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh\n necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd\n enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm\n rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc\n ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt\n gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh\n fuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr\n lhhonhdrnhgvth",
        "X-ME-Proxy": "<xmx:ZQVIYGtfH4qUFRrGqaoSkb0HxOBMAT9wW6uu4MdLem7aMRX_q-u86g>\n <xmx:ZQVIYIaARlPF4HnV7GmCdQlWfX-7VcAYn1GEv7WAF0XdAn653z6Dtw>\n <xmx:ZQVIYNY67vAUJfjIMOv-OpjhyD-X3fDBlopu8t0wy33yqUaJZCbgeQ>\n <xmx:ZgVIYJUA553LJveXSnbFIpdza8lQE4dIY6qEO1mGlwjzXNFBGlVFEw>",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, Ray Kinsella <mdr@ashroe.eu>,\n Neil Horman <nhorman@tuxdriver.com>",
        "Date": "Wed, 10 Mar 2021 00:31:11 +0100",
        "Message-Id": "<20210309233116.1934666-8-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.30.1",
        "In-Reply-To": "<20210309233116.1934666-1-thomas@monjalon.net>",
        "References": "<20210309233116.1934666-1-thomas@monjalon.net>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 07/11] eal: add log level help",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The option --log-level was not completely described in the usage text,\nand it was difficult to guess the names of the log types and levels.\n\nA new value \"help\" is accepted after --log-level to give more details\nabout the syntax and listing the log types and levels.\n\nThe array \"levels\" used for level name parsing is replaced with\na (modified) existing function which was used in rte_log_dump().\n\nThe new function rte_log_list_types() is exported in the API\nfor allowing an application to give this info to the user\nif not exposing the EAL option --log-level.\nThe list of log types cannot include all drivers if not linked in the\napplication (shared object plugin case).\n\nSigned-off-by: Thomas Monjalon <thomas@monjalon.net>\n---\n lib/librte_eal/common/eal_common_log.c     | 24 +++++++++---\n lib/librte_eal/common/eal_common_options.c | 44 +++++++++++++++-------\n lib/librte_eal/common/eal_log.h            |  5 +++\n lib/librte_eal/include/rte_log.h           | 11 ++++++\n lib/librte_eal/version.map                 |  3 ++\n 5 files changed, 69 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c\nindex 7f40c36f7e..e46ae7b112 100644\n--- a/lib/librte_eal/common/eal_common_log.c\n+++ b/lib/librte_eal/common/eal_common_log.c\n@@ -397,12 +397,12 @@ RTE_INIT_PRIO(log_init, LOG)\n \trte_logs.dynamic_types_len = RTE_LOGTYPE_FIRST_EXT_ID;\n }\n \n-static const char *\n-loglevel_to_string(uint32_t level)\n+const char *\n+eal_log_level2str(uint32_t level)\n {\n \tswitch (level) {\n \tcase 0: return \"disabled\";\n-\tcase RTE_LOG_EMERG: return \"emerg\";\n+\tcase RTE_LOG_EMERG: return \"emergency\";\n \tcase RTE_LOG_ALERT: return \"alert\";\n \tcase RTE_LOG_CRIT: return \"critical\";\n \tcase RTE_LOG_ERR: return \"error\";\n@@ -414,6 +414,20 @@ loglevel_to_string(uint32_t level)\n \t}\n }\n \n+/* Dump name of each logtype, one per line. */\n+void\n+rte_log_list_types(FILE *out, const char *prefix)\n+{\n+\tsize_t type;\n+\n+\tfor (type = 0; type < rte_logs.dynamic_types_len; ++type) {\n+\t\tif (rte_logs.dynamic_types[type].name == NULL)\n+\t\t\tcontinue;\n+\t\tfprintf(out, \"%s%s\\n\",\n+\t\t\t\tprefix, rte_logs.dynamic_types[type].name);\n+\t}\n+}\n+\n /* dump global level and registered log types */\n void\n rte_log_dump(FILE *f)\n@@ -421,14 +435,14 @@ rte_log_dump(FILE *f)\n \tsize_t i;\n \n \tfprintf(f, \"global log level is %s\\n\",\n-\t\tloglevel_to_string(rte_log_get_global_level()));\n+\t\teal_log_level2str(rte_log_get_global_level()));\n \n \tfor (i = 0; i < rte_logs.dynamic_types_len; i++) {\n \t\tif (rte_logs.dynamic_types[i].name == NULL)\n \t\t\tcontinue;\n \t\tfprintf(f, \"id %zu: %s, level is %s\\n\",\n \t\t\ti, rte_logs.dynamic_types[i].name,\n-\t\t\tloglevel_to_string(rte_logs.dynamic_types[i].loglevel));\n+\t\t\teal_log_level2str(rte_logs.dynamic_types[i].loglevel));\n \t}\n }\n \ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex 5b9ce286ff..6c14e788e8 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -1227,19 +1227,31 @@ eal_parse_syslog(const char *facility, struct internal_config *conf)\n }\n #endif\n \n+static void\n+eal_log_usage(void)\n+{\n+\tunsigned int level;\n+\n+\tprintf(\"Log type is a pattern matching items of this list\"\n+\t\t\t\" (plugins may be missing):\\n\");\n+\trte_log_list_types(stdout, \"\\t\");\n+\tprintf(\"\\n\");\n+\tprintf(\"Syntax using globbing pattern:     \");\n+\tprintf(\"--\"OPT_LOG_LEVEL\" pattern:level\\n\");\n+\tprintf(\"Syntax using regular expression:   \");\n+\tprintf(\"--\"OPT_LOG_LEVEL\" regexp,level\\n\");\n+\tprintf(\"Syntax for the global level:       \");\n+\tprintf(\"--\"OPT_LOG_LEVEL\" level\\n\");\n+\tprintf(\"Logs are emitted if allowed by both global and specific levels.\\n\");\n+\tprintf(\"\\n\");\n+\tprintf(\"Log level can be a number or the first letters of its name:\\n\");\n+\tfor (level = 1; level <= RTE_LOG_MAX; level++)\n+\t\tprintf(\"\\t%d   %s\\n\", level, eal_log_level2str(level));\n+}\n+\n static int\n eal_parse_log_priority(const char *level)\n {\n-\tstatic const char * const levels[] = {\n-\t\t[RTE_LOG_EMERG]   = \"emergency\",\n-\t\t[RTE_LOG_ALERT]   = \"alert\",\n-\t\t[RTE_LOG_CRIT]    = \"critical\",\n-\t\t[RTE_LOG_ERR]     = \"error\",\n-\t\t[RTE_LOG_WARNING] = \"warning\",\n-\t\t[RTE_LOG_NOTICE]  = \"notice\",\n-\t\t[RTE_LOG_INFO]    = \"info\",\n-\t\t[RTE_LOG_DEBUG]   = \"debug\",\n-\t};\n \tsize_t len = strlen(level);\n \tunsigned long tmp;\n \tchar *end;\n@@ -1250,7 +1262,7 @@ eal_parse_log_priority(const char *level)\n \n \t/* look for named values, skip 0 which is not a valid level */\n \tfor (i = 1; i < RTE_LOG_MAX; i++) {\n-\t\tif (strncmp(levels[i], level, len) == 0)\n+\t\tif (strncmp(eal_log_level2str(i), level, len) == 0)\n \t\t\treturn i;\n \t}\n \n@@ -1274,6 +1286,11 @@ eal_parse_log_level(const char *arg)\n \tchar *str, *level;\n \tint priority;\n \n+\tif (strcmp(arg, \"help\") == 0) {\n+\t\teal_log_usage();\n+\t\texit(EXIT_SUCCESS);\n+\t}\n+\n \tstr = strdup(arg);\n \tif (str == NULL)\n \t\treturn -1;\n@@ -2062,9 +2079,10 @@ eal_common_usage(void)\n #ifndef RTE_EXEC_ENV_WINDOWS\n \t       \"  --\"OPT_SYSLOG\"            Set syslog facility\\n\"\n #endif\n-\t       \"  --\"OPT_LOG_LEVEL\"=<int>   Set global log level\\n\"\n-\t       \"  --\"OPT_LOG_LEVEL\"=<type-match>:<int>\\n\"\n+\t       \"  --\"OPT_LOG_LEVEL\"=<level> Set global log level\\n\"\n+\t       \"  --\"OPT_LOG_LEVEL\"=<type-match>:<level>\\n\"\n \t       \"                      Set specific log level\\n\"\n+\t       \"  --\"OPT_LOG_LEVEL\"=help    Show log types and levels\\n\"\n #ifndef RTE_EXEC_ENV_WINDOWS\n \t       \"  --\"OPT_TRACE\"=<regex-match>\\n\"\n \t       \"                      Enable trace based on regular expression trace name.\\n\"\ndiff --git a/lib/librte_eal/common/eal_log.h b/lib/librte_eal/common/eal_log.h\nindex c057301769..4ca630b0f7 100644\n--- a/lib/librte_eal/common/eal_log.h\n+++ b/lib/librte_eal/common/eal_log.h\n@@ -24,4 +24,9 @@ void eal_log_set_default(FILE *default_log);\n int eal_log_save_regexp(const char *regexp, int priority);\n int eal_log_save_pattern(const char *pattern, int priority);\n \n+/*\n+ * Convert log level to string.\n+ */\n+const char *eal_log_level2str(uint32_t level);\n+\n #endif /* EAL_LOG_H */\ndiff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h\nindex 394e8682b9..e6192892c3 100644\n--- a/lib/librte_eal/include/rte_log.h\n+++ b/lib/librte_eal/include/rte_log.h\n@@ -240,6 +240,17 @@ int rte_log_register(const char *name);\n __rte_experimental\n int rte_log_register_type_and_pick_level(const char *name, uint32_t level_def);\n \n+/**\n+ * Dump name of each logtype, one per line.\n+ *\n+ * @param out\n+ *   Stream where the list is sent.\n+ * @param prefix\n+ *   String preceding each logtype in the output.\n+ */\n+__rte_experimental\n+void rte_log_list_types(FILE *out, const char *prefix);\n+\n /**\n  * Dump log information.\n  *\ndiff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map\nindex fce90a112f..6b7876a0b9 100644\n--- a/lib/librte_eal/version.map\n+++ b/lib/librte_eal/version.map\n@@ -412,6 +412,9 @@ EXPERIMENTAL {\n \trte_thread_tls_key_delete;\n \trte_thread_tls_value_get;\n \trte_thread_tls_value_set;\n+\n+\t# added in 21.05\n+\trte_log_list_types;\n };\n \n INTERNAL {\n",
    "prefixes": [
        "07/11"
    ]
}