Show a patch.

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

{
    "id": 15230,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15230/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15230/",
    "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": "<20211228215951.32396-5-laurent.pinchart@ideasonboard.com>",
    "date": "2021-12-28T21:59:50",
    "name": "[libcamera-devel,v1,4/5] v4l2: v4l2_compat_manager: Store V4L2CameraFile in mmaps_",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "a3dca4427e925c52ead170c579e558e831e7a08e",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/15230/mbox/",
    "series": [
        {
            "id": 2870,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2870/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2870",
            "date": "2021-12-28T21:59:46",
            "name": "libcamera: Improve debug messages in V4L2 compat layer",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2870/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/15230/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15230/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 88FA4C3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Dec 2021 22:00:04 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D21060917;\n\tTue, 28 Dec 2021 23:00:04 +0100 (CET)",
            "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 4339560868\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Dec 2021 22:59:59 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DC95C3E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Dec 2021 22:59:58 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hIteENsB\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640728799;\n\tbh=MjWKeZN9GqCHXj+cYSixOLC838Yfriuc6ECgBJSnzzg=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=hIteENsBsjVSXaGBGNlwQ/btk8JUmsPDMnCsIgrJsfdOA50wgf4XIiXls1F+idgHk\n\tBrLvHR25FRBAu9zx+ZXNbd9/445c9onF0QP6+LYxRIx25TxcIkTz2xREO8qrWQ8HOB\n\t7XXfqjiQAbq8paPuw/zfYoqkEvs6umGwXTOSJXsg=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 28 Dec 2021 23:59:50 +0200",
        "Message-Id": "<20211228215951.32396-5-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.33.1",
        "In-Reply-To": "<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20211228215951.32396-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 4/5] v4l2: v4l2_compat_manager: Store\n\tV4L2CameraFile in mmaps_",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The mmaps_ map stores a pointer to the V4L2CameraProxy to avoid\nincreasing the reference count on the V4L2CameraFile shared pointer\nneedlessly. While this provides a small optimization, it prevents\naccessing the V4L2CameraFile from the munmap() function which doesn't\ntake an fd as argument.\n\nTo prepare for improved debugging that will require access to\nV4L2CameraFile in munmap(), store the V4L2CameraFile pointer in mmaps_.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/v4l2/v4l2_compat_manager.cpp | 10 +++-------\n src/v4l2/v4l2_compat_manager.h   |  2 +-\n 2 files changed, 4 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\nindex 585046e97e4b..ded568beb60e 100644\n--- a/src/v4l2/v4l2_compat_manager.cpp\n+++ b/src/v4l2/v4l2_compat_manager.cpp\n@@ -198,11 +198,7 @@ void *V4L2CompatManager::mmap(void *addr, size_t length, int prot, int flags,\n \tif (map == MAP_FAILED)\n \t\treturn map;\n \n-\t/*\n-\t * Map to V4L2CameraProxy directly to prevent adding more references\n-\t * to V4L2CameraFile.\n-\t */\n-\tmmaps_[map] = file->proxy();\n+\tmmaps_[map] = file;\n \treturn map;\n }\n \n@@ -212,9 +208,9 @@ int V4L2CompatManager::munmap(void *addr, size_t length)\n \tif (device == mmaps_.end())\n \t\treturn fops_.munmap(addr, length);\n \n-\tV4L2CameraProxy *proxy = device->second;\n+\tV4L2CameraFile *file = device->second.get();\n \n-\tint ret = proxy->munmap(addr, length);\n+\tint ret = file->proxy()->munmap(addr, length);\n \tif (ret < 0)\n \t\treturn ret;\n \ndiff --git a/src/v4l2/v4l2_compat_manager.h b/src/v4l2/v4l2_compat_manager.h\nindex f52069f7b62d..64af9a8c008f 100644\n--- a/src/v4l2/v4l2_compat_manager.h\n+++ b/src/v4l2/v4l2_compat_manager.h\n@@ -65,5 +65,5 @@ private:\n \n \tstd::vector<std::unique_ptr<V4L2CameraProxy>> proxies_;\n \tstd::map<int, std::shared_ptr<V4L2CameraFile>> files_;\n-\tstd::map<void *, V4L2CameraProxy *> mmaps_;\n+\tstd::map<void *, std::shared_ptr<V4L2CameraFile>> mmaps_;\n };\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "4/5"
    ]
}