get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 627233,
    "url": "http://patchwork.ozlabs.org/api/patches/627233/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/lede/patch/1464359207-2744-3-git-send-email-ash.benz@bk.ru/",
    "project": {
        "id": 54,
        "url": "http://patchwork.ozlabs.org/api/projects/54/?format=api",
        "name": "LEDE development",
        "link_name": "lede",
        "list_id": "lede-dev.lists.infradead.org",
        "list_email": "lede-dev@lists.infradead.org",
        "web_url": "http://lede-project.org/",
        "scm_url": "",
        "webscm_url": "http://git.lede-project.org/",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1464359207-2744-3-git-send-email-ash.benz@bk.ru>",
    "list_archive_url": null,
    "date": "2016-05-27T14:26:39",
    "name": "[LEDE-DEV,v3,02/10] fw-utils/tplink-safeloader.c: Add support for Archer C2600",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d75dee066329b12c8332a3fe3de411464007ba5d",
    "submitter": {
        "id": 68948,
        "url": "http://patchwork.ozlabs.org/api/people/68948/?format=api",
        "name": "Ash Benz",
        "email": "ash.benz@bk.ru"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/lede/patch/1464359207-2744-3-git-send-email-ash.benz@bk.ru/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/627233/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/627233/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n\t[IPv6:2001:1868:205::9])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rGT0f6GBVz9t3x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 May 2016 00:29:06 +1000 (AEST)",
            "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux))\n\tid 1b6IjP-0005aN-BI; Fri, 27 May 2016 14:27:19 +0000",
            "from smtp49.i.mail.ru ([94.100.177.109])\n\tby bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat\n\tLinux)) id 1b6IjH-0005Sx-TH\n\tfor lede-dev@lists.infradead.org; Fri, 27 May 2016 14:27:14 +0000",
            "from [115.132.97.57] (port=49566 helo=builder.lan)\n\tby smtp49.i.mail.ru with esmtpa (envelope-from <ash.benz@bk.ru>)\n\tid 1b6Iiy-00052k-B9; Fri, 27 May 2016 17:26:53 +0300"
        ],
        "Authentication-Results": "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=bk.ru header.i=@bk.ru header.b=cHZcl06o;\n\tdkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bk.ru;\n\ts=mail; \n\th=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From;\n\tbh=uNI9+SDRZSLyGkqrLnEJ2lrCllFjyr+tn+9Fqp1XEc4=; \n\tb=cHZcl06o6Eq8egwiRjV62zyR5FPNHSpvs3W8et229z9xWn7deTBTU1MS7fYTg82WNtt8tuny5e37ABdspkPv4jEVp3fjaCtVXWAVvbTTSim3iFd5lE4rHBCgIiPWNPwS6KS5EL8aEC2yn1uwXuoV5OIS2AqhDyX2S0ZT+yzpuFY=;",
        "From": "Ash Benz <ash.benz@bk.ru>",
        "To": "lede-dev@lists.infradead.org",
        "Date": "Fri, 27 May 2016 22:26:39 +0800",
        "Message-Id": "<1464359207-2744-3-git-send-email-ash.benz@bk.ru>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1464359207-2744-1-git-send-email-ash.benz@bk.ru>",
        "References": "<1464359207-2744-1-git-send-email-ash.benz@bk.ru>",
        "X-Mras": "OK",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20160527_072712_699659_4BA5B8A2 ",
        "X-CRM114-Status": "GOOD (  11.38  )",
        "X-Spam-Score": "-2.7 (--)",
        "X-Spam-Report": "SpamAssassin version 3.4.0 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow trust [94.100.177.109 listed in list.dnswl.org]\n\t-0.0 SPF_HELO_PASS          SPF: HELO matches SPF record\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid",
        "Subject": "[LEDE-DEV] [PATCH v3 02/10] fw-utils/tplink-safeloader.c: Add\n\tsupport for Archer C2600",
        "X-BeenThere": "lede-dev@lists.infradead.org",
        "X-Mailman-Version": "2.1.20",
        "Precedence": "list",
        "List-Id": "<lede-dev.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/lede-dev/>",
        "List-Post": "<mailto:lede-dev@lists.infradead.org>",
        "List-Help": "<mailto:lede-dev-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=subscribe>",
        "Cc": "Ash Benz <ash.benz@bk.ru>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"Lede-dev\" <lede-dev-bounces@lists.infradead.org>",
        "Errors-To": "lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "Signed-off-by: Ash Benz <ash.benz@bk.ru>\n---\n tools/firmware-utils/src/tplink-safeloader.c | 114 ++++++++++++++++++++++++++-\n 1 file changed, 111 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c\nindex 77a894b..2e204aa 100644\n--- a/tools/firmware-utils/src/tplink-safeloader.c\n+++ b/tools/firmware-utils/src/tplink-safeloader.c\n@@ -105,6 +105,8 @@ static const uint8_t md5_salt[16] = {\n /** Vendor information for CPE210/220/510/520 */\n static const char cpe510_vendor[] = \"CPE510(TP-LINK|UN|N300-5):1.0\\r\\n\";\n \n+/** Vendor information for C2600 */\n+static const char c2600_vendor[] = \"\";\n \n /**\n     The flash partition table for CPE210/220/510/520;\n@@ -128,6 +130,39 @@ static const struct flash_partition_entry cpe510_partitions[] = {\n };\n \n /**\n+    The flash partition table for C2600;\n+    it is the same as the one used by the stock images.\n+*/\n+static const struct flash_partition_entry c2600_partitions[] = {\n+        {\"SBL1\", 0x00000, 0x20000},\n+        {\"MIBIB\", 0x20000, 0x20000},\n+        {\"SBL2\", 0x40000, 0x20000},\n+        {\"SBL3\", 0x60000, 0x30000},\n+        {\"DDRCONFIG\", 0x90000, 0x10000},\n+        {\"SSD\", 0xa0000, 0x10000},\n+        {\"TZ\", 0xb0000, 0x30000},\n+        {\"RPM\", 0xe0000, 0x20000},\n+        {\"fs-uboot\", 0x100000, 0x70000},\n+        {\"uboot-env\", 0x170000, 0x40000},\n+        {\"radio\", 0x1b0000, 0x40000},\n+        {\"os-image\", 0x1f0000, 0x200000},\n+        {\"file-system\", 0x3f0000, 0x1b00000},\n+        {\"default-mac\", 0x1ef0000, 0x00200},\n+        {\"pin\", 0x1ef0200, 0x00200},\n+        {\"product-info\", 0x1ef0400, 0x0fc00},\n+        {\"partition-table\", 0x1f00000, 0x10000},\n+        {\"soft-version\", 0x1f10000, 0x10000},\n+        {\"support-list\", 0x1f20000, 0x10000},\n+        {\"profile\", 0x1f30000, 0x10000},\n+        {\"default-config\", 0x1f40000, 0x10000},\n+        {\"user-config\", 0x1f50000, 0x40000},\n+        {\"qos-db\", 0x1f90000, 0x40000},\n+        {\"usb-config\", 0x1fd0000, 0x10000},\n+        {\"log\", 0x1fe0000, 0x20000},\n+\t{NULL, 0, 0}\n+};\n+\n+/**\n    The support list for CPE210/220/510/520\n */\n static const char cpe510_support_list[] =\n@@ -141,6 +176,13 @@ static const char cpe510_support_list[] =\n \t\"CPE220(TP-LINK|UN|N300-2):1.0\\r\\n\"\n \t\"CPE220(TP-LINK|UN|N300-2):1.1\\r\\n\";\n \n+/**\n+   The support list for C2600\n+*/\n+static const char c2600_support_list[] =\n+\t\"SupportList:\\r\\n\"\n+\t\"{product_name:Archer C2600,product_ver:1.0.0,special_id:00000000}\\r\\n\";\n+\n #define error(_ret, _errno, _str, ...)\t\t\t\t\\\n \tdo {\t\t\t\t\t\t\t\\\n \t\tfprintf(stderr, _str \": %s\\n\", ## __VA_ARGS__,\t\\\n@@ -240,14 +282,14 @@ static struct image_partition_entry make_soft_version(uint32_t rev) {\n }\n \n /** Generates the support-list partition */\n-static struct image_partition_entry make_support_list(const char *support_list) {\n+static struct image_partition_entry make_support_list(const char *support_list, bool trailzero) {\n \tsize_t len = strlen(support_list);\n \tstruct image_partition_entry entry = alloc_image_partition(\"support-list\", len + 9);\n \n \tput32(entry.data, len);\n \tmemset(entry.data+4, 0, 4);\n \tmemcpy(entry.data+8, support_list, len);\n-\tentry.data[len+8] = '\\xff';\n+\tentry.data[len+8] = trailzero ? '\\x00' : '\\xff';\n \n \treturn entry;\n }\n@@ -436,6 +478,37 @@ static void * generate_sysupgrade_image(const struct flash_partition_entry *flas\n \treturn image;\n }\n \n+static void * generate_sysupgrade_image_c2600(const struct flash_partition_entry *flash_parts, const struct image_partition_entry *image_parts, size_t *len) {\n+\tconst struct flash_partition_entry *flash_os_image = &flash_parts[11];\n+\tconst struct flash_partition_entry *flash_file_system = &flash_parts[12];\n+\n+\tconst struct image_partition_entry *image_os_image = &image_parts[3];\n+\tconst struct image_partition_entry *image_file_system = &image_parts[4];\n+\n+\tassert(strcmp(flash_os_image->name, \"os-image\") == 0);\n+\tassert(strcmp(flash_file_system->name, \"file-system\") == 0);\n+\n+\tassert(strcmp(image_os_image->name, \"os-image\") == 0);\n+\tassert(strcmp(image_file_system->name, \"file-system\") == 0);\n+\n+\tif (image_os_image->size > flash_os_image->size)\n+\t\terror(1, 0, \"kernel image too big (more than %u bytes)\", (unsigned)flash_os_image->size);\n+\tif (image_file_system->size > flash_file_system->size)\n+\t\terror(1, 0, \"rootfs image too big (more than %u bytes)\", (unsigned)flash_file_system->size);\n+\n+\t*len = flash_file_system->base - flash_os_image->base + image_file_system->size;\n+\n+\tuint8_t *image = malloc(*len);\n+\tif (!image)\n+\t\terror(1, errno, \"malloc\");\n+\n+\tmemset(image, 0xff, *len);\n+\n+\tmemcpy(image, image_os_image->data, image_os_image->size);\n+\tmemcpy(image + flash_file_system->base - flash_os_image->base, image_file_system->data, image_file_system->size);\n+\n+\treturn image;\n+}\n \n /** Generates an image for CPE210/220/510/520 and writes it to a file */\n static void do_cpe510(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) {\n@@ -443,7 +516,7 @@ static void do_cpe510(const char *output, const char *kernel_image, const char *\n \n \tparts[0] = make_partition_table(cpe510_partitions);\n \tparts[1] = make_soft_version(rev);\n-\tparts[2] = make_support_list(cpe510_support_list);\n+\tparts[2] = make_support_list(cpe510_support_list,false);\n \tparts[3] = read_file(\"os-image\", kernel_image, false);\n \tparts[4] = read_file(\"file-system\", rootfs_image, add_jffs2_eof);\n \n@@ -470,6 +543,39 @@ static void do_cpe510(const char *output, const char *kernel_image, const char *\n \t\tfree_image_partition(parts[i]);\n }\n \n+/** Generates an image for C2600 and writes it to a file */\n+static void do_c2600(const char *output, const char *kernel_image, const char *rootfs_image, uint32_t rev, bool add_jffs2_eof, bool sysupgrade) {\n+\tstruct image_partition_entry parts[6] = {};\n+\n+\tparts[0] = make_partition_table(c2600_partitions);\n+\tparts[1] = make_soft_version(rev);\n+\tparts[2] = make_support_list(c2600_support_list,true);\n+\tparts[3] = read_file(\"os-image\", kernel_image, false);\n+\tparts[4] = read_file(\"file-system\", rootfs_image, add_jffs2_eof);\n+\n+\tsize_t len;\n+\tvoid *image;\n+\tif (sysupgrade)\n+\t\timage = generate_sysupgrade_image_c2600(c2600_partitions, parts, &len);\n+\telse\n+\t\timage = generate_factory_image(c2600_vendor, parts, &len);\n+\n+\tFILE *file = fopen(output, \"wb\");\n+\tif (!file)\n+\t\terror(1, errno, \"unable to open output file\");\n+\n+\tif (fwrite(image, len, 1, file) != 1)\n+\t\terror(1, 0, \"unable to write output file\");\n+\n+\tfclose(file);\n+\n+\tfree(image);\n+\n+\tsize_t i;\n+\tfor (i = 0; parts[i].name; i++)\n+\t\tfree_image_partition(parts[i]);\n+}\n+\n \n /** Usage output */\n static void usage(const char *argv0) {\n@@ -552,6 +658,8 @@ int main(int argc, char *argv[]) {\n \n \tif (strcmp(board, \"CPE510\") == 0)\n \t\tdo_cpe510(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade);\n+\telse if (strcmp(board, \"C2600\") == 0)\n+\t\tdo_c2600(output, kernel_image, rootfs_image, rev, add_jffs2_eof, sysupgrade);\n \telse\n \t\terror(1, 0, \"unsupported board %s\", board);\n \n",
    "prefixes": [
        "LEDE-DEV",
        "v3",
        "02/10"
    ]
}