[LTP] [PATCH v13] fsconfig04: Check FSCONFIG_SET_PATH
Wei Gao
wegao@suse.com
Wed Sep 9 05:20:45 CEST 2026
On Fri, Sep 04, 2026 at 12:51:58PM +0000, Andrea Cervesato wrote:
> Hi Wei,
>
> > +#define MNTPOINT "mntpoint"
>
> this is never used
This used in following code:
static struct tst_test test = {
.test_all = run,
.setup = setup,
.cleanup = cleanup,
.needs_root = 1,
.needs_device = 1,
.mntpoint = MNTPOINT, <<<<<<<
>
> > +#define LOOP_DEV_SIZE 10
> > +#define UUID "d73c9e5e-97e4-4a9c-b17e-75a931b02660"
> > +
> > +static int fd = -1;
> > +static char dev0[PATH_MAX];
>
> the static dev0 buffer and strcpy() are redundant since tst_device->dev is
> already available
>
> > +static char dev1[PATH_MAX];
> > +static char dev2[PATH_MAX];
> > +
> > +static char device_option_dev1[PATH_MAX + 16];
> > +static char device_option_dev2[PATH_MAX + 16];
> > +static const char *const mkfs_opts_journal_dev1[] = {"-F", "-J", device_option_dev1, NULL};
> > +static const char *const mkfs_opts_journal_dev2[] = {"-F", "-J", device_option_dev2, NULL};
> > +static const char *const mkfs_opts_set_UUID[] = {"-F", "-U", UUID, "-O", "journal_dev", NULL};
>
> these static buffers and option arrays can be replaced with a small helper
> function that formats -J device=%s locally, eliminating global mutable
> state and setup() string formatting.
>
> > + if (found)
> > + tst_res(TPASS, "Device found in journal");
> > + else
> > + tst_res(TFAIL, "Device not found in journal");
>
> the manual if/else result reporting can also be simplified with
> TST_EXP_EXPR(found, ...)
>
> > +
> > + pclose(tune2fs);
> > + SAFE_CLOSE(fd);
>
> SAFE_CLOSE(fd) can be called immediately after FSCONFIG_CMD_CREATE,
> freeing the kernel filesystem context before invoking tune2fs
>
> --
> Andrea Cervesato
> SUSE QE Automation Engineer Linux
> andrea.cervesato@suse.com
More information about the ltp
mailing list