get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 133498,
    "url": "http://patches.dpdk.org/api/patches/133498/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231027110117.70995-7-bruce.richardson@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": "<20231027110117.70995-7-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231027110117.70995-7-bruce.richardson@intel.com",
    "date": "2023-10-27T11:01:14",
    "name": "[v7,6/9] examples/bond: auto-generate cmdline boilerplate",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "fcb792ca3b30769cb25278cdbc11b3be86e70af6",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231027110117.70995-7-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 30025,
            "url": "http://patches.dpdk.org/api/series/30025/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30025",
            "date": "2023-10-27T11:01:08",
            "name": "document and simplify use of cmdline",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/30025/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/133498/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/133498/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 9B17E43215;\n\tFri, 27 Oct 2023 13:02:21 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DE91F42DE0;\n\tFri, 27 Oct 2023 13:01:41 +0200 (CEST)",
            "from mgamail.intel.com (mgamail.intel.com [192.198.163.8])\n by mails.dpdk.org (Postfix) with ESMTP id A35AD42DC3\n for <dev@dpdk.org>; Fri, 27 Oct 2023 13:01:39 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Oct 2023 04:01:39 -0700",
            "from silpixa00401385.ir.intel.com ([10.237.214.154])\n by orsmga004.jf.intel.com with ESMTP; 27 Oct 2023 04:01:37 -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=1698404500; x=1729940500;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=5icIuUY+8/2afBY+54eoAIutWNrbC2j868jtw+6qSBE=;\n b=MTYOIEcGPMvX2DV+KpUBRIg+XcATMvzXWZkxP53x61dIWGSofrSt2rtA\n E7Q16vSCoyBP7vQyizrxV0s4rf1MPlv6UtNH9VgGCkELFwFSuHLTuWu5+\n H2bxf+U+PdPJW+f6+JSGy7suBNKXEGohlVa+aS/XImDqiEdERaf95FUOV\n wpIZP966RQDkOo5OIM1t4z/+BE43W+Hxh3Q6Z5vrLHVngis7CLhtG6asC\n +qq7VbNy/cY4PrnGJ3slXKWX4H2k7tdPk82YRmS/ad3yABKhLDPRFm5eu\n TQgLbXd3eCU69nXLZockedLGc4w0RJeh+XA4wIAUCUBsn5yuWU00f7eVk w==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10875\"; a=\"546705\"",
            "E=Sophos;i=\"6.03,256,1694761200\";\n   d=\"scan'208\";a=\"546705\"",
            "E=McAfee;i=\"6600,9927,10875\"; a=\"883157864\"",
            "E=Sophos;i=\"6.03,256,1694761200\"; d=\"scan'208\";a=\"883157864\""
        ],
        "X-ExtLoop1": "1",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "david.marchand@redhat.com, rjarry@redhat.com,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Subject": "[PATCH v7 6/9] examples/bond: auto-generate cmdline boilerplate",
        "Date": "Fri, 27 Oct 2023 12:01:14 +0100",
        "Message-Id": "<20231027110117.70995-7-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20231027110117.70995-1-bruce.richardson@intel.com>",
        "References": "<20230802170052.955323-1-bruce.richardson@intel.com>\n <20231027110117.70995-1-bruce.richardson@intel.com>",
        "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 the dpdk-cmdline-gen script to autogenerate all the boilerplate\nstructs and defines for the commandline part of the app.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n\n---\nNote: the original help text on some of the commands in this example\n  were not useful \"this command do not handle any arguments\". Therefore,\n  when converting over to the command script, the per-command help\n  info has been updated with reference to the code rather than a literal\n  transfer of the existing help text, as was done with the previous 2\n  example apps.\n---\n examples/bond/Makefile                        |  12 +-\n examples/bond/commands.list                   |   6 +\n examples/bond/main.c                          | 161 ++----------------\n examples/bond/main.h                          |  10 --\n examples/bond/meson.build                     |   8 +\n .../multi_process/simple_mp/mp_commands.list  |   3 +\n 6 files changed, 40 insertions(+), 160 deletions(-)\n create mode 100644 examples/bond/commands.list\n delete mode 100644 examples/bond/main.h",
    "diff": "diff --git a/examples/bond/Makefile b/examples/bond/Makefile\nindex ad711a5bee..d87c7a32ba 100644\n--- a/examples/bond/Makefile\n+++ b/examples/bond/Makefile\n@@ -6,6 +6,7 @@ APP = bond_app\n \n # all source are stored in SRCS-y\n SRCS-y := main.c\n+SRC-DEPS := build/commands.h\n \n PKGCONF ?= pkg-config\n \n@@ -24,10 +25,13 @@ static: build/$(APP)-static\n LDFLAGS += -lrte_net_bond\n \n PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)\n-CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)\n+CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk) -I build/\n LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)\n LDFLAGS_STATIC = $(shell $(PKGCONF) --static --libs libdpdk)\n \n+build/commands.h: commands.list Makefile\n+\tdpdk-cmdline-gen.py -o $@ --context-name=main_ctx $<\n+\n ifeq ($(MAKECMDGOALS),static)\n # check for broken pkg-config\n ifeq ($(shell echo $(LDFLAGS_STATIC) | grep 'whole-archive.*l:lib.*no-whole-archive'),)\n@@ -38,10 +42,10 @@ endif\n \n CFLAGS += -DALLOW_EXPERIMENTAL_API\n \n-build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build\n+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build $(SRC-DEPS)\n \t$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)\n \n-build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build\n+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build  $(SRC-DEPS)\n \t$(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)\n \n build:\n@@ -49,5 +53,5 @@ build:\n \n .PHONY: clean\n clean:\n-\trm -f build/$(APP) build/$(APP)-static build/$(APP)-shared\n+\trm -f build/$(APP) build/$(APP)-static build/$(APP)-shared build/*.h\n \ttest -d build && rmdir -p build || true\ndiff --git a/examples/bond/commands.list b/examples/bond/commands.list\nnew file mode 100644\nindex 0000000000..a10bf75708\n--- /dev/null\n+++ b/examples/bond/commands.list\n@@ -0,0 +1,6 @@\n+send <IP>ip   # sends one ARPrequest through bonding for IP\n+start         # starts listening if not started at startup\n+stop          # stops listening\n+show          # shows some bond info, e.g. active members\n+help          # show help\n+quit          # close application\ndiff --git a/examples/bond/main.c b/examples/bond/main.c\nindex 90f422ec11..8528abf675 100644\n--- a/examples/bond/main.c\n+++ b/examples/bond/main.c\n@@ -45,16 +45,8 @@\n #include <rte_cpuflags.h>\n #include <rte_eth_bond.h>\n \n-#include <cmdline_rdline.h>\n-#include <cmdline_parse.h>\n-#include <cmdline_parse_num.h>\n-#include <cmdline_parse_string.h>\n-#include <cmdline_parse_ipaddr.h>\n-#include <cmdline_parse_etheraddr.h>\n #include <cmdline_socket.h>\n-#include <cmdline.h>\n-\n-#include \"main.h\"\n+#include \"commands.h\"\n \n #define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1\n \n@@ -462,11 +454,7 @@ static int lcore_main(__rte_unused void *arg1)\n \treturn 0;\n }\n \n-struct cmd_obj_send_result {\n-\tcmdline_fixed_string_t action;\n-\tcmdline_ipaddr_t ip;\n-};\n-static inline void get_string(struct cmd_obj_send_result *res, char *buf, uint8_t size)\n+static inline void get_string(struct cmd_send_result *res, char *buf, uint8_t size)\n {\n \tsnprintf(buf, size, NIPQUAD_FMT,\n \t\t((unsigned)((unsigned char *)&(res->ip.addr.ipv4))[0]),\n@@ -475,12 +463,11 @@ static inline void get_string(struct cmd_obj_send_result *res, char *buf, uint8_\n \t\t((unsigned)((unsigned char *)&(res->ip.addr.ipv4))[3])\n \t\t);\n }\n-static void cmd_obj_send_parsed(void *parsed_result,\n-\t\t__rte_unused struct cmdline *cl,\n-\t\t\t       __rte_unused void *data)\n+void\n+cmd_send_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)\n {\n \n-\tstruct cmd_obj_send_result *res = parsed_result;\n+\tstruct cmd_send_result *res = parsed_result;\n \tchar ip_str[INET6_ADDRSTRLEN];\n \n \tstruct rte_ether_addr bond_mac_addr;\n@@ -544,29 +531,8 @@ static void cmd_obj_send_parsed(void *parsed_result,\n \tcmdline_printf(cl, \"\\n\");\n }\n \n-cmdline_parse_token_string_t cmd_obj_action_send =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_obj_send_result, action, \"send\");\n-cmdline_parse_token_ipaddr_t cmd_obj_ip =\n-\tTOKEN_IPV4_INITIALIZER(struct cmd_obj_send_result, ip);\n-\n-cmdline_parse_inst_t cmd_obj_send = {\n-\t.f = cmd_obj_send_parsed,  /* function to call */\n-\t.data = NULL,      /* 2nd arg of func */\n-\t.help_str = \"send client_ip\",\n-\t.tokens = {        /* token list, NULL terminated */\n-\t\t(void *)&cmd_obj_action_send,\n-\t\t(void *)&cmd_obj_ip,\n-\t\tNULL,\n-\t},\n-};\n-\n-struct cmd_start_result {\n-\tcmdline_fixed_string_t start;\n-};\n-\n-static void cmd_start_parsed(__rte_unused void *parsed_result,\n-\t\t\t       struct cmdline *cl,\n-\t\t\t       __rte_unused void *data)\n+void\n+cmd_start_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data)\n {\n \tint worker_core_id = rte_lcore_id();\n \n@@ -605,26 +571,8 @@ static void cmd_start_parsed(__rte_unused void *parsed_result,\n \t\t);\n }\n \n-cmdline_parse_token_string_t cmd_start_start =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_start_result, start, \"start\");\n-\n-cmdline_parse_inst_t cmd_start = {\n-\t.f = cmd_start_parsed,  /* function to call */\n-\t.data = NULL,      /* 2nd arg of func */\n-\t.help_str = \"starts listening if not started at startup\",\n-\t.tokens = {        /* token list, NULL terminated */\n-\t\t(void *)&cmd_start_start,\n-\t\tNULL,\n-\t},\n-};\n-\n-struct cmd_help_result {\n-\tcmdline_fixed_string_t help;\n-};\n-\n-static void cmd_help_parsed(__rte_unused void *parsed_result,\n-\t\t\t    struct cmdline *cl,\n-\t\t\t    __rte_unused void *data)\n+void\n+cmd_help_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data)\n {\n \tcmdline_printf(cl,\n \t\t\t\"ALB - link bonding mode 6 example\\n\"\n@@ -637,26 +585,8 @@ static void cmd_help_parsed(__rte_unused void *parsed_result,\n \t\t       );\n }\n \n-cmdline_parse_token_string_t cmd_help_help =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_help_result, help, \"help\");\n-\n-cmdline_parse_inst_t cmd_help = {\n-\t.f = cmd_help_parsed,  /* function to call */\n-\t.data = NULL,      /* 2nd arg of func */\n-\t.help_str = \"show help\",\n-\t.tokens = {        /* token list, NULL terminated */\n-\t\t(void *)&cmd_help_help,\n-\t\tNULL,\n-\t},\n-};\n-\n-struct cmd_stop_result {\n-\tcmdline_fixed_string_t stop;\n-};\n-\n-static void cmd_stop_parsed(__rte_unused void *parsed_result,\n-\t\t\t    struct cmdline *cl,\n-\t\t\t    __rte_unused void *data)\n+void\n+cmd_stop_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data)\n {\n \trte_spinlock_lock(&global_flag_stru_p->lock);\n \tif (global_flag_stru_p->LcoreMainIsRunning == 0)\t{\n@@ -678,26 +608,8 @@ static void cmd_stop_parsed(__rte_unused void *parsed_result,\n \trte_spinlock_unlock(&global_flag_stru_p->lock);\n }\n \n-cmdline_parse_token_string_t cmd_stop_stop =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_stop_result, stop, \"stop\");\n-\n-cmdline_parse_inst_t cmd_stop = {\n-\t.f = cmd_stop_parsed,  /* function to call */\n-\t.data = NULL,      /* 2nd arg of func */\n-\t.help_str = \"this command do not handle any arguments\",\n-\t.tokens = {        /* token list, NULL terminated */\n-\t\t(void *)&cmd_stop_stop,\n-\t\tNULL,\n-\t},\n-};\n-\n-struct cmd_quit_result {\n-\tcmdline_fixed_string_t quit;\n-};\n-\n-static void cmd_quit_parsed(__rte_unused void *parsed_result,\n-\t\t\t    struct cmdline *cl,\n-\t\t\t    __rte_unused void *data)\n+void\n+cmd_quit_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data)\n {\n \trte_spinlock_lock(&global_flag_stru_p->lock);\n \tif (global_flag_stru_p->LcoreMainIsRunning == 0)\t{\n@@ -721,26 +633,8 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result,\n \tcmdline_quit(cl);\n }\n \n-cmdline_parse_token_string_t cmd_quit_quit =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_quit_result, quit, \"quit\");\n-\n-cmdline_parse_inst_t cmd_quit = {\n-\t.f = cmd_quit_parsed,  /* function to call */\n-\t.data = NULL,      /* 2nd arg of func */\n-\t.help_str = \"this command do not handle any arguments\",\n-\t.tokens = {        /* token list, NULL terminated */\n-\t\t(void *)&cmd_quit_quit,\n-\t\tNULL,\n-\t},\n-};\n-\n-struct cmd_show_result {\n-\tcmdline_fixed_string_t show;\n-};\n-\n-static void cmd_show_parsed(__rte_unused void *parsed_result,\n-\t\t\t    struct cmdline *cl,\n-\t\t\t    __rte_unused void *data)\n+void\n+cmd_show_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data)\n {\n \tuint16_t members[16] = {0};\n \tuint8_t len = 16;\n@@ -772,31 +666,6 @@ static void cmd_show_parsed(__rte_unused void *parsed_result,\n \trte_spinlock_unlock(&global_flag_stru_p->lock);\n }\n \n-cmdline_parse_token_string_t cmd_show_show =\n-\tTOKEN_STRING_INITIALIZER(struct cmd_show_result, show, \"show\");\n-\n-cmdline_parse_inst_t cmd_show = {\n-\t.f = cmd_show_parsed,  /* function to call */\n-\t.data = NULL,      /* 2nd arg of func */\n-\t.help_str = \"this command do not handle any arguments\",\n-\t.tokens = {        /* token list, NULL terminated */\n-\t\t(void *)&cmd_show_show,\n-\t\tNULL,\n-\t},\n-};\n-\n-/****** CONTEXT (list of instruction) */\n-\n-cmdline_parse_ctx_t main_ctx[] = {\n-\t(cmdline_parse_inst_t *)&cmd_start,\n-\t(cmdline_parse_inst_t *)&cmd_obj_send,\n-\t(cmdline_parse_inst_t *)&cmd_stop,\n-\t(cmdline_parse_inst_t *)&cmd_show,\n-\t(cmdline_parse_inst_t *)&cmd_quit,\n-\t(cmdline_parse_inst_t *)&cmd_help,\n-\tNULL,\n-};\n-\n /* prompt function, called from main on MAIN lcore */\n static void prompt(__rte_unused void *arg1)\n {\ndiff --git a/examples/bond/main.h b/examples/bond/main.h\ndeleted file mode 100644\nindex f91ed9c885..0000000000\n--- a/examples/bond/main.h\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-/* SPDX-License-Identifier: BSD-3-Clause\n- * Copyright(c) 2010-2015 Intel Corporation\n- */\n-\n-#ifndef _MAIN_H_\n-#define _MAIN_H_\n-\n-int main(int argc, char *argv[]);\n-\n-#endif /* ifndef _MAIN_H_ */\ndiff --git a/examples/bond/meson.build b/examples/bond/meson.build\nindex ed22b7887d..bfbec04ecd 100644\n--- a/examples/bond/meson.build\n+++ b/examples/bond/meson.build\n@@ -11,3 +11,11 @@ allow_experimental_apis = true\n sources = files(\n         'main.c',\n )\n+\n+cmd_h = custom_target('commands_hdr',\n+\toutput: 'commands.h',\n+\tinput: files('commands.list'),\n+\tcapture: true,\n+\tcommand: [cmdline_gen_cmd, '--context-name=main_ctx', '@INPUT@']\n+)\n+sources += cmd_h\ndiff --git a/examples/multi_process/simple_mp/mp_commands.list b/examples/multi_process/simple_mp/mp_commands.list\nindex c8890cb071..afce5eb1c1 100644\n--- a/examples/multi_process/simple_mp/mp_commands.list\n+++ b/examples/multi_process/simple_mp/mp_commands.list\n@@ -1,3 +1,6 @@\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2023 Intel Corporation\n+#\n send <STRING>message  # send a string to another process\n help                  # show help\n quit                  # close the application\n",
    "prefixes": [
        "v7",
        "6/9"
    ]
}