get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 47800,
    "url": "https://patches.dpdk.org/api/patches/47800/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181105070447.67700-2-dariusz.stojaczyk@intel.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": "<20181105070447.67700-2-dariusz.stojaczyk@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181105070447.67700-2-dariusz.stojaczyk@intel.com",
    "date": "2018-11-05T07:04:46",
    "name": "[2/3] devargs: delay freeing previous devargs when overriding them",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": true,
    "hash": "79481870ef6fe3bd767e8ba4ddcd2d724d77b4d2",
    "submitter": {
        "id": 1123,
        "url": "https://patches.dpdk.org/api/people/1123/?format=api",
        "name": "Stojaczyk, Dariusz",
        "email": "dariusz.stojaczyk@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20181105070447.67700-2-dariusz.stojaczyk@intel.com/mbox/",
    "series": [
        {
            "id": 2249,
            "url": "https://patches.dpdk.org/api/series/2249/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=2249",
            "date": "2018-11-05T07:04:45",
            "name": "[1/3] bus/pci: update device devargs on each rescan",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/2249/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/47800/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/47800/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 240904F9A;\n\tMon,  5 Nov 2018 08:08:17 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 0C3254CA2\n\tfor <dev@dpdk.org>; Mon,  5 Nov 2018 08:08:13 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Nov 2018 23:08:12 -0800",
            "from violet.igk.intel.com ([10.102.54.137])\n\tby fmsmga001.fm.intel.com with ESMTP; 04 Nov 2018 23:08:11 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.54,467,1534834800\"; d=\"scan'208\";a=\"105308432\"",
        "From": "Darek Stojaczyk <dariusz.stojaczyk@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net,\n\tDarek Stojaczyk <dariusz.stojaczyk@intel.com>",
        "Date": "Mon,  5 Nov 2018 08:04:46 +0100",
        "Message-Id": "<20181105070447.67700-2-dariusz.stojaczyk@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20181105070447.67700-1-dariusz.stojaczyk@intel.com>",
        "References": "<20181105070447.67700-1-dariusz.stojaczyk@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 2/3] devargs: delay freeing previous devargs when\n\toverriding them",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "In eal hotplug path, the previous devargs may be still\nreferenced by device structs at the time the rte_devargs_insert()\nis called. Those references are updated almost immediately\nafterwards, but in cases something goes wrong and they cannot\nbe updated, we might want to still keep the old devargs around.\n\nThis patch modifies rte_devargs_insert() so that it returns\na pointer to previous devargs that are being overridden. In\ncase something in the EAL hotplug path goes wrong, we can now\nremove the newly inserted devargs and re-insert the old ones.\n\nNote: Functional changes will come in a subsequent patch. This\n      one only extends the API.\n\nSigned-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>\n---\n drivers/bus/vdev/vdev.c                     | 12 +++++++++---\n lib/librte_eal/common/eal_common_dev.c      | 11 +++++++----\n lib/librte_eal/common/eal_common_devargs.c  | 21 ++++++++++++++-------\n lib/librte_eal/common/include/rte_devargs.h |  8 ++------\n 4 files changed, 32 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c\nindex 9c66bdc78..bbdae2314 100644\n--- a/drivers/bus/vdev/vdev.c\n+++ b/drivers/bus/vdev/vdev.c\n@@ -9,6 +9,7 @@\n #include <stdint.h>\n #include <stdbool.h>\n #include <sys/queue.h>\n+#include <assert.h>\n \n #include <rte_eal.h>\n #include <rte_dev.h>\n@@ -207,7 +208,7 @@ insert_vdev(const char *name, const char *args,\n \t\tbool init)\n {\n \tstruct rte_vdev_device *dev;\n-\tstruct rte_devargs *devargs;\n+\tstruct rte_devargs *devargs, *prev_devargs;\n \tint ret;\n \n \tif (name == NULL)\n@@ -239,8 +240,13 @@ insert_vdev(const char *name, const char *args,\n \t}\n \n \tTAILQ_INSERT_TAIL(&vdev_device_list, dev, next);\n-\tif (init)\n-\t\trte_devargs_insert(devargs);\n+\tif (init) {\n+\t\trte_devargs_insert(devargs, &prev_devargs);\n+\t\t /* any previous devargs should have been caught by the above\n+\t\t  * find_vdev(name) check\n+\t\t  */\n+\t\tassert(prev_devargs == NULL);\n+\t}\n \n \tif (p_dev)\n \t\t*p_dev = dev;\ndiff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c\nindex 62e9ed477..4cb424df1 100644\n--- a/lib/librte_eal/common/eal_common_dev.c\n+++ b/lib/librte_eal/common/eal_common_dev.c\n@@ -131,7 +131,7 @@ int\n local_dev_probe(const char *devargs, struct rte_device **new_dev)\n {\n \tstruct rte_device *dev;\n-\tstruct rte_devargs *da;\n+\tstruct rte_devargs *da, *prev_da;\n \tint ret;\n \n \t*new_dev = NULL;\n@@ -150,9 +150,12 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)\n \t\tgoto err_devarg;\n \t}\n \n-\tret = rte_devargs_insert(da);\n-\tif (ret)\n-\t\tgoto err_devarg;\n+\trte_devargs_insert(da, &prev_da);\n+\n+\tif (prev_da != NULL) {\n+\t\tfree(prev_da->args);\n+\t\tfree(prev_da);\n+\t}\n \n \tret = da->bus->scan();\n \tif (ret)\ndiff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c\nindex b7b9cb69e..c46365b69 100644\n--- a/lib/librte_eal/common/eal_common_devargs.c\n+++ b/lib/librte_eal/common/eal_common_devargs.c\n@@ -262,16 +262,23 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...)\n \treturn ret;\n }\n \n-int __rte_experimental\n-rte_devargs_insert(struct rte_devargs *da)\n+void __rte_experimental\n+rte_devargs_insert(struct rte_devargs *da, struct rte_devargs **prev_da)\n {\n-\tint ret;\n+\tstruct rte_devargs *d;\n+\tvoid *tmp;\n+\n+\t*prev_da = NULL;\n+\tTAILQ_FOREACH_SAFE(d, &devargs_list, next, tmp) {\n+\t\tif (strcmp(d->bus->name, da->bus->name) == 0 &&\n+\t\t    strcmp(d->name, da->name) == 0) {\n+\t\t\tTAILQ_REMOVE(&devargs_list, d, next);\n+\t\t\t*prev_da = d;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n \n-\tret = rte_devargs_remove(da);\n-\tif (ret < 0)\n-\t\treturn ret;\n \tTAILQ_INSERT_TAIL(&devargs_list, da, next);\n-\treturn 0;\n }\n \n /* store a whitelist parameter for later parsing */\ndiff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h\nindex b1f121f83..753cf7f54 100644\n--- a/lib/librte_eal/common/include/rte_devargs.h\n+++ b/lib/librte_eal/common/include/rte_devargs.h\n@@ -146,14 +146,10 @@ __attribute__((format(printf, 2, 0)));\n  *\n  * @param da\n  *  The devargs structure to insert.\n- *\n- * @return\n- *   - 0 on success\n- *   - Negative on error.\n  */\n __rte_experimental\n-int\n-rte_devargs_insert(struct rte_devargs *da);\n+void\n+rte_devargs_insert(struct rte_devargs *da, struct rte_devargs **prev_da);\n \n /**\n  * Add a device to the user device list\n",
    "prefixes": [
        "2/3"
    ]
}