Re: [PATCH 3/9] fs: ext4: print change date in directory listing

Tom Rini <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs,org.u-boot-project.lists.u-boot
Message-ID <20260529200112.GA694169@bill-the-cat>
On Thu, May 21, 2026 at 02:46:51AM +0200, Heinrich Schuchardt wrote:
> On 5/20/26 22:42, Simon Glass wrote:
> > Hi Heinrich,
> > 
> > On Mon, 18 May 2026 at 00:57, Heinrich Schuchardt
> > <[email protected]> wrote:
> > > 
> > > Declare FS_CAP_DATE in the ext4 fstype_info entry so that fs_ls_generic()
> > > displays the modification date alongside the file size:
> > > 
> > >   4096 2024-03-15 09:30 filename.txt
> > > 
> > > Signed-off-by: Heinrich Schuchardt <[email protected]>
> > > ---
> > >   fs/fs.c | 3 +++
> > >   1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/fs/fs.c b/fs/fs.c
> > > index f8e4794c10e..482a5523712 100644
> > > --- a/fs/fs.c
> > > +++ b/fs/fs.c
> > > @@ -261,6 +261,9 @@ static struct fstype_info fstypes[] = {
> > >                  .fstype = FS_TYPE_EXT,
> > >                  .name = "ext4",
> > >                  .null_dev_desc_ok = false,
> > > +#if !IS_ENABLED(CONFIG_XPL_BUILD)
> > > +               .caps = FS_CAP_DATE,
> > > +#endif
> > >                  .probe = ext4fs_probe,
> > >                  .close = ext4fs_close,
> > >                  .ls = fs_ls_generic,
> > > --
> > > 2.53.0
> > > 
> > 
> > I would prefer having a head-file macro which expands to nothing for
> > xPL builds, rather than adding preprocessor macros.
> > 
> > Regards,
> > Simon
> 
> Hello Simon,
> 
> In the internet I could not find what a "head-file macro" might be.
> 
> As struct fstype_info is not defined in a header file, a preprocessor macro
> defined in a header file would not make sense here.
> 
> Do you mean something like:
> 
> #if IS_ENABLED(CONFIG_XPL_BUILD)
> #define FS_CAPS(flags)  /* empty */
> #else
> #define FS_CAPS(flags)  .caps = (flags),
> #endif
> 
> static struct fstype_info fstypes[] = {
> #if CONFIG_IS_ENABLED(FS_FAT)
>         {
>                 .fstype = FS_TYPE_FAT,
>                 .name = "fat",
>                 .null_dev_desc_ok = false,
>                 FS_CAPS(FS_CAP_DATE)
>                 .probe = fat_set_blk_dev,
> ...
> 
> A line without a comma in the initializer is easily mistaken as incorrect. I
> am not sure that a code reviewers life is made easier with defining a new
> preprocessor macro.

We have a lot of other examples like this in-tree already such as
ENV_NAME(..) so I think it's reasonable to make an FS_CAPS macro like
this.

-- 
Tom
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTzzqh0PWDgGS+bTHor4qD1Cr/kCgUCahnwhQAKCRAr4qD1Cr/k
Cr2kAQCgadsybh4J7JeK8gNZFoxFWxsAanUeadtWkzWgoniXMAEAwJkNH02zDbmW
WQPr1wdeUdrnL8L68LzU6wnAQiPJrgM=
=qb4P
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.