get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 90573,
    "url": "http://patchwork.dpdk.org/api/patches/90573/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20210405193000.1113542-5-thomas@monjalon.net/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20210405193000.1113542-5-thomas@monjalon.net>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210405193000.1113542-5-thomas@monjalon.net",
    "date": "2021-04-05T19:30:00",
    "name": "[v5,4/4] log: add option argument help",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "a72b945683c62301673ba8e4f10747a9765994de",
    "submitter": {
        "id": 685,
        "url": "http://patchwork.dpdk.org/api/people/685/?format=api",
        "name": "Thomas Monjalon",
        "email": "thomas@monjalon.net"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patchwork.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20210405193000.1113542-5-thomas@monjalon.net/mbox/",
    "series": [
        {
            "id": 16108,
            "url": "http://patchwork.dpdk.org/api/series/16108/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=16108",
            "date": "2021-04-05T19:29:56",
            "name": "log level enhancements",
            "version": 5,
            "mbox": "http://patchwork.dpdk.org/series/16108/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/90573/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/90573/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 5F1BDA0A02;\n\tMon,  5 Apr 2021 21:30:35 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DD725140E48;\n\tMon,  5 Apr 2021 21:30:18 +0200 (CEST)",
            "from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com\n [64.147.123.19]) by mails.dpdk.org (Postfix) with ESMTP id 81B27406A2\n for <dev@dpdk.org>; Mon,  5 Apr 2021 21:30:17 +0200 (CEST)",
            "from compute2.internal (compute2.nyi.internal [10.202.2.42])\n by mailout.west.internal (Postfix) with ESMTP id 51C741A70;\n Mon,  5 Apr 2021 15:30:16 -0400 (EDT)",
            "from mailfrontend1 ([10.202.2.162])\n by compute2.internal (MEProxy); Mon, 05 Apr 2021 15:30:16 -0400",
            "from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])\n by mail.messagingengine.com (Postfix) with ESMTPA id 9E0F0240054;\n Mon,  5 Apr 2021 15:30:14 -0400 (EDT)"
        ],
        "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=uIvL+0w/mmmGq\n lgwm4LGyM4G/54P53GXnzWLHDgIuf0=; b=ye4sjGGDAY4BNKDl96UHOUVqoJpvS\n bEHV5wbf2GBuCoI5eIO52VxbpvmNEqWK4M8MdQhuxQJJ1GPGC500H9d1w9OHnx2x\n Lgb07Q4D3NXHmpYjrJrdAHBviE4MTBGz+Rau0DvNAIs4nB8oBbS1VqvSoySdEVAW\n ejP5r3CwhFkYG5cCyQNNu8Ka+CADcRirmTu7EwiWvQXSUHjS6E3uUutj4iq3OuQI\n zG3wbB3nK2dP+CS+iE/2GRGFJUJA0cvzC3YAa8h0gF+wObx6zTdEQx1/IYFF7Yg6\n X251zU8ZQtJ5EBpXDOizbTAZ0CCg2TCCoKeLVFVv8fe8qblNHf1c5gyPw==",
            "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=uIvL+0w/mmmGqlgwm4LGyM4G/54P53GXnzWLHDgIuf0=; b=oY9QIkTZ\n 0L93Tmu0XInegnaRAN16CXZD9IOEFsHW02D4CmgkXrLtTi6pm3GHXOO80UzECmlZ\n TqR+RQrp+EW6OFSiAoE+ELcGDSEXvbdeUl3j1ZxV3xhVfD18ZlfOaezhDZj7hYpQ\n gyplXB7C1o2NafdLe10RkcMZOHknzkPBFLXiVABfcrOkIH+ZxqqDQPleu3k8l85e\n tTuazsZtzIwl1PG5MQAKtS0AhQMANZ5A9ygWkw0gfXxEMvGtQ+sQYFhH8B5NqCPo\n TKk2561kP418b1TpvEFqqwqxlU9pJ/g7gWRTUTqXZ8SmmBIoGcZSpSX2hVxuJMMX\n 6dJ6SkBcynqlBQ=="
        ],
        "X-ME-Sender": "<xms:R2VrYNxEN7b4aYDS4plxw97V2IuJtjndMDWqyEV56Gw1moPyn01f0w>\n <xme:R2VrYNQVLMiCwTEQuOEBBriMcCsTinlz5EXzRLxK8iwvd50ePq5Kw7Rm4sDxjVUZi\n B2w8JvpQRGw7i7Ugw>",
        "X-ME-Proxy-Cause": "\n gggruggvucftvghtrhhoucdtuddrgeduledrudejvddgudegtdcutefuodetggdotefrod\n ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh\n necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd\n enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm\n rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc\n ggtffrrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedt\n gfeutdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh\n fuihiivgepvdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr\n lhhonhdrnhgvth",
        "X-ME-Proxy": "<xmx:R2VrYHUbMsX-ejeBCTN_gD_eh9MZQ9DN_ahruyeoC_FSs4Q403Zkhw>\n <xmx:R2VrYPg6wAXQI-PaETKMyyDMEY53KZKrR0immf7_nlZTBPOZaq2rGQ>\n <xmx:R2VrYPCvt9CyJBHCnF7gQ6XR_mVXrc5N7aWiITTT0SfYAVyBTTEMBA>\n <xmx:R2VrYGP58D4GKMyA_-NiBskji2VYnUAKrbFa03L4GeVEICW-C1FEvQ>",
        "From": "Thomas Monjalon <thomas@monjalon.net>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, Bruce Richardson <bruce.richardson@intel.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Ray Kinsella <mdr@ashroe.eu>, Neil Horman <nhorman@tuxdriver.com>",
        "Date": "Mon,  5 Apr 2021 21:30:00 +0200",
        "Message-Id": "<20210405193000.1113542-5-thomas@monjalon.net>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20210405193000.1113542-1-thomas@monjalon.net>",
        "References": "<20210309233116.1934666-1-thomas@monjalon.net>\n <20210405193000.1113542-1-thomas@monjalon.net>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v5 4/4] log: add option argument 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>\nAcked-by: Bruce Richardson <bruce.richardson@intel.com>\nAcked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\n---\n lib/librte_eal/common/eal_common_log.c     | 51 +++++++++++++++++++---\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                 |  1 +\n 5 files changed, 94 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 b9b982fdb5..4c6766a360 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,47 @@ loglevel_to_string(uint32_t level)\n \t}\n }\n \n+static int\n+log_type_compare(const void *a, const void *b)\n+{\n+\tconst struct rte_log_dynamic_type *type_a = a;\n+\tconst struct rte_log_dynamic_type *type_b = b;\n+\n+\tif (type_a->name == NULL && type_b->name == NULL)\n+\t\treturn 0;\n+\tif (type_a->name == NULL)\n+\t\treturn -1;\n+\tif (type_b->name == NULL)\n+\t\treturn 1;\n+\treturn strcmp(type_a->name, type_b->name);\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+\tstruct rte_log_dynamic_type *sorted_types;\n+\tconst size_t type_size = sizeof(rte_logs.dynamic_types[0]);\n+\tconst size_t type_count = rte_logs.dynamic_types_len;\n+\tconst size_t total_size = type_size * type_count;\n+\tsize_t type;\n+\n+\tsorted_types = malloc(total_size);\n+\tif (sorted_types == NULL) {\n+\t\t/* no sorting - unlikely */\n+\t\tsorted_types = rte_logs.dynamic_types;\n+\t} else {\n+\t\tmemcpy(sorted_types, rte_logs.dynamic_types, total_size);\n+\t\tqsort(sorted_types, type_count, type_size, log_type_compare);\n+\t}\n+\n+\tfor (type = 0; type < type_count; ++type) {\n+\t\tif (sorted_types[type].name == NULL)\n+\t\t\tcontinue;\n+\t\tfprintf(out, \"%s%s\\n\", prefix, sorted_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 +462,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 7075a051b8..2951b1aca2 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@@ -2068,9 +2085,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 684650a17b..c784fa6043 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, uint32_t level);\n int eal_log_save_pattern(const char *pattern, uint32_t level);\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 424dfa3fd0..ccbb7ccd81 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 e23745ae6e..6c14fea27b 100644\n--- a/lib/librte_eal/version.map\n+++ b/lib/librte_eal/version.map\n@@ -411,6 +411,7 @@ EXPERIMENTAL {\n \trte_power_pause;\n \n \t# added in 21.05\n+\trte_log_list_types;\n \trte_thread_key_create;\n \trte_thread_key_delete;\n \trte_thread_value_get;\n",
    "prefixes": [
        "v5",
        "4/4"
    ]
}