All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] net: simplify seq_file code, revised
@ 2010-02-09  9:18 Li Zefan
  2010-02-09  9:18 ` [PATCH 01/13] seq_file: Add helpers for iteration over a hlist Li Zefan
                   ` (13 more replies)
  0 siblings, 14 replies; 17+ messages in thread
From: Li Zefan @ 2010-02-09  9:18 UTC (permalink / raw)
  To: David Miller; +Cc: Andrew Morton, LKML, netdev@vger.kernel.org

This patchset introduces seq_hlist_foo() helpers, and convert
net/* to seq_hlist_foo() and seq_list_foo().

Changelog:

- Add kerneldoc in patch 1/13
- Fix compile warning in patch 11/13
- Fix a bug in patch 12/13

---
 fs/seq_file.c                 |   60 ++++++++++++++++++++-
 include/linux/seq_file.h      |   11 ++++
 include/net/sock.h            |    5 ++
 net/appletalk/atalk_proc.c    |   30 +----------
 net/atm/proc.c                |    2 +-
 net/atm/resources.c           |   28 +++--------
 net/ax25/af_ax25.c            |   18 +-----
 net/ax25/ax25_uid.c           |   25 ++--------
 net/ipx/ipx_proc.c            |   90 ++++----------------------------
 net/irda/irlan/irlan_common.c |   28 ++---------
 net/key/af_key.c              |   20 +------
 net/netrom/af_netrom.c        |   21 +-------
 net/netrom/nr_route.c         |   53 +++----------------
 net/packet/af_packet.c        |   20 +------
 net/rose/af_rose.c            |   22 +-------
 net/x25/x25_proc.c            |  114 ++++-------------------------------------
 16 files changed, 139 insertions(+), 408 deletions(-)

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: [PATCH 00/13] net: simplify seq_file code
@ 2010-02-05  1:44 Li Zefan
  2010-02-05  1:58 ` Andrew Morton
  0 siblings, 1 reply; 17+ messages in thread
From: Li Zefan @ 2010-02-05  1:44 UTC (permalink / raw)
  To: David Miller; +Cc: Andrew Morton, LKML, netdev@vger.kernel.org

[PATCH 01/13] seq_file: Add helpers for iteration over a hlist

Some places in kernel need to iterate over a hlist in seq_file,
so provide some common helpers.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 fs/seq_file.c            |   37 ++++++++++++++++++++++++++++++++++---
 include/linux/seq_file.h |   11 +++++++++++
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/fs/seq_file.c b/fs/seq_file.c
index eae7d9d..e833076 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -674,7 +674,6 @@ struct list_head *seq_list_start(struct list_head *head, loff_t pos)
 
 	return NULL;
 }
-
 EXPORT_SYMBOL(seq_list_start);
 
 struct list_head *seq_list_start_head(struct list_head *head, loff_t pos)
@@ -684,7 +683,6 @@ struct list_head *seq_list_start_head(struct list_head *head, loff_t pos)
 
 	return seq_list_start(head, pos - 1);
 }
-
 EXPORT_SYMBOL(seq_list_start_head);
 
 struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos)
@@ -695,5 +693,38 @@ struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos)
 	++*ppos;
 	return lh == head ? NULL : lh;
 }
-
 EXPORT_SYMBOL(seq_list_next);
+
+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);
+
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 8366d8f..c95bcdc 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -135,4 +135,15 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
 extern struct list_head *seq_list_next(void *v, struct list_head *head,
 		loff_t *ppos);
 
+/*
+ * Helpers for iteration over hlist_head-s in seq_files
+ */
+
+extern struct hlist_node *seq_hlist_start(struct hlist_head *head,
+		loff_t pos);
+extern struct hlist_node *seq_hlist_start_head(struct hlist_head *head,
+		loff_t pos);
+extern struct hlist_node *seq_hlist_next(void *v, struct hlist_head *head,
+		loff_t *ppos);
+
 #endif
-- 
1.6.3


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-02-10 20:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09  9:18 [PATCH 00/13] net: simplify seq_file code, revised Li Zefan
2010-02-09  9:18 ` [PATCH 01/13] seq_file: Add helpers for iteration over a hlist Li Zefan
2010-02-09  9:18 ` [PATCH 02/13] net: add a wrapper sk_entry() Li Zefan
2010-02-09  9:19 ` [PATCH 03/13] net: x25: use seq_hlist_foo() helpers Li Zefan
2010-02-09  9:19 ` [PATCH 04/13] net: rose: " Li Zefan
2010-02-09  9:19 ` [PATCH 05/13] net: packet: " Li Zefan
2010-02-09  9:19 ` [PATCH 06/13] net: netrom: " Li Zefan
2010-02-09  9:19 ` [PATCH 07/13] net: ax25: " Li Zefan
2010-02-09  9:20 ` [PATCH 08/13] net: appletalk: " Li Zefan
2010-02-09  9:20 ` [PATCH 09/13] net: af_key: " Li Zefan
2010-02-09  9:20 ` [PATCH 10/13] net: x25: use seq_list_foo() helpers Li Zefan
2010-02-09  9:21 ` [PATCH 11/13] net: irda: " Li Zefan
2010-02-09  9:21 ` [PATCH 12/13] net: ipx: " Li Zefan
2010-02-09  9:21 ` [PATCH 13/13] net: atm: " Li Zefan
2010-02-10 19:31 ` [PATCH 00/13] net: simplify seq_file code, revised David Miller
2010-02-10 20:29   ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2010-02-05  1:44 [PATCH 00/13] net: simplify seq_file code Li Zefan
2010-02-05  1:58 ` Andrew Morton
2010-02-05  2:12   ` Li Zefan
2010-02-05  4:32     ` David Miller
2010-02-05  5:04       ` [PATCH 01/13] seq_file: Add helpers for iteration over a hlist Li Zefan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.