{"id":3807,"url":"https://patchwork.libcamera.org/api/1.1/patches/3807/?format=json","web_url":"https://patchwork.libcamera.org/patch/3807/","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":"<20200518164804.10088-3-laurent.pinchart@ideasonboard.com>","date":"2020-05-18T16:48:04","name":"[libcamera-devel,3/3] libcamera: v4l2_videodevice: Use FileDescriptor \"fd move\" constructor","commit_ref":"dfa25e18334c9dc68b1939c62d6b711ece153f92","pull_url":null,"state":"accepted","archived":false,"hash":"5ebf586920f148a0fcc2518ed9195f306e1b835b","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/3807/mbox/","series":[{"id":909,"url":"https://patchwork.libcamera.org/api/1.1/series/909/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=909","date":"2020-05-18T16:48:02","name":"[libcamera-devel,1/3] libcamera: file_descriptor: Implement move semantics for constructor","version":1,"mbox":"https://patchwork.libcamera.org/series/909/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3807/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3807/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 9679E603DA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 May 2020 18:48:19 +0200 (CEST)","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 76C4D258;\n\tMon, 18 May 2020 18:48:18 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"q6WIXzRT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1589820499;\n\tbh=ifo4Yx+iYu6gckImVvYYLDHliMrg84kcCjWWQrTMQEk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=q6WIXzRT4p03ltGs7QcKHChRRfBSnLxAYwYNTMKIvxWNV/DZ/cpZBxzb9IQYkmyWu\n\tjTd7BdHUQDVuhokDBkDtreMONudQAJCI3lSLrN8sgdQ4tsOSY+PF4SfAaZannBZvhW\n\tM0GJMsT7pFth2CkuFjl3jraoOSsMolPaiJDgGDUQ=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 18 May 2020 19:48:04 +0300","Message-Id":"<20200518164804.10088-3-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.26.2","In-Reply-To":"<20200518164804.10088-1-laurent.pinchart@ideasonboard.com>","References":"<20200518164804.10088-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 3/3] libcamera: v4l2_videodevice: Use\n\tFileDescriptor \"fd move\" constructor","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":"Mon, 18 May 2020 16:48:19 -0000"},"content":"Use the newly added \"fd move\" constructor of the FileDescriptor class to\navoid dup() + close().\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 9 +--------\n 1 file changed, 1 insertion(+), 8 deletions(-)","diff":"diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex fbe55bc6f54f..3614b2ed1cbc 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1276,14 +1276,7 @@ FileDescriptor V4L2VideoDevice::exportDmabufFd(unsigned int index,\n \t\treturn FileDescriptor();\n \t}\n \n-\tFileDescriptor fd(expbuf.fd);\n-\t/*\n-\t * FileDescriptor takes a duplicate of fd, so we must close the\n-\t * original here, otherwise it will be left dangling.\n-\t */\n-\t::close(expbuf.fd);\n-\n-\treturn fd;\n+\treturn FileDescriptor(std::move(expbuf.fd));\n }\n \n /**\n","prefixes":["libcamera-devel","3/3"]}