Re: [patch 6/7] vfs: mountinfo: add /proc/<pid>/mountinfo

From: Al Viro
Date: Thu Mar 27 2008 - 18:36:50 EST


On Thu, Mar 27, 2008 at 01:06:25PM +0100, Miklos Szeredi wrote:
> +36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue

Works for me...

> -static int show_vfsmnt(struct seq_file *m, void *v)
> +struct proc_fs_info {

struct flag_name would be better; will do on merge.

> +static void show_type(struct seq_file *m, struct super_block *sb)
> +{
> + mangle(m, sb->s_type->name);

BTW, do we really want to bother with quoting? Anyway, that can live
for now...

> +static int show_mountinfo(struct seq_file *m, void *v)
> +{
> + struct proc_mounts *p = m->private;
> + size_t count_save = m->count;

> + /*
> + * Mountpoint is outside root, rewind seq_file. Ugly,
> + * but necessary for race-free detection of unreachable
> + * mountpoints.
> + */
> + m->count = count_save;
> + return 0;
> + }

You know, _if_ we want to go that way, let's do it right; all callers
of ->show() are in seq_file.c and all of them know the previous value
of m->count. So let's define SEQ_SKIP as 1 and teach these 3 callers
to handle it. And make this sucker (and anything else that might want
the same kind of things) return SEQ_SKIP instead of playing with m->count
directly.

Again, will do on merge...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/