[LTP] 回复: [PATCH v4] syscalls/mount_setattr01: Add basic functional test

chenhx.fnst@fujitsu.com chenhx.fnst@fujitsu.com
Thu Apr 28 12:50:26 CEST 2022


Hi,all

> -----邮件原件-----
> 发件人: Cyril Hrubis <chrubis@suse.cz>
> 发送时间: 2022年4月27日 22:05
> 收件人: Chen, Hanxiao/陈 晗霄 <chenhx.fnst@fujitsu.com>
> 抄送: ltp@lists.linux.it; pvorel@suse.cz; Dai, Shili/戴 世丽
> <daisl.fnst@fujitsu.com>
> 主题: Re: [PATCH v4] syscalls/mount_setattr01: Add basic functional test
> 
> Hi!
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (c) 2022 FUJITSU LIMITED. All rights reserved.
> > + * Author: Dai Shili <daisl.fnst@fujitsu.com>
> > + * Author: Chen Hanxiao <chenhx.fnst@fujitsu.com>  */
> > +
> > +/*\
> > + * [Description]
> > + *
> > + * Basic mount_setattr() test.
> > + * Test whether the basic mount attributes are set correctly.
> > + *
> > + * Verify some MOUNT_SETATTR(2) attributes:
> > + *
> > + * - 1) MOUNT_ATTR_RDONLY - makes the mount read-only
> > + * - 2) MOUNT_ATTR_NOSUID - causes the mount not to honor the
> > + *     set-user-ID and set-group-ID mode bits and file capabilities
> > + *     when executing programs.
> > + * - 3) MOUNT_ATTR_NODEV - prevents access to devices on this mount
> > + * - 4) MOUNT_ATTR_NOEXEC - prevents executing programs on this mount
> > + * - 5) MOUNT_ATTR_NOSYMFOLLOW - prevents following symbolic links
> > + *    on this mount
> > + * - 6) MOUNT_ATTR_NODIRATIME - prevents updating access time for
> > + *    directories on this mount
> 
> The numbers here are useless and confusing I bet that it renders strangely in
> asciidoc too.
> 
OK.

> > + * The functionality was added in v5.12.
...
> > +	if (otfd > -1)
> > +		SAFE_CLOSE(otfd);
> > +	if (tst_is_mounted_at_tmpdir(OT_MNTPOINT)) {
> > +		mount_flag = 0;
> > +		SAFE_UMOUNT(OT_MNTPOINT);
> > +	}
> 
> Can we instead of the ifs just jump to a right label as I asked in the previous
> review?

Sure.

Regards,
- Chen

> 
> > +}
> > +
> > +static struct tst_test test = {
> > +	.tcnt = ARRAY_SIZE(tcases),
> > +	.test = run,
> > +	.setup = setup,
> > +	.cleanup = cleanup,
> > +	.needs_root = 1,
> > +	.mount_device = 1,
> > +	.mntpoint = MNTPOINT,
> > +	.all_filesystems = 1,
> > +	.skip_filesystems = (const char *const []){"fuse", NULL}, };
> > --
> > 2.35.1
> >
> >
> >
> 
> --
> Cyril Hrubis
> chrubis@suse.cz


More information about the ltp mailing list