{"id":11478,"url":"https://patchwork.libcamera.org/api/1.1/patches/11478/?format=json","web_url":"https://patchwork.libcamera.org/patch/11478/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210303163715.21730-1-laurent.pinchart@ideasonboard.com>","date":"2021-03-03T16:37:14","name":"[libcamera-devel,1/2] libcamera: v4l2_device: Make fd() function const","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"c27cb66c2070ebea46c3ed352ce3fe7e6f463fcb","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11478/mbox/","series":[{"id":1753,"url":"https://patchwork.libcamera.org/api/1.1/series/1753/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1753","date":"2021-03-03T16:37:14","name":"[libcamera-devel,1/2] libcamera: v4l2_device: Make fd() function const","version":1,"mbox":"https://patchwork.libcamera.org/series/1753/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11478/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11478/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 C4AA7BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Mar 2021 16:37:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D8E168A92;\n\tWed,  3 Mar 2021 17:37:48 +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 7FBDE68A7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Mar 2021 17:37:47 +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 13A868CA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Mar 2021 17:37:47 +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=\"LvCnK2PV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614789467;\n\tbh=0054k6DZd6EEbq+ffJKDi2PcJkRjtjUaxwC8WaTh30U=;\n\th=From:To:Subject:Date:From;\n\tb=LvCnK2PVcQI2z7uhUKjHV740EZfzyhNVfhXgNG8uDjvcxBXs/Rc28ZJGNKo6aXJGY\n\tMFDE5FZJUTNxT/3h5/Bfk+kC4XgRxGUGmVSXnKdFd3qlNRztFuOWnU2EkNWcVK+h2q\n\tcajxoBjZVy4Mp7kyw6jLEB/6ckQRRZHYsbOJod74=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  3 Mar 2021 18:37:14 +0200","Message-Id":"<20210303163715.21730-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.28.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 1/2] libcamera: v4l2_device: Make fd()\n\tfunction const","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"There are use cases for getting the file descriptor of a const\nV4L2Device instance, for instance to print it in a log. Make the\nfunction const. There's little risk of abuse here (as in code then\nperforming operations on the file descriptors that conceptually modify\nthe V4L2 device), as the fd() function is protected.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/v4l2_device.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h\nindex c56a950ee4f9..d006bf684335 100644\n--- a/include/libcamera/internal/v4l2_device.h\n+++ b/include/libcamera/internal/v4l2_device.h\n@@ -50,7 +50,7 @@ protected:\n \n \tint ioctl(unsigned long request, void *argp);\n \n-\tint fd() { return fd_; }\n+\tint fd() const { return fd_; }\n \n private:\n \tvoid listControls();\n","prefixes":["libcamera-devel","1/2"]}