get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 629157,
    "url": "http://patchwork.ozlabs.org/api/patches/629157/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/petitboot/patch/1464861418-19709-2-git-send-email-nayna@linux.vnet.ibm.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": "<1464861418-19709-2-git-send-email-nayna@linux.vnet.ibm.com>",
    "list_archive_url": null,
    "date": "2016-06-02T09:56:56",
    "name": "[1/3] lib/types : Adds function to return struct config as string",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": false,
    "hash": "b5991dc47f1e1ec977c53a78e34d89dfe93d1835",
    "submitter": {
        "id": 69141,
        "url": "http://patchwork.ozlabs.org/api/people/69141/?format=api",
        "name": "Nayna",
        "email": "nayna@linux.vnet.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/petitboot/patch/1464861418-19709-2-git-send-email-nayna@linux.vnet.ibm.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/629157/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/629157/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 3rL2wc2zSlz9t0r\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Jun 2016 20:08:00 +1000 (AEST)",
            "from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3rL2wc2FCRzDvL5\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  2 Jun 2016 20:08:00 +1000 (AEST)",
            "from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com\n\t[148.163.158.5])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3rL2hv1V5nzDqyH\n\tfor <petitboot@lists.ozlabs.org>;\n\tThu,  2 Jun 2016 19:57:51 +1000 (AEST)",
            "from pps.filterd (m0075420.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id\n\tu529urC1007842\n\tfor <petitboot@lists.ozlabs.org>; Thu, 2 Jun 2016 05:57:49 -0400",
            "from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 23abqeb211-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <petitboot@lists.ozlabs.org>; Thu, 02 Jun 2016 05:57:48 -0400",
            "from localhost\n\tby e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <petitboot@lists.ozlabs.org> from <nayna@linux.vnet.ibm.com>;\n\tThu, 2 Jun 2016 19:57:44 +1000",
            "from d23dlp03.au.ibm.com (202.81.31.214)\n\tby e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tThu, 2 Jun 2016 19:57:44 +1000",
            "from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219])\n\tby d23dlp03.au.ibm.com (Postfix) with ESMTP id F25CD3578053\n\tfor <petitboot@lists.ozlabs.org>;\n\tThu,  2 Jun 2016 19:57:22 +1000 (EST)",
            "from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151])\n\tby d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tu529vC9w7930118\n\tfor <petitboot@lists.ozlabs.org>; Thu, 2 Jun 2016 19:57:12 +1000",
            "from d23av06.au.ibm.com (localhost [127.0.0.1])\n\tby d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id\n\tu529vC18019560\n\tfor <petitboot@lists.ozlabs.org>; Thu, 2 Jun 2016 19:57:12 +1000",
            "from c365f16u1b3.pok.stglabs.ibm.com\n\t(c365f16u1b3.pok.stglabs.ibm.com [9.47.77.42])\n\tby d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tu529v6cQ019479; Thu, 2 Jun 2016 19:57:11 +1000"
        ],
        "X-IBM-Helo": "d23dlp03.au.ibm.com",
        "X-IBM-MailFrom": "nayna@linux.vnet.ibm.com",
        "X-IBM-RcptTo": "petitboot@lists.ozlabs.org",
        "From": "Nayna Jain <nayna@linux.vnet.ibm.com>",
        "To": "petitboot@lists.ozlabs.org",
        "Subject": "[PATCH 1/3] lib/types : Adds function to return struct config as\n\tstring",
        "Date": "Thu,  2 Jun 2016 05:56:56 -0400",
        "X-Mailer": "git-send-email 2.5.0",
        "In-Reply-To": "<1464861418-19709-1-git-send-email-nayna@linux.vnet.ibm.com>",
        "References": "<1464861418-19709-1-git-send-email-nayna@linux.vnet.ibm.com>",
        "X-TM-AS-MML": "disable",
        "X-Content-Scanned": "Fidelis XPS MAILER",
        "x-cbid": "16060209-0052-0000-0000-0000019C6224",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "16060209-0053-0000-0000-0000061C8121",
        "Message-Id": "<1464861418-19709-2-git-send-email-nayna@linux.vnet.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2016-06-02_04:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=1\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000\n\tdefinitions=main-1606020110",
        "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>",
        "Cc": "hellerda@us.ibm.com, gcwilson@us.ibm.com",
        "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": "Two new functions added to return ipmi boot configuration\nand nvram boot configuration separately as string.\n\nSigned-off-by: Nayna Jain <nayna@linux.vnet.ibm.com>\n---\n lib/types/types.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n lib/types/types.h |  3 +++\n 2 files changed, 78 insertions(+)",
    "diff": "diff --git a/lib/types/types.c b/lib/types/types.c\nindex 63045e1..2f924f1 100644\n--- a/lib/types/types.c\n+++ b/lib/types/types.c\n@@ -1,4 +1,6 @@\n #include <string.h>\n+#include <stdlib.h>\n+#include <log/log.h>\n #include <types/types.h>\n #include <i18n/i18n.h>\n \n@@ -75,3 +77,76 @@ enum device_type find_device_type(const char *str)\n \n \treturn DEVICE_TYPE_UNKNOWN;\n }\n+\n+unsigned char *get_ipmi_boot_policy_as_string(const struct config *config)\n+{\n+        unsigned char * input_data;\n+\n+        input_data = talloc_asprintf(config, \"%04x%s\", config->ipmi_bootdev,\n+\t\t\tconfig->ipmi_bootdev_persistent ? \"1\" : \"0\");\n+        pb_log(\"Input data is %s, %d, %d\\n\", input_data, sizeof(input_data),\n+\t\t\tstrlen(input_data));\n+\n+        return input_data;\n+}\n+\n+unsigned char *get_nvram_boot_policy_as_string(const struct config* config)\n+{\n+\n+        char * input_data = NULL;\n+        char * autoboot_device = NULL;\n+        unsigned int i = 0;\n+\n+        input_data = talloc_asprintf(config, \"%s%d%s%s%s%s\",\n+\t\t\tconfig->autoboot_enabled ? \"1\": \"0\",\n+                \tconfig->autoboot_timeout_sec,\n+\t\t\tconfig->safe_mode ? \"1\" : \"0\",\n+\t\t\tconfig->allow_writes ? \"1\" : \"0\",\n+\t\t\tconfig->disable_snapshots? \"1\" : \"0\",\n+                \tconfig->lang ? config->lang : \"0\");\n+        for (i = 0; i < config->n_autoboot_opts; i++)\n+        {\n+                if (config->autoboot_opts[i].boot_type == BOOT_DEVICE_TYPE)\n+                        autoboot_device = device_type_name(\n+\t\t\t\t\tconfig->autoboot_opts[i].type);\n+                else\n+                        autoboot_device = config->autoboot_opts[i].uuid;\n+                input_data = talloc_asprintf_append(input_data, \"%s\",\n+\t\t\t\tautoboot_device);\n+        }\n+\n+\n+        for (i =0; i < config->network.n_interfaces; i++)\n+        {\n+                struct interface_config *iconf = config->network.interfaces[i];\n+                input_data = talloc_asprintf_append(input_data,\n+\t\t\t\t\"%02x:%02x:%02x:%02x:%02x:%02x\",\n+\t\t\t\ticonf->hwaddr[0], iconf->hwaddr[1],\n+\t\t\t\ticonf->hwaddr[2], iconf->hwaddr[3],\n+                                iconf->hwaddr[4], iconf->hwaddr[5]);\n+\n+                input_data = talloc_asprintf_append(input_data,\"%s\",\n+\t\t\t\ticonf->ignore ? \"1\" : \"0\");\n+                if (iconf->method == CONFIG_METHOD_DHCP) {\n+                        input_data = talloc_asprintf_append(input_data,\n+\t\t\t\t\t\"%s\", \"dhcp\");\n+\n+                } else if (iconf->method == CONFIG_METHOD_STATIC) {\n+                        input_data = talloc_asprintf_append(input_data,\n+\t\t\t\t\t\"%s%s%s%s\", \"static\",\n+\t\t\t\t\ticonf->static_config.address,\n+\t\t\t\t\ticonf->static_config.gateway,\n+                                        iconf->static_config.url);\n+                }\n+\n+        }\n+\n+        for (i = 0; i < config->network.n_dns_servers; i++)\n+                input_data = talloc_asprintf_append(input_data, \"%s\",\n+\t\t\t\tconfig->network.dns_servers[i]);\n+\n+        pb_log(\"input data is %s, %d, %d\\n\", input_data, sizeof(input_data),\n+\t\t\tstrlen(input_data));\n+        return input_data;\n+\n+}\ndiff --git a/lib/types/types.h b/lib/types/types.h\nindex 6ff4620..e6e1a78 100644\n--- a/lib/types/types.h\n+++ b/lib/types/types.h\n@@ -167,4 +167,7 @@ struct config {\n \tbool\t\t\tdebug;\n };\n \n+unsigned char *get_ipmi_boot_policy_as_string(const struct config *conf);\n+unsigned char *get_nvram_boot_policy_as_string(const struct config *conf);\n+\n #endif /* _TYPES_H */\n",
    "prefixes": [
        "1/3"
    ]
}