[{"id":21406,"web_url":"https://patchwork.libcamera.org/comment/21406/","msgid":"<CAO5uPHO-TwehTVqaCHWmBEcf+HqHKPfhjWFStxd=UxwwOQGkvA@mail.gmail.com>","date":"2021-11-30T05:15:58","subject":"Re: [libcamera-devel] [PATCH v4 03/22] libcamera: base:\n\tfile_descriptor: Move inode() function to frame_buffer.cpp","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Laurent, thank you for the patch.\n\nOn Tue, Nov 30, 2021 at 12:38 PM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> The inode() function has always been a bit of an outcast in the\n> FileDescriptor class, as it's not related to the core feature provided\n> by FileDescriptor, a shared ownership wrapper around file descriptors.\n> As it's only used in the FrameBuffer implementation, move it to\n> frame_buffer.cpp as a static function.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n> ---\n> Changes since v3:\n>\n> - Move the inode function to frame_buffer.cpp\n> ---\n>  include/libcamera/base/file.h            |  2 ++\n>  include/libcamera/base/file_descriptor.h |  3 ---\n>  src/libcamera/base/file.cpp              |  1 +\n>  src/libcamera/base/file_descriptor.cpp   | 25 ---------------------\n>  src/libcamera/framebuffer.cpp            | 28 ++++++++++++++++++++++--\n>  5 files changed, 29 insertions(+), 30 deletions(-)\n>\n> diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h\n> index 55e8edd934d4..9b62871b8230 100644\n> --- a/include/libcamera/base/file.h\n> +++ b/include/libcamera/base/file.h\n> @@ -20,6 +20,8 @@\n>\n>  namespace libcamera {\n>\n> +class FileDescriptor;\n> +\n>  class File\n>  {\n>  public:\n> diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> index 8d764f8b4a26..5d1594e80801 100644\n> --- a/include/libcamera/base/file_descriptor.h\n> +++ b/include/libcamera/base/file_descriptor.h\n> @@ -8,7 +8,6 @@\n>  #pragma once\n>\n>  #include <memory>\n> -#include <sys/types.h>\n>\n>  namespace libcamera {\n>\n> @@ -28,8 +27,6 @@ public:\n>         int fd() const { return fd_ ? fd_->fd() : -1; }\n>         FileDescriptor dup() const;\n>\n> -       ino_t inode() const;\n> -\n>  private:\n>         class Descriptor\n>         {\n> diff --git a/src/libcamera/base/file.cpp b/src/libcamera/base/file.cpp\n> index ae4be1f95fa6..a04dfacdc102 100644\n> --- a/src/libcamera/base/file.cpp\n> +++ b/src/libcamera/base/file.cpp\n> @@ -14,6 +14,7 @@\n>  #include <sys/types.h>\n>  #include <unistd.h>\n>\n> +#include <libcamera/base/file_descriptor.h>\n>  #include <libcamera/base/log.h>\n>\n>  /**\n> diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> index f5f87c56eee8..98d4b4bfd24f 100644\n> --- a/src/libcamera/base/file_descriptor.cpp\n> +++ b/src/libcamera/base/file_descriptor.cpp\n> @@ -8,7 +8,6 @@\n>  #include <libcamera/base/file_descriptor.h>\n>\n>  #include <string.h>\n> -#include <sys/stat.h>\n>  #include <sys/types.h>\n>  #include <unistd.h>\n>  #include <utility>\n> @@ -223,30 +222,6 @@ FileDescriptor FileDescriptor::dup() const\n>         return FileDescriptor(fd());\n>  }\n>\n> -/**\n> - * \\brief Retrieve the file descriptor inode\n> - *\n> - * \\todo Should this move to the File class ?\n> - *\n> - * \\return The file descriptor inode on success, or 0 on error\n> - */\n> -ino_t FileDescriptor::inode() const\n> -{\n> -       if (!isValid())\n> -               return 0;\n> -\n> -       struct stat st;\n> -       int ret = fstat(fd_->fd(), &st);\n> -       if (ret < 0) {\n> -               ret = -errno;\n> -               LOG(FileDescriptor, Fatal)\n> -                       << \"Failed to fstat() fd: \" << strerror(-ret);\n> -               return 0;\n> -       }\n> -\n> -       return st.st_ino;\n> -}\n> -\n>  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)\n>  {\n>         if (!duplicate) {\n> diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> index 337ea1155a38..b1635f49b68a 100644\n> --- a/src/libcamera/framebuffer.cpp\n> +++ b/src/libcamera/framebuffer.cpp\n> @@ -8,6 +8,9 @@\n>  #include <libcamera/framebuffer.h>\n>  #include \"libcamera/internal/framebuffer.h\"\n>\n> +#include <sys/stat.h>\n> +\n> +#include <libcamera/base/file.h>\n>  #include <libcamera/base/log.h>\n>\n>  /**\n> @@ -207,6 +210,27 @@ FrameBuffer::Private::Private()\n>   * \\brief The plane length in bytes\n>   */\n>\n> +namespace {\n> +\n> +ino_t fileDescriptorInode(const FileDescriptor &fd)\n> +{\n> +       if (!fd.isValid())\n> +               return 0;\n> +\n> +       struct stat st;\n> +       int ret = fstat(fd.fd(), &st);\n> +       if (ret < 0) {\n> +               ret = -errno;\n> +               LOG(Buffer, Fatal)\n> +                       << \"Failed to fstat() fd: \" << strerror(-ret);\n> +               return 0;\n> +       }\n> +\n> +       return st.st_ino;\n> +}\n> +\n> +} /* namespace */\n> +\n>  /**\n>   * \\brief Construct a FrameBuffer with an array of planes\n>   * \\param[in] planes The frame memory planes\n> @@ -236,8 +260,8 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)\n>                  */\n>                 if (plane.fd.fd() != planes_[0].fd.fd()) {\n>                         if (!inode)\n> -                               inode = planes_[0].fd.inode();\n> -                       if (plane.fd.inode() != inode) {\n> +                               inode = fileDescriptorInode(planes_[0].fd);\n> +                       if (fileDescriptorInode(plane.fd) != inode) {\n>                                 isContiguous = false;\n>                                 break;\n>                         }\n> --\n> Regards,\n>\n> Laurent Pinchart\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 BE41EBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 05:16:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 25B90605B4;\n\tTue, 30 Nov 2021 06:16:11 +0100 (CET)","from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com\n\t[IPv6:2a00:1450:4864:20::52e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C1E57604FC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 06:16:09 +0100 (CET)","by mail-ed1-x52e.google.com with SMTP id t5so81929465edd.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Nov 2021 21:16:09 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"dCK2FziY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=oJTw+3+2sIF5IAGj2nH4wK+c8y0GOROfDgKPS2KZrl4=;\n\tb=dCK2FziY/YeVqp/Piuff2fROj7e6JaYjaqOaAAxIBjmQr8Ls9P/3NJz9A9nl99LY+W\n\towTaVe2m4CeHTEgnGDyUb3k0MVwcJSzSjnhFLZ+XMXw1twXT3GJrdGX/cy0v6VCXhVwi\n\tpMKpfiZqO0MYQtlsaY4U0xiB8U7hqomio3JeM=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=oJTw+3+2sIF5IAGj2nH4wK+c8y0GOROfDgKPS2KZrl4=;\n\tb=v8OPlNVq/Xr6Q+OjpkbPdXUVc0eHDiXUlHNhMWTI/DXWarhMBYpQL/GZGmOeR1Kdtr\n\t6zMCO6uAcDn1WgeUqrc3d7JqdZVyH+MKczPXSH1OJ2mPEQ/0TYU9Vx7Biuet4DBdmm7w\n\t1QaQjZ5Q98ylVu9Nm8z+OcWBcRqVVg2FnBFoNpDg4KRmxzINBcKfGFael0pR+IciJnDy\n\thROzIaHXjhP9bcPKYmtIY6+lYFzLSGhMOkJDlkgGucJdiRwsRgD8ymmCvVjwgQqrNA6W\n\trUQz2mCv6rKH36x95Lud1p5jiUypoxe15WGC5NBdo9QpJCuZQrAEcICrv5dSVJ+Hn15Q\n\tIgvw==","X-Gm-Message-State":"AOAM531t1vgYle+AI9xvde6viE7s91j+7288clJO7zylMgJ9fTGW9Gep\n\t4q7Esj5yFUxpCiByx9JDLcZrYOTxZJIz22UahAPjwg==","X-Google-Smtp-Source":"ABdhPJzCzoztQxFIwrfhA9M5qPLwKx7Vdsre7Y0EjVUlLbb95QILHUsGPaU9ZBc2KXu5flbyRA4tOSfWC7xTYpATeQA=","X-Received":"by 2002:a17:906:7688:: with SMTP id\n\to8mr20057021ejm.291.1638249369138; \n\tMon, 29 Nov 2021 21:16:09 -0800 (PST)","MIME-Version":"1.0","References":"<20211130033820.18235-1-laurent.pinchart@ideasonboard.com>\n\t<20211130033820.18235-4-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20211130033820.18235-4-laurent.pinchart@ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Tue, 30 Nov 2021 14:15:58 +0900","Message-ID":"<CAO5uPHO-TwehTVqaCHWmBEcf+HqHKPfhjWFStxd=UxwwOQGkvA@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v4 03/22] libcamera: base:\n\tfile_descriptor: Move inode() function to frame_buffer.cpp","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@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21418,"web_url":"https://patchwork.libcamera.org/comment/21418/","msgid":"<20211130075011.h26attf5rtzct43q@uno.localdomain>","date":"2021-11-30T07:50:11","subject":"Re: [libcamera-devel] [PATCH v4 03/22] libcamera: base:\n\tfile_descriptor: Move inode() function to frame_buffer.cpp","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent\n\nOn Tue, Nov 30, 2021 at 05:38:01AM +0200, Laurent Pinchart wrote:\n> The inode() function has always been a bit of an outcast in the\n> FileDescriptor class, as it's not related to the core feature provided\n> by FileDescriptor, a shared ownership wrapper around file descriptors.\n> As it's only used in the FrameBuffer implementation, move it to\n> frame_buffer.cpp as a static function.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n> Changes since v3:\n>\n> - Move the inode function to frame_buffer.cpp\n> ---\n>  include/libcamera/base/file.h            |  2 ++\n>  include/libcamera/base/file_descriptor.h |  3 ---\n>  src/libcamera/base/file.cpp              |  1 +\n>  src/libcamera/base/file_descriptor.cpp   | 25 ---------------------\n>  src/libcamera/framebuffer.cpp            | 28 ++++++++++++++++++++++--\n>  5 files changed, 29 insertions(+), 30 deletions(-)\n>\n> diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h\n> index 55e8edd934d4..9b62871b8230 100644\n> --- a/include/libcamera/base/file.h\n> +++ b/include/libcamera/base/file.h\n> @@ -20,6 +20,8 @@\n>\n>  namespace libcamera {\n>\n> +class FileDescriptor;\n> +\n\nIs this needed as nothing is added to file.h ?\n\n>  class File\n>  {\n>  public:\n> diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> index 8d764f8b4a26..5d1594e80801 100644\n> --- a/include/libcamera/base/file_descriptor.h\n> +++ b/include/libcamera/base/file_descriptor.h\n> @@ -8,7 +8,6 @@\n>  #pragma once\n>\n>  #include <memory>\n> -#include <sys/types.h>\n>\n>  namespace libcamera {\n>\n> @@ -28,8 +27,6 @@ public:\n>  \tint fd() const { return fd_ ? fd_->fd() : -1; }\n>  \tFileDescriptor dup() const;\n>\n> -\tino_t inode() const;\n> -\n>  private:\n>  \tclass Descriptor\n>  \t{\n> diff --git a/src/libcamera/base/file.cpp b/src/libcamera/base/file.cpp\n> index ae4be1f95fa6..a04dfacdc102 100644\n> --- a/src/libcamera/base/file.cpp\n> +++ b/src/libcamera/base/file.cpp\n> @@ -14,6 +14,7 @@\n>  #include <sys/types.h>\n>  #include <unistd.h>\n>\n> +#include <libcamera/base/file_descriptor.h>\n\nSame question\n\n>  #include <libcamera/base/log.h>\n>\n>  /**\n> diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> index f5f87c56eee8..98d4b4bfd24f 100644\n> --- a/src/libcamera/base/file_descriptor.cpp\n> +++ b/src/libcamera/base/file_descriptor.cpp\n> @@ -8,7 +8,6 @@\n>  #include <libcamera/base/file_descriptor.h>\n>\n>  #include <string.h>\n> -#include <sys/stat.h>\n>  #include <sys/types.h>\n>  #include <unistd.h>\n>  #include <utility>\n> @@ -223,30 +222,6 @@ FileDescriptor FileDescriptor::dup() const\n>  \treturn FileDescriptor(fd());\n>  }\n>\n> -/**\n> - * \\brief Retrieve the file descriptor inode\n> - *\n> - * \\todo Should this move to the File class ?\n> - *\n> - * \\return The file descriptor inode on success, or 0 on error\n> - */\n> -ino_t FileDescriptor::inode() const\n> -{\n> -\tif (!isValid())\n> -\t\treturn 0;\n> -\n> -\tstruct stat st;\n> -\tint ret = fstat(fd_->fd(), &st);\n> -\tif (ret < 0) {\n> -\t\tret = -errno;\n> -\t\tLOG(FileDescriptor, Fatal)\n> -\t\t\t<< \"Failed to fstat() fd: \" << strerror(-ret);\n> -\t\treturn 0;\n> -\t}\n> -\n> -\treturn st.st_ino;\n> -}\n> -\n>  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)\n>  {\n>  \tif (!duplicate) {\n> diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> index 337ea1155a38..b1635f49b68a 100644\n> --- a/src/libcamera/framebuffer.cpp\n> +++ b/src/libcamera/framebuffer.cpp\n> @@ -8,6 +8,9 @@\n>  #include <libcamera/framebuffer.h>\n>  #include \"libcamera/internal/framebuffer.h\"\n>\n> +#include <sys/stat.h>\n> +\n> +#include <libcamera/base/file.h>\n\nDo you need file.h or rather file_descriptor.h for the new function ?\n\nThanks\n   j\n\n\n\n\n>  #include <libcamera/base/log.h>\n>\n>  /**\n> @@ -207,6 +210,27 @@ FrameBuffer::Private::Private()\n>   * \\brief The plane length in bytes\n>   */\n>\n> +namespace {\n> +\n> +ino_t fileDescriptorInode(const FileDescriptor &fd)\n> +{\n> +\tif (!fd.isValid())\n> +\t\treturn 0;\n> +\n> +\tstruct stat st;\n> +\tint ret = fstat(fd.fd(), &st);\n> +\tif (ret < 0) {\n> +\t\tret = -errno;\n> +\t\tLOG(Buffer, Fatal)\n> +\t\t\t<< \"Failed to fstat() fd: \" << strerror(-ret);\n> +\t\treturn 0;\n> +\t}\n> +\n> +\treturn st.st_ino;\n> +}\n> +\n> +} /* namespace */\n> +\n>  /**\n>   * \\brief Construct a FrameBuffer with an array of planes\n>   * \\param[in] planes The frame memory planes\n> @@ -236,8 +260,8 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)\n>  \t\t */\n>  \t\tif (plane.fd.fd() != planes_[0].fd.fd()) {\n>  \t\t\tif (!inode)\n> -\t\t\t\tinode = planes_[0].fd.inode();\n> -\t\t\tif (plane.fd.inode() != inode) {\n> +\t\t\t\tinode = fileDescriptorInode(planes_[0].fd);\n> +\t\t\tif (fileDescriptorInode(plane.fd) != inode) {\n>  \t\t\t\tisContiguous = false;\n>  \t\t\t\tbreak;\n>  \t\t\t}\n> --\n> Regards,\n>\n> Laurent Pinchart\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 8E380BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 07:49:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F1CCA605B4;\n\tTue, 30 Nov 2021 08:49:20 +0100 (CET)","from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net\n\t[217.70.183.200])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D2F8B604FC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 08:49:19 +0100 (CET)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 4861B20008;\n\tTue, 30 Nov 2021 07:49:19 +0000 (UTC)"],"Date":"Tue, 30 Nov 2021 08:50:11 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20211130075011.h26attf5rtzct43q@uno.localdomain>","References":"<20211130033820.18235-1-laurent.pinchart@ideasonboard.com>\n\t<20211130033820.18235-4-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211130033820.18235-4-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v4 03/22] libcamera: base:\n\tfile_descriptor: Move inode() function to frame_buffer.cpp","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@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21430,"web_url":"https://patchwork.libcamera.org/comment/21430/","msgid":"<YaXyXdWG+eIm3x6o@pendragon.ideasonboard.com>","date":"2021-11-30T09:43:57","subject":"Re: [libcamera-devel] [PATCH v4 03/22] libcamera: base:\n\tfile_descriptor: Move inode() function to frame_buffer.cpp","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Tue, Nov 30, 2021 at 08:50:11AM +0100, Jacopo Mondi wrote:\n> On Tue, Nov 30, 2021 at 05:38:01AM +0200, Laurent Pinchart wrote:\n> > The inode() function has always been a bit of an outcast in the\n> > FileDescriptor class, as it's not related to the core feature provided\n> > by FileDescriptor, a shared ownership wrapper around file descriptors.\n> > As it's only used in the FrameBuffer implementation, move it to\n> > frame_buffer.cpp as a static function.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> > Changes since v3:\n> >\n> > - Move the inode function to frame_buffer.cpp\n> > ---\n> >  include/libcamera/base/file.h            |  2 ++\n> >  include/libcamera/base/file_descriptor.h |  3 ---\n> >  src/libcamera/base/file.cpp              |  1 +\n> >  src/libcamera/base/file_descriptor.cpp   | 25 ---------------------\n> >  src/libcamera/framebuffer.cpp            | 28 ++++++++++++++++++++++--\n> >  5 files changed, 29 insertions(+), 30 deletions(-)\n> >\n> > diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h\n> > index 55e8edd934d4..9b62871b8230 100644\n> > --- a/include/libcamera/base/file.h\n> > +++ b/include/libcamera/base/file.h\n> > @@ -20,6 +20,8 @@\n> >\n> >  namespace libcamera {\n> >\n> > +class FileDescriptor;\n> > +\n> \n> Is this needed as nothing is added to file.h ?\n\nAbsolutely not, it's an incorrect leftover.\n\n> >  class File\n> >  {\n> >  public:\n> > diff --git a/include/libcamera/base/file_descriptor.h b/include/libcamera/base/file_descriptor.h\n> > index 8d764f8b4a26..5d1594e80801 100644\n> > --- a/include/libcamera/base/file_descriptor.h\n> > +++ b/include/libcamera/base/file_descriptor.h\n> > @@ -8,7 +8,6 @@\n> >  #pragma once\n> >\n> >  #include <memory>\n> > -#include <sys/types.h>\n> >\n> >  namespace libcamera {\n> >\n> > @@ -28,8 +27,6 @@ public:\n> >  \tint fd() const { return fd_ ? fd_->fd() : -1; }\n> >  \tFileDescriptor dup() const;\n> >\n> > -\tino_t inode() const;\n> > -\n> >  private:\n> >  \tclass Descriptor\n> >  \t{\n> > diff --git a/src/libcamera/base/file.cpp b/src/libcamera/base/file.cpp\n> > index ae4be1f95fa6..a04dfacdc102 100644\n> > --- a/src/libcamera/base/file.cpp\n> > +++ b/src/libcamera/base/file.cpp\n> > @@ -14,6 +14,7 @@\n> >  #include <sys/types.h>\n> >  #include <unistd.h>\n> >\n> > +#include <libcamera/base/file_descriptor.h>\n> \n> Same question\n\nSame answer :-)\n\n> >  #include <libcamera/base/log.h>\n> >\n> >  /**\n> > diff --git a/src/libcamera/base/file_descriptor.cpp b/src/libcamera/base/file_descriptor.cpp\n> > index f5f87c56eee8..98d4b4bfd24f 100644\n> > --- a/src/libcamera/base/file_descriptor.cpp\n> > +++ b/src/libcamera/base/file_descriptor.cpp\n> > @@ -8,7 +8,6 @@\n> >  #include <libcamera/base/file_descriptor.h>\n> >\n> >  #include <string.h>\n> > -#include <sys/stat.h>\n> >  #include <sys/types.h>\n> >  #include <unistd.h>\n> >  #include <utility>\n> > @@ -223,30 +222,6 @@ FileDescriptor FileDescriptor::dup() const\n> >  \treturn FileDescriptor(fd());\n> >  }\n> >\n> > -/**\n> > - * \\brief Retrieve the file descriptor inode\n> > - *\n> > - * \\todo Should this move to the File class ?\n> > - *\n> > - * \\return The file descriptor inode on success, or 0 on error\n> > - */\n> > -ino_t FileDescriptor::inode() const\n> > -{\n> > -\tif (!isValid())\n> > -\t\treturn 0;\n> > -\n> > -\tstruct stat st;\n> > -\tint ret = fstat(fd_->fd(), &st);\n> > -\tif (ret < 0) {\n> > -\t\tret = -errno;\n> > -\t\tLOG(FileDescriptor, Fatal)\n> > -\t\t\t<< \"Failed to fstat() fd: \" << strerror(-ret);\n> > -\t\treturn 0;\n> > -\t}\n> > -\n> > -\treturn st.st_ino;\n> > -}\n> > -\n> >  FileDescriptor::Descriptor::Descriptor(int fd, bool duplicate)\n> >  {\n> >  \tif (!duplicate) {\n> > diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\n> > index 337ea1155a38..b1635f49b68a 100644\n> > --- a/src/libcamera/framebuffer.cpp\n> > +++ b/src/libcamera/framebuffer.cpp\n> > @@ -8,6 +8,9 @@\n> >  #include <libcamera/framebuffer.h>\n> >  #include \"libcamera/internal/framebuffer.h\"\n> >\n> > +#include <sys/stat.h>\n> > +\n> > +#include <libcamera/base/file.h>\n> \n> Do you need file.h or rather file_descriptor.h for the new function ?\n\nI really messed up this one, haven't I ? I'll fix it.\n\n> >  #include <libcamera/base/log.h>\n> >\n> >  /**\n> > @@ -207,6 +210,27 @@ FrameBuffer::Private::Private()\n> >   * \\brief The plane length in bytes\n> >   */\n> >\n> > +namespace {\n> > +\n> > +ino_t fileDescriptorInode(const FileDescriptor &fd)\n> > +{\n> > +\tif (!fd.isValid())\n> > +\t\treturn 0;\n> > +\n> > +\tstruct stat st;\n> > +\tint ret = fstat(fd.fd(), &st);\n> > +\tif (ret < 0) {\n> > +\t\tret = -errno;\n> > +\t\tLOG(Buffer, Fatal)\n> > +\t\t\t<< \"Failed to fstat() fd: \" << strerror(-ret);\n> > +\t\treturn 0;\n> > +\t}\n> > +\n> > +\treturn st.st_ino;\n> > +}\n> > +\n> > +} /* namespace */\n> > +\n> >  /**\n> >   * \\brief Construct a FrameBuffer with an array of planes\n> >   * \\param[in] planes The frame memory planes\n> > @@ -236,8 +260,8 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)\n> >  \t\t */\n> >  \t\tif (plane.fd.fd() != planes_[0].fd.fd()) {\n> >  \t\t\tif (!inode)\n> > -\t\t\t\tinode = planes_[0].fd.inode();\n> > -\t\t\tif (plane.fd.inode() != inode) {\n> > +\t\t\t\tinode = fileDescriptorInode(planes_[0].fd);\n> > +\t\t\tif (fileDescriptorInode(plane.fd) != inode) {\n> >  \t\t\t\tisContiguous = false;\n> >  \t\t\t\tbreak;\n> >  \t\t\t}","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 C6439BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 09:44:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3517F605B4;\n\tTue, 30 Nov 2021 10:44:24 +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 A3A3D60230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 10:44:22 +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 18B878F0;\n\tTue, 30 Nov 2021 10:44:22 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"HbPrKPxT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638265462;\n\tbh=Mtq1HhqXsQNe6+VdEeXxE7hiu3D3SMY/WrOO25ogV5Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=HbPrKPxThbpZCkN7AUcYSzidiawetxy8d0lxf4YRe7ZV7kHf74OygDpdzKw59QtZQ\n\t2tXgxnPayjNB75s35HEUcVWHAIWR278s2CiL9gPCxPfPvtPyVOMQ4mCmMpNVi4y+3D\n\twoGjTXYsUrP4iOs/LCwL1/SPMz2V0N8p8VhGOhLQ=","Date":"Tue, 30 Nov 2021 11:43:57 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YaXyXdWG+eIm3x6o@pendragon.ideasonboard.com>","References":"<20211130033820.18235-1-laurent.pinchart@ideasonboard.com>\n\t<20211130033820.18235-4-laurent.pinchart@ideasonboard.com>\n\t<20211130075011.h26attf5rtzct43q@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211130075011.h26attf5rtzct43q@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH v4 03/22] libcamera: base:\n\tfile_descriptor: Move inode() function to frame_buffer.cpp","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@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]