Show a patch.

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

{
    "id": 12543,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12543/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12543/",
    "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": "<20210610075027.523672-11-hiroh@chromium.org>",
    "date": "2021-06-10T07:50:27",
    "name": "[libcamera-devel,v2,10/10] v4l2: V4L2Camera: Return int in getBufferFd()",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "16296091459299f41c51c6794863e411f29def97",
    "submitter": {
        "id": 63,
        "url": "https://patchwork.libcamera.org/api/1.1/people/63/?format=api",
        "name": "Hirokazu Honda",
        "email": "hiroh@chromium.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12543/mbox/",
    "series": [
        {
            "id": 2115,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2115/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2115",
            "date": "2021-06-10T07:50:17",
            "name": "Introduce ScopedFD",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2115/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12543/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12543/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 E30D0C3214\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jun 2021 07:50:51 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 96C8C6892F;\n\tThu, 10 Jun 2021 09:50:51 +0200 (CEST)",
            "from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com\n\t[IPv6:2607:f8b0:4864:20::42e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6587F6892F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 09:50:50 +0200 (CEST)",
            "by mail-pf1-x42e.google.com with SMTP id c12so924385pfl.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 00:50:50 -0700 (PDT)",
            "from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:98e0:b356:1c8a:25d4])\n\tby smtp.gmail.com with ESMTPSA id\n\td66sm1565161pfa.32.2021.06.10.00.50.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 10 Jun 2021 00:50:48 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"nQqrcFxf\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=dOwdZ1a4Xmkt8I8dXzLynSQEvGuaDTE1Jt4nfltN2pE=;\n\tb=nQqrcFxfoOHPHxbM8u8GSBKmZ5SfYC32sYkITLiztcdepDzVXXk2MNb5gTNCFFeUzd\n\tHONn2mAEgzMuMkTXgkxwWWsqWXOSppQsQ9PTdsvcF4ln5anjAEBIxu+/kEaIBhcEGZTg\n\tpLDbYXDTUYRD14r773u07aFtmvs8EDSSr+qKI=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=dOwdZ1a4Xmkt8I8dXzLynSQEvGuaDTE1Jt4nfltN2pE=;\n\tb=cmQ7w89/1rHDKa4mAIaPpznIWGdO1UshKFeLVNZ8Am3WQsHPbZnsigey2yQCYZfmmX\n\tjDhzVpllAjxyGlNciV+OPom2XNf2Leb1pBLHD07D0uhJV4oOO2XjLYHoGFqTBQ4cowXY\n\tBefNP85WHc2SrXi5AMlcuLtzEcroiM2y/4p/JhXPdpxYZgpieOm0vC4LKrxsGziuEaiR\n\tm/+7vmX4ehaZwd/Q+RmRLhYvyDS9YYB1wzRQmxjgmxjO+8A6Df4uJ16VqZmL7d+wMAUM\n\tewWEZRZlMqUMnuPy5tCmb9dEI/eK7vRfJSeU6V0VUxeNuNfvSuqOjGE9QW6Ow+TzB3NU\n\taJwg==",
        "X-Gm-Message-State": "AOAM533mEv9fUR+EHlIVR3ZManKiMz7KqmGo8QV8HP+vhwHZFU47r6Jo\n\twCHbXG3J8Xi3aPe42d6ZMfBpHONraIltlQ==",
        "X-Google-Smtp-Source": "ABdhPJzBG00XUt7lVVSY46TK3mWroMT/loNmweLQsnFkpFxrubc88ehJcJb/EDD9LL7S7EUA2ZkYcA==",
        "X-Received": "by 2002:a63:bc19:: with SMTP id\n\tq25mr3758086pge.211.1623311448772; \n\tThu, 10 Jun 2021 00:50:48 -0700 (PDT)",
        "From": "Hirokazu Honda <hiroh@chromium.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 10 Jun 2021 16:50:27 +0900",
        "Message-Id": "<20210610075027.523672-11-hiroh@chromium.org>",
        "X-Mailer": "git-send-email 2.32.0.rc1.229.g3e70b5a671-goog",
        "In-Reply-To": "<20210610075027.523672-1-hiroh@chromium.org>",
        "References": "<20210610075027.523672-1-hiroh@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 10/10] v4l2: V4L2Camera: Return int in\n\tgetBufferFd()",
        "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": "V4L2Camera::getBufferFd() returns FileDescriptor. However, the\nfile descriptor is still owned by V4L2Camera. It should rather\nreturn an integer to represent V4L2Camera doesn't have the\nownership of the file descriptor.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/v4l2/v4l2_camera.cpp       | 6 +++---\n src/v4l2/v4l2_camera.h         | 2 +-\n src/v4l2/v4l2_camera_proxy.cpp | 6 +++---\n 3 files changed, 7 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp\nindex 97825c71..cccc6749 100644\n--- a/src/v4l2/v4l2_camera.cpp\n+++ b/src/v4l2/v4l2_camera.cpp\n@@ -186,16 +186,16 @@ void V4L2Camera::freeBuffers()\n \tbufferAllocator_->free(stream);\n }\n \n-FileDescriptor V4L2Camera::getBufferFd(unsigned int index)\n+int V4L2Camera::getBufferFd(unsigned int index)\n {\n \tStream *stream = config_->at(0).stream();\n \tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers =\n \t\tbufferAllocator_->buffers(stream);\n \n \tif (buffers.size() <= index)\n-\t\treturn FileDescriptor();\n+\t\treturn -1;\n \n-\treturn buffers[index]->planes()[0].fd;\n+\treturn buffers[index]->planes()[0].fd.fd();\n }\n \n int V4L2Camera::streamOn()\ndiff --git a/src/v4l2/v4l2_camera.h b/src/v4l2/v4l2_camera.h\nindex d2380462..8efe1642 100644\n--- a/src/v4l2/v4l2_camera.h\n+++ b/src/v4l2/v4l2_camera.h\n@@ -53,7 +53,7 @@ public:\n \n \tint allocBuffers(unsigned int count);\n \tvoid freeBuffers();\n-\tFileDescriptor getBufferFd(unsigned int index);\n+\tint getBufferFd(unsigned int index);\n \n \tint streamOn();\n \tint streamOff();\ndiff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\nindex f8bfe595..8f417421 100644\n--- a/src/v4l2/v4l2_camera_proxy.cpp\n+++ b/src/v4l2/v4l2_camera_proxy.cpp\n@@ -112,14 +112,14 @@ void *V4L2CameraProxy::mmap(void *addr, size_t length, int prot, int flags,\n \t\treturn MAP_FAILED;\n \t}\n \n-\tFileDescriptor fd = vcam_->getBufferFd(index);\n-\tif (!fd.isValid()) {\n+\tint fd = vcam_->getBufferFd(index);\n+\tif (fd < 0) {\n \t\terrno = EINVAL;\n \t\treturn MAP_FAILED;\n \t}\n \n \tvoid *map = V4L2CompatManager::instance()->fops().mmap(addr, length, prot,\n-\t\t\t\t\t\t\t       flags, fd.fd(), 0);\n+\t\t\t\t\t\t\t       flags, fd, 0);\n \tif (map == MAP_FAILED)\n \t\treturn map;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "10/10"
    ]
}