get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 808320,
    "url": "http://patchwork.ozlabs.org/api/patches/808320/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/1504198860-12951-2-git-send-email-Dave.Martin@arm.com/",
    "project": {
        "id": 41,
        "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api",
        "name": "GNU C Library",
        "link_name": "glibc",
        "list_id": "libc-alpha.sourceware.org",
        "list_email": "libc-alpha@sourceware.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1504198860-12951-2-git-send-email-Dave.Martin@arm.com>",
    "list_archive_url": null,
    "date": "2017-08-31T17:00:33",
    "name": "[v2,01/28] regset: Add support for dynamically sized regsets",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "13d0dccad569e55d78f6542d1cf1d99889508842",
    "submitter": {
        "id": 26612,
        "url": "http://patchwork.ozlabs.org/api/people/26612/?format=api",
        "name": "Dave Martin",
        "email": "Dave.Martin@arm.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/1504198860-12951-2-git-send-email-Dave.Martin@arm.com/mbox/",
    "series": [
        {
            "id": 882,
            "url": "http://patchwork.ozlabs.org/api/series/882/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=882",
            "date": "2017-08-31T17:00:32",
            "name": "ARM Scalable Vector Extension (SVE)",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/882/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808320/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808320/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<libc-alpha-return-83962-incoming=patchwork.ozlabs.org@sourceware.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "mailing list libc-alpha@sourceware.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-83962-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"FCXpK5xl\"; dkim-atps=neutral",
            "sourceware.org; auth=none"
        ],
        "Received": [
            "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjpYx3Tt4z9t16\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 03:01:41 +1000 (AEST)",
            "(qmail 77965 invoked by alias); 31 Aug 2017 17:01:28 -0000",
            "(qmail 77902 invoked by uid 89); 31 Aug 2017 17:01:27 -0000"
        ],
        "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\tq=dns; s=default; b=FOi2vB0iwto2VMXixj8RgyB/+N1+lZOnqAi2kZfSihW\n\tG9z1VNeZta8UTfP86T9ZfSDDTAWSBEv0VKTJ6d2PmkK/pqtBdwhqKmVlckm/1kz8\n\tSd7rYVbyInoylDr9hHb/VHPCjAugvMB4LNA/bYnXxOWA+NUy+GdksUvkYKJ0JRO4\n\t=",
        "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\ts=default; bh=VLasVmyn/CsHJiV9sJq56SCq3oQ=; b=FCXpK5xloZgIMGyRy\n\tlIFPcu1kcaVYPA+qJ8OHI44+6DonVMJNYqHMXL0CL9h7At2WOoQ3LBu4Ac84IOv1\n\t8Lvs7f90QaudqWrU4+5xQ3zRaV2dDsxCE6qONKFLI3KSLFX8OvI2xgvK4O4QVw+B\n\tGyaeOLlKAEtEsmjLcV69IcED+Y=",
        "Mailing-List": "contact libc-alpha-help@sourceware.org; run by ezmlm",
        "Precedence": "bulk",
        "List-Id": "<libc-alpha.sourceware.org>",
        "List-Unsubscribe": "<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>",
        "List-Subscribe": "<mailto:libc-alpha-subscribe@sourceware.org>",
        "List-Archive": "<http://sourceware.org/ml/libc-alpha/>",
        "List-Post": "<mailto:libc-alpha@sourceware.org>",
        "List-Help": "<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>",
        "Sender": "libc-alpha-owner@sourceware.org",
        "X-Virus-Found": "No",
        "X-Spam-SWARE-Status": "No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:D*org.uk,\n\tH*Ad:D*columbia.edu, Hx-spam-relays-external:ESMTPA",
        "X-HELO": "foss.arm.com",
        "From": "Dave Martin <Dave.Martin@arm.com>",
        "To": "linux-arm-kernel@lists.infradead.org",
        "Cc": "Catalin Marinas <catalin.marinas@arm.com>, Will Deacon\n\t<will.deacon@arm.com>, \tArd Biesheuvel <ard.biesheuvel@linaro.org>,\n\t=?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= <alex.bennee@linaro.org>,\n\tSzabolcs Nagy <szabolcs.nagy@arm.com>, Richard Sandiford\n\t<richard.sandiford@arm.com>, \tkvmarm@lists.cs.columbia.edu,\n\tlibc-alpha@sourceware.org, \tlinux-arch@vger.kernel.org,\n\tOleg Nesterov <oleg@redhat.com>, Alexander Viro <viro@zeniv.linux.org.uk>",
        "Subject": "[PATCH v2 01/28] regset: Add support for dynamically sized regsets",
        "Date": "Thu, 31 Aug 2017 18:00:33 +0100",
        "Message-Id": "<1504198860-12951-2-git-send-email-Dave.Martin@arm.com>",
        "In-Reply-To": "<1504198860-12951-1-git-send-email-Dave.Martin@arm.com>",
        "References": "<1504198860-12951-1-git-send-email-Dave.Martin@arm.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit"
    },
    "content": "Currently the regset API doesn't allow for the possibility that\nregsets (or at least, the amount of meaningful data in a regset)\nmay change in size.\n\nIn particular, this results in useless padding being added to\ncoredumps in a regset's current size is smaller than its\ntheoretical maximum size.\n\nThis patch adds a get_size() function to struct user_regset.\nIndividual regset implementations can implement this function to\nreturn the current size of the regset data.  A regset_size()\nfunction is added to provide callers with an abstract interface for\ndetermining the size of a regset without needing to know whether\nthe regset is dynamically sized or not.\n\nThe only affected user of this interface is the ELF coredump code:\nThis patch ports ELF coredump to dump regsets with their actual\nsize in the coredump.  This has no effect except for new regsets\nthat are dynamically sized and provide a get_size() implementation.\n\nSigned-off-by: Dave Martin <Dave.Martin@arm.com>\nReviewed-by: Alex Bennée <alex.bennee@linaro.org>\n---\n fs/binfmt_elf.c        |  6 ++---\n include/linux/regset.h | 67 ++++++++++++++++++++++++++++++++++++++++++++------\n 2 files changed, 63 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c\nindex 6466153..94ca285 100644\n--- a/fs/binfmt_elf.c\n+++ b/fs/binfmt_elf.c\n@@ -1696,7 +1696,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,\n \t\t\t\t long signr, size_t *total)\n {\n \tunsigned int i;\n-\tunsigned int regset_size = view->regsets[0].n * view->regsets[0].size;\n+\tunsigned int size = regset_size(t->task, &view->regsets[0]);\n \n \t/*\n \t * NT_PRSTATUS is the one special case, because the regset data\n@@ -1705,7 +1705,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,\n \t * We assume that regset 0 is NT_PRSTATUS.\n \t */\n \tfill_prstatus(&t->prstatus, t->task, signr);\n-\t(void) view->regsets[0].get(t->task, &view->regsets[0], 0, regset_size,\n+\t(void) view->regsets[0].get(t->task, &view->regsets[0], 0, size,\n \t\t\t\t    &t->prstatus.pr_reg, NULL);\n \n \tfill_note(&t->notes[0], \"CORE\", NT_PRSTATUS,\n@@ -1725,7 +1725,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,\n \t\tif (regset->core_note_type && regset->get &&\n \t\t    (!regset->active || regset->active(t->task, regset))) {\n \t\t\tint ret;\n-\t\t\tsize_t size = regset->n * regset->size;\n+\t\t\tsize_t size = regset_size(t->task, regset);\n \t\t\tvoid *data = kmalloc(size, GFP_KERNEL);\n \t\t\tif (unlikely(!data))\n \t\t\t\treturn 0;\ndiff --git a/include/linux/regset.h b/include/linux/regset.h\nindex 8e0c9fe..494ceda 100644\n--- a/include/linux/regset.h\n+++ b/include/linux/regset.h\n@@ -107,6 +107,28 @@ typedef int user_regset_writeback_fn(struct task_struct *target,\n \t\t\t\t     int immediate);\n \n /**\n+ * user_regset_get_size_fn - type of @get_size function in &struct user_regset\n+ * @target:\tthread being examined\n+ * @regset:\tregset being examined\n+ *\n+ * This call is optional; usually the pointer is %NULL.\n+ *\n+ * When provided, this function must return the current size of regset\n+ * data, as observed by the @get function in &struct user_regset.  The\n+ * value returned must be a multiple of @size.  The returned size is\n+ * required to be valid only until the next time (if any) @regset is\n+ * modified for @target.\n+ *\n+ * This function is intended for dynamically sized regsets.  A regset\n+ * that is statically sized does not need to implement it.\n+ *\n+ * This function should not be called directly: instead, callers should\n+ * call regset_size() to determine the current size of a regset.\n+ */\n+typedef unsigned int user_regset_get_size_fn(struct task_struct *target,\n+\t\t\t\t\t     const struct user_regset *regset);\n+\n+/**\n  * struct user_regset - accessible thread CPU state\n  * @n:\t\t\tNumber of slots (registers).\n  * @size:\t\tSize in bytes of a slot (register).\n@@ -117,19 +139,33 @@ typedef int user_regset_writeback_fn(struct task_struct *target,\n  * @set:\t\tFunction to store values.\n  * @active:\t\tFunction to report if regset is active, or %NULL.\n  * @writeback:\t\tFunction to write data back to user memory, or %NULL.\n+ * @get_size:\t\tFunction to return the regset's size, or %NULL.\n  *\n  * This data structure describes a machine resource we call a register set.\n  * This is part of the state of an individual thread, not necessarily\n  * actual CPU registers per se.  A register set consists of a number of\n  * similar slots, given by @n.  Each slot is @size bytes, and aligned to\n- * @align bytes (which is at least @size).\n+ * @align bytes (which is at least @size).  For dynamically-sized\n+ * regsets, @n must contain the maximum possible number of slots for the\n+ * regset, and @get_size must point to a function that returns the\n+ * current regset size.\n  *\n- * These functions must be called only on the current thread or on a\n- * thread that is in %TASK_STOPPED or %TASK_TRACED state, that we are\n- * guaranteed will not be woken up and return to user mode, and that we\n- * have called wait_task_inactive() on.  (The target thread always might\n- * wake up for SIGKILL while these functions are working, in which case\n- * that thread's user_regset state might be scrambled.)\n+ * Callers that need to know only the current size of the regset and do\n+ * not care about its internal structure should call regset_size()\n+ * instead of inspecting @n or calling @get_size.\n+ *\n+ * For backward compatibility, the @get and @set methods must pad to, or\n+ * accept, @n * @size bytes, even if the current regset size is smaller.\n+ * The precise semantics of these operations depend on the regset being\n+ * accessed.\n+ *\n+ * The functions to which &struct user_regset members point must be\n+ * called only on the current thread or on a thread that is in\n+ * %TASK_STOPPED or %TASK_TRACED state, that we are guaranteed will not\n+ * be woken up and return to user mode, and that we have called\n+ * wait_task_inactive() on.  (The target thread always might wake up for\n+ * SIGKILL while these functions are working, in which case that\n+ * thread's user_regset state might be scrambled.)\n  *\n  * The @pos argument must be aligned according to @align; the @count\n  * argument must be a multiple of @size.  These functions are not\n@@ -156,6 +192,7 @@ struct user_regset {\n \tuser_regset_set_fn\t\t*set;\n \tuser_regset_active_fn\t\t*active;\n \tuser_regset_writeback_fn\t*writeback;\n+\tuser_regset_get_size_fn\t\t*get_size;\n \tunsigned int\t\t\tn;\n \tunsigned int \t\t\tsize;\n \tunsigned int \t\t\talign;\n@@ -371,5 +408,21 @@ static inline int copy_regset_from_user(struct task_struct *target,\n \treturn regset->set(target, regset, offset, size, NULL, data);\n }\n \n+/**\n+ * regset_size - determine the current size of a regset\n+ * @target:\tthread to be examined\n+ * @regset:\tregset to be examined\n+ *\n+ * Note that the returned size is valid only until the next time\n+ * (if any) @regset is modified for @target.\n+ */\n+static inline unsigned int regset_size(struct task_struct *target,\n+\t\t\t\t       const struct user_regset *regset)\n+{\n+\tif (!regset->get_size)\n+\t\treturn regset->n * regset->size;\n+\telse\n+\t\treturn regset->get_size(target, regset);\n+}\n \n #endif\t/* <linux/regset.h> */\n",
    "prefixes": [
        "v2",
        "01/28"
    ]
}