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

xuyang2018.jy@fujitsu.com xuyang2018.jy@fujitsu.com
Thu Feb 9 04:25:21 CET 2023


Hi Petr

> 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>

Thanks for your review, merged!

Best Regards
Yang Xu
> 
> Kind regards,
> Petr


More information about the ltp mailing list