lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50120F8C.8010001@parallels.com>
Date:	Fri, 27 Jul 2012 07:48:28 +0400
From:	Pavel Emelyanov <xemul@...allels.com>
To:	Cyrill Gorcunov <gorcunov@...nvz.org>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	Alexey Dobriyan <adobriyan@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	James Bottomley <jbottomley@...allels.com>,
	Matthew Helsley <matt.helsley@...il.com>
Subject: Re: [patch 3/7] procfs: Add ability to plug in auxiliary fdinfo providers

> +static int prep_fdinfo_driver(struct proc_fdinfo_extra *extra)
> +{
> +	struct proc_fdinfo_driver *s;
> +
> +	down_read(&fdinfo_drivers_sem);
> +	list_for_each_entry(s, &fdinfo_drivers, list) {
> +		if (s->probe(extra->f_file)) {
> +			extra->driver = s;
> +			break;
> +		}
> +	}
> +	up_read(&fdinfo_drivers_sem);
> +
> +	return 0;
> +}

Maybe a simple list of file_operations:seq_operations mappings would be simpler?

> +static void *seq_next(struct seq_file *m, void *p, loff_t *pos)
> +{
> +	struct proc_fdinfo_extra *extra = m->private;
> +	void *v = NULL;
> +
> +	if (extra->driver) {
> +		int ret = 0;
> +
> +		if (*pos == 0) {
> +			v = extra->driver->ops->start(m, pos);
> +			if (v) {
> +				ret = extra->driver->ops->show(m, v);

Why is it necessary to call ->show here? The logic should be

seq_start = (pos == 0 ? nop : extra->start)
seq_next  = (pos == 0 ? extra->start : extra->next)
seq_stop  = (pos == 0 ? nop : extra->stop)
seq_show  = (pos == 0 ? proc_show : extra->show)

Or I'm missing something?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ