[LTP] [PATCH V7 10/10] syscalls/open_tree: New tests

Viresh Kumar viresh.kumar@linaro.org
Fri Mar 20 05:35:48 CET 2020


On 13-03-20, 13:49, Cyril Hrubis wrote:
> > +static void run(unsigned int n)
> > +{
> > +	struct tcase *tc = &tcases[n];
> > +	int fd, fsmfd, otfd;
> > +
> > +	TEST(fd = fsopen(tst_device->fs_type, 0));
> > +	if (fd == -1) {
> > +		tst_res(TFAIL | TERRNO, "fsopen() failed");
> > +		return;
> > +	}
> > +
> > +	TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
> > +	if (TST_RET == -1) {
> > +		SAFE_CLOSE(fd);
> > +		tst_res(TFAIL | TERRNO, "fsconfig() failed");
> > +		return;
> > +	}
> > +
> > +	TEST(fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));
> > +	if (TST_RET == -1) {
> > +		SAFE_CLOSE(fd);
> > +		tst_res(TFAIL | TERRNO, "fsconfig() failed");
> > +		return;
> > +	}
> > +
> > +	TEST(fsmfd = fsmount(fd, 0, 0));
> > +	SAFE_CLOSE(fd);
> > +
> > +	if (fsmfd == -1) {
> > +		tst_res(TFAIL | TERRNO, "fsmount() failed");
> > +		return;
> > +	}
> > +
> > +	TEST(move_mount(fsmfd, "", AT_FDCWD, MNTPOINT,
> > +			MOVE_MOUNT_F_EMPTY_PATH));
> > +	SAFE_CLOSE(fsmfd);
> 
> Here as well, shouldn't we just set the .mount_device flag instead?

Hi,

Sorry but I am not sure what will happen by .mount_device here. From
what I see from tst_test.c, that flag will end up calling SAFE_MOUNT()
automatically, but what we are calling here is fsmount() and
move_mount() instead.

Can you please elaborate a bit on that ? Thanks.

-- 
viresh


More information about the ltp mailing list