get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 631982,
    "url": "http://patchwork.ozlabs.org/api/patches/631982/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/petitboot/patch/20160608062812.14480-2-sam@mendozajonas.com/",
    "project": {
        "id": 53,
        "url": "http://patchwork.ozlabs.org/api/projects/53/?format=api",
        "name": "Petitboot development",
        "link_name": "petitboot",
        "list_id": "petitboot.lists.ozlabs.org",
        "list_email": "petitboot@lists.ozlabs.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20160608062812.14480-2-sam@mendozajonas.com>",
    "list_archive_url": null,
    "date": "2016-06-08T06:28:07",
    "name": "[1/6] lib: Add support for tracking boot consoles",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ede410b00568ca45620de2c79ed9446636cdeff6",
    "submitter": {
        "id": 68013,
        "url": "http://patchwork.ozlabs.org/api/people/68013/?format=api",
        "name": "Sam Mendoza-Jonas",
        "email": "sam@mendozajonas.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/petitboot/patch/20160608062812.14480-2-sam@mendozajonas.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/631982/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/631982/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "petitboot@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "petitboot@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3rPdmv3VgGz9sCg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  8 Jun 2016 16:28:47 +1000 (AEST)",
            "from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3rPdmv28zXzDqJ1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  8 Jun 2016 16:28:47 +1000 (AEST)",
            "from mendozajonas.com (mendozajonas.com [188.166.185.233])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3rPdmX3sfmzDq5m\n\tfor <petitboot@lists.ozlabs.org>;\n\tWed,  8 Jun 2016 16:28:28 +1000 (AEST)",
            "from skellige.ozlabs.ibm.com (unknown [122.99.82.10])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (Client did not present a certificate)\n\t(Authenticated sender: sam@mendozajonas.com)\n\tby mendozajonas.com (Postfix) with ESMTPSA id 8E225143F71\n\tfor <petitboot@lists.ozlabs.org>;\n\tWed,  8 Jun 2016 14:28:24 +0800 (SGT)"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=Gy1kt/0j; dkim-atps=neutral",
            "lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=Gy1kt/0j; dkim-atps=neutral",
            "lists.ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=Gy1kt/0j; dkim-atps=neutral"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=mendozajonas.com;\n\ts=mail; t=1465367305;\n\tbh=5ko9lkyf5mI+I3Mm3slLEe+e6E10Ua9l8XxTwA5cr9g=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Gy1kt/0jYv4T0Z0BI6navfngAa+ZRyb50zlsEzybYGBMePyXMUYBOYFPD84iQP0Ux\n\ttIGBZheXLXDACTb+DgO4J1Sq/1dk2lcF8DfmLGQtGaTH636ptxQt64cRTE3rTMv0cM\n\t9M6i+HshCUkiOSKBTs7ioMmoOCqnlrNH4FZa6faQ=",
        "From": "Samuel Mendoza-Jonas <sam@mendozajonas.com>",
        "To": "petitboot@lists.ozlabs.org",
        "Subject": "[PATCH 1/6] lib: Add support for tracking boot consoles",
        "Date": "Wed,  8 Jun 2016 16:28:07 +1000",
        "Message-Id": "<20160608062812.14480-2-sam@mendozajonas.com>",
        "X-Mailer": "git-send-email 2.8.3",
        "In-Reply-To": "<20160608062812.14480-1-sam@mendozajonas.com>",
        "References": "<20160608062812.14480-1-sam@mendozajonas.com>",
        "X-BeenThere": "petitboot@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.22",
        "Precedence": "list",
        "List-Id": "Petitboot bootloader development <petitboot.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/petitboot>,\n\t<mailto:petitboot-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/petitboot/>",
        "List-Post": "<mailto:petitboot@lists.ozlabs.org>",
        "List-Help": "<mailto:petitboot-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/petitboot>,\n\t<mailto:petitboot-request@lists.ozlabs.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Petitboot\"\n\t<petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"
    },
    "content": "Add tty_list and boot_tty to the config struct to keep track of\navailable console interfaces and the default console to set as primary\nrespectively.\nAlso add a tty field to the boot_command struct so that the current\nconsole can be sent to the discover server during a manual boot command.\n\nSigned-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>\n---\n lib/pb-config/pb-config.c     | 12 +++++++++++-\n lib/pb-protocol/pb-protocol.c | 35 ++++++++++++++++++++++++++++++++++-\n lib/types/types.h             |  4 ++++\n 3 files changed, 49 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/pb-config/pb-config.c b/lib/pb-config/pb-config.c\nindex 8200883..66ce84a 100644\n--- a/lib/pb-config/pb-config.c\n+++ b/lib/pb-config/pb-config.c\n@@ -39,7 +39,7 @@ struct config *config_copy(void *ctx, const struct config *src)\n \tstruct config *dest;\n \tunsigned int i;\n \n-\tdest = talloc(ctx, struct config);\n+\tdest = talloc_zero(ctx, struct config);\n \tdest->autoboot_enabled = src->autoboot_enabled;\n \tdest->autoboot_timeout_sec = src->autoboot_timeout_sec;\n \tdest->safe_mode = src->safe_mode;\n@@ -79,6 +79,16 @@ struct config *config_copy(void *ctx, const struct config *src)\n \n \tdest->allow_writes = src->allow_writes;\n \n+\tdest->n_tty = src->n_tty;\n+\tif (src->tty_list)\n+\t\tdest->tty_list = talloc_array(dest, char *, src->n_tty);\n+\tfor (i = 0; i < src->n_tty && src->n_tty; i++)\n+\t\tdest->tty_list[i] = talloc_strdup(dest->tty_list,\n+\t\t\t\t\t\tsrc->tty_list[i]);\n+\n+\tif (src->boot_tty)\n+\t\tdest->boot_tty = talloc_strdup(dest, src->boot_tty);\n+\n \tif (src->lang && strlen(src->lang))\n \t\tdest->lang = talloc_strdup(dest, src->lang);\n \telse\ndiff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c\nindex 9091709..7887fb0 100644\n--- a/lib/pb-protocol/pb-protocol.c\n+++ b/lib/pb-protocol/pb-protocol.c\n@@ -206,7 +206,8 @@ int pb_protocol_boot_len(const struct boot_command *boot)\n \t\t4 + optional_strlen(boot->boot_image_file) +\n \t\t4 + optional_strlen(boot->initrd_file) +\n \t\t4 + optional_strlen(boot->dtb_file) +\n-\t\t4 + optional_strlen(boot->boot_args);\n+\t\t4 + optional_strlen(boot->boot_args) +\n+\t\t4 + optional_strlen(boot->tty);\n }\n \n int pb_protocol_boot_status_len(const struct boot_status *status)\n@@ -310,6 +311,12 @@ int pb_protocol_config_len(const struct config *config)\n \n \tlen += 4; /* allow_writes */\n \n+\tlen += 4; /* n_tty */\n+\tfor (i = 0; i < config->n_tty; i++)\n+\t\tlen += 4 + optional_strlen(config->tty_list[i]);\n+\n+\tlen += 4 + optional_strlen(config->boot_tty);\n+\n \tlen += 4 + optional_strlen(config->lang);\n \n \treturn len;\n@@ -373,6 +380,7 @@ int pb_protocol_serialise_boot_command(const struct boot_command *boot,\n \tpos += pb_protocol_serialise_string(pos, boot->initrd_file);\n \tpos += pb_protocol_serialise_string(pos, boot->dtb_file);\n \tpos += pb_protocol_serialise_string(pos, boot->boot_args);\n+\tpos += pb_protocol_serialise_string(pos, boot->tty);\n \n \tassert(pos <= buf + buf_len);\n \t(void)buf_len;\n@@ -553,6 +561,13 @@ int pb_protocol_serialise_config(const struct config *config,\n \t*(uint32_t *)pos = config->allow_writes;\n \tpos += 4;\n \n+\t*(uint32_t *)pos = __cpu_to_be32(config->n_tty);\n+\tpos += 4;\n+\tfor (i = 0; i < config->n_tty; i++)\n+\t\tpos += pb_protocol_serialise_string(pos, config->tty_list[i]);\n+\n+\tpos += pb_protocol_serialise_string(pos, config->boot_tty);\n+\n \tpos += pb_protocol_serialise_string(pos, config->lang);\n \n \tassert(pos <= buf + buf_len);\n@@ -770,6 +785,9 @@ int pb_protocol_deserialise_boot_command(struct boot_command *cmd,\n \tif (read_string(cmd, &pos, &len, &cmd->boot_args))\n \t\tgoto out;\n \n+\tif (read_string(cmd, &pos, &len, &cmd->tty))\n+\t\tgoto out;\n+\n \trc = 0;\n \n out:\n@@ -1069,6 +1087,21 @@ int pb_protocol_deserialise_config(struct config *config,\n \t\tgoto out;\n \tconfig->allow_writes = !!tmp;\n \n+\tif (read_u32(&pos, &len, &config->n_tty))\n+\t\tgoto out;\n+\n+\tconfig->tty_list = talloc_array(config, char *, config->n_tty);\n+\tfor (i = 0; i < config->n_tty; i++) {\n+\t\tif (read_string(config->tty_list, &pos, &len, &str))\n+\t\t\tgoto out;\n+\t\tconfig->tty_list[i] = str;\n+\t}\n+\n+\tif (read_string(config, &pos, &len, &str))\n+\t\tgoto out;\n+\n+\tconfig->boot_tty = str;\n+\n \tif (read_string(config, &pos, &len, &str))\n \t\tgoto out;\n \ndiff --git a/lib/types/types.h b/lib/types/types.h\nindex 6ff4620..5c5f6ed 100644\n--- a/lib/types/types.h\n+++ b/lib/types/types.h\n@@ -65,6 +65,7 @@ struct boot_command {\n \tchar *initrd_file;\n \tchar *dtb_file;\n \tchar *boot_args;\n+\tchar *tty;\n };\n \n struct boot_status {\n@@ -159,9 +160,12 @@ struct config {\n \n \tbool\t\t\tallow_writes;\n \n+\tchar\t\t\t*boot_tty;\n \tchar\t\t\t*lang;\n \n \t/* not user-settable */\n+\tunsigned int\t\tn_tty;\n+\tchar\t\t\t**tty_list;\n \tbool\t\t\tdisable_snapshots;\n \tbool\t\t\tsafe_mode;\n \tbool\t\t\tdebug;\n",
    "prefixes": [
        "1/6"
    ]
}