[LTP] [PATCH v1] syscalls/mount07: Add new test case for MS_NOSYMFOLLOW

Petr Vorel pvorel@suse.cz
Tue Feb 7 19:12:13 CET 2023


Hi Xu,

> +static void test_statfs(bool nosymfollow)
> +{
> +	struct statfs buf;
> +
> +	SAFE_STATFS(MNTPOINT, &buf);
> +	if (buf.f_flags & ST_NOSYMFOLLOW) {
> +		tst_res(nosymfollow ? TPASS : TFAIL, "ST_NOSYMFOLLOW set on %s",
> +				MNTPOINT);
> +	} else {
> +		tst_res(nosymfollow ? TFAIL : TPASS, "ST_NOSYMFOLLOW not set on %s",
> +				MNTPOINT);
> +	}
> +}

I was thinking about this:

static void test_statfs(bool nosymfollow)
{
	struct statfs buf;
	bool st_nosymfollow;
	int res;

	SAFE_STATFS(MNTPOINT, &buf);
	st_nosymfollow = buf.f_flags & ST_NOSYMFOLLOW;
	res = !!st_nosymfollow == !!nosymfollow ? TPASS : TFAIL;

	tst_res(res, "ST_NOSYMFOLLOW %sset on %s", st_nosymfollow ? "" : "not ",
		MNTPOINT);
}
but your version is much readable, thus forget the above.

LGTM, thanks!
Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list