get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 806966,
    "url": "http://patchwork.ozlabs.org/api/patches/806966/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/skiboot/patch/20170829062506.8317-9-cyril.bur@au1.ibm.com/",
    "project": {
        "id": 44,
        "url": "http://patchwork.ozlabs.org/api/projects/44/?format=api",
        "name": "skiboot firmware development",
        "link_name": "skiboot",
        "list_id": "skiboot.lists.ozlabs.org",
        "list_email": "skiboot@lists.ozlabs.org",
        "web_url": "http://github.com/open-power/skiboot",
        "scm_url": "http://github.com/open-power/skiboot",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170829062506.8317-9-cyril.bur@au1.ibm.com>",
    "list_archive_url": null,
    "date": "2017-08-29T06:25:01",
    "name": "[RFC,08/13] libflash/libffs: Remove the 'sides' from the FFS TOC generation code",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": false,
    "hash": "4a0fed90a8fc78c2e380a9e47b074ae7ef21ce4e",
    "submitter": {
        "id": 64738,
        "url": "http://patchwork.ozlabs.org/api/people/64738/?format=api",
        "name": "Cyril Bur",
        "email": "cyril.bur@au1.ibm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/skiboot/patch/20170829062506.8317-9-cyril.bur@au1.ibm.com/mbox/",
    "series": [
        {
            "id": 313,
            "url": "http://patchwork.ozlabs.org/api/series/313/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/skiboot/list/?series=313",
            "date": "2017-08-29T06:24:53",
            "name": "Rework flash TOC generation",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/313/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/806966/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/806966/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "skiboot@lists.ozlabs.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "skiboot@lists.ozlabs.org"
        ],
        "Received": [
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xhJvf000qz9ryr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Aug 2017 16:41:49 +1000 (AEST)",
            "from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xhJvd5stDzDrWm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 29 Aug 2017 16:41:49 +1000 (AEST)",
            "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n\t[148.163.156.1])\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 3xhJY324ZbzDqYV\n\tfor <skiboot@lists.ozlabs.org>; Tue, 29 Aug 2017 16:25:43 +1000 (AEST)",
            "from pps.filterd (m0098410.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7T6OHgW100276\n\tfor <skiboot@lists.ozlabs.org>; Tue, 29 Aug 2017 02:25:41 -0400",
            "from e23smtp01.au.ibm.com (e23smtp01.au.ibm.com [202.81.31.143])\n\tby mx0a-001b2d01.pphosted.com with ESMTP id 2cmx61t732-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <skiboot@lists.ozlabs.org>; Tue, 29 Aug 2017 02:25:41 -0400",
            "from localhost\n\tby e23smtp01.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <skiboot@lists.ozlabs.org> from <cyril.bur@au1.ibm.com>;\n\tTue, 29 Aug 2017 16:25:38 +1000",
            "from d23relay09.au.ibm.com (202.81.31.228)\n\tby e23smtp01.au.ibm.com (202.81.31.207) with IBM ESMTP SMTP Gateway:\n\tAuthorized Use Only! Violators will be prosecuted; \n\tTue, 29 Aug 2017 16:25:36 +1000",
            "from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151])\n\tby d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n\tv7T6PaD941484432\n\tfor <skiboot@lists.ozlabs.org>; Tue, 29 Aug 2017 16:25:36 +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\tv7T6PZEi016430\n\tfor <skiboot@lists.ozlabs.org>; Tue, 29 Aug 2017 16:25:36 +1000",
            "from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14])\n\tby d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id\n\tv7T6PZ6U016425; Tue, 29 Aug 2017 16:25:35 +1000",
            "from camb691.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114])\n\t(using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby ozlabs.au.ibm.com (Postfix) with ESMTPSA id 6A6B0A0389;\n\tTue, 29 Aug 2017 16:25:35 +1000 (AEST)"
        ],
        "From": "Cyril Bur <cyril.bur@au1.ibm.com>",
        "To": "skiboot@lists.ozlabs.org, stewart@linux.vnet.ibm.com",
        "Date": "Tue, 29 Aug 2017 16:25:01 +1000",
        "X-Mailer": "git-send-email 2.14.1",
        "In-Reply-To": "<20170829062506.8317-1-cyril.bur@au1.ibm.com>",
        "References": "<20170829062506.8317-1-cyril.bur@au1.ibm.com>",
        "X-TM-AS-MML": "disable",
        "x-cbid": "17082906-1617-0000-0000-000001FCFDEA",
        "X-IBM-AV-DETECTION": "SAVI=unused REMOTE=unused XFE=unused",
        "x-cbparentid": "17082906-1618-0000-0000-00004849560C",
        "Message-Id": "<20170829062506.8317-9-cyril.bur@au1.ibm.com>",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-29_01:, , signatures=0",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=2\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1708290096",
        "Subject": "[Skiboot] [RFC PATCH 08/13] libflash/libffs: Remove the 'sides'\n\tfrom the FFS TOC generation code",
        "X-BeenThere": "skiboot@lists.ozlabs.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "Mailing list for skiboot development <skiboot.lists.ozlabs.org>",
        "List-Unsubscribe": "<https://lists.ozlabs.org/options/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.ozlabs.org/pipermail/skiboot/>",
        "List-Post": "<mailto:skiboot@lists.ozlabs.org>",
        "List-Help": "<mailto:skiboot-request@lists.ozlabs.org?subject=help>",
        "List-Subscribe": "<https://lists.ozlabs.org/listinfo/skiboot>,\n\t<mailto:skiboot-request@lists.ozlabs.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org",
        "Sender": "\"Skiboot\"\n\t<skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"
    },
    "content": "It turns out this code was messy and not all that reliable. Doing it at\nthe library level adds complexity to the library and restrictions to the\ncaller.\n\nA simpler approach can be achived with the just instantiating multiple\nffs_header structures pointing to different parts of the same file.\n\nSigned-off-by: Cyril Bur <cyril.bur@au1.ibm.com>\n---\n external/ffspart/ffspart.c |  2 +-\n libflash/ffs.h             |  2 --\n libflash/libffs.c          | 77 ++--------------------------------------------\n libflash/libffs.h          |  3 +-\n 4 files changed, 5 insertions(+), 79 deletions(-)",
    "diff": "diff --git a/external/ffspart/ffspart.c b/external/ffspart/ffspart.c\nindex bd223c78..74e12ff6 100644\n--- a/external/ffspart/ffspart.c\n+++ b/external/ffspart/ffspart.c\n@@ -273,7 +273,7 @@ int main(int argc, char *argv[])\n \t\t\tgoto out_while;\n \t\t}\n \n-\t\trc = ffs_entry_add(new_hdr, new_entry, 0);\n+\t\trc = ffs_entry_add(new_hdr, new_entry);\n \t\tif (rc) {\n \t\t\tfprintf(stderr, \"Couldn't add entry '%s' 0x%08x for 0x%08x\\n\",\n \t\t\t\t\tname, pbase, psize);\ndiff --git a/libflash/ffs.h b/libflash/ffs.h\nindex 81818fdf..cc2460c8 100644\n--- a/libflash/ffs.h\n+++ b/libflash/ffs.h\n@@ -205,7 +205,6 @@ struct __ffs_hdr {\n  * @block_size:\t\tSize of block on device (in bytes)\n  * @block_count:\tNumber of blocks on device.\n  * @backup\t\tThe backup partition\n- * @side\t\tThe ffs header for the other side\n  * @entries:\t\tList of partition entries\n  */\n struct ffs_hdr {\n@@ -216,7 +215,6 @@ struct ffs_hdr {\n \tuint32_t block_count;\n \tstruct ffs_entry *part;\n \tstruct ffs_entry *backup;\n-\tstruct ffs_hdr *side;\n \tstruct list_head entries;\n };\n \ndiff --git a/libflash/libffs.c b/libflash/libffs.c\nindex 0159c07b..e741121d 100644\n--- a/libflash/libffs.c\n+++ b/libflash/libffs.c\n@@ -436,10 +436,6 @@ static void __hdr_free(struct ffs_hdr *hdr)\n \t\tlist_del(&ent->list);\n \t\tfree(ent);\n \t}\n-\tif (hdr->side) {\n-\t\thdr->side->side = NULL;\n-\t\tffs_hdr_free(hdr->side);\n-\t}\n }\n \n int ffs_hdr_free(struct ffs_hdr *hdr)\n@@ -603,10 +599,8 @@ static int __ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry)\n \treturn 0;\n }\n \n-int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry, unsigned int side)\n+int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry)\n {\n-\tint rc;\n-\n \t/*\n \t * Refuse to add anything after BACKUP_PART has been added, not\n \t * sure why this is needed anymore\n@@ -614,36 +608,7 @@ int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry, unsigned int sid\n \tif (hdr->backup)\n \t\treturn FLASH_ERR_PARM_ERROR;\n \n-\tif (side == 0) { /* Sideless... */\n-\t\trc = __ffs_entry_add(hdr, entry);\n-\t\tif (!rc && hdr->side) {\n-\t\t\tstruct ffs_entry *other_ent;\n-\n-\t\t\t/*\n-\t\t\t * A rather sneaky copy is hidden here.\n-\t\t\t * It doesn't make sense for a consumer to be aware that structures\n-\t\t\t * must be duplicated. The entries list in the header could have\n-\t\t\t * been an array of pointers and no copy would have been required.\n-\t\t\t */\n-\t\t\tother_ent = calloc(1, sizeof (struct ffs_entry));\n-\t\t\tif (!other_ent)\n-\t\t\t\t/* TODO Remove the added entry from side 1 */\n-\t\t\t\treturn FLASH_ERR_PARM_ERROR;\n-\t\t\tmemcpy(other_ent, entry, sizeof(struct ffs_entry));\n-\t\t\trc = __ffs_entry_add(hdr->side, other_ent);\n-\t\t\tif (rc)\n-\t\t\t\t/* TODO Remove the added entry from side 1 */\n-\t\t\t\tfree(other_ent);\n-\t\t}\n-\t} else if (side == 1) {\n-\t\trc = __ffs_entry_add(hdr, entry);\n-\t} else if (side == 2 && hdr->side) {\n-\t\trc = __ffs_entry_add(hdr->side, entry);\n-\t} else {\n-\t\trc = FLASH_ERR_PARM_ERROR;\n-\t}\n-\n-\treturn rc;\n+\treturn __ffs_entry_add(hdr, entry);\n }\n \n /* This should be done last! */\n@@ -675,29 +640,6 @@ int ffs_hdr_create_backup(struct ffs_hdr *hdr)\n \n \thdr->backup = backup;\n \n-\t/* Do we try to roll back completely if that fails or leave what we've added? */\n-\tif (hdr->side && hdr->base == 0)\n-\t\trc = ffs_hdr_create_backup(hdr->side);\n-\n-\treturn rc;\n-}\n-\n-int ffs_hdr_add_side(struct ffs_hdr *hdr)\n-{\n-\tint rc;\n-\n-\t/* Only a second side for now */\n-\tif (hdr->side)\n-\t\treturn FLASH_ERR_PARM_ERROR;\n-\n-\trc = ffs_hdr_new(hdr->block_size, hdr->block_count, &hdr->side);\n-\tif (rc)\n-\t\treturn rc;\n-\n-\thdr->side->base = hdr->block_size * hdr->block_count;\n-\t/* Sigh */\n-\thdr->side->side = hdr;\n-\n \treturn rc;\n }\n \n@@ -713,16 +655,6 @@ int ffs_hdr_finalise(struct blocklevel_device *bl, struct ffs_hdr *hdr)\n \tif (num_entries == 0)\n \t\treturn FFS_ERR_BAD_SIZE;\n \n-\tif (hdr->side) {\n-\t\tstruct ffs_entry *other_side;\n-\t\t/* TODO: Change the hard coded 0x8000 */\n-\t\trc = ffs_entry_new(\"OTHER_SIDE\", hdr->side->base, 0x8000, &other_side);\n-\t\tif (rc)\n-\t\t\treturn rc;\n-\t\tlist_add_tail(&hdr->entries, &other_side->list);\n-\t\tnum_entries++;\n-\t}\n-\n \treal_hdr = malloc(ffs_hdr_raw_size(num_entries));\n \tif (!real_hdr)\n \t\treturn FLASH_ERR_MALLOC_FAILED;\n@@ -773,11 +705,6 @@ int ffs_hdr_finalise(struct blocklevel_device *bl, struct ffs_hdr *hdr)\n \t\trc = blocklevel_write(bl, hdr->backup->base, real_hdr,\n \t\t\tffs_hdr_raw_size(num_entries));\n \t}\n-\tif (rc)\n-\t\tgoto out;\n-\n-\tif (hdr->side && hdr->base == 0)\n-\t\trc = ffs_hdr_finalise(bl, hdr->side);\n out:\n \tfree(real_hdr);\n \treturn rc;\ndiff --git a/libflash/libffs.h b/libflash/libffs.h\nindex 2196d526..d81b9dfe 100644\n--- a/libflash/libffs.h\n+++ b/libflash/libffs.h\n@@ -149,10 +149,11 @@ int ffs_entry_user_set(struct ffs_entry *ent, struct ffs_entry_user *user);\n \n int ffs_entry_set_act_size(struct ffs_entry *ent, uint32_t actual_size);\n \n-int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry, unsigned int side);\n \n struct ffs_entry_user ffs_entry_user_get(struct ffs_entry *ent);\n \n+int ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry);\n+\n int ffs_hdr_create_backup(struct ffs_hdr *hdr);\n \n int ffs_hdr_finalise(struct blocklevel_device *bl, struct ffs_hdr *hdr);\n",
    "prefixes": [
        "RFC",
        "08/13"
    ]
}