Re: [LTP] [PATCH v4] statvfs01: Convert to new LTP API

Petr Vorel
2022-12-16T10:18:30Z

Hi Avinesh,

> > + fs_type = tst_fs_type(TEST_PATH);
> > + if (fs_type != TST_VFAT_MAGIC && fs_type != TST_EXFAT_MAGIC)
> > + TST_EXP_FD(creat(valid_fname, 0444));

> I suppose, thanks to Petr, we now know using a unicode character will
> allow you to construct a valid name of the maximum length.

Yes, Avinesh would you mind to add valid testing also for vfat and exfat?

Something like this?

#define NLS_MAX_CHARSET_SIZE 6 /* from include/linux/nls.h */

if (fs_type == TST_VFAT_MAGIC && fs_type == TST_EXFAT_MAGIC)
memset(valid_fname, 'a', buf.f_namemax / NLS_MAX_CHARSET_SIZE); // should be (f_namelen / 6) + 1
else
memset(valid_fname, 'a', buf.f_namemax - 1);

Kind regards,
Petr

[1] https://lore.kernel.org/ltp/Y4nDWW2ur6KA1kIw@pevik/