Show a patch.

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

{
    "id": 15228,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/15228/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/15228/",
    "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-3-laurent.pinchart@ideasonboard.com>",
    "date": "2021-12-28T21:59:48",
    "name": "[libcamera-devel,v1,2/5] v4l2: v4l2_camera_file: Store file description",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "7f7c0f6cb6309f2ede562bfab4b0751f67cd604c",
    "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/15228/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/15228/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/15228/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 C200CC3258\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Dec 2021 22:00:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 067056091C;\n\tTue, 28 Dec 2021 23:00:00 +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 50F6C608E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Dec 2021 22:59:58 +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 E93413E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Dec 2021 22:59:57 +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=\"K8yBROvq\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1640728798;\n\tbh=zvuQC9WPq43vhHmWWlaS9LD1cwEdf0G0itcmYG0Tgx8=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=K8yBROvqnq9lyBqeAX07B8lWfx4aYjAiqf7rdVX0fRbuaCjHBq9bkCQT555Q2HzxL\n\t0KuGQ74bKUgopOgKZo646FbZ280bppSJy5vgczmB5pRq74JcyeJDNV9gfU3KhntZ8I\n\tdcREbPIfobOXO1WW/8Ihq8OCC3EMJu1DgxIx65GM=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 28 Dec 2021 23:59:48 +0200",
        "Message-Id": "<20211228215951.32396-3-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 2/5] v4l2: v4l2_camera_file: Store file\n\tdescription",
        "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": "Create a string that describe the file from the path and file\ndescriptor. This will be used in log messages to clearly identify which\nfile an operation is related to.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/v4l2/v4l2_camera_file.cpp    | 28 +++++++++++++++++++++++++++-\n src/v4l2/v4l2_camera_file.h      |  8 +++++++-\n src/v4l2/v4l2_compat_manager.cpp |  4 +++-\n 3 files changed, 37 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/v4l2/v4l2_camera_file.cpp b/src/v4l2/v4l2_camera_file.cpp\nindex a07679b587ce..0a41587ca90b 100644\n--- a/src/v4l2/v4l2_camera_file.cpp\n+++ b/src/v4l2/v4l2_camera_file.cpp\n@@ -7,20 +7,46 @@\n \n #include \"v4l2_camera_file.h\"\n \n+#include <fcntl.h>\n+#include <stdlib.h>\n+#include <unistd.h>\n+\n #include <linux/videodev2.h>\n \n #include \"v4l2_camera_proxy.h\"\n \n using namespace libcamera;\n \n-V4L2CameraFile::V4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy)\n+V4L2CameraFile::V4L2CameraFile(int dirfd, const char *path, int efd,\n+\t\t\t       bool nonBlocking, V4L2CameraProxy *proxy)\n \t: proxy_(proxy), nonBlocking_(nonBlocking), efd_(efd),\n \t  priority_(V4L2_PRIORITY_DEFAULT)\n {\n \tproxy_->open(this);\n+\n+\tif (path[0] != '/') {\n+\t\tif (dirfd == AT_FDCWD) {\n+\t\t\tchar *cwd = getcwd(nullptr, 0);\n+\t\t\tif (cwd) {\n+\t\t\t\tdescription_ = std::string(cwd) + \"/\";\n+\t\t\t\tfree(cwd);\n+\t\t\t} else {\n+\t\t\t\tdescription_ = std::string(\"(unreachable)/\");\n+\t\t\t}\n+\t\t} else {\n+\t\t\tdescription_ = \"(dirfd:\" + std::to_string(dirfd) + \")/\";\n+\t\t}\n+\t}\n+\n+\tdescription_ += std::string(path) + \" (fd:\" + std::to_string(efd) + \")\";\n }\n \n V4L2CameraFile::~V4L2CameraFile()\n {\n \tproxy_->close(this);\n }\n+\n+const std::string &V4L2CameraFile::description() const\n+{\n+\treturn description_;\n+}\ndiff --git a/src/v4l2/v4l2_camera_file.h b/src/v4l2/v4l2_camera_file.h\nindex 6c4cb5d89dbf..1a7b6a63ae95 100644\n--- a/src/v4l2/v4l2_camera_file.h\n+++ b/src/v4l2/v4l2_camera_file.h\n@@ -7,6 +7,8 @@\n \n #pragma once\n \n+#include <string>\n+\n #include <linux/videodev2.h>\n \n class V4L2CameraProxy;\n@@ -14,7 +16,8 @@ class V4L2CameraProxy;\n class V4L2CameraFile\n {\n public:\n-\tV4L2CameraFile(int efd, bool nonBlocking, V4L2CameraProxy *proxy);\n+\tV4L2CameraFile(int dirfd, const char *path, int efd, bool nonBlocking,\n+\t\t       V4L2CameraProxy *proxy);\n \t~V4L2CameraFile();\n \n \tV4L2CameraProxy *proxy() const { return proxy_; }\n@@ -25,9 +28,12 @@ public:\n \tenum v4l2_priority priority() const { return priority_; }\n \tvoid setPriority(enum v4l2_priority priority) { priority_ = priority; }\n \n+\tconst std::string &description() const;\n+\n private:\n \tV4L2CameraProxy *proxy_;\n \n+\tstd::string description_;\n \tbool nonBlocking_;\n \tint efd_;\n \tenum v4l2_priority priority_;\ndiff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp\nindex c64cdb862489..585046e97e4b 100644\n--- a/src/v4l2/v4l2_compat_manager.cpp\n+++ b/src/v4l2/v4l2_compat_manager.cpp\n@@ -156,7 +156,9 @@ int V4L2CompatManager::openat(int dirfd, const char *path, int oflag, mode_t mod\n \t\treturn efd;\n \n \tV4L2CameraProxy *proxy = proxies_[ret].get();\n-\tfiles_.emplace(efd, std::make_shared<V4L2CameraFile>(efd, oflag & O_NONBLOCK, proxy));\n+\tfiles_.emplace(efd, std::make_shared<V4L2CameraFile>(dirfd, path, efd,\n+\t\t\t\t\t\t\t     oflag & O_NONBLOCK,\n+\t\t\t\t\t\t\t     proxy));\n \n \tLOG(V4L2Compat, Debug) << \"Opened \" << path << \" -> fd \" << efd;\n \treturn efd;\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "2/5"
    ]
}