Re: [RFC][PATCH 25/27] /proc/mounts: prep for flags from sb or mnt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 07, 2006 at 05:10:38PM -0700, Dave Hansen wrote:
> 
> Originally from: Herbert Poetzl <herbert@xxxxxxxxxxxx>
> 
> Right now, show_vfsmnt() will produce output such as "ro" or
> "nodev" based on sb flags or mount flags.  Each output string
> can only come from one of these sources.
> 
> This patch prepares show_vfsmnt() so that a single string can
> come from either source.  We need this for r/o bind mounts.
> 
> The for loop's terminating condition was getting a little bit
> long, so I used ARRAY_SIZE() instead of checking for the NULL
> terminator.

IMHO this can go in unconditionally, even if there
are no read only MNT flags present, as it is supposed
to work now and in the future ... maybe I should
give that a special test run on its own ...


Signed-off-by: Herbert Poetzl <herbert@xxxxxxxxxxxx>
> Signed-off-by: Dave Hansen <haveblue@xxxxxxxxxx>
> ---
> 
>  lxc-dave/fs/namespace.c |   46 ++++++++++++++++++++++++----------------------
>  1 files changed, 24 insertions(+), 22 deletions(-)
> 
> diff -puN fs/namespace.c~D6-proc-show-ro-attr fs/namespace.c
> --- lxc/fs/namespace.c~D6-proc-show-ro-attr	2006-06-07 16:53:27.000000000 -0700
> +++ lxc-dave/fs/namespace.c	2006-06-07 16:53:27.000000000 -0700
> @@ -354,24 +354,22 @@ static int show_vfsmnt(struct seq_file *
>  {
>  	struct vfsmount *mnt = v;
>  	int err = 0;
> +	int i;
>  	static struct proc_fs_info {
> -		int flag;
> -		char *str;
> +		int s_flag;
> +		int mnt_flag;
> +		char *set_str;
> +		char *unset_str;
>  	} fs_info[] = {
> -		{ MS_SYNCHRONOUS, ",sync" },
> -		{ MS_DIRSYNC, ",dirsync" },
> -		{ MS_MANDLOCK, ",mand" },
> -		{ 0, NULL }
> -	};
> -	static struct proc_fs_info mnt_info[] = {
> -		{ MNT_NOSUID, ",nosuid" },
> -		{ MNT_NODEV, ",nodev" },
> -		{ MNT_NOEXEC, ",noexec" },
> -		{ MNT_NOATIME, ",noatime" },
> -		{ MNT_NODIRATIME, ",nodiratime" },
> -		{ 0, NULL }
> +		{ MS_SYNCHRONOUS, 0, ",sync", NULL },
> +		{ MS_DIRSYNC, 0, ",dirsync", NULL },
> +		{ MS_MANDLOCK, 0, ",mand", NULL },
> +		{ 0, MNT_NOSUID, ",nosuid", NULL },
> +		{ 0, MNT_NODEV, ",nodev", NULL },
> +		{ 0, MNT_NOEXEC, ",noexec", NULL },
> +		{ 0, MNT_NOATIME, ",noatime", NULL },
> +		{ 0, MNT_NODIRATIME, ",nodiratime", NULL }
>  	};
> -	struct proc_fs_info *fs_infop;
>  
>  	mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
>  	seq_putc(m, ' ');
> @@ -379,13 +377,17 @@ static int show_vfsmnt(struct seq_file *
>  	seq_putc(m, ' ');
>  	mangle(m, mnt->mnt_sb->s_type->name);
>  	seq_puts(m, mnt->mnt_sb->s_flags & MS_RDONLY ? " ro" : " rw");
> -	for (fs_infop = fs_info; fs_infop->flag; fs_infop++) {
> -		if (mnt->mnt_sb->s_flags & fs_infop->flag)
> -			seq_puts(m, fs_infop->str);
> -	}
> -	for (fs_infop = mnt_info; fs_infop->flag; fs_infop++) {
> -		if (mnt->mnt_flags & fs_infop->flag)
> -			seq_puts(m, fs_infop->str);
> +	for (i = 0; i < ARRAY_SIZE(fs_info); i++) {
> +		struct proc_fs_info *fs_infop = &fs_info[i];
> +		char *str = NULL;
> +		if ((mnt->mnt_sb->s_flags & fs_infop->s_flag) ||
> +		    (mnt->mnt_flags & fs_infop->mnt_flag))
> +			str = fs_infop->set_str;
> +		else
> +			str = fs_infop->unset_str;
> +
> +		if (str)
> +			seq_puts(m, str);
>  	}
>  	if (mnt->mnt_sb->s_op->show_options)
>  		err = mnt->mnt_sb->s_op->show_options(m, mnt);
> _
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux