Hi Saurav,

I think you found a BUG!

Please report it at https://github.com/apache/nuttx/issues to keep a track
of it and when you we submit a PR it could be closed automatically (since
you link it at your PR).

In fact looking both macros the f to fs mistake becomes clear:

#define DIRSEC_NDXMASK(f)   (((f)->fs_hwsectorsize - 1) >> 5)

#define DIRSEC_BYTENDX(f,i) (((i) & DIRSEC_NDXMASK(fs)) << 5)

I'm curious to know what this mistake could cause to VFAT on NuttX?

Why haven't we seen any side effects in products using NuttX with VFAT?

Best Regards,

Alan

On Fri, Feb 2, 2024 at 1:55 PM Saurav Pal <resyfer....@gmail.com> wrote:

> Hi Alan,
>
> Thank you for looking at our code base and planning to add Documentation,
> > that is really important!
> >
> > NuttX has a long history but our Documentation is still lagging behind,
> so
> > your work will be very beneficial for our community.
> >
>
> I'll try my best to contribute some documentation for the various file
> systems I look into, and I, in turn, hope they are informative, and more
> importantly, correct, as I'm pretty new to the VFS layer of NuttX.
>
>
> > BTW, why do you think it is wrong, could you please share your thoughts?
> >
>
> The problem according to me is on L264...where it's defined as:
>
> #define DIRSEC_BYTENDX(*f*,i) (((i) & DIRSEC_NDXMASK(*fs*)) << 5)
>
> I can't seem to find anything defined as *fs *in the namespace at that
> point (used in the fat_findsfnentry
> <https://github.com/apache/nuttx/blob/master/fs/fat/fs_fat32dirent.c#L1137
> >function),
> and I was wondering if it was a simple typo or a mistake on my part as it's
> code that's quite old, which usually don't have such mistakes due to
> extensive testing.
>
> Best Regards,
> Saurav
>

Reply via email to