get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 13508,
    "url": "https://patches.dpdk.org/api/patches/13508/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1465805550-30640-5-git-send-email-viktorin@rehivetech.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": "<1465805550-30640-5-git-send-email-viktorin@rehivetech.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1465805550-30640-5-git-send-email-viktorin@rehivetech.com",
    "date": "2016-06-13T08:12:24",
    "name": "[dpdk-dev,v4,04/10] app/test: add functions to create files from resources",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "66961d5a06ebefc34f827e5859d8d9ee23fecc84",
    "submitter": {
        "id": 292,
        "url": "https://patches.dpdk.org/api/people/292/?format=api",
        "name": "Jan Viktorin",
        "email": "viktorin@rehivetech.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1465805550-30640-5-git-send-email-viktorin@rehivetech.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/13508/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/13508/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 A214B5598;\n\tMon, 13 Jun 2016 10:17:52 +0200 (CEST)",
            "from wes1-so1.wedos.net (wes1-so1.wedos.net [46.28.106.15])\n\tby dpdk.org (Postfix) with ESMTP id F3046530A\n\tfor <dev@dpdk.org>; Mon, 13 Jun 2016 10:17:46 +0200 (CEST)",
            "from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz\n\t[147.229.13.147])\n\tby wes1-so1.wedos.net (Postfix) with ESMTPSA id 3rSlyL5S0czBp0;\n\tMon, 13 Jun 2016 10:17:46 +0200 (CEST)"
        ],
        "From": "Jan Viktorin <viktorin@rehivetech.com>",
        "To": "dev@dpdk.org",
        "Cc": "Jan Viktorin <viktorin@rehivetech.com>,\n\tThomas Monjalon <thomas.monjalon@6wind.com>,\n\tDavid Marchand <david.marchand@6wind.com>,\n\tBruce Richardson <bruce.richardson@intel.com>",
        "Date": "Mon, 13 Jun 2016 10:12:24 +0200",
        "Message-Id": "<1465805550-30640-5-git-send-email-viktorin@rehivetech.com>",
        "X-Mailer": "git-send-email 2.8.0",
        "In-Reply-To": [
            "<1465805550-30640-1-git-send-email-viktorin@rehivetech.com>",
            "<1463510101-5633-1-git-send-email-viktorin@rehivetech.com>"
        ],
        "References": [
            "<1465805550-30640-1-git-send-email-viktorin@rehivetech.com>",
            "<1463510101-5633-1-git-send-email-viktorin@rehivetech.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v4 04/10] app/test: add functions to create files\n\tfrom resources",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <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": "A resource can be written into the target filesystem by calling\nresource_fwrite or resource_fwrite_file. Such file can be created\nbefore a test is started and removed after the test finishes.\n\nSigned-off-by: Jan Viktorin <viktorin@rehivetech.com>\n---\n app/test/resource.c      | 35 +++++++++++++++++++++++++++++++++++\n app/test/resource.h      | 14 ++++++++++++++\n app/test/test_resource.c | 10 ++++++++++\n 3 files changed, 59 insertions(+)",
    "diff": "diff --git a/app/test/resource.c b/app/test/resource.c\nindex 30513db..acb63c1 100644\n--- a/app/test/resource.c\n+++ b/app/test/resource.c\n@@ -31,6 +31,7 @@\n  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n  */\n \n+#include <stdio.h>\n #include <string.h>\n #include <errno.h>\n #include <sys/queue.h>\n@@ -60,6 +61,40 @@ const struct resource *resource_find(const char *name)\n \treturn NULL;\n }\n \n+int resource_fwrite(const struct resource *r, FILE *f)\n+{\n+\tconst size_t goal = resource_size(r);\n+\tsize_t total = 0;\n+\n+\twhile (total < goal) {\n+\t\tsize_t wlen = fwrite(r->begin + total, 1, goal - total, f);\n+\t\tif (wlen == 0) {\n+\t\t\tperror(__func__);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\ttotal += wlen;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int resource_fwrite_file(const struct resource *r, const char *fname)\n+{\n+\tFILE *f;\n+\tint ret;\n+\n+\tf = fopen(fname, \"w\");\n+\tif (f == NULL) {\n+\t\tperror(__func__);\n+\t\treturn -1;\n+\t}\n+\n+\tret = resource_fwrite(r, f);\n+\tfclose(f);\n+\treturn ret;\n+}\n+\n void resource_register(struct resource *r)\n {\n \tTAILQ_INSERT_TAIL(&resource_list, r, next);\ndiff --git a/app/test/resource.h b/app/test/resource.h\nindex 966fc24..ac9cae6 100644\n--- a/app/test/resource.h\n+++ b/app/test/resource.h\n@@ -45,6 +45,7 @@\n  */\n \n #include <sys/queue.h>\n+#include <stdio.h>\n #include <stddef.h>\n \n #include <rte_eal.h>\n@@ -75,6 +76,19 @@ size_t resource_size(const struct resource *r);\n const struct resource *resource_find(const char *name);\n \n /**\n+ * Write the raw data of the resource to the given file.\n+ * @return 0 on success\n+ */\n+int resource_fwrite(const struct resource *r, FILE *f);\n+\n+/**\n+ * Write the raw data of the resource to the given file given by name.\n+ * The name is relative to the current working directory.\n+ * @return 0 on success\n+ */\n+int resource_fwrite_file(const struct resource *r, const char *fname);\n+\n+/**\n  * Register a resource in the global list of resources.\n  * Not intended for direct use, please check the REGISTER_RESOURCE\n  * macro.\ndiff --git a/app/test/test_resource.c b/app/test/test_resource.c\nindex b397fa8..3d1bf00 100644\n--- a/app/test/test_resource.c\n+++ b/app/test/test_resource.c\n@@ -65,6 +65,7 @@ REGISTER_LINKED_RESOURCE(test_resource_c);\n static int test_resource_c(void)\n {\n \tconst struct resource *r;\n+\tFILE *f;\n \n \tr = resource_find(\"test_resource_c\");\n \tTEST_ASSERT_NOT_NULL(r, \"No test_resource_c found\");\n@@ -72,6 +73,15 @@ static int test_resource_c(void)\n \t\t\t\"Found resource %s, expected test_resource_c\",\n \t\t\tr->name);\n \n+\tTEST_ASSERT_SUCCESS(resource_fwrite_file(r, \"test_resource.c\"),\n+\t\t\t\"Failed to to write file %s\", r->name);\n+\n+\tf = fopen(\"test_resource.c\", \"r\");\n+\tTEST_ASSERT_NOT_NULL(f,\n+\t\t\t\"Missing extracted file resource.c\");\n+\tfclose(f);\n+\tremove(\"test_resource.c\");\n+\n \treturn 0;\n }\n \n",
    "prefixes": [
        "dpdk-dev",
        "v4",
        "04/10"
    ]
}