[{"id":15105,"web_url":"https://patchwork.libcamera.org/comment/15105/","msgid":"<YCWdSoAHsKAvNPGB@pendragon.ideasonboard.com>","date":"2021-02-11T21:10:34","subject":"Re: [libcamera-devel] [PATCH v2 4/6] libcamera: media_object:\n\tUtilise LIBCAMERA_DISABLE_COPY","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Thu, Feb 11, 2021 at 01:34:42PM +0000, Kieran Bingham wrote:\n> Convert MediaLink, MediaPad, and MediaEntity to declare\n> LIBCAMERA_DISABLE_COPY. These classes already deleted their copy\n> constructor but not the assignment operator.\n> \n> Utilising the LIBCAMERA_DISABLE_COPY fully prevents all copying of\n> these classes.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nThese classes shouldn't be movable either, so I'd use\nLIBCAMERA_DISABLE_COPY_AND_MOVE.\n\n> ---\n>  include/libcamera/internal/media_object.h | 9 ++++++---\n>  1 file changed, 6 insertions(+), 3 deletions(-)\n> \n> diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h\n> index 2b336961f98d..058f5b413837 100644\n> --- a/include/libcamera/internal/media_object.h\n> +++ b/include/libcamera/internal/media_object.h\n> @@ -12,6 +12,8 @@\n>  \n>  #include <linux/media.h>\n>  \n> +#include <libcamera/class.h>\n> +\n>  namespace libcamera {\n>  \n>  class MediaDevice;\n> @@ -47,11 +49,12 @@ public:\n>  \tint setEnabled(bool enable);\n>  \n>  private:\n> +\tLIBCAMERA_DISABLE_COPY(MediaLink);\n> +\n>  \tfriend class MediaDevice;\n>  \n>  \tMediaLink(const struct media_v2_link *link,\n>  \t\t  MediaPad *source, MediaPad *sink);\n> -\tMediaLink(const MediaLink &) = delete;\n>  \n>  \tMediaPad *source_;\n>  \tMediaPad *sink_;\n> @@ -72,7 +75,7 @@ private:\n>  \tfriend class MediaDevice;\n>  \n>  \tMediaPad(const struct media_v2_pad *pad, MediaEntity *entity);\n> -\tMediaPad(const MediaPad &) = delete;\n> +\tLIBCAMERA_DISABLE_COPY(MediaPad);\n>  \n>  \tunsigned int index_;\n>  \tMediaEntity *entity_;\n> @@ -103,7 +106,7 @@ private:\n>  \n>  \tMediaEntity(MediaDevice *dev, const struct media_v2_entity *entity,\n>  \t\t    unsigned int major = 0, unsigned int minor = 0);\n> -\tMediaEntity(const MediaEntity &) = delete;\n> +\tLIBCAMERA_DISABLE_COPY(MediaEntity);\n>  \n>  \tvoid addPad(MediaPad *pad);\n>","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 A3785BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 11 Feb 2021 21:11:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 730CB6374A;\n\tThu, 11 Feb 2021 22:11:01 +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 26DE3601B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Feb 2021 22:11:00 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A842841;\n\tThu, 11 Feb 2021 22:10:59 +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=\"XiGWxsEl\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1613077859;\n\tbh=R7rT3EwRxZJF+biSi+Phy0RNPBXg+I6kf0g/F7smzQ4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=XiGWxsElG6/R3ZuHPdiLJW1fc4KV6I8x+0A+xrefkmyNkotrFHvM0bNCMd5kb8Mad\n\t85+0KvL5Ihw5wdujs5cAEZvIAB68Z73rce5atuAtMDGTgl7qwXsjC+eLbjCoI3VjHI\n\tUcsLPfOy/WdBur6O/i45HLqv2jTw+BNL3coGJMKc=","Date":"Thu, 11 Feb 2021 23:10:34 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YCWdSoAHsKAvNPGB@pendragon.ideasonboard.com>","References":"<20210211133444.764808-1-kieran.bingham@ideasonboard.com>\n\t<20210211133444.764808-5-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210211133444.764808-5-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 4/6] libcamera: media_object:\n\tUtilise LIBCAMERA_DISABLE_COPY","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","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>"}}]