Show a patch.

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

{
    "id": 2996,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/2996/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2996/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20200306160002.30549-25-laurent.pinchart@ideasonboard.com>",
    "date": "2020-03-06T15:59:54",
    "name": "[libcamera-devel,v2,24/32] libcamera: byte_stream_buffer: Add Span<> support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "ff7275adf868702b348ec89009ea258081be15de",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2996/mbox/",
    "series": [
        {
            "id": 703,
            "url": "https://patchwork.libcamera.org/api/1.1/series/703/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=703",
            "date": "2020-03-06T15:59:30",
            "name": "libcamera: Add support for array controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/703/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2996/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2996/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BAE0E62895\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Mar 2020 17:00:25 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A4552A48;\n\tFri,  6 Mar 2020 17:00:24 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1583510424;\n\tbh=1/2Wqqln0poX9Rz1quWVVe9nTWwmDhh7XhouunM5ZpY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=YktRlJFPm0EJz0uVAbSGshESfdnM7Ue3oWP8fxnxmLtXkDcQx7QwpoSsNKNZAPWpc\n\tfaGFhXI8K5fUTL+LZHlmWItuyrcGCHe57DbZjK2R3C3Nv1qyWfA3sBJP88B7WDWNtd\n\tc+co21dsNasahVUVf4LxjM8QiT8+wtwwOZ4C8QGw=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  6 Mar 2020 17:59:54 +0200",
        "Message-Id": "<20200306160002.30549-25-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.24.1",
        "In-Reply-To": "<20200306160002.30549-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20200306160002.30549-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 24/32] libcamera: byte_stream_buffer:\n\tAdd Span<> support",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "X-List-Received-Date": "Fri, 06 Mar 2020 16:00:27 -0000"
    },
    "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nAdd support to write and read a Span<> to and from the ByteStreamBuffer\nclass.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/byte_stream_buffer.cpp       | 18 ++++++++++++++++++\n src/libcamera/include/byte_stream_buffer.h | 17 +++++++++++++++++\n 2 files changed, 35 insertions(+)",
    "diff": "diff --git a/src/libcamera/byte_stream_buffer.cpp b/src/libcamera/byte_stream_buffer.cpp\nindex cd1d8a36d464..17e710c4887e 100644\n--- a/src/libcamera/byte_stream_buffer.cpp\n+++ b/src/libcamera/byte_stream_buffer.cpp\n@@ -232,6 +232,15 @@ int ByteStreamBuffer::skip(size_t size)\n  * \\retval -ENOSPC no more space is available in the managed memory buffer\n  */\n \n+/**\n+ * \\fn template<typename T> int ByteStreamBuffer::read(const Span<T> &data)\n+ * \\brief Read data from the managed memory buffer into Span \\a data\n+ * \\param[out] data Span representing the destination memory\n+ * \\return 0 on success, a negative error code otherwise\n+ * \\retval -EACCES attempting to read from a write buffer\n+ * \\retval -ENOSPC no more space is available in the managed memory buffer\n+ */\n+\n /**\n  * \\fn template<typename T> int ByteStreamBuffer::write(const T *t)\n  * \\brief Write \\a t to the managed memory buffer\n@@ -241,6 +250,15 @@ int ByteStreamBuffer::skip(size_t size)\n  * \\retval -ENOSPC no more space is available in the managed memory buffer\n  */\n \n+/**\n+ * \\fn template<typename T> int ByteStreamBuffer::write(const Span<T> &data)\n+ * \\brief Write \\a data to the managed memory buffer\n+ * \\param[in] data The data to write to memory\n+ * \\return 0 on success, a negative error code otherwise\n+ * \\retval -EACCES attempting to write to a read buffer\n+ * \\retval -ENOSPC no more space is available in the managed memory buffer\n+ */\n+\n int ByteStreamBuffer::read(uint8_t *data, size_t size)\n {\n \tif (!read_)\ndiff --git a/src/libcamera/include/byte_stream_buffer.h b/src/libcamera/include/byte_stream_buffer.h\nindex b5274c62b85e..17cb0146061e 100644\n--- a/src/libcamera/include/byte_stream_buffer.h\n+++ b/src/libcamera/include/byte_stream_buffer.h\n@@ -10,6 +10,8 @@\n #include <stddef.h>\n #include <stdint.h>\n \n+#include <libcamera/span.h>\n+\n namespace libcamera {\n \n class ByteStreamBuffer\n@@ -33,12 +35,27 @@ public:\n \t{\n \t\treturn read(reinterpret_cast<uint8_t *>(t), sizeof(*t));\n \t}\n+\n+\ttemplate<typename T>\n+\tint read(const Span<T> &data)\n+\t{\n+\t\treturn read(reinterpret_cast<uint8_t *>(data.data()),\n+\t\t\t    data.size_bytes());\n+\t}\n+\n \ttemplate<typename T>\n \tint write(const T *t)\n \t{\n \t\treturn write(reinterpret_cast<const uint8_t *>(t), sizeof(*t));\n \t}\n \n+\ttemplate<typename T>\n+\tint write(const Span<T> &data)\n+\t{\n+\t\treturn write(reinterpret_cast<const uint8_t *>(data.data()),\n+\t\t\t     data.size_bytes());\n+\t}\n+\n private:\n \tByteStreamBuffer(const ByteStreamBuffer &other) = delete;\n \tByteStreamBuffer &operator=(const ByteStreamBuffer &other) = delete;\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "24/32"
    ]
}