[{"id":29181,"web_url":"https://patchwork.libcamera.org/comment/29181/","msgid":"<171258346788.1623123.17188461493614697079@ping.linuxembedded.co.uk>","date":"2024-04-08T13:37:47","subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Milan Zamazal (2024-04-04 09:46:42)\n\nPotential expansion to add (while committing??)\n\nThe SharedMemObject has been imported directly into the libcamera\ninternal components. Adapt the SIZE constant of the class to match the\nlibcamera coding style.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\nThat said, don't we prefix constants with a k? kSize ? Or maybe it's not\nquite globally constant as it's only constant to the class\ninstantiation?\n\nAnd as it's a class variable should it be postfixed with an underscore?\n\n\tstatic constexpr kSize_ = sizeof(T); ?\n\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>  include/libcamera/internal/shared_mem_object.h | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/include/libcamera/internal/shared_mem_object.h b/include/libcamera/internal/shared_mem_object.h\n> index 98636b44..8f2e7120 100644\n> --- a/include/libcamera/internal/shared_mem_object.h\n> +++ b/include/libcamera/internal/shared_mem_object.h\n> @@ -23,7 +23,7 @@ template<class T>\n>  class SharedMemObject\n>  {\n>  public:\n> -       static constexpr std::size_t SIZE = sizeof(T);\n> +       static constexpr std::size_t size = sizeof(T);\n>  \n>         SharedMemObject()\n>                 : obj_(nullptr)\n> @@ -45,11 +45,11 @@ public:\n>                 if (!fd_.isValid())\n>                         return;\n>  \n> -               ret = ftruncate(fd_.get(), SIZE);\n> +               ret = ftruncate(fd_.get(), size);\n>                 if (ret < 0)\n>                         return;\n>  \n> -               mem = mmap(nullptr, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,\n> +               mem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,\n>                            fd_.get(), 0);\n>                 if (mem == MAP_FAILED)\n>                         return;\n> @@ -69,7 +69,7 @@ public:\n>         {\n>                 if (obj_) {\n>                         obj_->~T();\n> -                       munmap(obj_, SIZE);\n> +                       munmap(obj_, size);\n>                 }\n>         }\n>  \n> -- \n> 2.42.0\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 CB757C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Apr 2024 13:37:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E11BD61C28;\n\tMon,  8 Apr 2024 15:37:52 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 66BCD61C28\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Apr 2024 15:37:51 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5D5ADABE;\n\tMon,  8 Apr 2024 15:37:10 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"TDtiurw/\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1712583430;\n\tbh=Pc4lBwRmW8lT+OrQh9XffKApELkpkt0A4xm74J9+WaI=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=TDtiurw/JnHrpSzDPU0R4Ub1Gnnh6jdVRr2vx/7HxIs3tMf66pP2Z7im8Cqo2P6oH\n\tEH/bLIS1fLLy3lffyDtcMND4JarJbtQvt0+oGVYBWTR9EIYYe21QXLGHyTO9bhr1Bt\n\tdfBLuGEZEsrrLdTDwosOqWWDxzk4rzBZ37PbhQpo=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20240404084657.353464-6-mzamazal@redhat.com>","References":"<20240404084657.353464-1-mzamazal@redhat.com>\n\t<20240404084657.353464-6-mzamazal@redhat.com>","Subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Milan Zamazal <mzamazal@redhat.com>,\n\tAndrei Konovalov <andrey.konovalov.ynk@gmail.com>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tMaxime Ripard <mripard@redhat.com>, Pavel Machek <pavel@ucw.cz>,\n\tHans de Goede <hdegoede@redhat.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","Date":"Mon, 08 Apr 2024 14:37:47 +0100","Message-ID":"<171258346788.1623123.17188461493614697079@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","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>"}},{"id":29183,"web_url":"https://patchwork.libcamera.org/comment/29183/","msgid":"<87jzl7g8we.fsf@redhat.com>","date":"2024-04-08T15:40:33","subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Kieran Bingham <kieran.bingham@ideasonboard.com> writes:\n\n> Quoting Milan Zamazal (2024-04-04 09:46:42)\n>\n> Potential expansion to add (while committing??)\n>\n> The SharedMemObject has been imported directly into the libcamera\n> internal components. Adapt the SIZE constant of the class to match the\n> libcamera coding style.\n>\n>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>\n>\n> That said, don't we prefix constants with a k? kSize ? Or maybe it's not\n> quite globally constant as it's only constant to the class\n> instantiation?\n>\n> And as it's a class variable should it be postfixed with an underscore?\n>\n> \tstatic constexpr kSize_ = sizeof(T); ?\n\nRight, I'll fix it if we decide for v8, otherwise I can fix it in a followup\npatch.\n\nThanks,\nMilan\n\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>  include/libcamera/internal/shared_mem_object.h | 8 ++++----\n>>  1 file changed, 4 insertions(+), 4 deletions(-)\n>> \n>> diff --git a/include/libcamera/internal/shared_mem_object.h b/include/libcamera/internal/shared_mem_object.h\n>> index 98636b44..8f2e7120 100644\n>> --- a/include/libcamera/internal/shared_mem_object.h\n>> +++ b/include/libcamera/internal/shared_mem_object.h\n>> @@ -23,7 +23,7 @@ template<class T>\n>>  class SharedMemObject\n>>  {\n>>  public:\n>> -       static constexpr std::size_t SIZE = sizeof(T);\n>> +       static constexpr std::size_t size = sizeof(T);\n>>  \n>>         SharedMemObject()\n>>                 : obj_(nullptr)\n>> @@ -45,11 +45,11 @@ public:\n>>                 if (!fd_.isValid())\n>>                         return;\n>>  \n>> -               ret = ftruncate(fd_.get(), SIZE);\n>> +               ret = ftruncate(fd_.get(), size);\n>>                 if (ret < 0)\n>>                         return;\n>>  \n>> -               mem = mmap(nullptr, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,\n>> +               mem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,\n>>                            fd_.get(), 0);\n>>                 if (mem == MAP_FAILED)\n>>                         return;\n>> @@ -69,7 +69,7 @@ public:\n>>         {\n>>                 if (obj_) {\n>>                         obj_->~T();\n>> -                       munmap(obj_, SIZE);\n>> +                       munmap(obj_, size);\n>>                 }\n>>         }\n>>  \n>> -- \n>> 2.42.0\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 81F52C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Apr 2024 15:40:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7731B63352;\n\tMon,  8 Apr 2024 17:40:41 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CFF9B61C28\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Apr 2024 17:40:39 +0200 (CEST)","from mail-lf1-f71.google.com (mail-lf1-f71.google.com\n\t[209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-594-T6Olh4MsOOW7Ov3pn--xHA-1; Mon, 08 Apr 2024 11:40:37 -0400","by mail-lf1-f71.google.com with SMTP id\n\t2adb3069b0e04-516d2048ba1so3092306e87.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 08 Apr 2024 08:40:36 -0700 (PDT)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tz14-20020a1709060f0e00b00a4c9b39b726sm4573037eji.75.2024.04.08.08.40.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 08 Apr 2024 08:40:34 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"DQXlYmF0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1712590838;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=otBlPxZi5jzGmoyZz3sVCc1Lu1VK0nlpUFOLqfIsIG8=;\n\tb=DQXlYmF01AsvRr2SNTiWLN1whAO6U+X0JOnsYdTr3/JA5el/bxs9KQ9XBOxDc/jmzINOiN\n\t6aLwNAyJzHcra5083ITCI2a9BmoUz5ulnS0UOrzzRDhaUAk1TxIpRCzMIApvF4pk94a6J6\n\tapxikDzVwl8vL8UTa2Wian4fHBHLRQ0=","X-MC-Unique":"T6Olh4MsOOW7Ov3pn--xHA-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1712590835; x=1713195635;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=otBlPxZi5jzGmoyZz3sVCc1Lu1VK0nlpUFOLqfIsIG8=;\n\tb=Ds4V0PjtBWAfoTz/iEq68JBibaweOcDu1e5g1dMztG6Rf3AqwkrJQDvj2O5B68zRUt\n\taKkYUQDJL8g5VLD6U72C2NC5qH/3SGsaL2vMliYWrYk0qqc0ITBGTBPOz3c/egvNsGZr\n\tSXB4QngLeclR/iWCQK4seVcvJ/rw/pvTcGjXzNBwgKGVQT0MwCUpo4w0CDDf+65tbIjh\n\tYC0hMLNZjsHspO4/VKFsOpMl+m+Cm9P9QRZ/qIHJFOaJZ6o7FxrNfdoT01b3DaCeBciS\n\tcXbbJ+4aeUinnHfJOMyrFYpZyW4RbXlma7WqTR3n1/MJL/ezj8xqRcJYhuvh+WBhKFUJ\n\tIRdQ==","X-Gm-Message-State":"AOJu0YwUJ0YMyQQYp0F5m9gMjN/PG4dSWrzSlEYPWgnd0a531GZ/Tr4U\n\t+kFRPCqHGIFuZul+y6NGpLoKfBZfjv1ve4ytgMOTh32NMq8LTv2/6eYvdCcu9gmwsiX++vdVv6w\n\tmJ508mX4ZfXAr7VIlpnyqw1u3biCOwLYhzefaau/prrH3pxFsXbJa3RPfZgPCTkRBKA4T2LM=","X-Received":["by 2002:ac2:5ec4:0:b0:515:cb19:41f4 with SMTP id\n\td4-20020ac25ec4000000b00515cb1941f4mr5844960lfq.59.1712590835648; \n\tMon, 08 Apr 2024 08:40:35 -0700 (PDT)","by 2002:ac2:5ec4:0:b0:515:cb19:41f4 with SMTP id\n\td4-20020ac25ec4000000b00515cb1941f4mr5844943lfq.59.1712590835319; \n\tMon, 08 Apr 2024 08:40:35 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IHF7oCzaKy6A6mHIVlTDljHdeeheAGb6WZjx8Gi9E6EmaDJLTNmJT2iNd03m+E+RJvwOVY9TA==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,  Andrei Konovalov\n\t<andrey.konovalov.ynk@gmail.com>,  Bryan O'Donoghue\n\t<bryan.odonoghue@linaro.org>, Maxime Ripard <mripard@redhat.com>, Pavel\n\tMachek <pavel@ucw.cz>, Hans de Goede <hdegoede@redhat.com>, Laurent\n\tPinchart <laurent.pinchart@ideasonboard.com>","Subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","In-Reply-To":"<171258346788.1623123.17188461493614697079@ping.linuxembedded.co.uk>\n\t(Kieran Bingham's message of \"Mon, 08 Apr 2024 14:37:47 +0100\")","References":"<20240404084657.353464-1-mzamazal@redhat.com>\n\t<20240404084657.353464-6-mzamazal@redhat.com>\n\t<171258346788.1623123.17188461493614697079@ping.linuxembedded.co.uk>","Date":"Mon, 08 Apr 2024 17:40:33 +0200","Message-ID":"<87jzl7g8we.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}},{"id":29217,"web_url":"https://patchwork.libcamera.org/comment/29217/","msgid":"<20240414203654.GF12561@pendragon.ideasonboard.com>","date":"2024-04-14T20:36:54","subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello,\n\nOn Mon, Apr 08, 2024 at 05:40:33PM +0200, Milan Zamazal wrote:\n> Kieran Bingham <kieran.bingham@ideasonboard.com> writes:\n> \n> > Quoting Milan Zamazal (2024-04-04 09:46:42)\n> >\n> > Potential expansion to add (while committing??)\n> >\n> > The SharedMemObject has been imported directly into the libcamera\n> > internal components. Adapt the SIZE constant of the class to match the\n> > libcamera coding style.\n> >\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> >\n> > That said, don't we prefix constants with a k? kSize ? Or maybe it's not\n> > quite globally constant as it's only constant to the class\n> > instantiation?\n> >\n> > And as it's a class variable should it be postfixed with an underscore?\n> >\n> > \tstatic constexpr kSize_ = sizeof(T); ?\n\nIt should be prefixed with a k, yes. As for the trailing underscore, I\ndon't think we use it for constants.\n\nWith kSize,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> Right, I'll fix it if we decide for v8, otherwise I can fix it in a followup\n> patch.\n\nThere are minor review comments on other patches, so I think a final v8\nwill be needed. I'm worried I would be messing up something if I applied\nall the small changes myself.\n\n> >> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> >> ---\n> >>  include/libcamera/internal/shared_mem_object.h | 8 ++++----\n> >>  1 file changed, 4 insertions(+), 4 deletions(-)\n> >> \n> >> diff --git a/include/libcamera/internal/shared_mem_object.h b/include/libcamera/internal/shared_mem_object.h\n> >> index 98636b44..8f2e7120 100644\n> >> --- a/include/libcamera/internal/shared_mem_object.h\n> >> +++ b/include/libcamera/internal/shared_mem_object.h\n> >> @@ -23,7 +23,7 @@ template<class T>\n> >>  class SharedMemObject\n> >>  {\n> >>  public:\n> >> -       static constexpr std::size_t SIZE = sizeof(T);\n> >> +       static constexpr std::size_t size = sizeof(T);\n> >>  \n> >>         SharedMemObject()\n> >>                 : obj_(nullptr)\n> >> @@ -45,11 +45,11 @@ public:\n> >>                 if (!fd_.isValid())\n> >>                         return;\n> >>  \n> >> -               ret = ftruncate(fd_.get(), SIZE);\n> >> +               ret = ftruncate(fd_.get(), size);\n> >>                 if (ret < 0)\n> >>                         return;\n> >>  \n> >> -               mem = mmap(nullptr, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,\n> >> +               mem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,\n> >>                            fd_.get(), 0);\n> >>                 if (mem == MAP_FAILED)\n> >>                         return;\n> >> @@ -69,7 +69,7 @@ public:\n> >>         {\n> >>                 if (obj_) {\n> >>                         obj_->~T();\n> >> -                       munmap(obj_, SIZE);\n> >> +                       munmap(obj_, size);\n> >>                 }\n> >>         }\n> >>  \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 048E2C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 14 Apr 2024 20:37:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27BAE63352;\n\tSun, 14 Apr 2024 22:37:06 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8E8F16333B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 14 Apr 2024 22:37:04 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C9CA7E4;\n\tSun, 14 Apr 2024 22:36:19 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oYUAqgHG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1713126979;\n\tbh=fcjzmZ2ok5z4k5dqyC0lR8LZgO42XRcitykc4nv56kU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=oYUAqgHGByVb0n4IeBz0Kg0z3u3JTmYVY4UAFcSaWlhfeu619dJufgzHZwF2zOHzP\n\tnzE/xcC4DN+N/Q6Z/VZ2QQUBGz7TfenHS+oSXUAg82XZXMm5uCmF+FVvQcU/dQdEdS\n\tW/UwAYDvcfH+45Y7gxy5T74vUTRUvwmoVJGpCTr8=","Date":"Sun, 14 Apr 2024 23:36:54 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Milan Zamazal <mzamazal@redhat.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org,\n\tAndrei Konovalov <andrey.konovalov.ynk@gmail.com>,\n\tBryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tMaxime Ripard <mripard@redhat.com>, Pavel Machek <pavel@ucw.cz>,\n\tHans de Goede <hdegoede@redhat.com>","Subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","Message-ID":"<20240414203654.GF12561@pendragon.ideasonboard.com>","References":"<20240404084657.353464-1-mzamazal@redhat.com>\n\t<20240404084657.353464-6-mzamazal@redhat.com>\n\t<171258346788.1623123.17188461493614697079@ping.linuxembedded.co.uk>\n\t<87jzl7g8we.fsf@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<87jzl7g8we.fsf@redhat.com>","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>"}},{"id":29223,"web_url":"https://patchwork.libcamera.org/comment/29223/","msgid":"<875xwihmiy.fsf@redhat.com>","date":"2024-04-15T11:51:17","subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Laurent Pinchart <laurent.pinchart@ideasonboard.com> writes:\n\n> Hello,\n>\n> On Mon, Apr 08, 2024 at 05:40:33PM +0200, Milan Zamazal wrote:\n>> Kieran Bingham <kieran.bingham@ideasonboard.com> writes:\n>> \n>> > Quoting Milan Zamazal (2024-04-04 09:46:42)\n>> >\n>> > Potential expansion to add (while committing??)\n>> >\n>> > The SharedMemObject has been imported directly into the libcamera\n>> > internal components. Adapt the SIZE constant of the class to match the\n>> > libcamera coding style.\n>> >\n>> >\n>> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>> >\n>> >\n>> > That said, don't we prefix constants with a k? kSize ? Or maybe it's not\n>> > quite globally constant as it's only constant to the class\n>> > instantiation?\n>> >\n>> > And as it's a class variable should it be postfixed with an underscore?\n>> >\n>> > \tstatic constexpr kSize_ = sizeof(T); ?\n>\n> It should be prefixed with a k, yes. As for the trailing underscore, I\n> don't think we use it for constants.\n>\n> With kSize,\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n>> Right, I'll fix it if we decide for v8, otherwise I can fix it in a followup\n>> patch.\n>\n> There are minor review comments on other patches, so I think a final v8\n> will be needed. I'm worried I would be messing up something if I applied\n> all the small changes myself.\n\nHi Laurent,\n\nOK, I'll prepare v8.\n\nRegards,\nMilan\n\n>> >> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> >> ---\n>> >>  include/libcamera/internal/shared_mem_object.h | 8 ++++----\n>> >>  1 file changed, 4 insertions(+), 4 deletions(-)\n>> >> \n>> >> diff --git a/include/libcamera/internal/shared_mem_object.h b/include/libcamera/internal/shared_mem_object.h\n>> >> index 98636b44..8f2e7120 100644\n>> >> --- a/include/libcamera/internal/shared_mem_object.h\n>> >> +++ b/include/libcamera/internal/shared_mem_object.h\n>> >> @@ -23,7 +23,7 @@ template<class T>\n>> >>  class SharedMemObject\n>> >>  {\n>> >>  public:\n>> >> -       static constexpr std::size_t SIZE = sizeof(T);\n>> >> +       static constexpr std::size_t size = sizeof(T);\n>> >>  \n>> >>         SharedMemObject()\n>> >>                 : obj_(nullptr)\n>> >> @@ -45,11 +45,11 @@ public:\n>> >>                 if (!fd_.isValid())\n>> >>                         return;\n>> >>  \n>> >> -               ret = ftruncate(fd_.get(), SIZE);\n>> >> +               ret = ftruncate(fd_.get(), size);\n>> >>                 if (ret < 0)\n>> >>                         return;\n>> >>  \n>> >> -               mem = mmap(nullptr, SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,\n>> >> +               mem = mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED,\n>> >>                            fd_.get(), 0);\n>> >>                 if (mem == MAP_FAILED)\n>> >>                         return;\n>> >> @@ -69,7 +69,7 @@ public:\n>> >>         {\n>> >>                 if (obj_) {\n>> >>                         obj_->~T();\n>> >> -                       munmap(obj_, SIZE);\n>> >> +                       munmap(obj_, size);\n>> >>                 }\n>> >>         }\n>> >>  \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 0B09EC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 15 Apr 2024 11:51:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C4BA363352;\n\tMon, 15 Apr 2024 13:51:24 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 631BD63339\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2024 13:51:23 +0200 (CEST)","from mail-ed1-f70.google.com (mail-ed1-f70.google.com\n\t[209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-433-4lyqUKnjN7qB5Tmz1uzHWA-1; Mon, 15 Apr 2024 07:51:20 -0400","by mail-ed1-f70.google.com with SMTP id\n\t4fb4d7f45d1cf-57030f8ef16so414160a12.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Apr 2024 04:51:20 -0700 (PDT)","from nuthatch (nat-pool-brq-t.redhat.com. [213.175.37.10])\n\tby smtp.gmail.com with ESMTPSA id\n\ts24-20020a056402165800b0056e45917d09sm4712076edx.44.2024.04.15.04.51.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 15 Apr 2024 04:51:18 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"fG+LhqBf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1713181882;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=2hGeyi+JTyXZDs8rCD5/7DSPaalW7mq55nDCPKp0A7g=;\n\tb=fG+LhqBfUl5qmLEoEArnDaHLOohduAo8JQuckY/Ng3QeCaZ85kX1LGZfD/mtkTq55bgIyh\n\tI8Poi5ZfseeTigyUYwCg7e1x+5yVvftN8fRw5rkYfCdFCE2nBYP/jTjIYyxa4bU45VBZkc\n\t85PPJobBAonr1dwdEziv2Rh5p/2zrNU=","X-MC-Unique":"4lyqUKnjN7qB5Tmz1uzHWA-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1713181879; x=1713786679;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=2hGeyi+JTyXZDs8rCD5/7DSPaalW7mq55nDCPKp0A7g=;\n\tb=BtKbstqHPklZKnLNMWY+heKO4lhNPPUw1zlIEnzErUOfbbk96CqU5Xo+2NAAppauYi\n\tDRCWPJgIYqL2LhpL2tbIggkrAzka+lna8PbjHqhLYQEDw2XpvKkvH8OyP2Y2Ygc2MpIJ\n\tafphVXI/9juUkvZypaf/2Gi0vkhmLLRoOQYM9cQDoZoHhPkgONQ9stR5QR9j5OIaxwTH\n\tayM6UUfM+bDRc9cavrYILnNHNkurXeFNsLiISjED2NrVnDwJgpSWGIEeFXBAIcnj8blx\n\tts72MiAu70/F9M5XEomh5KvXQhvZqFCrWA4OYM0cTeI/fOeUcIZSW+lMhcDSH1I+oVsv\n\tErkQ==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCVJ7AofyHNH4zyZa+iNU2thrjJLPXSokZK/I5tbXAPrrrp0uUiZXtgO+/W7x+L1Wc/2nzuiIw2HeYcgCoo5TGdJh7o1X84ibe8I6cinxJpSEA7mDw==","X-Gm-Message-State":"AOJu0YxWtqwSaQgeKWcDrAqKeMN9bfK6mjztRrS+wiSTVOzrssqW2FQt\n\tFHxfirevfAkKDRVhhWW039fGcZ/pTaaZ20nSlbIN9E0gk2Tqx6tfYTQa/6lP4ziUTvO099c/kU2\n\tPo3RRO5thS/s8ZaTJ7naiud9hbfLOFzBRqPsB64jIr/2dmy9Gd9x6VGvOa7cFaNxw8zrfKUU=","X-Received":["by 2002:a50:8d1e:0:b0:56c:24e6:ca7e with SMTP id\n\ts30-20020a508d1e000000b0056c24e6ca7emr6964227eds.2.1713181879576; \n\tMon, 15 Apr 2024 04:51:19 -0700 (PDT)","by 2002:a50:8d1e:0:b0:56c:24e6:ca7e with SMTP id\n\ts30-20020a508d1e000000b0056c24e6ca7emr6964216eds.2.1713181879209; \n\tMon, 15 Apr 2024 04:51:19 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IHi+/ySBHgvT2pbua1uxbaw22GxUoxCRfmkLcUslIQevUNjRN/9wjdmeZ4R1I7fhSfIWcheGQ==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org,  Andrei Konovalov\n\t<andrey.konovalov.ynk@gmail.com>,  Bryan O'Donoghue\n\t<bryan.odonoghue@linaro.org>, Maxime Ripard <mripard@redhat.com>, Pavel\n\tMachek <pavel@ucw.cz>,  Hans de Goede <hdegoede@redhat.com>","Subject":"Re: [PATCH v7 05/18] libcamera: shared_mem_object: Rename SIZE\n\tconstant to `size'","In-Reply-To":"<20240414203654.GF12561@pendragon.ideasonboard.com> (Laurent\n\tPinchart's message of \"Sun, 14 Apr 2024 23:36:54 +0300\")","References":"<20240404084657.353464-1-mzamazal@redhat.com>\n\t<20240404084657.353464-6-mzamazal@redhat.com>\n\t<171258346788.1623123.17188461493614697079@ping.linuxembedded.co.uk>\n\t<87jzl7g8we.fsf@redhat.com>\n\t<20240414203654.GF12561@pendragon.ideasonboard.com>","Date":"Mon, 15 Apr 2024 13:51:17 +0200","Message-ID":"<875xwihmiy.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]