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: <4B6B7EA8.4070104@cn.fujitsu.com>
Date:	Fri, 05 Feb 2010 10:12:56 +0800
From:	Li Zefan <lizf@...fujitsu.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	David Miller <davem@...emloft.net>,
	LKML <linux-kernel@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 00/13] net: simplify seq_file code

Andrew Morton wrote:
> On Fri, 05 Feb 2010 09:44:45 +0800 Li Zefan <lizf@...fujitsu.com> wrote:
> 
>> +struct hlist_node *seq_hlist_start(struct hlist_head *head, loff_t pos)
>> +{
>> +	struct hlist_node *node;
>> +
>> +	hlist_for_each(node, head)
>> +		if (pos-- == 0)
>> +			return node;
>> +	return NULL;
>> +}
>> +EXPORT_SYMBOL(seq_hlist_start);
>> +
>> +struct hlist_node *seq_hlist_start_head(struct hlist_head *head, loff_t pos)
>> +{
>> +	if (!pos)
>> +		return SEQ_START_TOKEN;
>> +
>> +	return seq_hlist_start(head, pos - 1);
>> +}
>> +EXPORT_SYMBOL(seq_hlist_start_head);
>> +
>> +struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head,
>> +				  loff_t *ppos)
>> +{
>> +	struct hlist_node *node = v;
>> +
>> +	++*ppos;
>> +	if (v == SEQ_START_TOKEN)
>> +		return head->first;
>> +	else
>> +		return node->next;
>> +}
>> +EXPORT_SYMBOL(seq_hlist_next);
> 
> Oy.  Most of the global functions in seq_file.c are kerneldocumented,
> as they should be!
> 

I'll add kerneldoc in v2 patchset if I have to resend, otherwise I'll
send a delta patch for this.

> Shouldn't seq_hlist_start_head() have been called seq_hlist_prev()?
> 

The list_head version has the name seq_list_start_head().

If you need to print a title in a seq_file, call seq_list_start_head()
in ->start() handler, otherwise call seq_list_start().

Those functions really need kerneldoc. ;)

> Should seq_hlist_start() be passed *ppos, and update *ppos so the
> caller can then call seq_hlist_next() and seq_hlist_prev()?
> 

No, the ->start() callback of seq_operations shouldn't update *ppos.
I fixed some bugs in ftrace debugfs files which were caused by
updating *ppos in start().

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ